diff --git a/.circleci/config.yml b/.circleci/config.yml index a38d75d87d..2b9ce726a1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,7 +3,6 @@ version: 2.1 orbs: gcp-cli: circleci/gcp-cli@3.0.1 slack: circleci/slack@4.10.1 - utils: ethereum-optimism/circleci-utils@1.0.13 parameters: go_version: @@ -53,39 +52,6 @@ commands: echo "export GOOGLE_APPLICATION_CREDENTIALS='<< parameters.gcp_cred_config_file_path >>'" | tee -a "$BASH_ENV" jobs: - build-and-deploy: - machine: - image: ubuntu-2004:current - steps: - - checkout - # Fetch more history for diffing - - run: - name: Fetch git history - command: | - git fetch --depth 1000 - - # Build forkdiff using Docker - - run: - name: Build forkdiff - command: | - docker run --volume $(pwd):/workspace \ - protolambda/forkdiff:0.1.0 \ - -repo=/workspace \ - -fork=/workspace/fork.yaml \ - -out=/workspace/index.html - - # Prepare pages directory - - run: - name: Build pages - command: | - mkdir -p /tmp/pages - mv index.html /tmp/pages/index.html - touch /tmp/pages/.nojekyll - if [ "$CIRCLE_PROJECT_REPONAME" == "op-geth" ] && [ "$CIRCLE_PROJECT_USERNAME" == "ethereum-optimism" ]; then - echo "op-geth.optimism.io" > /tmp/pages/CNAME - fi - - utils/github-pages-deploy: - src-pages-dir: /tmp/pages docker-release: environment: DOCKER_BUILDKIT: 1 @@ -104,7 +70,7 @@ jobs: repo: description: Docker repo type: string - default: "oplabs-tools-artifacts/images" + default: "boba-392114/bobanetwork-tools-artifacts/images" push_tags: description: Push release push tags type: boolean @@ -141,7 +107,7 @@ jobs: -f Dockerfile . - when: condition: - equal: [true, <>] + equal: [ true, <> ] steps: - run: name: Tag @@ -170,6 +136,7 @@ jobs: --signer-logging-level="INFO"\ --attestor-key-id="//cloudkms.googleapis.com/v1/projects/$ATTESTOR_PROJECT_NAME/locations/global/keyRings/$ATTESTOR_NAME-key-ring/cryptoKeys/$ATTESTOR_NAME-key/cryptoKeyVersions/1" + build-geth: docker: - image: cimg/go:<> @@ -202,19 +169,20 @@ jobs: - checkout - run: command: go mod tidy && git diff --exit-code - check-sr-diff: - docker: - - image: cimg/go:<> - steps: - - checkout - - run: - name: install dasel - command: go install github.com/tomwright/dasel/v2/cmd/dasel@v2.8.1 - - run: - name: generate artifact and check diff - command: | - bash ./sync-superchain.sh - git diff --exit-code + # check-sr-diff: + # docker: + # - image: cimg/go:<> + # steps: + # - checkout + # - run: + # name: install dasel + # command: go install github.com/tomwright/dasel/v2/cmd/dasel@v2.8.1 + # - run: + # name: generate artifact and check diff + # command: | + # bash ./sync-superchain.sh + # git diff --exit-code + workflows: main: @@ -227,13 +195,13 @@ workflows: name: Run linter over geth - tidy-geth: name: Check geth go.mod file has been tidied - - docker-release: - name: Push to Docker - docker_tags: <> - context: - - oplabs-gcr - - check-sr-diff: - name: Check superchain registry bundle diff + # - docker-release: + # name: Push to Docker + # docker_tags: <> + # context: + # - oplabs-gcr + # - check-sr-diff: + # name: Check superchain registry bundle diff release: jobs: - hold: @@ -257,10 +225,10 @@ workflows: requires: - hold - merge: - jobs: - - build-and-deploy: - context: circleci-repo-op-geth - filters: - branches: - only: optimism + # merge: + # jobs: + # - build-and-deploy: + # context: circleci-repo-op-geth + # filters: + # branches: + # only: optimism \ No newline at end of file diff --git a/core/rawdb/accessors_chain.go b/core/rawdb/accessors_chain.go index 8dec668fc7..d5600c2b65 100644 --- a/core/rawdb/accessors_chain.go +++ b/core/rawdb/accessors_chain.go @@ -635,6 +635,7 @@ type storedReceiptRLP struct { L1GasPrice *big.Int `rlp:"optional"` // OVM legacy L1Fee *big.Int `rlp:"optional"` // OVM legacy FeeScalar string `rlp:"optional"` // OVM legacy + L2BobaFee *big.Int `rlp:"optional"` // OVM legacy } // ReceiptLogs is a barebone version of ReceiptForStorage which only keeps diff --git a/core/rawdb/accessors_chain_test.go b/core/rawdb/accessors_chain_test.go index a23d6bb209..2b6f8b4596 100644 --- a/core/rawdb/accessors_chain_test.go +++ b/core/rawdb/accessors_chain_test.go @@ -794,6 +794,38 @@ func TestParseLegacyReceiptRLP(t *testing.T) { require.Equal(t, receipt.FeeScalar, result.FeeScalar) } +func TestParseLegacyReceiptRLPWithBoba(t *testing.T) { + // Create a gasUsed value greater than a uint64 can represent + gasUsed := big.NewInt(0) + gasUsed = gasUsed.SetUint64(math.MaxUint64) + gasUsed = gasUsed.Add(gasUsed, big.NewInt(math.MaxInt64)) + sanityCheck := (&big.Int{}).SetUint64(gasUsed.Uint64()) + require.NotEqual(t, gasUsed, sanityCheck) + receipt := types.LegacyOptimismStoredReceiptRLP{ + CumulativeGasUsed: 1, + Logs: []*types.LogForStorage{ + {Address: common.BytesToAddress([]byte{0x11})}, + {Address: common.BytesToAddress([]byte{0x01, 0x11})}, + }, + L1GasUsed: gasUsed, + L1GasPrice: gasUsed, + L1Fee: gasUsed, + FeeScalar: "6", + L2BobaFee: gasUsed, + } + + data, err := rlp.EncodeToBytes(receipt) + require.NoError(t, err) + var result storedReceiptRLP + err = rlp.DecodeBytes(data, &result) + require.NoError(t, err) + require.Equal(t, receipt.L1GasUsed, result.L1GasUsed) + require.Equal(t, receipt.L1GasPrice, result.L1GasPrice) + require.Equal(t, receipt.L1Fee, result.L1Fee) + require.Equal(t, receipt.FeeScalar, result.FeeScalar) + require.Equal(t, receipt.L2BobaFee, result.L2BobaFee) +} + func TestDeriveLogFields(t *testing.T) { // Create a few transactions to have receipts for to2 := common.HexToAddress("0x2") diff --git a/core/superchain.go b/core/superchain.go index bdc7157183..b3f8ac64bd 100644 --- a/core/superchain.go +++ b/core/superchain.go @@ -68,6 +68,12 @@ func LoadOPStackGenesis(chainID uint64) (*Genesis, error) { switch chainID { case params.OPMainnetChainID: expectedHash = common.HexToHash("0x7ca38a1916c42007829c55e69d3e9a73265554b586a499015373241b8a3fa48b") + case params.BobaMainnetChainID: + expectedHash = common.HexToHash("0xdcd9e6a8f9973eaa62da2874959cb152faeb4fd6929177bd6335a1a16074ef9c") + case params.BobaSepoliaChainID: + expectedHash = common.HexToHash("0xc6171953a6a376ece6e33149686044f24f58a387ce2636a54e391d330b2326b5") + case params.BobaBnbTestnetChainID: + expectedHash = common.HexToHash("0x4d26ddc947c7cea924d5ef272c1a5ef40a1dce5ca2cbbaccad59d33f2505a30d") default: return nil, fmt.Errorf("unknown stateless genesis definition for chain %d", chainID) } diff --git a/core/types/receipt.go b/core/types/receipt.go index a445399c03..8a4e8069ed 100644 --- a/core/types/receipt.go +++ b/core/types/receipt.go @@ -170,6 +170,7 @@ type LegacyOptimismStoredReceiptRLP struct { L1GasPrice *big.Int L1Fee *big.Int FeeScalar string + L2BobaFee *big.Int `rlp:"optional"` } // LogForStorage is a wrapper around a Log that handles diff --git a/go.mod b/go.mod index cdd0a9cafa..cbe1bb93a0 100644 --- a/go.mod +++ b/go.mod @@ -150,4 +150,4 @@ require ( rsc.io/tmplfunc v0.0.3 // indirect ) -//replace github.com/ethereum-optimism/superchain-registry/superchain => ../superchain-registry/superchain +// replace github.com/ethereum-optimism/superchain-registry/superchain => github.com/bobanetwork/superchain-registry/superchain v0.0.0-20250107213715-cb3c5cb83e2e diff --git a/params/config.go b/params/config.go index 35f84052c0..d98616dbf2 100644 --- a/params/config.go +++ b/params/config.go @@ -35,9 +35,24 @@ var ( ) const ( - OPMainnetChainID = 10 - BaseMainnetChainID = 8453 - baseSepoliaChainID = 84532 + OPMainnetChainID = 10 + BaseMainnetChainID = 8453 + baseSepoliaChainID = 84532 + BobaMainnetChainID = 288 + BobaSepoliaChainID = 28882 + BobaBnbTestnetChainID = 9728 +) + +// OP Stack chain config +var ( + // March 17, 2023 @ 7:00:00 pm UTC + OptimismGoerliRegolithTime = uint64(1679079600) + // Apr Apr 16 2024 21:27:59 UTC 2024 + BobaMainnetRegolithTime = uint64(1713302879) + // January 18, 2024 @ 5:59:48 pm UTC + BobaSepoliaRegolithTime = uint64(1705600788) + // Thu Jun 20 2024 21:49:27 pm UTC + BobaBnbTestnetRegoTime = uint64(1718920167) ) func newUint64(val uint64) *uint64 { return &val } diff --git a/params/superchain.go b/params/superchain.go index 2bfcef031b..4f36d0ee1f 100644 --- a/params/superchain.go +++ b/params/superchain.go @@ -80,6 +80,30 @@ func LoadOPStackChainConfig(chConfig *superchain.ChainConfig) (*ChainConfig, err out.GrayGlacierBlock = big.NewInt(105235063) out.MergeNetsplitBlock = big.NewInt(105235063) out.BedrockBlock = big.NewInt(105235063) + case BobaMainnetChainID: + out.BerlinBlock = big.NewInt(1149019) + out.LondonBlock = big.NewInt(1149019) + out.ArrowGlacierBlock = big.NewInt(1149019) + out.GrayGlacierBlock = big.NewInt(1149019) + out.MergeNetsplitBlock = big.NewInt(1149019) + out.BedrockBlock = big.NewInt(1149019) + out.RegolithTime = &BobaMainnetRegolithTime + case BobaSepoliaChainID: + out.BerlinBlock = big.NewInt(511) + out.LondonBlock = big.NewInt(511) + out.ArrowGlacierBlock = big.NewInt(511) + out.GrayGlacierBlock = big.NewInt(511) + out.MergeNetsplitBlock = big.NewInt(511) + out.BedrockBlock = big.NewInt(511) + out.RegolithTime = &BobaSepoliaRegolithTime + case BobaBnbTestnetChainID: + out.BerlinBlock = big.NewInt(675077) + out.LondonBlock = big.NewInt(675077) + out.ArrowGlacierBlock = big.NewInt(675077) + out.GrayGlacierBlock = big.NewInt(675077) + out.MergeNetsplitBlock = big.NewInt(675077) + out.BedrockBlock = big.NewInt(675077) + out.RegolithTime = &BobaBnbTestnetRegoTime } return out, nil diff --git a/params/superchain_test.go b/params/superchain_test.go index 953b614e65..0e3f8354e0 100644 --- a/params/superchain_test.go +++ b/params/superchain_test.go @@ -2,7 +2,11 @@ package params import ( "fmt" + "math/big" "testing" + + "github.com/ethereum/go-ethereum/superchain" + "github.com/stretchr/testify/require" ) type HumanProtocolVersion struct { @@ -169,3 +173,155 @@ func TestProtocolVersion_String(t *testing.T) { }) } } + +type hardforkConfig struct { + chainID uint64 + ShanghaiTime uint64 + CancunTime uint64 + BedrockBlock *big.Int + RegolithTime uint64 + CanyonTime uint64 + EcotoneTime uint64 + FjordTime uint64 + GraniteTime uint64 + HoloceneTime uint64 + EIP1559Elasticity uint64 + EIP1559Denominator uint64 + EIP1559DenominatorCanyon uint64 +} + +var bobaSepoliaCfg = hardforkConfig{ + chainID: 28882, + ShanghaiTime: uint64(1705600788), + CancunTime: uint64(1709078400), + BedrockBlock: big.NewInt(511), + RegolithTime: uint64(1705600788), + CanyonTime: uint64(1705600788), + EcotoneTime: uint64(1709078400), + FjordTime: uint64(1722297600), + GraniteTime: uint64(1726470000), + HoloceneTime: uint64(1736150400), + EIP1559Elasticity: 6, + EIP1559Denominator: 50, + EIP1559DenominatorCanyon: 250, +} + +var bobaMainnetCfg = hardforkConfig{ + chainID: 288, + ShanghaiTime: uint64(1713302879), + CancunTime: uint64(1713302880), + BedrockBlock: big.NewInt(1149019), + RegolithTime: uint64(1713302879), + CanyonTime: uint64(1713302879), + EcotoneTime: uint64(1713302880), + FjordTime: uint64(1725951600), + GraniteTime: uint64(1729753200), + HoloceneTime: uint64(1738785600), + EIP1559Elasticity: 6, + EIP1559Denominator: 50, + EIP1559DenominatorCanyon: 250, +} + +var bobaBnbTestnetCfg = hardforkConfig{ + chainID: 9728, + ShanghaiTime: uint64(1718920167), + CancunTime: uint64(1718920168), + BedrockBlock: big.NewInt(675077), + RegolithTime: uint64(1718920167), + CanyonTime: uint64(1718920167), + EcotoneTime: uint64(1718920168), + FjordTime: uint64(1722297600), + GraniteTime: uint64(1726470000), + HoloceneTime: uint64(1736150400), + EIP1559Elasticity: 6, + EIP1559Denominator: 50, + EIP1559DenominatorCanyon: 250, +} + +var bobaSepoliaDev0Cfg = hardforkConfig{ + chainID: 288882, + ShanghaiTime: uint64(1724692140), + CancunTime: uint64(1724692141), + BedrockBlock: big.NewInt(0), + RegolithTime: uint64(0), + CanyonTime: uint64(1724692140), + EcotoneTime: uint64(1724692141), + FjordTime: uint64(1724692150), + GraniteTime: uint64(1724914800), + HoloceneTime: uint64(1732435200), + EIP1559Elasticity: 6, + EIP1559Denominator: 50, + EIP1559DenominatorCanyon: 250, +} + +var opSepoliaCfg = hardforkConfig{ + chainID: 11155420, + ShanghaiTime: uint64(1699981200), + CancunTime: uint64(1708534800), + BedrockBlock: big.NewInt(0), + RegolithTime: uint64(0), + CanyonTime: uint64(1699981200), + EcotoneTime: uint64(1708534800), + FjordTime: uint64(1716998400), + GraniteTime: uint64(1723478400), + HoloceneTime: uint64(1732633200), + EIP1559Elasticity: 6, + EIP1559Denominator: 50, + EIP1559DenominatorCanyon: 250, +} + +var opMainnetCfg = hardforkConfig{ + chainID: 10, + ShanghaiTime: uint64(1704992401), + CancunTime: uint64(1710374401), + BedrockBlock: big.NewInt(105235063), + RegolithTime: uint64(0), + CanyonTime: uint64(1704992401), + EcotoneTime: uint64(1710374401), + FjordTime: uint64(1720627201), + GraniteTime: uint64(1726070401), + HoloceneTime: uint64(1736445601), + EIP1559Elasticity: 6, + EIP1559Denominator: 50, + EIP1559DenominatorCanyon: 250, +} + +func TestChainConfigByOpStackChainName(t *testing.T) { + hardforkConfigsByName := map[uint64]hardforkConfig{ + 288882: bobaSepoliaDev0Cfg, + 28882: bobaSepoliaCfg, + 288: bobaMainnetCfg, + 9728: bobaBnbTestnetCfg, + 11155420: opSepoliaCfg, + 10: opMainnetCfg, + } + + for name, expectedHarhardforkCfg := range hardforkConfigsByName { + chain, err := superchain.GetChain(name) + require.NoError(t, err) + chainConf, err := chain.Config() + require.NoError(t, err) + gotCfg, err := LoadOPStackChainConfig(chainConf) + require.NotNil(t, gotCfg) + require.NoError(t, err) + + // ChainID + require.Equal(t, expectedHarhardforkCfg.chainID, gotCfg.ChainID.Uint64()) + + // Hardforks + require.Equal(t, expectedHarhardforkCfg.ShanghaiTime, *gotCfg.ShanghaiTime) + require.Equal(t, expectedHarhardforkCfg.CancunTime, *gotCfg.CancunTime) + require.Equal(t, expectedHarhardforkCfg.BedrockBlock, gotCfg.BedrockBlock) + require.Equal(t, expectedHarhardforkCfg.RegolithTime, *gotCfg.RegolithTime) + require.Equal(t, expectedHarhardforkCfg.CanyonTime, *gotCfg.CanyonTime) + require.Equal(t, expectedHarhardforkCfg.EcotoneTime, *gotCfg.EcotoneTime) + require.Equal(t, expectedHarhardforkCfg.FjordTime, *gotCfg.FjordTime) + require.Equal(t, expectedHarhardforkCfg.GraniteTime, *gotCfg.GraniteTime) + require.Equal(t, expectedHarhardforkCfg.HoloceneTime, *gotCfg.HoloceneTime) + + // EIP-1559 + require.Equal(t, expectedHarhardforkCfg.EIP1559Elasticity, gotCfg.Optimism.EIP1559Elasticity) + require.Equal(t, expectedHarhardforkCfg.EIP1559Denominator, gotCfg.Optimism.EIP1559Denominator) + require.Equal(t, expectedHarhardforkCfg.EIP1559DenominatorCanyon, *gotCfg.Optimism.EIP1559DenominatorCanyon) + } +} diff --git a/superchain/superchain-configs.zip b/superchain/superchain-configs.zip index 2c6b2c0022..2a48b22c75 100644 Binary files a/superchain/superchain-configs.zip and b/superchain/superchain-configs.zip differ