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

feat: calc block base reward use block number only #8876

Merged
merged 7 commits into from
Jun 17, 2024

Conversation

jsvisa
Copy link
Contributor

@jsvisa jsvisa commented Jun 17, 2024

Copy link
Member

@onbjerg onbjerg left a comment

Choose a reason for hiding this comment

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

i don't think the idea was removing the ttd check entirely, just avoiding fetching ttd where possible by checking with the block number first, e.g. if paris is not activated at a specific block number, we'd need to fetch the ttd and check again because it might be a false negative (in the case where we don't know the number of the merge block)

cc @mattsse for clarification

@jsvisa
Copy link
Contributor Author

jsvisa commented Jun 17, 2024

@onbjerg I have the same thoughts as you, but after some consideration, if the chain has passed merge, it must be set paris_block_and_final_difficulty, so I think there's no need to check the ttd again.

@onbjerg
Copy link
Member

onbjerg commented Jun 17, 2024

The block is only set if its present in the chain spec, which is not the case for all chains, e.g. if the block is not known, but the TTD is. We don't update the chain spec while the node is running, so we don't set the block when we detect TTD has been passed.

@emhane emhane added the A-rpc Related to the RPC implementation label Jun 17, 2024
Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

we can't safely do that, but what we can do this, add a new function that checks the base block reward pre-merge based on the block number

@jsvisa jsvisa requested a review from DaniPopes as a code owner June 17, 2024 16:49
@jsvisa
Copy link
Contributor Author

jsvisa commented Jun 17, 2024

@mattsse ptal, seems the is_paris_active_at_block is missed in #8891, so add back in this pr; and add a simple func base_block_reward_pre_merge returns 2,3,5 ETH for blocks before merge. I'll check if the block is after merge or not in #8868 before invoking base_block_reward, so no need to adjust more in this pr, wdyt.

@mattsse
Copy link
Collaborator

mattsse commented Jun 17, 2024

-.- adding back in #8896

@mattsse
Copy link
Collaborator

mattsse commented Jun 17, 2024

nvm, I'll include it here, ty

Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

lgtm

@mattsse mattsse enabled auto-merge June 17, 2024 17:14
@mattsse mattsse added this pull request to the merge queue Jun 17, 2024
Merged via the queue into paradigmxyz:main with commit ed9f36b Jun 17, 2024
29 checks passed
@jsvisa jsvisa deleted the calc-block-reard branch June 18, 2024 00:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rpc Related to the RPC implementation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants