From 0ad7c38c990a9f0d47e0220b29fa69d4d8529578 Mon Sep 17 00:00:00 2001 From: redhdx Date: Sat, 11 May 2024 16:10:07 +0800 Subject: [PATCH 1/2] feature: update deployment script for opBNB --- .../scripts/getting-started/config.sh | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/packages/contracts-bedrock/scripts/getting-started/config.sh b/packages/contracts-bedrock/scripts/getting-started/config.sh index 95ab527d60..3c90ca3c86 100755 --- a/packages/contracts-bedrock/scripts/getting-started/config.sh +++ b/packages/contracts-bedrock/scripts/getting-started/config.sh @@ -23,23 +23,24 @@ reqenv "L1_RPC_URL" block=$(cast block finalized --rpc-url "$L1_RPC_URL") timestamp=$(echo "$block" | awk '/timestamp/ { print $2 }') blockhash=$(echo "$block" | awk '/hash/ { print $2 }') +l1chainId=$(cast chain-id --rpc-url "$L1_RPC_URL") # Generate the config file config=$(cat << EOL { "l1StartingBlockTag": "$blockhash", - "l1ChainID": 11155111, - "l2ChainID": 42069, - "l2BlockTime": 2, - "l1BlockTime": 12, + "l1ChainID": $l1chainId, + "l2ChainID": 901, + "l2BlockTime": 1, + "l1BlockTime": 3, "maxSequencerDrift": 600, "sequencerWindowSize": 3600, "channelTimeout": 300, "p2pSequencerAddress": "$GS_SEQUENCER_ADDRESS", - "batchInboxAddress": "0xff00000000000000000000000000000000042069", + "batchInboxAddress": "0xff00000000000000000000000000000000000901", "batchSenderAddress": "$GS_BATCHER_ADDRESS", "l2OutputOracleSubmissionInterval": 120, @@ -98,6 +99,18 @@ config=$(cat << EOL "preimageOracleMinProposalSize": 1800000, "preimageOracleChallengePeriod": 86400, + "fermat": 0, + "fundDevAccounts": true, + "proofMaturityDelaySeconds": 12, + "disputeGameFinalityDelaySeconds": 6, + "respectedGameType": 0, + "useFaultProofs": false, + "usePlasma": false, + "daChallengeWindow": 160, + "daResolveWindow": 160, + "daBondSize": 1000000, + "daResolverRefundPercentage": 0, + "faultGameWithdrawalDelay": 604800 } EOL ) From cea944cc4e40206daa80c98757ef5f4ef1971efa Mon Sep 17 00:00:00 2001 From: redhdx Date: Mon, 13 May 2024 15:04:11 +0800 Subject: [PATCH 2/2] feature: add snow fork config in deployment --- op-chain-ops/genesis/config.go | 15 +++++++++++++++ .../scripts/getting-started/config.sh | 1 + 2 files changed, 16 insertions(+) diff --git a/op-chain-ops/genesis/config.go b/op-chain-ops/genesis/config.go index 9ff847b421..6beb612f7b 100644 --- a/op-chain-ops/genesis/config.go +++ b/op-chain-ops/genesis/config.go @@ -225,6 +225,9 @@ type DeployConfig struct { FundDevAccounts bool `json:"fundDevAccounts"` // opBNB fermat hard fork Fermat *big.Int `json:"fermat,omitempty"` + // SnowTimeOffset is the number of seconds after genesis block that snow hard fork activates. + // Set it to 0 to activate at genesis. Nil to disable snow fork. + SnowTimeOffset *hexutil.Uint64 `json:"snowTimeOffset,omitempty"` // RequiredProtocolVersion indicates the protocol version that // nodes are required to adopt, to stay in sync with the network. RequiredProtocolVersion params.ProtocolVersion `json:"requiredProtocolVersion"` @@ -553,6 +556,17 @@ func (d *DeployConfig) InteropTime(genesisTime uint64) *uint64 { return &v } +func (d *DeployConfig) SnowTime(genesisTime uint64) *uint64 { + if d.SnowTimeOffset == nil { + return nil + } + v := uint64(0) + if offset := *d.SnowTimeOffset; offset > 0 { + v = genesisTime + uint64(offset) + } + return &v +} + // RollupConfig converts a DeployConfig to a rollup.Config func (d *DeployConfig) RollupConfig(l1StartBlock *types.Block, l2GenesisBlockHash common.Hash, l2GenesisBlockNumber uint64) (*rollup.Config, error) { if d.OptimismPortalProxy == (common.Address{}) { @@ -600,6 +614,7 @@ func (d *DeployConfig) RollupConfig(l1StartBlock *types.Block, l2GenesisBlockHas DAChallengeWindow: d.DAChallengeWindow, DAResolveWindow: d.DAResolveWindow, Fermat: d.Fermat, + SnowTime: d.SnowTime(l1StartBlock.Time()), }, nil } diff --git a/packages/contracts-bedrock/scripts/getting-started/config.sh b/packages/contracts-bedrock/scripts/getting-started/config.sh index 3c90ca3c86..bff35378fc 100755 --- a/packages/contracts-bedrock/scripts/getting-started/config.sh +++ b/packages/contracts-bedrock/scripts/getting-started/config.sh @@ -100,6 +100,7 @@ config=$(cat << EOL "preimageOracleMinProposalSize": 1800000, "preimageOracleChallengePeriod": 86400, "fermat": 0, + "snowTimeOffset": "0x0", "fundDevAccounts": true, "proofMaturityDelaySeconds": 12, "disputeGameFinalityDelaySeconds": 6,