Skip to content

Commit

Permalink
ePBS configuration constants
Browse files Browse the repository at this point in the history
  • Loading branch information
potuz committed Apr 19, 2024
1 parent cf23bc7 commit 4b0a79c
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 0 deletions.
3 changes: 3 additions & 0 deletions config/fieldparams/mainnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const (
CurrentEpochAttestationsLength = 4096 // MAX_ATTESTATIONS * SLOTS_PER_EPOCH
SlashingsLength = 8192 // EPOCHS_PER_SLASHINGS_VECTOR
SyncCommitteeLength = 512 // SYNC_COMMITTEE_SIZE
PTCSize = 512 // PTC_SIZE [New in ePBS]
RootLength = 32 // RootLength defines the byte length of a Merkle root.
BLSSignatureLength = 96 // BLSSignatureLength defines the byte length of a BLSSignature.
BLSPubkeyLength = 48 // BLSPubkeyLength defines the byte length of a BLSSignature.
Expand All @@ -28,6 +29,8 @@ const (
MaxWithdrawalsPerPayload = 16 // MaxWithdrawalsPerPayloadLength defines the maximum number of withdrawals that can be included in a payload.
MaxBlobsPerBlock = 6 // MaxBlobsPerBlock defines the maximum number of blobs with respect to consensus rule can be included in a block.
MaxBlobCommitmentsPerBlock = 4096 // MaxBlobCommitmentsPerBlock defines the theoretical limit of blobs can be included in a block.
MaxPayloadAttestationsPerBlock = 4 // MAX_PAYLOAD_ATTESTATIONS [New in ePBS]
MaxTransactionsPerInclusionList = 1024 // MAX_TRANSACTIONS_PER_INCLUSION_LIST [New in ePBS]
LogMaxBlobCommitments = 12 // Log_2 of MaxBlobCommitmentsPerBlock
BlobLength = 131072 // BlobLength defines the byte length of a blob.
BlobSize = 131072 // defined to match blob.size in bazel ssz codegen
Expand Down
3 changes: 3 additions & 0 deletions config/fieldparams/minimal.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const (
CurrentEpochAttestationsLength = 1024 // MAX_ATTESTATIONS * SLOTS_PER_EPOCH
SlashingsLength = 64 // EPOCHS_PER_SLASHINGS_VECTOR
SyncCommitteeLength = 32 // SYNC_COMMITTEE_SIZE
PTCSize = 32 // PTC_SIZE [New in ePBS]
RootLength = 32 // RootLength defines the byte length of a Merkle root.
BLSSignatureLength = 96 // BLSSignatureLength defines the byte length of a BLSSignature.
BLSPubkeyLength = 48 // BLSPubkeyLength defines the byte length of a BLSSignature.
Expand All @@ -28,6 +29,8 @@ const (
MaxWithdrawalsPerPayload = 4 // MaxWithdrawalsPerPayloadLength defines the maximum number of withdrawals that can be included in a payload.
MaxBlobsPerBlock = 6 // MaxBlobsPerBlock defines the maximum number of blobs with respect to consensus rule can be included in a block.
MaxBlobCommitmentsPerBlock = 16 // MaxBlobCommitmentsPerBlock defines the theoretical limit of blobs can be included in a block.
MaxPayloadAttestationsPerBlock = 4 // MAX_PAYLOAD_ATTESTATIONS [New in ePBS]
MaxTransactionsPerInclusionList = 16 // MAX_TRANSACTIONS_PER_INCLUSION_LIST [New in ePBS]
LogMaxBlobCommitments = 4 // Log_2 of MaxBlobCommitmentsPerBlock
BlobLength = 131072 // BlobLength defines the byte length of a blob.
BlobSize = 131072 // defined to match blob.size in bazel ssz codegen
Expand Down
5 changes: 5 additions & 0 deletions config/params/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ type BeaconChainConfig struct {
DomainApplicationMask [4]byte `yaml:"DOMAIN_APPLICATION_MASK" spec:"true"` // DomainApplicationMask defines the BLS signature domain for application mask.
DomainApplicationBuilder [4]byte `yaml:"DOMAIN_APPLICATION_BUILDER" spec:"true"` // DomainApplicationBuilder defines the BLS signature domain for application builder.
DomainBLSToExecutionChange [4]byte `yaml:"DOMAIN_BLS_TO_EXECUTION_CHANGE" spec:"true"` // DomainBLSToExecutionChange defines the BLS signature domain to change withdrawal addresses to ETH1 prefix
DomainBeaconBuilder [4]byte `yaml:"DOMAIN_BEACON_BULDER" spec:"false"` // DomainBeaconBuilder defines the BLS signature domain used by builders [New in ePBS]
DomainPTCAttester [4]byte `yaml:"DOMAIN_PTC_ATTESTER" spec:"false"` // DomainPTCAttester defines the BLS signature domain used by PTC members [New in ePBS]

// Prysm constants.
GweiPerEth uint64 // GweiPerEth is the amount of gwei corresponding to 1 eth.
Expand Down Expand Up @@ -157,6 +159,8 @@ type BeaconChainConfig struct {
CapellaForkEpoch primitives.Epoch `yaml:"CAPELLA_FORK_EPOCH" spec:"true"` // CapellaForkEpoch is used to represent the assigned fork epoch for capella.
DenebForkVersion []byte `yaml:"DENEB_FORK_VERSION" spec:"true"` // DenebForkVersion is used to represent the fork version for deneb.
DenebForkEpoch primitives.Epoch `yaml:"DENEB_FORK_EPOCH" spec:"true"` // DenebForkEpoch is used to represent the assigned fork epoch for deneb.
EPBSForkVersion []byte // EPBSForkVersion is used to represent the fork version for ePBS.
EPBSForkEpoch primitives.Epoch // EPBSForkEpoch is used to represent the assigned fork epoch for ePBS.

ForkVersionSchedule map[[fieldparams.VersionLength]byte]primitives.Epoch // Schedule of fork epochs by version.
ForkVersionNames map[[fieldparams.VersionLength]byte]string // Human-readable names of fork versions.
Expand Down Expand Up @@ -280,6 +284,7 @@ func ConfigForkVersions(b *BeaconChainConfig) map[[fieldparams.VersionLength]byt
bytesutil.ToBytes4(b.BellatrixForkVersion): version.Bellatrix,
bytesutil.ToBytes4(b.CapellaForkVersion): version.Capella,
bytesutil.ToBytes4(b.DenebForkVersion): version.Deneb,
bytesutil.ToBytes4(b.EPBSForkVersion): version.EPBS,
}
}

Expand Down
7 changes: 7 additions & 0 deletions config/params/mainnet_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ const (
mainnetCapellaForkEpoch = 194048 // April 12, 2023, 22:27:35 UTC
// Deneb Fork Epoch for mainnet config.
mainnetDenebForkEpoch = 269568 // March 13, 2024, 13:55:35 UTC
// ePBS Fork Epoch for mainnet config.
mainnetEPBSForkEpoch = math.MaxUint64
)

var mainnetNetworkConfig = &NetworkConfig{
Expand Down Expand Up @@ -207,6 +209,8 @@ var mainnetBeaconConfig = &BeaconChainConfig{
CapellaForkEpoch: mainnetCapellaForkEpoch,
DenebForkVersion: []byte{4, 0, 0, 0},
DenebForkEpoch: mainnetDenebForkEpoch,
EPBSForkVersion: []byte{6, 0, 0, 0},
EPBSForkEpoch: mainnetEPBSForkEpoch,

// New values introduced in Altair hard fork 1.
// Participation flag indices.
Expand Down Expand Up @@ -302,16 +306,19 @@ func FillTestVersions(c *BeaconChainConfig, b byte) {
c.BellatrixForkVersion = make([]byte, fieldparams.VersionLength)
c.CapellaForkVersion = make([]byte, fieldparams.VersionLength)
c.DenebForkVersion = make([]byte, fieldparams.VersionLength)
c.EPBSForkVersion = make([]byte, fieldparams.VersionLength)

c.GenesisForkVersion[fieldparams.VersionLength-1] = b
c.AltairForkVersion[fieldparams.VersionLength-1] = b
c.BellatrixForkVersion[fieldparams.VersionLength-1] = b
c.CapellaForkVersion[fieldparams.VersionLength-1] = b
c.DenebForkVersion[fieldparams.VersionLength-1] = b
c.EPBSForkVersion[fieldparams.VersionLength-1] = b

c.GenesisForkVersion[0] = 0
c.AltairForkVersion[0] = 1
c.BellatrixForkVersion[0] = 2
c.CapellaForkVersion[0] = 3
c.DenebForkVersion[0] = 4
c.EPBSForkVersion[0] = 6
}
2 changes: 2 additions & 0 deletions runtime/version/fork.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const (
Bellatrix
Capella
Deneb
EPBS
)

var versionToString = map[int]string{
Expand All @@ -16,6 +17,7 @@ var versionToString = map[int]string{
Bellatrix: "bellatrix",
Capella: "capella",
Deneb: "deneb",
EPBS: "epbs",
}

// stringToVersion and allVersions are populated in init()
Expand Down

0 comments on commit 4b0a79c

Please sign in to comment.