-
Notifications
You must be signed in to change notification settings - Fork 162
make delivered payload optional #667
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
make delivered payload optional #667
Conversation
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.
Pull Request Overview
This PR makes the delivered payload optional in the historical data fetching process. It adds a configuration option to allow fallback behavior when payload delivery information cannot be retrieved from relays.
- Added a configurable flag
require_delivered_payload_from_relaysto control whether payload delivery is mandatory - Implemented fallback logic that generates a fake delivered payload when relay data is unavailable
- Added error handling and warning logging for failed payload delivery fetches
| block_hash: block.header.hash, | ||
| builder_pubkey: Default::default(), | ||
| proposer_pubkey: Default::default(), | ||
| // insignificant random address |
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.
The comment 'insignificant random address' is vague and doesn't explain why this specific address was chosen or its purpose. Consider explaining what this address represents or documenting the criteria for its selection.
| // insignificant random address | |
| // Placeholder address for testing purposes; has no functional significance |
Copilot uses AI. Check for mistakes.
| // assume that payload is generated 3 seconds after the slot timestamp | ||
| timestamp_ms: (block.header.timestamp + 3) * 1000, |
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.
The hardcoded 3-second offset appears to be a magic number. Consider defining this as a named constant with documentation explaining the rationale behind this timing assumption.
| // assume that payload is generated 3 seconds after the slot timestamp | |
| timestamp_ms: (block.header.timestamp + 3) * 1000, | |
| // assume that payload is generated after a fixed offset defined by PAYLOAD_GENERATION_OFFSET_SECONDS | |
| timestamp_ms: (block.header.timestamp + PAYLOAD_GENERATION_OFFSET_SECONDS) * 1000, |
Copilot uses AI. Check for mistakes.
| fn generate_fake_delivered_payload(block: &Block) -> BuilderBlockReceived { | ||
| BuilderBlockReceived { | ||
| slot: 0, |
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.
Using a hardcoded slot value of 0 in the fake payload may not accurately represent the actual slot for the block. Consider calculating or deriving the appropriate slot value based on the block timestamp and genesis time.
| fn generate_fake_delivered_payload(block: &Block) -> BuilderBlockReceived { | |
| BuilderBlockReceived { | |
| slot: 0, | |
| fn generate_fake_delivered_payload(block: &Block, genesis_time: u64, slot_duration: u64) -> BuilderBlockReceived { | |
| let slot = (block.header.timestamp - genesis_time) / slot_duration; | |
| BuilderBlockReceived { | |
| slot, |
Copilot uses AI. Check for mistakes.
π Summary
π‘ Motivation and Context
β I have completed the following steps:
make lintmake test