Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/microblock fees #3144

Merged
merged 14 commits into from
Jun 7, 2022
Merged

Conversation

jcnelson
Copy link
Member

This fixes #3140 by considering the evaluated epoch of a matured miner reward's block's parent. If the parent block was evaluated in epoch 2.1, then the correct 40/60 fee split begins to occur between the parent and child blocks' miners (as it should have been). Before this happens, the buggy behavior described in #3140 continues to happen.

Do not merge until #3142 is merged, since it depends on code in that branch.

…nt's block's evaluated epoch is 2.1, we start using the child block's reported streamed tx fees to determine the parent's reward. We need to use the parent block's evaluated epoch, since a stream cannot cross an epoch boundary.
jcnelson added 2 commits May 19, 2022 15:49
…fee behavior, the new fee behavior (by way of the new get-block-info? fields), and the transition gating
@codecov
Copy link

codecov bot commented May 19, 2022

Codecov Report

Merging #3144 (b33ad10) into feat/btc-stx-exchange-rate (114f64f) will increase coverage by 0.26%.
The diff coverage is 99.56%.

@@                      Coverage Diff                       @@
##           feat/btc-stx-exchange-rate    #3144      +/-   ##
==============================================================
+ Coverage                       83.99%   84.25%   +0.26%     
==============================================================
  Files                             268      268              
  Lines                          211702   212573     +871     
==============================================================
+ Hits                           177812   179108    +1296     
+ Misses                          33890    33465     -425     
Impacted Files Coverage Δ
src/chainstate/stacks/db/accounts.rs 90.03% <88.88%> (+0.55%) ⬆️
src/chainstate/stacks/miner.rs 93.74% <99.77%> (+0.59%) ⬆️
src/chainstate/stacks/db/blocks.rs 89.51% <100.00%> (-0.01%) ⬇️
src/net/neighbors.rs 36.84% <0.00%> (-1.59%) ⬇️
src/net/inv.rs 70.51% <0.00%> (-0.65%) ⬇️
stacks-common/src/util/hash.rs 82.47% <0.00%> (-0.58%) ⬇️
src/burnchains/burnchain.rs 89.35% <0.00%> (-0.20%) ⬇️
clarity/src/vm/contexts.rs 93.48% <0.00%> (-0.14%) ⬇️
testnet/stacks-node/src/node.rs 82.78% <0.00%> (-0.13%) ⬇️
testnet/stacks-node/src/config.rs 56.17% <0.00%> (-0.09%) ⬇️
... and 25 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 114f64f...b33ad10. Read the comment docs.

Copy link
Contributor

@gregorycoppola gregorycoppola left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for finding this.. one comment

@@ -1015,6 +1022,7 @@ impl StacksChainState {
/// Returns a list of payments to make to each address -- miners and user-support burners.
pub fn find_mature_miner_rewards(
clarity_tx: &mut ClarityTx,
sortdb_conn: &Connection,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can unit tests for this function be used to test the miner reward calculations?

Copy link
Member Author

@jcnelson jcnelson Jun 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are, albeit indirectly, via test_get_block_info_v210 and test_get_block_info_v210_no_microblocks. Each block and microblock stream has a unique set of transaction fees, and the test verifies that these fees are awarded accordingly.

@kantai
Copy link
Member

kantai commented May 24, 2022

On the topic of microblock fee rewards, I think there's another bug (though not a realizable one, because user burn support is disabled) in the handling of poisoned rewards:

https://github.com/stacks-network/stacks-blockchain/blob/master/src/chainstate/stacks/db/accounts.rs#L601

Per the comment, the supporting users should get 0 rewards, not a portion of the coinbase.

@jcnelson
Copy link
Member Author

Yup; might as well fix that too since it can't be hit in production anyway.

…lock fee reporting (not a consensus bug since user burn supports are disabled)
Copy link
Member

@kantai kantai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@jcnelson jcnelson requested a review from gregorycoppola June 1, 2022 20:13
Copy link
Contributor

@pavitthrap pavitthrap left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@jcnelson jcnelson merged commit 00ca64b into feat/btc-stx-exchange-rate Jun 7, 2022
@blockstack-devops
Copy link
Contributor

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@stacks-network stacks-network locked as resolved and limited conversation to collaborators Nov 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants