Support New Subnet Backbone (#13179)

* add in changes

* fix it up

* fix test

* gaz

* lint

* add back

* fix tests

* fix it

* fix tests

* add lib

* fix it
This commit is contained in:
Nishant Das
2023-12-08 12:07:48 +08:00
committed by GitHub
parent 68b7d1009e
commit 590317553c
20 changed files with 188 additions and 127 deletions

View File

@@ -225,6 +225,13 @@ type BeaconChainConfig struct {
// Values introduced in Deneb hard fork
MaxPerEpochActivationChurnLimit uint64 `yaml:"MAX_PER_EPOCH_ACTIVATION_CHURN_LIMIT" spec:"true"` // MaxPerEpochActivationChurnLimit is the maximum amount of churn allotted for validator activation.
// Values related to the new subnet backbone
EpochsPerSubnetSubscription uint64 `yaml:"EPOCHS_PER_SUBNET_SUBSCRIPTION" spec:"true"` // EpochsPerSubnetSubscription specifies the minimum duration a validator is connected to their subnet.
AttestationSubnetExtraBits uint64 `yaml:"ATTESTATION_SUBNET_EXTRA_BITS" spec:"true"` // AttestationSubnetExtraBits is the number of extra bits of a NodeId to use when mapping to a subscribed subnet.
AttestationSubnetPrefixBits uint64 `yaml:"ATTESTATION_SUBNET_PREFIX_BITS" spec:"true"` // AttestationSubnetPrefixBits is defined as (ceillog2(ATTESTATION_SUBNET_COUNT) + ATTESTATION_SUBNET_EXTRA_BITS).
SubnetsPerNode uint64 `yaml:"SUBNETS_PER_NODE" spec:"true"` // SubnetsPerNode is the number of long-lived subnets a beacon node should be subscribed to.
NodeIdBits uint64 `yaml:"NODE_ID_BITS" spec:"true"` // NodeIdBits defines the bit length of a node id.
}
// InitializeForkSchedule initializes the schedules forks baked into the config.

View File

@@ -209,6 +209,11 @@ func ConfigToYaml(cfg *BeaconChainConfig) []byte {
fmt.Sprintf("DEPOSIT_CONTRACT_ADDRESS: %s", cfg.DepositContractAddress),
fmt.Sprintf("DENEB_FORK_EPOCH: %d", cfg.DenebForkEpoch),
fmt.Sprintf("DENEB_FORK_VERSION: %#x", cfg.DenebForkVersion),
fmt.Sprintf("EPOCHS_PER_SUBNET_SUBSCRIPTION: %d", cfg.EpochsPerSubnetSubscription),
fmt.Sprintf("ATTESTATION_SUBNET_EXTRA_BITS: %d", cfg.AttestationSubnetExtraBits),
fmt.Sprintf("ATTESTATION_SUBNET_PREFIX_BITS: %d", cfg.AttestationSubnetPrefixBits),
fmt.Sprintf("SUBNETS_PER_NODE: %d", cfg.SubnetsPerNode),
fmt.Sprintf("NODE_ID_BITS: %d", cfg.NodeIdBits),
}
yamlFile := []byte(strings.Join(lines, "\n"))

View File

@@ -25,13 +25,10 @@ import (
var placeholderFields = []string{
"ATTESTATION_PROPAGATION_SLOT_RANGE",
"ATTESTATION_SUBNET_COUNT",
"ATTESTATION_SUBNET_EXTRA_BITS",
"ATTESTATION_SUBNET_PREFIX_BITS",
"EIP6110_FORK_EPOCH",
"EIP6110_FORK_VERSION",
"EIP7002_FORK_EPOCH",
"EIP7002_FORK_VERSION",
"EPOCHS_PER_SUBNET_SUBSCRIPTION",
"GOSSIP_MAX_SIZE",
"MAXIMUM_GOSSIP_CLOCK_DISPARITY",
"MAX_BLOBS_PER_BLOCK",
@@ -44,7 +41,6 @@ var placeholderFields = []string{
"MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS",
"MIN_EPOCHS_FOR_BLOCK_REQUESTS",
"RESP_TIMEOUT",
"SUBNETS_PER_NODE",
"TTFB_TIMEOUT",
"UPDATE_TIMEOUT",
"WHISK_EPOCHS_PER_SHUFFLING_PHASE",

View File

@@ -274,6 +274,13 @@ var mainnetBeaconConfig = &BeaconChainConfig{
BlobsidecarSubnetCount: 6,
MaxPerEpochActivationChurnLimit: 8,
// Values related to the new subnet backbone
EpochsPerSubnetSubscription: 256,
AttestationSubnetExtraBits: 0,
AttestationSubnetPrefixBits: 6,
SubnetsPerNode: 2,
NodeIdBits: 256,
}
// MainnetTestConfig provides a version of the mainnet config that has a different name