Skip to content

Enable execution only mode in nitro#4386

Open
bragaigor wants to merge 16 commits intomasterfrom
braga/consensus-exec-diff-proc
Open

Enable execution only mode in nitro#4386
bragaigor wants to merge 16 commits intomasterfrom
braga/consensus-exec-diff-proc

Conversation

@bragaigor
Copy link
Copy Markdown
Contributor

Enable execution only mode in nitro as well as consensus only mode

closes NIT-4241
relates to NIT-4202

pulls in OffchainLabs/nitro-testnode#177

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 14, 2026

❌ 15 Tests Failed:

Tests completed Failed Passed Skipped
4717 15 4702 0
View the top 3 failed tests by shortest run time
TestAliasingFlaky
Stack Traces | -0.000s run time
... [CONTENT TRUNCATED: Keeping last 20 lines]
INFO [04-06|17:30:11.144] Writing cached state to disk             block=8  hash=ad0b09..0d8ad4 root=f35713..f3c523
INFO [04-06|17:30:11.144] Persisted trie from memory database      nodes=16  flushnodes=0 size=3.10KiB  flushsize=0.00B time="33.232µs"  flushtime=0s gcnodes=0 gcsize=0.00B gctime=0s          livenodes=146 livesize=26.69KiB
INFO [04-06|17:30:11.144] Writing cached state to disk             block=1  hash=c4e338..9f3b83 root=915879..6ac679
INFO [04-06|17:30:11.144] Persisted trie from memory database      nodes=24  flushnodes=0 size=4.55KiB  flushsize=0.00B time="59.37µs"   flushtime=0s gcnodes=0 gcsize=0.00B gctime=0s          livenodes=122 livesize=22.14KiB
INFO [04-06|17:30:11.144] Writing snapshot state to disk           root=77ae46..2fbcae
INFO [04-06|17:30:11.144] Persisted trie from memory database      nodes=0   flushnodes=0 size=0.00B    flushsize=0.00B time=591ns       flushtime=0s gcnodes=0 gcsize=0.00B gctime=0s          livenodes=122 livesize=22.14KiB
INFO [04-06|17:30:11.144] Blockchain stopped
INFO [04-06|17:30:11.145] Submitted transaction                    hash=0x57e601445b3627d121f392223c7ddaf5b9f69d47135ad2f827a6de00c52de5fa from=0xaF24Ca6c2831f4d4F629418b50C227DF0885613A nonce=5  recipient=0xaF24Ca6c2831f4d4F629418b50C227DF0885613A value=1,000,000,000,000
INFO [04-06|17:30:11.145] Starting work on payload                 id=0x03744430ae1babdc
INFO [04-06|17:30:11.145] Updated payload                          id=0x03744430ae1babdc                      number=44 hash=450240..3c4fcc txs=1  withdrawals=0 gas=21000     fees=0.002089418537 root=060a69..b3fff6 elapsed="285.976µs"
INFO [04-06|17:30:11.146] Stopping work on payload                 id=0x03744430ae1babdc                      reason=delivery
INFO [04-06|17:30:11.146] Imported new potential chain segment     number=44 hash=450240..3c4fcc blocks=1  txs=1  mgas=0.021 elapsed="448.342µs" mgasps=46.839   triediffs=213.38KiB triedirty=0.00B
INFO [04-06|17:30:11.146] Chain head was updated                   number=44 hash=450240..3c4fcc root=060a69..b3fff6 elapsed="34.624µs"
INFO [04-06|17:30:11.147] Ethereum protocol stopped
INFO [04-06|17:30:11.147] Transaction pool stopped
INFO [04-06|17:30:11.147] Persisting dirty state                   head=35 root=d6a1aa..560327 layers=35
INFO [04-06|17:30:11.147] Persisted dirty state to disk            size=168.46KiB elapsed="827.193µs"
INFO [04-06|17:30:11.148] Blockchain stopped
INFO [04-06|17:30:11.148] Submitted transaction                    hash=0xd4467e282fb18ea7c883d24b52c8aa7e5380a796a6f879b8bff49baf170900c3 from=0xaF24Ca6c2831f4d4F629418b50C227DF0885613A nonce=6  recipient=0xaF24Ca6c2831f4d4F629418b50C227DF0885613A value=1,000,000,000,000
INFO [04-06|17:30:11.148] Starting work on payload                 id=0x0368cb094332da22
TestPruningDBSizeReduction
Stack Traces | 0.000s run time
=== RUN   TestPruningDBSizeReduction
--- FAIL: TestPruningDBSizeReduction (0.00s)
TestBatchPosterL1SurplusMatchesBatchGasFlaky
Stack Traces | 0.560s run time
... [CONTENT TRUNCATED: Keeping last 20 lines]
panic: runtime error: invalid memory address or nil pointer dereference [recovered, repanicked]
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x207ed92]

goroutine 23 [running]:
testing.tRunner.func1.2({0x37e7220, 0x62029b0})
	/opt/hostedtoolcache/go/1.25.8/x64/src/testing/testing.go:1872 +0x237
testing.tRunner.func1()
	/opt/hostedtoolcache/go/1.25.8/x64/src/testing/testing.go:1875 +0x35b
panic({0x37e7220?, 0x62029b0?})
	/opt/hostedtoolcache/go/1.25.8/x64/src/runtime/panic.go:783 +0x132
github.com/offchainlabs/nitro/arbnode.(*InboxTracker).GetBatchCount(0x5ebd900?)
	/home/runner/work/nitro/nitro/arbnode/inbox_tracker.go:210 +0x12
github.com/offchainlabs/nitro/arbnode.(*InboxTracker).FindInboxBatchContainingMessage(0x0, 0x7)
	/home/runner/work/nitro/nitro/arbnode/inbox_tracker.go:225 +0x2f
github.com/offchainlabs/nitro/system_tests.TestBatchPosterL1SurplusMatchesBatchGasFlaky(0xc00010b880)
	/home/runner/work/nitro/nitro/system_tests/batch_poster_test.go:839 +0x725
testing.tRunner(0xc00010b880, 0x41b9d48)
	/opt/hostedtoolcache/go/1.25.8/x64/src/testing/testing.go:1934 +0xea
created by testing.(*T).Run in goroutine 1
	/opt/hostedtoolcache/go/1.25.8/x64/src/testing/testing.go:1997 +0x465

📣 Thoughts on this report? Let Codecov know! | Powered by Codecov

@bragaigor bragaigor force-pushed the braga/consensus-exec-diff-proc branch from be02672 to b2f5213 Compare February 18, 2026 19:14
Comment thread cmd/nitro/init/init.go Outdated
@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 18, 2026

Codecov Report

❌ Patch coverage is 1.78571% with 165 lines in your changes missing coverage. Please review.
✅ Project coverage is 33.99%. Comparing base (b22c9c5) to head (a8b6a6b).
⚠️ Report is 4 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4386      +/-   ##
==========================================
- Coverage   34.42%   33.99%   -0.43%     
==========================================
  Files         494      494              
  Lines       58930    58966      +36     
==========================================
- Hits        20285    20044     -241     
- Misses      35054    35370     +316     
+ Partials     3591     3552      -39     

Conversily enable consensus only mode in nitro

Signed-off-by: Igor Braga <5835477+bragaigor@users.noreply.github.com>
Signed-off-by: Igor Braga <5835477+bragaigor@users.noreply.github.com>
Signed-off-by: Igor Braga <5835477+bragaigor@users.noreply.github.com>
Signed-off-by: Igor Braga <5835477+bragaigor@users.noreply.github.com>
Signed-off-by: Igor Braga <5835477+bragaigor@users.noreply.github.com>
Signed-off-by: Igor Braga <5835477+bragaigor@users.noreply.github.com>
Comment thread cmd/nitro/nitro.go Outdated
Signed-off-by: Igor Braga <5835477+bragaigor@users.noreply.github.com>
Signed-off-by: Igor Braga <5835477+bragaigor@users.noreply.github.com>
Signed-off-by: Igor Braga <5835477+bragaigor@users.noreply.github.com>
Signed-off-by: Igor Braga <5835477+bragaigor@users.noreply.github.com>
@bragaigor bragaigor marked this pull request as ready for review March 12, 2026 14:01
@diegoximenes diegoximenes requested a review from Copilot March 12, 2026 16:47
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Enables running Nitro in “execution-only” or “consensus-only” mode (splitting normally co-located components) and adds configuration/validation to support RPC-based separation.

Changes:

  • Add execution/consensus enablement gating in cmd/nitro/nitro.go to allow running only one component in-process.
  • Tighten config validation for RPC-mode requirements and add --chain.genesis-block-num.
  • Bump nitro-testnode submodule and document the change in the changelog.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
nitro-testnode Updates testnode submodule revision to pick up supporting changes.
execution_consensus/init.go Allows consensus node to be absent (nil) when starting/stopping nodes.
cmd/nitro/nitro.go Introduces execution/consensus-only gating; adjusts initialization paths accordingly.
cmd/nitro/config/config.go Adds RPC-mode validation rules for mutually exclusive execution vs consensus.
cmd/conf/chain.go Adds genesis-block-num field/flag to L2 chain config.
changelog/bragaigor-nit-4241.md Documents the new mode(s) and new chain config flag.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread execution_consensus/init.go
Comment thread cmd/nitro/nitro.go
Comment thread cmd/nitro/nitro.go Outdated
Comment thread cmd/nitro/config/config.go Outdated
Comment thread changelog/bragaigor-nit-4241.md Outdated
Signed-off-by: Igor Braga <5835477+bragaigor@users.noreply.github.com>
pmikolajczyk41
pmikolajczyk41 previously approved these changes Mar 13, 2026
Copy link
Copy Markdown
Member

@pmikolajczyk41 pmikolajczyk41 left a comment

Choose a reason for hiding this comment

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

couldn't spot any obvious problems

Comment thread cmd/nitro/nitro.go
}

if execNode != nil {
if executionNodeEnabled && execNode != nil {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

shouldn't/aren't these two checks redundant?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

who are we if we don't have redundancy xD jokes apart you're right, I'll remove executionNodeEnabled

Copy link
Copy Markdown
Contributor

@diegoximenes diegoximenes left a comment

Choose a reason for hiding this comment

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

Not to do in this PR.
But at some point we can have less code blocks gated by if executionNode { for example, and have a single one.
This is decreasing code readability a lot.

Comment thread cmd/nitro/config/config.go Outdated
Comment thread cmd/nitro/nitro.go
Comment thread cmd/nitro/nitro.go
Comment thread cmd/nitro/nitro.go Outdated
Comment thread cmd/nitro/nitro.go Outdated
Comment thread cmd/nitro/nitro.go Outdated
Comment thread cmd/nitro/nitro.go
Comment thread execution_consensus/init.go
Comment thread cmd/nitro/nitro.go Outdated
Comment thread cmd/nitro/nitro.go Outdated
Signed-off-by: Igor Braga <5835477+bragaigor@users.noreply.github.com>
@bragaigor
Copy link
Copy Markdown
Contributor Author

But at some point we can have less code blocks gated by if executionNode { for example, and have a single one.
This is decreasing code readability a lot.

agreed and created ticket for it

Signed-off-by: Igor Braga <5835477+bragaigor@users.noreply.github.com>
@bragaigor bragaigor assigned diegoximenes and unassigned bragaigor Mar 25, 2026
Comment thread cmd/nitro/nitro.go Outdated
consensusNodeEnabled = nodeConfig.Node.RPCServer.Enable
} else {
// same process: no RPC communication
// TODO: There should be a validation that in this scenario no RPC URL is set.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Missing TODO

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done in a8b6a6b

Comment thread cmd/nitro/nitro.go Outdated
if consensusNodeEnabled {
var chainConfig *params.ChainConfig
// TODO: First try to get chainConfig from consensusParsedInitMsg (needs https://github.com/OffchainLabs/nitro/pull/4395)
chainConfig, err = chaininfo.GetChainConfig(new(big.Int).SetUint64(nodeConfig.Chain.ID), nodeConfig.Chain.Name, nil, nodeConfig.Chain.InfoFiles, nodeConfig.Chain.InfoJson)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

There is this code block before:

chainInfo, err := chaininfo.ProcessChainInfo(nodeConfig.Chain.ID, nodeConfig.Chain.Name, nodeConfig.Chain.InfoFiles, nodeConfig.Chain.InfoJson)
	if err != nil {
		log.Error("error processing l2 chain info", "err", err)
		return 1
	}

This chainInfo is only retrieved in order to read the inner chain config.
Change this code block to use chaininfo.GetChainConfig, and remove this chaininfo.GetChainConfig from inside this if.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Was able to remove chaininfo.GetChainConfig(..) completely in favour of using chainInfo.ChainConfig in a8b6a6b

Comment thread cmd/nitro/nitro.go
Signed-off-by: Igor Braga <5835477+bragaigor@users.noreply.github.com>
Signed-off-by: Igor Braga <5835477+bragaigor@users.noreply.github.com>
@bragaigor bragaigor requested a review from diegoximenes April 6, 2026 20:03
@bragaigor bragaigor assigned diegoximenes and unassigned bragaigor Apr 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants