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

Add support for Electra #613

Draft
wants to merge 33 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
c9f2a02
Begin to add Electra support
jtraglia Apr 4, 2024
9b69d61
Add electra fork versions & fix tests
jtraglia Apr 4, 2024
33b6f64
Add ElectraUnblindSignedBlock
jtraglia Apr 4, 2024
8770896
Use electra fork of go-boost-utils
jtraglia Apr 4, 2024
40aeed5
Use electra fork of geth & add test
jtraglia Apr 5, 2024
5794db2
Add support for deposit receipts
jtraglia Apr 8, 2024
096be7f
Run make fmt
jtraglia Apr 8, 2024
573d448
Update some redis things
jtraglia Apr 8, 2024
770d711
Replace Exits with WithdrawRequests
jtraglia Apr 10, 2024
8a5ed48
Rename WithdrawRequest to WithdrawalRequest
jtraglia Apr 27, 2024
002f5e5
Merge remote-tracking branch 'origin/main' into electra
jtraglia Apr 29, 2024
ec5f753
Use go-*-client@electra & lightclient's geth
jtraglia May 9, 2024
a9caf4e
Fix linter issues
jtraglia May 9, 2024
b0e3d4d
Fix issues & temporarily skip block simulation
jtraglia May 17, 2024
e63a669
Use new go-eth2-client
jtraglia May 17, 2024
3577f76
Use jtraglia's geth block-validation branch
jtraglia May 22, 2024
fba3991
update deps
avalonche Aug 6, 2024
7fb201f
Merge remote-tracking branch 'origin/main' into electra
jtraglia Sep 25, 2024
40fe836
Update for v1.5.0-alpha.6
jtraglia Sep 25, 2024
acb5536
Remove replacement for geth
jtraglia Sep 25, 2024
6ba1b5d
Try to fix linters
jtraglia Sep 25, 2024
20c3cf5
Remove toolchain from go.mod
jtraglia Sep 25, 2024
0f0fe8c
Maybe fix linter errors
jtraglia Sep 25, 2024
94e0115
Update deps
jtraglia Sep 25, 2024
aac580d
Update go-eth2-client for alpha.7 support
jtraglia Oct 7, 2024
1278068
Run go mod tidy
jtraglia Oct 7, 2024
61a5230
Add execution request support
jtraglia Oct 14, 2024
94882aa
Update go-eth2-client
jtraglia Oct 14, 2024
68a6618
Update go-builder-client
jtraglia Oct 14, 2024
20d0a95
Fix lint
jtraglia Oct 14, 2024
fe05f94
Temporarly disable block simulation
jtraglia Oct 28, 2024
873bbc4
Add debug log for registration timestamp
jtraglia Oct 28, 2024
67615f0
Revert "Add debug log for registration timestamp"
jtraglia Oct 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ linters-settings:
replace-allow-list:
- github.com/attestantio/go-builder-client
- github.com/attestantio/go-eth2-client
- github.com/ethereum/go-ethereum

maintidx:
under: 5
Expand Down
32 changes: 31 additions & 1 deletion common/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 {
Expand All @@ -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) {
Expand All @@ -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:
Expand All @@ -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)
}
Expand All @@ -137,6 +153,11 @@ 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,
Expand All @@ -148,6 +169,7 @@ func NewEthNetworkDetails(networkName string) (ret *EthNetworkDetails, err error
DomainBeaconProposerBellatrix: domainBeaconProposerBellatrix,
DomainBeaconProposerCapella: domainBeaconProposerCapella,
DomainBeaconProposerDeneb: domainBeaconProposerDeneb,
DomainBeaconProposerElectra: domainBeaconProposerElectra,
}, nil
}

Expand All @@ -160,21 +182,25 @@ func (e *EthNetworkDetails) String() string {
BellatrixForkVersionHex: %s,
CapellaForkVersionHex: %s,
DenebForkVersionHex: %s,
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
Expand Down Expand Up @@ -414,6 +440,8 @@ type BlockSubmissionInfo struct {
Blobs []deneb.Blob
BlobGasUsed uint64
ExcessBlobGas uint64
DepositReceipts []*electra.DepositReceipt
WithdrawalRequests []*electra.ExecutionLayerWithdrawalRequest
}

/*
Expand All @@ -425,6 +453,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.
Copy link
Collaborator

Choose a reason for hiding this comment

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

can be separate upgrade added deneb support here #618

Copy link
Collaborator Author

Choose a reason for hiding this comment

The 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.


Header only layout:
[000-236) = Message (236 bytes)
[236-240) = offset1 ( 4 bytes)
Expand Down
Loading
Loading