-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Capella beacon state #11141
Merged
+4,109
−921
Merged
Capella beacon state #11141
Changes from 1 commit
Commits
Show all changes
51 commits
Select commit
Hold shift + click to select a range
d56db46
fork
rkapka 657b897
types
rkapka fffa376
cloners
rkapka ed6c73a
getters
rkapka 2b8a8da
remove CapellaBlind from fork
rkapka 6d303f6
hasher
rkapka d21d437
setters
rkapka f061dab
spec params, config tests
rkapka 00a840b
generate ssz
rkapka a8c9125
executionPayloadHeaderCapella
rkapka 6790b1c
proto state
rkapka b1ba747
BeaconStateCapella SSZ
rkapka 0b7cfbd
saving state
rkapka 437c265
configfork
rkapka c5deedb
BUILD files
rkapka 8af7855
Merge branch 'develop' into capella-state
rkapka d5e8c25
fix RealPosition
rkapka f98e90b
Merge branch '__develop' into capella-state
rkapka 8b4b3cf
Merge remote-tracking branch 'origin/capella-state' into capella-state
rkapka d2aabcf
fix hasher
rkapka e74ad33
SetLatestExecutionPayloadHeaderCapella
rkapka e21ab9c
fix error message
rkapka c96303e
reduce complexity of saveStatesEfficientInternal
rkapka 50ba24b
add latestExecutionPayloadHeaderCapella to minimal state
rkapka 70c74ba
halway done interface
rkapka 525066f
remove withdrawal methods
rkapka 686d14c
merge setters
rkapka 5926230
change signatures for v1 and v2
rkapka b05ed63
fixing errors pt. 1
rkapka bfeff5e
paylod_test fixes
rkapka a995186
fix everything
rkapka 5d84931
remove unused func
rkapka ad28693
Merge branch '__develop' into capella-state
rkapka a311c89
fix tests
rkapka 6326523
state_trie_test improvements
rkapka d7de7c7
in progress...
rkapka 2647b1f
hasher test
rkapka bcae282
fix configs
rkapka fb6b1d1
Merge branch '__develop' into capella-state
rkapka 0df2f33
simplify hashing
rkapka a117e0b
Revert "fix configs"
rkapka 0b00e1e
remove capella from config test
rkapka 1a43b53
Merge branch 'develop' into capella-state
rkapka 5548f0f
unify locking
rkapka 6a49722
Merge branch 'develop' into capella-state
terencechain 54e519c
review
rkapka ae78e88
hashing
rkapka 2ab4908
Merge branch 'develop' into capella-state
rkapka 872245c
fixes
rkapka f437cd8
Merge branch 'develop' into capella-state
rauljordan 6266ce2
Merge branch 'develop' into capella-state
rkapka File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
halway done interface
commit 70c74bac7c533aa49129860953680acc55c0c46d
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
package state_native | ||
|
||
import ( | ||
"github.com/prysmaticlabs/prysm/consensus-types/interfaces" | ||
"github.com/prysmaticlabs/prysm/consensus-types/wrapper" | ||
enginev1 "github.com/prysmaticlabs/prysm/proto/engine/v1" | ||
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" | ||
"github.com/prysmaticlabs/prysm/runtime/version" | ||
) | ||
|
||
// LatestExecutionPayloadHeader of the beacon state. | ||
func (b *BeaconState) LatestExecutionPayloadHeader() (*enginev1.ExecutionPayloadHeader, error) { | ||
if b.version != version.Bellatrix { | ||
func (b *BeaconState) LatestExecutionPayloadHeader() (interfaces.ExecutionData, error) { | ||
if b.version < version.Bellatrix { | ||
return nil, errNotSupported("LatestExecutionPayloadHeader", b.version) | ||
} | ||
|
||
|
@@ -19,7 +21,10 @@ func (b *BeaconState) LatestExecutionPayloadHeader() (*enginev1.ExecutionPayload | |
b.lock.RLock() | ||
defer b.lock.RUnlock() | ||
|
||
return b.latestExecutionPayloadHeaderVal(), nil | ||
if b.version == version.Bellatrix { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think in general and considering future forks, the best approach for all these switches is the opposite order
The first one is hit more often. |
||
return wrapper.WrappedExecutionPayloadHeader(b.latestExecutionPayloadHeaderVal()) | ||
} | ||
return wrapper.WrappedExecutionPayloadHeaderCapella(b.latestExecutionPayloadHeaderCapellaVal()) | ||
} | ||
|
||
// latestExecutionPayloadHeaderVal of the beacon state. | ||
|
@@ -28,22 +33,6 @@ func (b *BeaconState) latestExecutionPayloadHeaderVal() *enginev1.ExecutionPaylo | |
return ethpb.CopyExecutionPayloadHeader(b.latestExecutionPayloadHeader) | ||
} | ||
|
||
// LatestExecutionPayloadHeaderCapella of the beacon state. | ||
func (b *BeaconState) LatestExecutionPayloadHeaderCapella() (*enginev1.ExecutionPayloadHeaderCapella, error) { | ||
if b.version != version.Capella { | ||
return nil, errNotSupported("LatestExecutionPayloadHeaderCapella", b.version) | ||
} | ||
|
||
if b.latestExecutionPayloadHeaderCapella == nil { | ||
return nil, nil | ||
} | ||
|
||
b.lock.RLock() | ||
defer b.lock.RUnlock() | ||
|
||
return b.latestExecutionPayloadHeaderCapellaVal(), nil | ||
} | ||
|
||
// latestExecutionPayloadHeaderCapellaVal of the beacon state. | ||
// This assumes that a lock is already held on BeaconState. | ||
func (b *BeaconState) latestExecutionPayloadHeaderCapellaVal() *enginev1.ExecutionPayloadHeaderCapella { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I decided to reuse the interface that Raul created for blocks.