Skip to content
Open
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
66 changes: 59 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -137,27 +137,70 @@ go-ubuntu-builder:

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

devnet-up: submodules go-ubuntu-builder
python3 ops/devnet-morph/main.py --polyrepo-dir=.
EXECUTION_CLIENT ?= geth
MORPH_RETH_BUILD_FROM_SOURCE ?= false
ifeq ($(MORPH_RETH_BUILD_FROM_SOURCE),true)
MORPH_RETH_IMAGE ?= morph-reth:latest
MORPH_RETH_ENTRYPOINT ?= /app/morph-reth
else
MORPH_RETH_IMAGE ?= ghcr.io/morph-l2/morph-reth:latest
MORPH_RETH_ENTRYPOINT ?= /usr/local/bin/morph-reth
endif
MORPH_RETH_DIR ?= ../morph-reth
MORPH_RETH_BUILD_PROFILE ?= release
MORPH_RETH_RUSTFLAGS ?=
MORPH_RETH_DOCKER_TARGET ?= builder
export MORPH_RETH_IMAGE
export MORPH_RETH_DIR
export MORPH_RETH_BUILD_PROFILE
export MORPH_RETH_RUSTFLAGS
export MORPH_RETH_DOCKER_TARGET
export MORPH_RETH_ENTRYPOINT
DEVNET_COMPOSE_FILES := -f docker-compose-4nodes.yml

ifeq ($(EXECUTION_CLIENT),geth)
DEVNET_EXECUTION_DEPS := submodules
else ifeq ($(EXECUTION_CLIENT),reth)
DEVNET_COMPOSE_FILES += -f docker-compose-reth.yml
ifeq ($(MORPH_RETH_BUILD_FROM_SOURCE),true)
DEVNET_EXECUTION_DEPS := reth
else
DEVNET_EXECUTION_DEPS := reth-image
endif
else
$(error unsupported EXECUTION_CLIENT "$(EXECUTION_CLIENT)", expected "geth" or "reth")
endif

devnet-up: $(DEVNET_EXECUTION_DEPS) go-ubuntu-builder
python3 ops/devnet-morph/main.py --polyrepo-dir=. --execution-client=$(EXECUTION_CLIENT)
.PHONY: devnet-up

devnet-up-debugccc:
python3 ops/devnet-morph/main.py --polyrepo-dir=. --debugccc
devnet-up-reth:
$(MAKE) devnet-up EXECUTION_CLIENT=reth
.PHONY: devnet-up-reth

devnet-up-debugccc: $(DEVNET_EXECUTION_DEPS) go-ubuntu-builder
python3 ops/devnet-morph/main.py --polyrepo-dir=. --execution-client=$(EXECUTION_CLIENT) --debugccc
.PHONY: devnet-up-debugccc

devnet-down:
cd ops/docker && docker compose -f docker-compose-4nodes.yml down
cd ops/docker && docker compose $(DEVNET_COMPOSE_FILES) down
.PHONY: devnet-down

devnet-clean-build: devnet-l1-clean
cd ops/docker && docker compose -f docker-compose-4nodes.yml down --volumes --remove-orphans
cd ops/docker && docker compose $(DEVNET_COMPOSE_FILES) down --volumes --remove-orphans
docker volume ls --filter name=docker_ --format='{{.Name}}' | xargs docker volume rm 2>/dev/null || true
rm -rf ops/l2-genesis/.devnet
rm -rf ops/docker/.devnet
rm -rf ops/docker/consensus/beacondata ops/docker/consensus/validatordata ops/docker/consensus/genesis.ssz
rm -rf ops/docker/execution/geth
rm -rf ops/docker/execution/reth
.PHONY: devnet-clean-build

devnet-clean-build-reth:
$(MAKE) devnet-clean-build EXECUTION_CLIENT=reth
.PHONY: devnet-clean-build-reth

devnet-clean: devnet-clean-build
docker image ls '*morph*' --format='{{.Repository}}' | xargs -r docker rmi
docker image ls '*sentry-*' --format='{{.Repository}}' | xargs -r docker rmi
Expand All @@ -171,9 +214,18 @@ devnet-l1-clean:
.PHONY: devnet-l1-clean

devnet-logs:
@(cd ops/docker && docker-compose logs -f)
@(cd ops/docker && docker compose $(DEVNET_COMPOSE_FILES) logs -f)
.PHONY: devnet-logs

reth-image:
docker pull "$(MORPH_RETH_IMAGE)"
.PHONY: reth-image

reth:
@test -d "$(MORPH_RETH_DIR)" || (echo "morph-reth directory not found: $(MORPH_RETH_DIR)" && exit 1)
docker build -t "$(MORPH_RETH_IMAGE)" --target "$(MORPH_RETH_DOCKER_TARGET)" --build-arg BUILD_PROFILE="$(MORPH_RETH_BUILD_PROFILE)" --build-arg RUSTFLAGS="$(MORPH_RETH_RUSTFLAGS)" "$(MORPH_RETH_DIR)"
.PHONY: reth

# tx-submitter
SUBMITTERS := $(shell grep -o 'tx-submitter-[0-9]*[^:]' ops/docker/docker-compose-4nodes.yml | sort | uniq)
rebuild-all-tx-submitter:
Expand Down
21 changes: 15 additions & 6 deletions common/batch/batch_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ func (bc *BatchCache) CalculateCapWithProposalBlock(blockNumber uint64, withdraw
}

// Parse transactions, distinguish L1 and L2 transactions
txsPayload, l1TxHashes, newTotalL1MessagePopped, l2TxNum, err := parsingTxs(block.Transactions(), bc.totalL1MessagePopped)
txsPayload, l1TxHashes, newTotalL1MessagePopped, l2TxNum, err := ParsingTxs(block.Transactions(), bc.totalL1MessagePopped)
if err != nil {
return false, fmt.Errorf("failed to parse transactions: %w", err)
}
Expand All @@ -518,7 +518,7 @@ func (bc *BatchCache) CalculateCapWithProposalBlock(blockNumber uint64, withdraw
txsNum := l2TxNum + l1TxNum

// Build BlockContext (60 bytes)
blockContext := buildBlockContext(header, txsNum, l1TxNum)
blockContext := BuildBlockContext(header, txsNum, l1TxNum)

// Store to current, do not immediately append to batch
bc.currentBlockContext = blockContext
Expand Down Expand Up @@ -840,8 +840,14 @@ func (bc *BatchCache) createBatchHeader(dataHash common.Hash, sidecar *ethtypes.
return batchHeaderV0.Bytes()
}

// parsingTxs parses transactions, distinguishes L1 and L2 transactions
func parsingTxs(transactions []*ethtypes.Transaction, totalL1MessagePoppedBefore uint64) (
// ParsingTxs encodes a block's transactions into the on-chain payload format
// used by the batch builder: L2 transactions are RLP-marshalled and concatenated
// in order; L1 message transactions are excluded from the payload but their
// hashes and queue indices are tracked separately.
//
// Exported for derivation Path B (SPEC-005), which must rebuild blob bytes from
// local L2 blocks using the same encoding the sequencer applied at seal time.
func ParsingTxs(transactions []*ethtypes.Transaction, totalL1MessagePoppedBefore uint64) (
txsPayload []byte,
l1TxHashes []common.Hash,
totalL1MessagePopped uint64,
Expand Down Expand Up @@ -901,9 +907,12 @@ func (bc *BatchCache) effectiveMaxBlobCount(blockTimestamp uint64) int {
return 1
}

// buildBlockContext builds BlockContext from block header (60 bytes)
// BuildBlockContext serialises a block header + tx counts into the 60-byte
// BlockContext blob the batch builder writes for each block.
// Format: Number(8) || Timestamp(8) || BaseFee(32) || GasLimit(8) || numTxs(2) || numL1Messages(2)
func buildBlockContext(header *ethtypes.Header, txsNum, l1MsgNum int) []byte {
//
// Exported for derivation Path B (SPEC-005); see ParsingTxs.
func BuildBlockContext(header *ethtypes.Header, txsNum, l1MsgNum int) []byte {
blsBytes := make([]byte, 60)

// Number (8 bytes)
Expand Down
52 changes: 0 additions & 52 deletions node/blocktag/config.go

This file was deleted.

Loading