Skip to content

Commit

Permalink
feature: update deployment script for opBNB (ethereum-optimism#196)
Browse files Browse the repository at this point in the history
  • Loading branch information
redhdx authored May 16, 2024
1 parent fefabbf commit dc43753
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 5 deletions.
15 changes: 15 additions & 0 deletions op-chain-ops/genesis/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down Expand Up @@ -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{}) {
Expand Down Expand Up @@ -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
}

Expand Down
24 changes: 19 additions & 5 deletions packages/contracts-bedrock/scripts/getting-started/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -98,6 +99,19 @@ config=$(cat << EOL
"preimageOracleMinProposalSize": 1800000,
"preimageOracleChallengePeriod": 86400,
"fermat": 0,
"snowTimeOffset": "0x0",
"fundDevAccounts": true,
"proofMaturityDelaySeconds": 12,
"disputeGameFinalityDelaySeconds": 6,
"respectedGameType": 0,
"useFaultProofs": false,
"usePlasma": false,
"daChallengeWindow": 160,
"daResolveWindow": 160,
"daBondSize": 1000000,
"daResolverRefundPercentage": 0,
"faultGameWithdrawalDelay": 604800
}
EOL
)
Expand Down

0 comments on commit dc43753

Please sign in to comment.