Skip to content
Closed
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
47 changes: 0 additions & 47 deletions .github/workflows/oracle.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[submodule "go-ethereum"]
path = go-ethereum
url = https://github.com/morph-l2/go-ethereum.git
branch = main
branch = features/coinbase
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
################## update dependencies ####################

ETHEREUM_TARGET_VERSION := v1.10.14-0.20250218031646-de5160c106de
ETHEREUM_TARGET_VERSION := v1.10.14-0.20250226070544-6039a12094aa
TENDERMINT_TARGET_VERSION := v0.3.2-0.20250115141431-c84dfe5c8533

ETHEREUM_MODULE_NAME := github.com/morph-l2/go-ethereum
Expand Down Expand Up @@ -128,7 +128,7 @@ go-ubuntu-builder:

################## devnet 4 nodes ####################

devnet-up: submodules go-ubuntu-builder
devnet-up: go-ubuntu-builder
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Simplified dependency chain for devnet-up target

The dependency on submodules has been removed from the devnet-up target, which simplifies the build process but might affect dependency management.

This simplification means developers will need to manually update submodules before running this target. Consider adding a comment or documentation update if this change is intentional.


🏁 Script executed:

#!/bin/bash
# Check if there are any uninitialized or outdated submodules
git submodule status | grep -E '^\-|^\+'

Length of output: 96


Attention: Update Documentation for Manual Submodule Refresh in devnet-up Target

The dependency on submodules has been removed from the devnet-up target—as evidenced by the outdated go-ethereum submodule in your verification—which means submodules now need to be updated manually. Please add a comment in the Makefile and update the relevant documentation (e.g., README) to remind developers that running devnet-up no longer auto-updates submodules.

  • The output from git submodule status | grep -E '^\-|^\+' shows an outdated go-ethereum submodule.
  • If the removal of automatic submodule updates is intentional, document this behavior to avoid confusion.

python3 ops/devnet-morph/main.py --polyrepo-dir=.
.PHONY: devnet-up

Expand Down
2 changes: 1 addition & 1 deletion bindings/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.22

replace github.com/tendermint/tendermint => github.com/morph-l2/tendermint v0.3.2-0.20250115141431-c84dfe5c8533

require github.com/morph-l2/go-ethereum v1.10.14-0.20250218031646-de5160c106de
require github.com/morph-l2/go-ethereum v1.10.14-0.20250225020901-6fe0ee6ffedd

require (
github.com/VictoriaMetrics/fastcache v1.12.2 // indirect
Expand Down
4 changes: 2 additions & 2 deletions bindings/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ github.com/mmcloughlin/addchain v0.4.0/go.mod h1:A86O+tHqZLMNO4w6ZZ4FlVQEadcoqky
github.com/mmcloughlin/profile v0.1.1/go.mod h1:IhHD7q1ooxgwTgjxQYkACGA77oFTDdFVejUS1/tS/qU=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/morph-l2/go-ethereum v1.10.14-0.20250218031646-de5160c106de h1:NOzYvFCuqWZ0bg2GAcC2S9cwd1rThSCTwyJCT8Iwfgc=
github.com/morph-l2/go-ethereum v1.10.14-0.20250218031646-de5160c106de/go.mod h1:sMJCfHOBzVRDkM2yF/Hy+oUk2rgC0CQZHTLs0cyzhhk=
github.com/morph-l2/go-ethereum v1.10.14-0.20250225020901-6fe0ee6ffedd h1:u8Ww4bHGUbRR2iPrLFaMM1GuCBQvL1cYUL7ijtbfoH0=
github.com/morph-l2/go-ethereum v1.10.14-0.20250225020901-6fe0ee6ffedd/go.mod h1:sMJCfHOBzVRDkM2yF/Hy+oUk2rgC0CQZHTLs0cyzhhk=
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
Expand Down
2 changes: 1 addition & 1 deletion contracts/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ replace github.com/tendermint/tendermint => github.com/morph-l2/tendermint v0.3.

require (
github.com/iden3/go-iden3-crypto v0.0.16
github.com/morph-l2/go-ethereum v1.10.14-0.20250218031646-de5160c106de
github.com/morph-l2/go-ethereum v1.10.14-0.20250225020901-6fe0ee6ffedd
github.com/stretchr/testify v1.9.0
)

Expand Down
4 changes: 2 additions & 2 deletions contracts/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ github.com/kr/pty v1.1.1/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/morph-l2/go-ethereum v1.10.14-0.20250218031646-de5160c106de h1:NOzYvFCuqWZ0bg2GAcC2S9cwd1rThSCTwyJCT8Iwfgc=
github.com/morph-l2/go-ethereum v1.10.14-0.20250218031646-de5160c106de/go.mod h1:sMJCfHOBzVRDkM2yF/Hy+oUk2rgC0CQZHTLs0cyzhhk=
github.com/morph-l2/go-ethereum v1.10.14-0.20250225020901-6fe0ee6ffedd h1:u8Ww4bHGUbRR2iPrLFaMM1GuCBQvL1cYUL7ijtbfoH0=
github.com/morph-l2/go-ethereum v1.10.14-0.20250225020901-6fe0ee6ffedd/go.mod h1:sMJCfHOBzVRDkM2yF/Hy+oUk2rgC0CQZHTLs0cyzhhk=
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/deploy-config/l1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const config = {
rollupProposer: '0x70997970C51812dc3A010C7d01b50e0d17dc79C8',
rollupChallenger: '0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65',
// genesis config
batchHeader: '0x0000000000000000000000000000000000000000000000000043a758882ae97327ffcc63373e26fcd144a5a738eac834c167175d69713780c0010657f37554c781402a22917dee2f75def7ab966d7b770905398eba3c444014000000000000000000000000000000000000000000000000000000000000000020cd420e20d610897b8f2c5ac5259ab8b57cce1074212cec2815b2b73ff93d9f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
batchHeader: '0x000000000000000000000000000000000000000000000000000b2e7f71779f5cf83a7c814aefc01a72f4ea2a655c94a482461d755ae7ccc23a010657f37554c781402a22917dee2f75def7ab966d7b770905398eba3c44401400000000000000000000000000000000000000000000000000000000000000000b762b3dff1d9e0e89fdc07af2379d0df60e9c97e6bb4bb85ccb389677ae34ba000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',

// staking config
// staking Cross-Chain config
Expand Down
1 change: 0 additions & 1 deletion go.work
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@ use (
./node
./ops/l2-genesis
./ops/tools
./oracle
./tx-submitter
)
6 changes: 2 additions & 4 deletions go.work.sum
Original file line number Diff line number Diff line change
Expand Up @@ -765,10 +765,8 @@ github.com/morph-l2/go-ethereum v1.10.14-0.20241028101924-8c247ffe3315 h1:egBq7X
github.com/morph-l2/go-ethereum v1.10.14-0.20241028101924-8c247ffe3315/go.mod h1:sMJCfHOBzVRDkM2yF/Hy+oUk2rgC0CQZHTLs0cyzhhk=
github.com/morph-l2/go-ethereum v1.10.14-0.20241224100051-1582a364edc0 h1:w0RXAFr/x9fWNgQkcrmSnZseYCNkbBFDWgEIfSqhCeY=
github.com/morph-l2/go-ethereum v1.10.14-0.20241224100051-1582a364edc0/go.mod h1:sMJCfHOBzVRDkM2yF/Hy+oUk2rgC0CQZHTLs0cyzhhk=
github.com/morph-l2/go-ethereum v1.10.14-0.20250218031646-de5160c106de h1:NOzYvFCuqWZ0bg2GAcC2S9cwd1rThSCTwyJCT8Iwfgc=
github.com/morph-l2/go-ethereum v1.10.14-0.20250218031646-de5160c106de/go.mod h1:sMJCfHOBzVRDkM2yF/Hy+oUk2rgC0CQZHTLs0cyzhhk=
github.com/morph-l2/tendermint v0.3.1 h1:yqyM3/p9sCNmFSsIFeIxS5RBgXHWqbtyNHx16I9cIZ0=
github.com/morph-l2/tendermint v0.3.1/go.mod h1:TtCzp9l6Z6yDUiwv3TbqKqw8Q8RKp3fSz5+adO1/Y8w=
github.com/morph-l2/go-ethereum v1.10.14-0.20250225020901-6fe0ee6ffedd h1:u8Ww4bHGUbRR2iPrLFaMM1GuCBQvL1cYUL7ijtbfoH0=
github.com/morph-l2/go-ethereum v1.10.14-0.20250225020901-6fe0ee6ffedd/go.mod h1:sMJCfHOBzVRDkM2yF/Hy+oUk2rgC0CQZHTLs0cyzhhk=
github.com/mschoch/smat v0.0.0-20160514031455-90eadee771ae/go.mod h1:qAyveg+e4CE+eKJXWVjKXM4ck2QobLqTDytGJbLLhJg=
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f h1:KUppIJq7/+SVif2QVs3tOP0zanoHgBEVAwHxUSIzRqU=
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
Expand Down
12 changes: 1 addition & 11 deletions node/core/batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,13 +178,7 @@ func (e *Executor) CalculateCapWithProposalBlock(currentBlockBytes []byte, curre
return false, err
}

var exceeded bool
if e.isBatchUpgraded(block.Timestamp) {
exceeded, err = e.batchingCache.batchData.WillExceedCompressedSizeLimit(e.batchingCache.currentBlockContext, e.batchingCache.currentTxsPayload)
} else {
exceeded, err = e.batchingCache.batchData.EstimateCompressedSizeWithNewPayload(e.batchingCache.currentTxsPayload)
}
return exceeded, err
return e.batchingCache.batchData.WillExceedCompressedSizeLimit(e.batchingCache.currentBlockContext, e.batchingCache.currentTxsPayload)
}

func (e *Executor) AppendBlsData(height int64, batchHash []byte, data l2node.BlsData) error {
Expand Down Expand Up @@ -347,7 +341,3 @@ func (e *Executor) ConvertBlsData(blsData l2node.BlsData) (*eth.BatchSignature,
}
return &bs, nil
}

func (e *Executor) isBatchUpgraded(blockTime uint64) bool {
return blockTime >= e.UpgradeBatchTime
}
62 changes: 23 additions & 39 deletions node/core/batch_seal.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,37 +61,25 @@ func (e *Executor) SealBatch() ([]byte, []byte, error) {
}

// handleBatchSealing determines which version to use for compression and calculates the data hash.
func (e *Executor) handleBatchSealing(blockTimestamp uint64) ([]byte, common.Hash, error) {
func (e *Executor) handleBatchSealing(_ uint64) ([]byte, common.Hash, error) {
var (
compressedPayload []byte
batchDataHash common.Hash
err error
)

// Check if the batch should use the upgraded version
if e.isBatchUpgraded(blockTimestamp) {
compressedPayload, err = types.CompressBatchBytes(e.batchingCache.batchData.TxsPayloadV2())
if err != nil {
return nil, common.Hash{}, fmt.Errorf("failed to compress upgraded payload: %w", err)
}

if len(compressedPayload) <= types.MaxBlobBytesSize {
batchDataHash, err = e.batchingCache.batchData.DataHashV2()
if err != nil {
return nil, common.Hash{}, fmt.Errorf("failed to calculate upgraded data hash: %w", err)
}
return compressedPayload, batchDataHash, nil
}
compressedPayload, err = types.CompressBatchBytes(e.batchingCache.batchData.TxsPayloadV2())
if err != nil {
return nil, common.Hash{}, fmt.Errorf("failed to compress upgraded payload: %w", err)
}

// Fallback to old version if upgraded is not used
compressedPayload, err = types.CompressBatchBytes(e.batchingCache.batchData.TxsPayload())
batchDataHash, err = e.batchingCache.batchData.DataHashV2()
if err != nil {
return nil, common.Hash{}, fmt.Errorf("failed to compress payload: %w", err)
return nil, common.Hash{}, fmt.Errorf("failed to calculate upgraded data hash: %w", err)
}
batchDataHash = e.batchingCache.batchData.DataHash()

return compressedPayload, batchDataHash, nil

}

// createBatchHeader creates a BatchHeader from the given parameters.
Expand All @@ -107,27 +95,23 @@ func (e *Executor) createBatchHeader(dataHash common.Hash, sidecar *eth.BlobTxSi

parentBatchIndex, _ := e.batchingCache.parentBatchHeader.BatchIndex()
parentBatchHash, _ := e.batchingCache.parentBatchHeader.Hash()
batchHeaderV0 := types.BatchHeaderV0{
BatchIndex: parentBatchIndex + 1,
L1MessagePopped: l1MessagePopped,
TotalL1MessagePopped: e.batchingCache.totalL1MessagePopped,
DataHash: dataHash,
BlobVersionedHash: blobHashes[0],
PrevStateRoot: e.batchingCache.prevStateRoot,
PostStateRoot: e.batchingCache.postStateRoot,
WithdrawalRoot: e.batchingCache.withdrawRoot,
SequencerSetVerifyHash: sequencerSetVerifyHash,
ParentBatchHash: parentBatchHash,
}
if e.isBatchUpgraded(blockTimestamp) {
batchHeaderV1 := types.BatchHeaderV1{
BatchHeaderV0: batchHeaderV0,
LastBlockNumber: e.batchingCache.lastPackedBlockHeight,
}
return batchHeaderV1.Bytes()
}

return batchHeaderV0.Bytes()
batchHeaderV1 := types.BatchHeaderV1{
BatchHeaderV0: types.BatchHeaderV0{
BatchIndex: parentBatchIndex + 1,
L1MessagePopped: l1MessagePopped,
TotalL1MessagePopped: e.batchingCache.totalL1MessagePopped,
DataHash: dataHash,
BlobVersionedHash: blobHashes[0],
PrevStateRoot: e.batchingCache.prevStateRoot,
PostStateRoot: e.batchingCache.postStateRoot,
WithdrawalRoot: e.batchingCache.withdrawRoot,
SequencerSetVerifyHash: sequencerSetVerifyHash,
ParentBatchHash: parentBatchHash,
},
LastBlockNumber: e.batchingCache.lastPackedBlockHeight,
}
return batchHeaderV1.Bytes()
}

// logSealedBatch logs the details of the sealed batch for debugging purposes.
Expand Down
38 changes: 29 additions & 9 deletions node/core/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,19 @@ import (
"morph-l2/node/types"
)

type UpgradeConfig struct {
BatchTime uint64
Morph204Time uint64
}

var (
MainnetUpgradeBatchTime uint64 = 2000
HoleskyUpgradeBatchTime uint64 = 350000
MainnetUpgradeConfig = UpgradeConfig{
Morph204Time: 0,
}

HoleskyUpgradeConfig = UpgradeConfig{
Morph204Time: 0,
}
)

type Config struct {
Expand All @@ -34,7 +44,7 @@ type Config struct {
GovAddress common.Address `json:"gov_address"`
L2StakingAddress common.Address `json:"l2staking_address"`
MaxL1MessageNumPerBlock uint64 `json:"max_l1_message_num_per_block"`
UpgradeBatchTime uint64 `json:"upgrade_batch_time"`
UpgradeConfig *UpgradeConfig `json:"upgrade_config"`
DevSequencer bool `json:"dev_sequencer"`
Logger tmlog.Logger `json:"logger"`
}
Expand Down Expand Up @@ -157,15 +167,25 @@ func (c *Config) SetCliContext(ctx *cli.Context) error {
c.DevSequencer = ctx.GlobalBool(flags.DevSequencer.Name)
}

// setup batch upgrade index
// setup upgrade config
switch {
case ctx.GlobalIsSet(flags.MainnetFlag.Name):
c.UpgradeBatchTime = MainnetUpgradeBatchTime
c.UpgradeConfig = &MainnetUpgradeConfig
case ctx.GlobalIsSet(flags.HoleskyFlag.Name):
c.UpgradeBatchTime = HoleskyUpgradeBatchTime
case ctx.GlobalIsSet(flags.UpgradeBatchTime.Name):
c.UpgradeBatchTime = ctx.GlobalUint64(flags.UpgradeBatchTime.Name)
logger.Info("set UpgradeBatchTime: ", ctx.GlobalUint64(flags.UpgradeBatchTime.Name))
c.UpgradeConfig = &HoleskyUpgradeConfig
}
if c.UpgradeConfig == nil {
c.UpgradeConfig = &UpgradeConfig{}
if ctx.GlobalIsSet(flags.UpgradeBatchTime.Name) {
logger.Info("set UpgradeBatchTime: ", ctx.GlobalUint64(flags.UpgradeBatchTime.Name))
upgradeBatchTime := ctx.GlobalUint64(flags.UpgradeBatchTime.Name)
c.UpgradeConfig.BatchTime = upgradeBatchTime
}
if ctx.GlobalIsSet(flags.Morph204Time.Name) {
logger.Info("set Morph204Time: ", ctx.GlobalUint64(flags.Morph204Time.Name))
morph204Time := ctx.GlobalUint64(flags.Morph204Time.Name)
c.UpgradeConfig.Morph204Time = morph204Time
}
}

return nil
Expand Down
13 changes: 11 additions & 2 deletions node/core/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func NewExecutor(newSyncFunc NewSyncerFunc, config *Config, tmPubKey crypto.PubK
devSequencer: config.DevSequencer,
rollupABI: rollupAbi,
batchingCache: NewBatchingCache(),
UpgradeBatchTime: config.UpgradeBatchTime,
UpgradeBatchTime: config.UpgradeConfig.BatchTime,
logger: logger,
metrics: PrometheusMetrics("morphnode"),
}
Expand Down Expand Up @@ -175,7 +175,16 @@ func (e *Executor) RequestBlockData(height int64) (txs [][]byte, blockMeta []byt
l1MsgTx := tx.AsL1MessageTx()
e.logger.Info("[debug]queueIndex in transactions: ", "queueIndex", l1MsgTx.QueueIndex, "gas", l1MsgTx.Gas, "hash", tx.Hash().String())
}
l2Block, err := e.l2Client.AssembleL2Block(context.Background(), big.NewInt(height), transactions)

var tmKey [32]byte
copy(tmKey[:], e.tmPubKey)
val, found := e.valsByTmKey[tmKey]
if !found {
e.logger.Error("no address found for this proposer", "public key", hexutil.Encode(tmKey[:]))
return nil, nil, false, errors.New("no address found for this proposer")
}
coinbase := val.address
l2Block, err := e.l2Client.AssembleL2Block(context.Background(), big.NewInt(height), coinbase, transactions)
if err != nil {
e.logger.Error("failed to assemble block", "height", height, "error", err)
return
Expand Down
Loading