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

BEP341 & BEP402 #52

Merged
merged 53 commits into from
Aug 14, 2024
Merged

BEP341 & BEP402 #52

merged 53 commits into from
Aug 14, 2024

Conversation

Naohiro Yoshida added 30 commits May 26, 2024 17:02
Signed-off-by: Naohiro Yoshida <[email protected]>
Signed-off-by: Naohiro Yoshida <[email protected]>
Signed-off-by: Naohiro Yoshida <[email protected]>
Signed-off-by: Naohiro Yoshida <[email protected]>
Signed-off-by: Naohiro Yoshida <[email protected]>
Signed-off-by: Naohiro Yoshida <[email protected]>
Signed-off-by: Naohiro Yoshida <[email protected]>
Signed-off-by: Naohiro Yoshida <[email protected]>
Signed-off-by: Naohiro Yoshida <[email protected]>
Signed-off-by: Naohiro Yoshida <[email protected]>
Signed-off-by: Naohiro Yoshida <[email protected]>
Signed-off-by: Naohiro Yoshida <[email protected]>
Signed-off-by: Naohiro Yoshida <[email protected]>
Signed-off-by: Naohiro Yoshida <[email protected]>
Signed-off-by: Naohiro Yoshida <[email protected]>
Signed-off-by: Naohiro Yoshida <[email protected]>
Signed-off-by: Naohiro Yoshida <[email protected]>
Signed-off-by: Naohiro Yoshida <[email protected]>
Signed-off-by: Naohiro Yoshida <[email protected]>
Signed-off-by: Naohiro Yoshida <[email protected]>
Signed-off-by: Naohiro Yoshida <[email protected]>
Signed-off-by: Naohiro Yoshida <[email protected]>
Signed-off-by: Naohiro Yoshida <[email protected]>
Signed-off-by: Naohiro Yoshida <[email protected]>
Signed-off-by: Naohiro Yoshida <[email protected]>
Signed-off-by: Naohiro Yoshida <[email protected]>
Signed-off-by: Naohiro Yoshida <[email protected]>
Signed-off-by: Naohiro Yoshida <[email protected]>
Signed-off-by: Naohiro Yoshida <[email protected]>
Signed-off-by: Naohiro Yoshida <[email protected]>
Naohiro Yoshida added 5 commits July 23, 2024 19:51
Signed-off-by: Naohiro Yoshida <[email protected]>
Signed-off-by: Naohiro Yoshida <[email protected]>
Signed-off-by: Naohiro Yoshida <[email protected]>
Signed-off-by: Naohiro Yoshida <[email protected]>
Signed-off-by: Naohiro Yoshida <[email protected]>
@yoshidan yoshidan changed the title BEP341 BEP341 & BEP402 Jul 24, 2024
Naohiro Yoshida added 2 commits July 24, 2024 09:53
Signed-off-by: Naohiro Yoshida <[email protected]>
Signed-off-by: Naohiro Yoshida <[email protected]>
Naohiro Yoshida added 5 commits July 25, 2024 19:06
Signed-off-by: Naohiro Yoshida <[email protected]>
Signed-off-by: Naohiro Yoshida <[email protected]>
Signed-off-by: Naohiro Yoshida <[email protected]>
Signed-off-by: Naohiro Yoshida <[email protected]>
Signed-off-by: Naohiro Yoshida <[email protected]>
@yoshidan yoshidan marked this pull request as ready for review July 29, 2024 10:10
@@ -105,6 +113,32 @@ impl ETHHeader {
stream.append(&self.extra_data[..self.extra_data.len() - EXTRA_SEAL].to_vec());
stream.append(&self.mix_digest);
stream.append(&self.nonce);
if let Some(parent_beacon_root) = &self.parent_beacon_root {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Calculation of the seal hash according to BEP-402

let start = EXTRA_VANITY + VALIDATOR_NUM_SIZE;
let end = start + num * VALIDATOR_BYTES_LENGTH;
let turn_length = extra_data[end];
if !(turn_length == 1 || (3..=9).contains(&turn_length)) {
Copy link
Contributor Author

@yoshidan yoshidan Jul 29, 2024

Choose a reason for hiding this comment

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

According to 424-governable-number-of-consecutive-blocks
currently, the range for the value of n is set to [1,9] but except 2.


impl Epoch {
pub fn new(validator_set: ValidatorSet, turn_length: u8) -> Self {
let seed = [[turn_length].as_slice(), validator_set.hash.as_slice()].concat();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Save this hash as a validator hash in the cons state.


pub struct Localnet;

impl Network for Localnet {
Copy link
Contributor Author

@yoshidan yoshidan Jul 29, 2024

Choose a reason for hiding this comment

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

Test data can be prepared for each network for future HF support. Currently, Bohr is only operating on the localnet, so the test data is for the localnet only.
We will increase the corresponding test data once it is deployed on the testnet and mainnet.

Signed-off-by: Naohiro Yoshida <[email protected]>
@yoshidan yoshidan requested a review from 3100 July 30, 2024 01:01
Naohiro Yoshida and others added 3 commits August 14, 2024 16:58
Signed-off-by: Naohiro Yoshida <[email protected]>
@yoshidan yoshidan merged commit 85ec7f9 into HF/Bohr Aug 14, 2024
1 check passed
@yoshidan yoshidan deleted the feature/bep-341-1 branch August 14, 2024 12:27
yoshidan added a commit that referenced this pull request Aug 14, 2024
support bep-341 & bep-342

Signed-off-by: Naohiro Yoshida <[email protected]>
@yoshidan yoshidan mentioned this pull request Aug 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants