-
Notifications
You must be signed in to change notification settings - Fork 139
Add support for Electra #613
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
Changes from 44 commits
c9f2a02
9b69d61
33b6f64
8770896
40aeed5
5794db2
096be7f
573d448
770d711
8a5ed48
002f5e5
ec5f753
a9caf4e
b0e3d4d
e63a669
3577f76
fba3991
7fb201f
40fe836
acb5536
6ba1b5d
20c3cf5
0f0fe8c
94e0115
aac580d
1278068
61a5230
94882aa
68a6618
20d0a95
fe05f94
873bbc4
67615f0
5491a31
3d1cf3c
940dc33
0557d53
46c6c69
a6d2ce5
e5d991e
0743dc4
8a6ed9f
fb6973b
fd61c64
fced1f3
8321f63
12fbbfc
54c9bf8
a32d82a
7b592ea
65453e5
32e2449
7fd62d4
38711fd
e6606f1
0ba3dd0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -47,10 +47,10 @@ jobs: | |
| uses: actions/checkout@v3 | ||
|
|
||
| - name: Install gofumpt | ||
| run: go install mvdan.cc/gofumpt@v0.4.0 | ||
| run: go install mvdan.cc/gofumpt@latest | ||
|
|
||
| - name: Install staticcheck | ||
| run: go install honnef.co/go/tools/cmd/staticcheck@v0.5.1 | ||
| run: go install honnef.co/go/tools/cmd/staticcheck@latest | ||
|
|
||
| - name: Install golangci-lint | ||
| run: go install github.com/golangci/golangci-lint/cmd/[email protected] | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -12,6 +12,7 @@ import ( | |||
| "github.com/attestantio/go-eth2-client/spec/bellatrix" | ||||
| "github.com/attestantio/go-eth2-client/spec/capella" | ||||
| "github.com/attestantio/go-eth2-client/spec/deneb" | ||||
| "github.com/attestantio/go-eth2-client/spec/electra" | ||||
| "github.com/attestantio/go-eth2-client/spec/phase0" | ||||
| ssz "github.com/ferranbt/fastssz" | ||||
| boostSsz "github.com/flashbots/go-boost-utils/ssz" | ||||
|
|
@@ -52,9 +53,15 @@ var ( | |||
| DenebForkVersionGoerli = "0x04001020" | ||||
| DenebForkVersionMainnet = "0x04000000" | ||||
|
|
||||
| ElectraForkVersionHolesky = "0x06017000" | ||||
| ElectraForkVersionSepolia = "0x90000074" | ||||
| ElectraForkVersionGoerli = "0x05001020" | ||||
| ElectraForkVersionMainnet = "0x05000000" | ||||
|
|
||||
| ForkVersionStringBellatrix = "bellatrix" | ||||
| ForkVersionStringCapella = "capella" | ||||
| ForkVersionStringDeneb = "deneb" | ||||
| ForkVersionStringElectra = "electra" | ||||
| ) | ||||
|
|
||||
| type EthNetworkDetails struct { | ||||
|
|
@@ -64,11 +71,13 @@ type EthNetworkDetails struct { | |||
| BellatrixForkVersionHex string | ||||
| CapellaForkVersionHex string | ||||
| DenebForkVersionHex string | ||||
| ElectraForkVersionHex string | ||||
|
|
||||
| DomainBuilder phase0.Domain | ||||
| DomainBeaconProposerBellatrix phase0.Domain | ||||
| DomainBeaconProposerCapella phase0.Domain | ||||
| DomainBeaconProposerDeneb phase0.Domain | ||||
| DomainBeaconProposerElectra phase0.Domain | ||||
| } | ||||
|
|
||||
| func NewEthNetworkDetails(networkName string) (ret *EthNetworkDetails, err error) { | ||||
|
|
@@ -77,10 +86,12 @@ func NewEthNetworkDetails(networkName string) (ret *EthNetworkDetails, err error | |||
| var bellatrixForkVersion string | ||||
| var capellaForkVersion string | ||||
| var denebForkVersion string | ||||
| var electraForkVersion string | ||||
| var domainBuilder phase0.Domain | ||||
| var domainBeaconProposerBellatrix phase0.Domain | ||||
| var domainBeaconProposerCapella phase0.Domain | ||||
| var domainBeaconProposerDeneb phase0.Domain | ||||
| var domainBeaconProposerElectra phase0.Domain | ||||
|
|
||||
| switch networkName { | ||||
| case EthNetworkHolesky: | ||||
|
|
@@ -89,30 +100,35 @@ func NewEthNetworkDetails(networkName string) (ret *EthNetworkDetails, err error | |||
| bellatrixForkVersion = BellatrixForkVersionHolesky | ||||
| capellaForkVersion = CapellaForkVersionHolesky | ||||
| denebForkVersion = DenebForkVersionHolesky | ||||
| electraForkVersion = ElectraForkVersionHolesky | ||||
| case EthNetworkSepolia: | ||||
| genesisForkVersion = GenesisForkVersionSepolia | ||||
| genesisValidatorsRoot = GenesisValidatorsRootSepolia | ||||
| bellatrixForkVersion = BellatrixForkVersionSepolia | ||||
| capellaForkVersion = CapellaForkVersionSepolia | ||||
| denebForkVersion = DenebForkVersionSepolia | ||||
| electraForkVersion = ElectraForkVersionSepolia | ||||
| case EthNetworkGoerli: | ||||
| genesisForkVersion = GenesisForkVersionGoerli | ||||
| genesisValidatorsRoot = GenesisValidatorsRootGoerli | ||||
| bellatrixForkVersion = BellatrixForkVersionGoerli | ||||
| capellaForkVersion = CapellaForkVersionGoerli | ||||
| denebForkVersion = DenebForkVersionGoerli | ||||
| electraForkVersion = ElectraForkVersionGoerli | ||||
| case EthNetworkMainnet: | ||||
| genesisForkVersion = GenesisForkVersionMainnet | ||||
| genesisValidatorsRoot = GenesisValidatorsRootMainnet | ||||
| bellatrixForkVersion = BellatrixForkVersionMainnet | ||||
| capellaForkVersion = CapellaForkVersionMainnet | ||||
| denebForkVersion = DenebForkVersionMainnet | ||||
| electraForkVersion = ElectraForkVersionMainnet | ||||
| case EthNetworkCustom: | ||||
| genesisForkVersion = os.Getenv("GENESIS_FORK_VERSION") | ||||
| genesisValidatorsRoot = os.Getenv("GENESIS_VALIDATORS_ROOT") | ||||
| bellatrixForkVersion = os.Getenv("BELLATRIX_FORK_VERSION") | ||||
| capellaForkVersion = os.Getenv("CAPELLA_FORK_VERSION") | ||||
| denebForkVersion = os.Getenv("DENEB_FORK_VERSION") | ||||
| electraForkVersion = os.Getenv("ELECTRA_FORK_VERSION") | ||||
| default: | ||||
| return nil, fmt.Errorf("%w: %s", ErrUnknownNetwork, networkName) | ||||
| } | ||||
|
|
@@ -137,44 +153,55 @@ func NewEthNetworkDetails(networkName string) (ret *EthNetworkDetails, err error | |||
| return nil, err | ||||
| } | ||||
|
|
||||
| domainBeaconProposerElectra, err = ComputeDomain(boostSsz.DomainTypeBeaconProposer, electraForkVersion, genesisValidatorsRoot) | ||||
| if err != nil { | ||||
| return nil, err | ||||
| } | ||||
|
|
||||
| return &EthNetworkDetails{ | ||||
| Name: networkName, | ||||
| GenesisForkVersionHex: genesisForkVersion, | ||||
| GenesisValidatorsRootHex: genesisValidatorsRoot, | ||||
| BellatrixForkVersionHex: bellatrixForkVersion, | ||||
| CapellaForkVersionHex: capellaForkVersion, | ||||
| DenebForkVersionHex: denebForkVersion, | ||||
| ElectraForkVersionHex: electraForkVersion, | ||||
| DomainBuilder: domainBuilder, | ||||
| DomainBeaconProposerBellatrix: domainBeaconProposerBellatrix, | ||||
| DomainBeaconProposerCapella: domainBeaconProposerCapella, | ||||
| DomainBeaconProposerDeneb: domainBeaconProposerDeneb, | ||||
| DomainBeaconProposerElectra: domainBeaconProposerElectra, | ||||
| }, nil | ||||
| } | ||||
|
|
||||
| func (e *EthNetworkDetails) String() string { | ||||
| return fmt.Sprintf( | ||||
| `EthNetworkDetails{ | ||||
| Name: %s, | ||||
| GenesisForkVersionHex: %s, | ||||
| Name: %s, | ||||
| GenesisForkVersionHex: %s, | ||||
| GenesisValidatorsRootHex: %s, | ||||
| BellatrixForkVersionHex: %s, | ||||
| CapellaForkVersionHex: %s, | ||||
| BellatrixForkVersionHex: %s, | ||||
| CapellaForkVersionHex: %s, | ||||
| DenebForkVersionHex: %s, | ||||
| DomainBuilder: %x, | ||||
| DomainBeaconProposerBellatrix: %x, | ||||
| DomainBeaconProposerCapella: %x, | ||||
| ElectraForkVersionHex: %s, | ||||
| DomainBuilder: %x, | ||||
| DomainBeaconProposerBellatrix: %x, | ||||
| DomainBeaconProposerCapella: %x, | ||||
| DomainBeaconProposerDeneb: %x | ||||
| DomainBeaconProposerElectra: %x | ||||
| }`, | ||||
| e.Name, | ||||
| e.GenesisForkVersionHex, | ||||
| e.GenesisValidatorsRootHex, | ||||
| e.BellatrixForkVersionHex, | ||||
| e.CapellaForkVersionHex, | ||||
| e.DenebForkVersionHex, | ||||
| e.ElectraForkVersionHex, | ||||
| e.DomainBuilder, | ||||
| e.DomainBeaconProposerBellatrix, | ||||
| e.DomainBeaconProposerCapella, | ||||
| e.DomainBeaconProposerDeneb) | ||||
| e.DomainBeaconProposerDeneb, | ||||
| e.DomainBeaconProposerElectra) | ||||
| } | ||||
|
|
||||
| type PubkeyHex string | ||||
|
|
@@ -414,6 +441,9 @@ type BlockSubmissionInfo struct { | |||
| Blobs []deneb.Blob | ||||
| BlobGasUsed uint64 | ||||
| ExcessBlobGas uint64 | ||||
| DepositRequests []*electra.DepositRequest | ||||
| WithdrawalRequests []*electra.WithdrawalRequest | ||||
| ConsolidationRequests []*electra.ConsolidationRequest | ||||
| } | ||||
|
|
||||
| /* | ||||
|
|
@@ -425,6 +455,8 @@ which is sufficient data to set the bid of the builder. The `Transactions` | |||
| and `Withdrawals` fields are required to construct the full SignedBeaconBlock | ||||
| and are parsed asynchronously. | ||||
|
|
||||
| TODO(JWT): Does this need to be updated? It hasn't been updated for Deneb. | ||||
|
Collaborator
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. can be separate upgrade added deneb support here #618
Collaborator
Author
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. Yes, good idea. Thank you for making that PR. I will remove this comment. |
||||
|
|
||||
|
Comment on lines
+458
to
+459
Contributor
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.
Suggested change
|
||||
| Header only layout: | ||||
| [000-236) = Message (236 bytes) | ||||
| [236-240) = offset1 ( 4 bytes) | ||||
|
|
||||
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.
static pinning is better because otherwise at some point CI might just break.