Skip to content

Commit

Permalink
feat: handle mpt transition time (#390)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pangssu authored Dec 2, 2024
1 parent 7cc02bb commit 13b08b8
Show file tree
Hide file tree
Showing 12 changed files with 379 additions and 43 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/kroma-network/kroma
go 1.21

require (
github.com/btcsuite/btcd v0.24.0
github.com/btcsuite/btcd v0.24.2
github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0
github.com/cockroachdb/pebble v0.0.0-20231018212520-f6cde3fc2fa4
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0
Expand Down Expand Up @@ -207,4 +207,4 @@ require (

replace github.com/ethereum-optimism/optimism v1.7.2 => ./

replace github.com/ethereum/go-ethereum v1.13.8 => github.com/kroma-network/go-ethereum v0.5.0
replace github.com/ethereum/go-ethereum v1.13.8 => github.com/kroma-network/go-ethereum v1.101308.3-0.20241129080356-056a5b4d3639
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBT
github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ=
github.com/btcsuite/btcd v0.22.0-beta.0.20220111032746-97732e52810c/go.mod h1:tjmYdS6MLJ5/s0Fj4DbLgSbDHbEqLJrtnHecBFkdz5M=
github.com/btcsuite/btcd v0.23.5-0.20231215221805-96c9fd8078fd/go.mod h1:nm3Bko6zh6bWP60UxwoT5LzdGJsQJaPo6HjduXq9p6A=
github.com/btcsuite/btcd v0.24.0 h1:gL3uHE/IaFj6fcZSu03SvqPMSx7s/dPzfpG/atRwWdo=
github.com/btcsuite/btcd v0.24.0/go.mod h1:K4IDc1593s8jKXIF7yS7yCTSxrknB9z0STzc2j6XgE4=
github.com/btcsuite/btcd v0.24.2 h1:aLmxPguqxza+4ag8R1I2nnJjSu2iFn/kqtHTIImswcY=
github.com/btcsuite/btcd v0.24.2/go.mod h1:5C8ChTkl5ejr3WHj8tkQSCmydiMEPB0ZhQhehpq7Dgg=
github.com/btcsuite/btcd/btcec/v2 v2.1.0/go.mod h1:2VzYrv4Gm4apmbVVsSq5bqf1Ec8v56E48Vt0Y/umPgA=
github.com/btcsuite/btcd/btcec/v2 v2.1.3/go.mod h1:ctjw4H1kknNJmRN4iP1R7bTQ+v3GJkZBd6mui8ZsAZE=
github.com/btcsuite/btcd/btcec/v2 v2.2.0 h1:fzn1qaOt32TuLjFlkzYSsBC35Q3KUjT1SwPxiMSCF5k=
Expand Down Expand Up @@ -395,8 +395,8 @@ github.com/kr/pty v1.1.3/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/kroma-network/go-ethereum v0.5.0 h1:HqQ7khCuhQSWFCJu6/WnRQaBFlwDpPNNaLqDI3e+Br4=
github.com/kroma-network/go-ethereum v0.5.0/go.mod h1:SEk7AN/4FrDNJZg2pE1ja6xtPxLIJjfsbVVTweOafyk=
github.com/kroma-network/go-ethereum v1.101308.3-0.20241129080356-056a5b4d3639 h1:e4mSqeGxCFsRjxUf24HhdZwWAjM1Uu+Uw6A2cN3wYz0=
github.com/kroma-network/go-ethereum v1.101308.3-0.20241129080356-056a5b4d3639/go.mod h1:ZG4M8oph2j0C+R6CtUXuHeeUk5TuN5hVyl9gfwZawJg=
github.com/kroma-network/zktrie v0.5.1-0.20230420142222-950ce7a8ce84 h1:VpLCQx+tFV6Nk0hbs3Noyxma/q9wIDdyacKpGQWUMI8=
github.com/kroma-network/zktrie v0.5.1-0.20230420142222-950ce7a8ce84/go.mod h1:w54LrYo5rJEV503BgMPRNONsLTOEQv5V87q+uYaw9sM=
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
Expand Down
15 changes: 9 additions & 6 deletions kroma-chain-ops/genesis/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ func NewL2Genesis(config *DeployConfig, block *types.Block) (*core.Genesis, erro
ShanghaiTime: config.CanyonTime(block.Time()),
CancunTime: config.EcotoneTime(block.Time()),
EcotoneTime: config.EcotoneTime(block.Time()),
// TODO(seolaoh): uncomment this when geth updated
// KromaMPTTime: config.KromaMPTTime(block.Time()),
KromaMPTTime: config.KromaMPTTime(block.Time()),
InteropTime: config.InteropTime(block.Time()),
Kroma: &params.KromaConfig{
EIP1559Denominator: eip1559Denom,
Expand All @@ -73,10 +72,14 @@ func NewL2Genesis(config *DeployConfig, block *types.Block) (*core.Genesis, erro
Zktrie: true,
}

// TODO(seolaoh): turn off Zktrie when MPT time is past in genesis
//if kromaChainConfig.IsKromaMPT(block.Time()) {
// kromaChainConfig.Zktrie = false
//}
if kromaChainConfig.IsKromaMPT(block.Time()) {
kromaChainConfig.Optimism = &params.OptimismConfig{
EIP1559Denominator: eip1559Denom,
EIP1559Elasticity: eip1559Elasticity,
EIP1559DenominatorCanyon: eip1559DenomCanyon,
}
kromaChainConfig.Zktrie = false
}

gasLimit := config.L2GenesisBlockGasLimit
if gasLimit == 0 {
Expand Down
7 changes: 6 additions & 1 deletion kroma-devnet/devnet/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,15 @@ def devnet_deploy(paths):
run_command(['docker', 'compose', 'up', '-d', 'l2'], cwd=paths.ops_bedrock_dir, env={
'PWD': paths.ops_bedrock_dir
})
run_command(['docker', 'compose', 'up', '-d', 'l2-historical'], cwd=paths.ops_bedrock_dir, env={
'PWD': paths.ops_bedrock_dir
})

# Wait for the L2 to be available.
wait_up(9545)
wait_for_rpc_server('127.0.0.1:9545')
wait_up(9445)
wait_for_rpc_server('127.0.0.1:9445')

# [Kroma: START]
# Print out the addresses being used for easier debugging.
Expand All @@ -275,7 +280,7 @@ def devnet_deploy(paths):
log.info(f'Using AssetManager {asset_manager}')

log.info('Bringing up `kroma-node`, `kroma-batcher` and `kroma-validator`.')
run_command(['docker', 'compose', 'up', '-d', 'kroma-node', 'kroma-batcher', 'kroma-validator', 'kroma-challenger'], cwd=paths.ops_bedrock_dir, env={
run_command(['docker', 'compose', 'up', '-d', 'kroma-node', 'kroma-node-historical', 'kroma-batcher', 'kroma-validator', 'kroma-challenger'], cwd=paths.ops_bedrock_dir, env={
'PWD': paths.ops_bedrock_dir,
'L2OO_ADDRESS': l2_output_oracle,
'COLOSSEUM_ADDRESS': colosseum,
Expand Down
16 changes: 3 additions & 13 deletions op-e2e/actions/user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@ import (
"math/rand"
"testing"

"github.com/ethereum-optimism/optimism/op-e2e/e2eutils"
"github.com/ethereum-optimism/optimism/op-service/testlog"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/log"
"github.com/stretchr/testify/require"

"github.com/ethereum-optimism/optimism/op-e2e/e2eutils"
"github.com/ethereum-optimism/optimism/op-service/testlog"
)

type hardforkScheduledTest struct {
regolithTime *hexutil.Uint64
canyonTime *hexutil.Uint64
deltaTime *hexutil.Uint64
ecotoneTime *hexutil.Uint64
kromaMPTTime *hexutil.Uint64
fjordTime *hexutil.Uint64
runToFork string
}
Expand All @@ -35,8 +35,6 @@ func (tc *hardforkScheduledTest) fork(fork string) **hexutil.Uint64 {
switch fork {
case "fjord":
return &tc.fjordTime
case "mpt":
return &tc.kromaMPTTime
case "ecotone":
return &tc.ecotoneTime
case "delta":
Expand Down Expand Up @@ -67,10 +65,6 @@ func TestCrossLayerUser(t *testing.T) {
"canyon",
"delta",
"ecotone",
// [Kroma: START]
// TODO(seolaoh): uncomment below forks when geth updated
//"mpt",
// [Kroma: END]
//"fjord",
}
for i, fork := range forks {
Expand Down Expand Up @@ -119,7 +113,6 @@ func runCrossLayerUserTest(gt *testing.T, test hardforkScheduledTest) {
dp.DeployConfig.L2GenesisCanyonTimeOffset = test.canyonTime
dp.DeployConfig.L2GenesisDeltaTimeOffset = test.deltaTime
dp.DeployConfig.L2GenesisEcotoneTimeOffset = test.ecotoneTime
dp.DeployConfig.L2GenesisKromaMPTTimeOffset = test.kromaMPTTime
dp.DeployConfig.L2GenesisFjordTimeOffset = test.fjordTime

// [Kroma: START]
Expand All @@ -133,9 +126,6 @@ func runCrossLayerUserTest(gt *testing.T, test hardforkScheduledTest) {
if test.ecotoneTime != nil {
require.Zero(t, uint64(*test.ecotoneTime)%uint64(dp.DeployConfig.L2BlockTime), "ecotone fork must be aligned")
}
if test.kromaMPTTime != nil {
require.Zero(t, uint64(*test.kromaMPTTime)%uint64(dp.DeployConfig.L2BlockTime), "kroma mpt fork must be aligned")
}

sd := e2eutils.Setup(t, dp, defaultAlloc)
log := testlog.Logger(t, log.LevelDebug)
Expand Down
Loading

0 comments on commit 13b08b8

Please sign in to comment.