Skip to content

Commit

Permalink
feat(spec): add betnet (#1941)
Browse files Browse the repository at this point in the history
  • Loading branch information
Devon Bear authored Aug 20, 2024
1 parent 20853da commit d61881f
Show file tree
Hide file tree
Showing 26 changed files with 75 additions and 25 deletions.
40 changes: 40 additions & 0 deletions mod/config/pkg/spec/betnet.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// 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/math"
)

// BetnetChainSpec is the ChainSpec for the localnet.
func BetnetChainSpec() chain.Spec[
common.DomainType,
math.Epoch,
common.ExecutionAddress,
math.Slot,
any,
] {
testnetSpec := BaseSpec()
testnetSpec.DepositEth1ChainID = BetnetEth1ChainID
return chain.NewChainSpec(testnetSpec)
}
4 changes: 4 additions & 0 deletions mod/config/pkg/spec/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
package spec

const (

// BetnetEth1ChainID is the chain ID for the local devnet.
BetnetEth1ChainID uint64 = 80088

// DevnetEth1ChainID is the chain ID for the local devnet.
DevnetEth1ChainID uint64 = 80087

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion mod/node-api/backend/mocks/availability_store.mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion mod/node-api/backend/mocks/beacon_block_header.mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion mod/node-api/backend/mocks/beacon_state.mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion mod/node-api/backend/mocks/block_store.mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion mod/node-api/backend/mocks/deposit_store.mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion mod/node-api/backend/mocks/node.mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion mod/node-api/backend/mocks/state_processor.mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion mod/node-api/backend/mocks/storage_backend.mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion mod/node-api/backend/mocks/validator.mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion mod/node-api/backend/mocks/withdrawal.mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion mod/node-api/backend/mocks/withdrawal_credentials.mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions mod/node-core/pkg/components/chain_spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,22 @@ import (
const (
ChainSpecTypeEnvVar = "CHAIN_SPEC"
DevnetChainSpecType = "devnet"
BetnetChainSpecType = "betnet"
)

// ProvideChainSpec provides the chain spec based on the environment variable.
func ProvideChainSpec() common.ChainSpec {
// TODO: This is hood as fuck needs to be improved
// but for now we ball to get CI unblocked.
specType := os.Getenv(ChainSpecTypeEnvVar)
chainSpec := spec.TestnetChainSpec()
if specType == DevnetChainSpecType {
var chainSpec common.ChainSpec
switch specType {
case DevnetChainSpecType:
chainSpec = spec.DevnetChainSpec()
case BetnetChainSpecType:
chainSpec = spec.BetnetChainSpec()
default:
chainSpec = spec.TestnetChainSpec()
}

return chainSpec
Expand Down
2 changes: 1 addition & 1 deletion mod/primitives/pkg/crypto/mocks/bls_signer.mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion mod/runtime/pkg/service/mocks/basic.mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion mod/runtime/pkg/service/mocks/dispatcher.mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion mod/runtime/pkg/service/mocks/registry_option.mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion mod/storage/pkg/interfaces/mocks/db.mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion mod/storage/pkg/pruner/mocks/beacon_block.mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion mod/storage/pkg/pruner/mocks/block_event.mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion mod/storage/pkg/pruner/mocks/prunable.mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion mod/storage/pkg/pruner/mocks/pruner.mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d61881f

Please sign in to comment.