-
Notifications
You must be signed in to change notification settings - Fork 0
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
chore(forrestrie/examples): programmatically match ethereum block with its beacon slot #8
chore(forrestrie/examples): programmatically match ethereum block with its beacon slot #8
Conversation
BACK-38 Programmatically match Ethereum block with its Beacon slot.
Blocks occasionally miss slots. In such cases there's no execution payload in the Beacon Block. Given an Ethereum block, find the Beacon Block with the Ethereum block in its execution payload. |
This comment has been minimized.
This comment has been minimized.
0c52bf1
to
ed83653
Compare
🤖 Cargo Audit Report 🤖 Crate: object_store Crate: ansi_term Crate: atty Crate: dotenv Crate: proc-macro-error Crate: atty warning: 5 allowed warnings found (Empty means OK! 👍) |
e6af2a5
to
48a424d
Compare
ed83653
to
976c8c5
Compare
976c8c5
to
ca5cfe3
Compare
6312f05
to
1b29eaf
Compare
@anirudh2 This is the last of the post-merge stuff I had in dev last from week. |
1b29eaf
to
27b71d5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Example ran successfully, output makes sense. Minor question for understanding in match_ethereum_to_beacon.rs
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor question for understanding of constant value.
27b71d5
to
4827175
Compare
let mut high = EXECUTION_BLOCK_NUMBER - ETHEREUM_BEACON_DENEB_OFFSET as u64 + 2_000_000; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this magic number 2_000_000?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A conservative guess. Because not every slot on the Beacon chain has a block in it, each time that happens the offset between the execution layer and the beacon chain grows. So this is just a super slack guess to get the ball rolling.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, shouldn't we use EXECUTION_BLOCK_NUMBER - ETHEREUM_BEACON_DENEB_OFFSET
as low? Since this would be without any missing slots.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
high should be the current block isn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, of course! 😄
match block_number.cmp(&EXECUTION_BLOCK_NUMBER) { | ||
Less => low = mid + 1, | ||
Greater => high = mid - 1, | ||
_ => unreachable!(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you are doing a cmp here, you could just add 77-80 here as Equal.
41cb977
to
7b4c039
Compare
7b4c039
to
d8f042d
Compare
feat(HeadState): Added function to compute block root inclusion proof
BACK-38
Blocks occasionally miss slots. In such cases there's no execution payload in the Beacon Block. Given an Ethereum block, we need to find the Beacon Block with the Ethereum block in its execution payload.
This PR's aim is to provide an example of what needs to be done as a basis for further implementation and optimization in production code at a later stage.