Skip to content

Commit

Permalink
feat(withdrawals): Fixed withdrawal for EVM inflation per block (#2158)
Browse files Browse the repository at this point in the history
Signed-off-by: Cal Bera <[email protected]>
Co-authored-by: Alberto Benegiamo <[email protected]>
  • Loading branch information
calbera and abi87 authored Nov 28, 2024
1 parent 847e414 commit 4f43ca9
Show file tree
Hide file tree
Showing 34 changed files with 1,402 additions and 668 deletions.
13 changes: 12 additions & 1 deletion mod/chain-spec/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,24 @@ module github.com/berachain/beacon-kit/mod/chain-spec
go 1.23.0

require (
github.com/berachain/beacon-kit/mod/errors v0.0.0-20240610210054-bfdc14c4013c
github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240911165923-82f71ec86570
github.com/stretchr/testify v1.9.0
)

require (
github.com/cockroachdb/errors v1.11.3 // indirect
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
github.com/cockroachdb/redact v1.1.5 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/getsentry/sentry-go v0.28.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
github.com/rogpeppe/go-internal v1.12.0 // indirect
golang.org/x/sys v0.24.0 // indirect
golang.org/x/text v0.17.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
59 changes: 56 additions & 3 deletions mod/chain-spec/go.sum
Original file line number Diff line number Diff line change
@@ -1,20 +1,73 @@
github.com/berachain/beacon-kit/mod/errors v0.0.0-20240610210054-bfdc14c4013c h1:rPoD2zVkIzuMC4R/XMuwx6eanJL8ccu37sLro+eIj3Y=
github.com/berachain/beacon-kit/mod/errors v0.0.0-20240610210054-bfdc14c4013c/go.mod h1:xgngH5/PYbyW+YDEmRhbBy3V333GXsNWF4DAkjYCmfs=
github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240911165923-82f71ec86570 h1:w0Gkg31VQRFDv0EJjYgVtlpza7kSaJq7U28zxZjfZeE=
github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240911165923-82f71ec86570/go.mod h1:Mrq1qol8vbkgZp2IMPFwngg75qE3k9IvT2MouBEhuus=
github.com/cockroachdb/errors v1.11.3 h1:5bA+k2Y6r+oz/6Z/RFlNeVCesGARKuC6YymtcDrbC/I=
github.com/cockroachdb/errors v1.11.3/go.mod h1:m4UIW4CDjx+R5cybPsNrRbreomiFqt8o1h1wUVazSd8=
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b h1:r6VH0faHjZeQy818SGhaone5OnYfxFR/+AzdY3sf5aE=
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs=
github.com/cockroachdb/redact v1.1.5 h1:u1PMllDkdFfPWaNGMyLD1+so+aq3uUItthCFqzwPJ30=
github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/getsentry/sentry-go v0.28.1 h1:zzaSm/vHmGllRM6Tpx1492r0YDzauArdBfkJRtY6P5k=
github.com/getsentry/sentry-go v0.28.1/go.mod h1:1fQZ+7l7eeJ3wYi82q5Hg8GqAPgefRq+FP/QhafYVgg=
github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA=
github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og=
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4=
github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8=
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg=
golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc=
golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
Expand Down
48 changes: 45 additions & 3 deletions mod/chain-spec/pkg/chain/chain_spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,17 @@ type Spec[
// GetCometBFTConfigForSlot retrieves the CometBFT config for a specific
// slot.
GetCometBFTConfigForSlot(slot SlotT) CometBFTConfigT

// Berachain Values

// EVMInflationAddress returns the address on the EVM which will receive
// the inflation amount of native EVM balance through a withdrawal every
// block.
EVMInflationAddress() ExecutionAddressT

// EVMInflationPerBlock returns the amount of native EVM balance (in Gwei)
// to be minted to the EVMInflationAddress via a withdrawal every block.
EVMInflationPerBlock() uint64
}

// chainSpec is a concrete implementation of the ChainSpec interface, holding
Expand All @@ -207,14 +218,29 @@ func NewChainSpec[
CometBFTConfigT any,
](data SpecData[
DomainTypeT, EpochT, ExecutionAddressT, SlotT, CometBFTConfigT,
]) Spec[
]) (Spec[
DomainTypeT, EpochT, ExecutionAddressT, SlotT, CometBFTConfigT,
] {
return &chainSpec[
], error) {
c := &chainSpec[
DomainTypeT, EpochT, ExecutionAddressT, SlotT, CometBFTConfigT,
]{
Data: data,
}
return c, c.validate()
}

// validate ensures that the chain spec is valid, returning error if it is not.
func (c *chainSpec[
DomainTypeT, EpochT, ExecutionAddressT, SlotT, CometBFTConfigT,
]) validate() error {
if c.MaxWithdrawalsPerPayload() <= 1 {
return ErrInsufficientMaxWithdrawalsPerPayload
}

// EVM Inflation values can be zero or non-zero, no validation needed.

// TODO: Add more validation rules here.
return nil
}

// MinDepositAmount returns the minimum deposit amount required.
Expand Down Expand Up @@ -476,3 +502,19 @@ func (c chainSpec[
]) GetCometBFTConfigForSlot(_ SlotT) CometBFTConfigT {
return c.Data.CometValues
}

// EVMInflationAddress returns the address on the EVM which will receive the
// inflation amount of native EVM balance through a withdrawal every block.
func (c chainSpec[
DomainTypeT, EpochT, ExecutionAddressT, SlotT, CometBFTConfigT,
]) EVMInflationAddress() ExecutionAddressT {
return c.Data.EVMInflationAddress
}

// EVMInflationPerBlock returns the amount of native EVM balance (in Gwei) to
// be minted to the EVMInflationAddress via a withdrawal every block.
func (c chainSpec[
DomainTypeT, EpochT, ExecutionAddressT, SlotT, CometBFTConfigT,
]) EVMInflationPerBlock() uint64 {
return c.Data.EVMInflationPerBlock
}
11 changes: 10 additions & 1 deletion mod/chain-spec/pkg/chain/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,15 @@ type SpecData[
// KZGCommitmentInclusionProofDepth is the depth of the KZG inclusion proof.
KZGCommitmentInclusionProofDepth uint64 `mapstructure:"kzg-commitment-inclusion-proof-depth"`

// CometValues
// Comet Values
CometValues CometBFTConfigT `mapstructure:"comet-bft-config"`

// Berachain Values
//
// EVMInflationAddress is the address on the EVM which will receive the
// inflation amount of native EVM balance through a withdrawal every block.
EVMInflationAddress ExecutionAddressT `mapstructure:"evm-inflation-address"`
// EVMInflationPerBlock is the amount of native EVM balance (in Gwei) to be
// minted to the EVMInflationAddress via a withdrawal every block.
EVMInflationPerBlock uint64 `mapstructure:"evm-inflation-per-block"`
}
32 changes: 32 additions & 0 deletions mod/chain-spec/pkg/chain/errors.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// SPDX-License-Identifier: BUSL-1.1
//
// Copyright (C) 2024, Berachain Foundation. All rights reserved.
// Use of this software is governed by the Business Source License included
// in the LICENSE file of this repository and at www.mariadb.com/bsl11.
//
// ANY USE OF THE LICENSED WORK IN VIOLATION OF THIS LICENSE WILL AUTOMATICALLY
// TERMINATE YOUR RIGHTS UNDER THIS LICENSE FOR THE CURRENT AND ALL OTHER
// VERSIONS OF THE LICENSED WORK.
//
// THIS LICENSE DOES NOT GRANT YOU ANY RIGHT IN ANY TRADEMARK OR LOGO OF
// LICENSOR OR ITS AFFILIATES (PROVIDED THAT YOU MAY USE A TRADEMARK OR LOGO OF
// LICENSOR AS EXPRESSLY REQUIRED BY THIS LICENSE).
//
// TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
// AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
// EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
// TITLE.

package chain

import "github.com/berachain/beacon-kit/mod/errors"

var (
// ErrInsufficientMaxWithdrawalsPerPayload is returned when the max
// withdrawals per payload less than 2. Must allow at least one for the EVM
// inflation withdrawal, and at least one more for a validator withdrawal
// per block.
ErrInsufficientMaxWithdrawalsPerPayload = errors.New(
"max withdrawals per payload must be greater than 1")
)
5 changes: 4 additions & 1 deletion mod/chain-spec/pkg/chain/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,18 @@ type (
cometBFTConfig struct{}
)

// TODO: Add setupValid, setupInvalid functions and use in each test.

// Create an instance of chainSpec with test data.
var spec = chain.NewChainSpec(
var spec, _ = chain.NewChainSpec(
chain.SpecData[
domainType, epoch, executionAddress, slot, cometBFTConfig,
]{
DenebPlusForkEpoch: 9,
ElectraForkEpoch: 10,
SlotsPerEpoch: 32,
MinEpochsForBlobsSidecarsRequest: 5,
MaxWithdrawalsPerPayload: 2,
},
)

Expand Down
123 changes: 123 additions & 0 deletions mod/config/pkg/spec/base.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
// SPDX-License-Identifier: BUSL-1.1
//
// Copyright (C) 2024, Berachain Foundation. All rights reserved.
// Use of this software is governed by the Business Source License included
// in the LICENSE file of this repository and at www.mariadb.com/bsl11.
//
// ANY USE OF THE LICENSED WORK IN VIOLATION OF THIS LICENSE WILL AUTOMATICALLY
// TERMINATE YOUR RIGHTS UNDER THIS LICENSE FOR THE CURRENT AND ALL OTHER
// VERSIONS OF THE LICENSED WORK.
//
// THIS LICENSE DOES NOT GRANT YOU ANY RIGHT IN ANY TRADEMARK OR LOGO OF
// LICENSOR OR ITS AFFILIATES (PROVIDED THAT YOU MAY USE A TRADEMARK OR LOGO OF
// LICENSOR AS EXPRESSLY REQUIRED BY THIS LICENSE).
//
// TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
// AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
// EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
// TITLE.

package spec

import (
"github.com/berachain/beacon-kit/mod/chain-spec/pkg/chain"
"github.com/berachain/beacon-kit/mod/primitives/pkg/common"
"github.com/berachain/beacon-kit/mod/primitives/pkg/crypto"
"github.com/berachain/beacon-kit/mod/primitives/pkg/math"
cmttypes "github.com/cometbft/cometbft/types"
)

const (
// Default DepositContractAddress is the default address of the pre-deployed
// beacon deposit contract.
DefaultDepositContractAddress = "0x4242424242424242424242424242424242424242"
)

// BaseSpec returns a chain spec with default values.
//
//nolint:mnd // bet.
func BaseSpec() chain.SpecData[
common.DomainType,
math.Epoch,
common.ExecutionAddress,
math.Slot,
any,
] {
cmtConsensusParams := cmttypes.DefaultConsensusParams()
cmtConsensusParams.Validator.PubKeyTypes = []string{crypto.CometBLSType}

return chain.SpecData[
common.DomainType,
math.Epoch,
common.ExecutionAddress,
math.Slot,
any,
]{
// Gwei value constants.
MinDepositAmount: 1e9,
MaxEffectiveBalance: 32e9,
EjectionBalance: 16e9,
EffectiveBalanceIncrement: 1e9,
// Time parameters constants.
SlotsPerEpoch: 32,
MinEpochsToInactivityPenalty: 4,
SlotsPerHistoricalRoot: 8,
// Signature domains.
DomainTypeProposer: common.DomainType{
0x00, 0x00, 0x00, 0x00,
},
DomainTypeAttester: common.DomainType{
0x01, 0x00, 0x00, 0x00,
},
DomainTypeRandao: common.DomainType{
0x02, 0x00, 0x00, 0x00,
},
DomainTypeDeposit: common.DomainType{
0x03, 0x00, 0x00, 0x00,
},
DomainTypeVoluntaryExit: common.DomainType{
0x04, 0x00, 0x00, 0x00,
},
DomainTypeSelectionProof: common.DomainType{
0x05, 0x00, 0x00, 0x00,
},
DomainTypeAggregateAndProof: common.DomainType{
0x06, 0x00, 0x00, 0x00,
},
DomainTypeApplicationMask: common.DomainType{
0x00, 0x00, 0x00, 0x01,
},
// Eth1-related values.
DepositContractAddress: common.NewExecutionAddressFromHex(
DefaultDepositContractAddress,
),
DepositEth1ChainID: 1,
Eth1FollowDistance: 1,
TargetSecondsPerEth1Block: 3,
// Fork-related values.
DenebPlusForkEpoch: 9999999999999998,
ElectraForkEpoch: 9999999999999999,
// State list length constants.
EpochsPerHistoricalVector: 8,
EpochsPerSlashingsVector: 8,
HistoricalRootsLimit: 8,
ValidatorRegistryLimit: 1099511627776,
// Max operations per block constants.
MaxDepositsPerBlock: 16,
// Slashing
ProportionalSlashingMultiplier: 1,
// Capella values.
MaxWithdrawalsPerPayload: 16,
MaxValidatorsPerWithdrawalsSweep: 1 << 14,
// Deneb values.
MinEpochsForBlobsSidecarsRequest: 4096,
MaxBlobCommitmentsPerBlock: 16,
MaxBlobsPerBlock: 6,
FieldElementsPerBlob: 4096,
BytesPerBlob: 131072,
KZGCommitmentInclusionProofDepth: 17,
// Comet values.
CometValues: cmtConsensusParams,
}
}
4 changes: 2 additions & 2 deletions mod/config/pkg/spec/betnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ import (
)

// BetnetChainSpec is the ChainSpec for the localnet.
func BetnetChainSpec() chain.Spec[
func BetnetChainSpec() (chain.Spec[
common.DomainType,
math.Epoch,
common.ExecutionAddress,
math.Slot,
any,
] {
], error) {
testnetSpec := BaseSpec()
testnetSpec.DepositEth1ChainID = BetnetEth1ChainID
return chain.NewChainSpec(testnetSpec)
Expand Down
Loading

0 comments on commit 4f43ca9

Please sign in to comment.