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

initialize_beacon_state_from_eth1 for pre-transition merge #2640

Merged
merged 4 commits into from
Oct 4, 2021

Conversation

djrtwo
Copy link
Contributor

@djrtwo djrtwo commented Oct 3, 2021

initialize_beacon_state_from_eth1 on the Merge fork should work for two cases:

  1. The Merge beacon chain logic at genesis and the merge has already happened (what is in the function today)
  2. The Merge beacon chain logic at genesis but the merge has not yet happened

(2) is very valuable for testnets that are built to test the merge transition logic

TODO:

  • fix tests

@djrtwo djrtwo force-pushed the fix-merge-gen-state branch from bea4b3c to af262be Compare October 3, 2021 12:16
@djrtwo djrtwo force-pushed the fix-merge-gen-state branch from 6b95a5b to 34fd3ef Compare October 3, 2021 13:19
@djrtwo djrtwo force-pushed the fix-merge-gen-state branch from 34fd3ef to 789eea0 Compare October 3, 2021 13:19
@@ -17,7 +19,7 @@ def eth1_init_data(eth1_block_hash, eth1_timestamp):
}


@with_merge_and_later
@with_phases([MERGE])
Copy link
Contributor

@hwwhww hwwhww Oct 3, 2021

Choose a reason for hiding this comment

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

I changed it to @with_phases([MERGE]) because I think for the subsequent forks, the execution_payload_header field would be required?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I personally think the transition logic might just stay in there, but we can debate it further down the line

@hwwhww hwwhww force-pushed the fix-merge-gen-state branch from dd82ba3 to e235aa8 Compare October 3, 2021 14:38
Copy link
Contributor

@hwwhww hwwhww left a comment

Choose a reason for hiding this comment

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

@djrtwo

I cleaned up the tests & testgen. I've tested that I can generate the new test vectors successfully.

Signing my approval now so that you can review & merge. :)

Copy link
Contributor

@mkalinin mkalinin left a comment

Choose a reason for hiding this comment

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

Looks good to me! 👍

Copy link
Contributor Author

@djrtwo djrtwo left a comment

Choose a reason for hiding this comment

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

Thank you @hwwhww !!

@@ -17,7 +19,7 @@ def eth1_init_data(eth1_block_hash, eth1_timestamp):
}


@with_merge_and_later
@with_phases([MERGE])
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I personally think the transition logic might just stay in there, but we can debate it further down the line

@djrtwo djrtwo changed the title [WIP] initialize_beacon_state_from_eth1 for pre-transition merge initialize_beacon_state_from_eth1 for pre-transition merge Oct 4, 2021
@djrtwo djrtwo added the Bellatrix CL+EL Merge label Oct 4, 2021
@djrtwo djrtwo merged commit 7e34b8e into dev Oct 4, 2021
@djrtwo djrtwo deleted the fix-merge-gen-state branch October 4, 2021 04:49

```python
def initialize_beacon_state_from_eth1(eth1_block_hash: Bytes32,
eth1_timestamp: uint64,
deposits: Sequence[Deposit]) -> BeaconState:
deposits: Sequence[Deposit],
execution_payload_header: ExecutionPayloadHeader=ExecutionPayloadHeader()
Copy link
Member

Choose a reason for hiding this comment

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

Why do we still need eth1_block_hash & eth1_timestamp? They should be both in the passed execution_payload_header

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bellatrix CL+EL Merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants