Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: update deployment script for opBNB #196

Merged
merged 2 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading