Skip to content

Conversation

@pmikolajczyk41
Copy link
Member

@pmikolajczyk41 pmikolajczyk41 commented Dec 30, 2025

Make execution.ExecutionRecorder interface use promise API:

  • it makes it aligned with the ExecutionClient interface
  • it makes it easier to expose it as an RPC API (especially that we don't pass the context argument in the member methods)

To keep things simple and avoid nesting threads we abandon BlockRecorder implementing ExecutionRecorder interface. It is enough that the ExecutionNode implements it.


part of NIT-4063

@codecov
Copy link

codecov bot commented Dec 30, 2025

Codecov Report

❌ Patch coverage is 88.23529% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 33.17%. Comparing base (02566fc) to head (3dadae0).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4186      +/-   ##
==========================================
- Coverage   33.41%   33.17%   -0.25%     
==========================================
  Files         461      461              
  Lines       55901    55910       +9     
==========================================
- Hits        18681    18549     -132     
- Misses      33921    34115     +194     
+ Partials     3299     3246      -53     

@github-actions
Copy link

github-actions bot commented Dec 30, 2025

❌ 7 Tests Failed:

Tests completed Failed Passed Skipped
4450 7 4443 0
View the top 3 failed tests by shortest run time
TestDataStreaming_PositiveScenario/Many_senders,_long_messages
Stack Traces | 0.070s run time
... [CONTENT TRUNCATED: Keeping last 20 lines]
        	/home/runner/work/nitro/nitro/util/testhelpers/testhelpers.go:29 +0x55
        github.com/offchainlabs/nitro/daprovider/data_streaming.testBasic.func1()
        	/home/runner/work/nitro/nitro/daprovider/data_streaming/protocol_test.go:230 +0x14f
        created by github.com/offchainlabs/nitro/daprovider/data_streaming.testBasic in goroutine 292
        	/home/runner/work/nitro/nitro/daprovider/data_streaming/protocol_test.go:223 +0x85
        
    protocol_test.go:230: �[31;1m [] too much time has elapsed since request was signed �[0;0m
INFO [01-06|19:15:12.046] rpc response                             method=datastreaming_start logId=4  err="too much time has elapsed since request was signed" result={} attempt=0 args="[\"0x695d5f3f\", \"0x2a\", \"0xd9\", \"0x2323\", \"0xa\", \"0xebae5ff0d0040af1532c40b0e6f08c7e397a5901d96602d4d8fbc8f38b5443bc2ec5dbc81d9e39c093952e499be805ef4c5df969c7d044c1ba36b6baca25fa2e01\"]" errorData=null
    protocol_test.go:230: goroutine 301 [running]:
        runtime/debug.Stack()
        	/opt/hostedtoolcache/go/1.25.5/x64/src/runtime/debug/stack.go:26 +0x5e
        github.com/offchainlabs/nitro/util/testhelpers.RequireImpl({0x1568e70, 0xc00069aa80}, {0x154f920, 0xc0003f8720}, {0x0, 0x0, 0x0})
        	/home/runner/work/nitro/nitro/util/testhelpers/testhelpers.go:29 +0x55
        github.com/offchainlabs/nitro/daprovider/data_streaming.testBasic.func1()
        	/home/runner/work/nitro/nitro/daprovider/data_streaming/protocol_test.go:230 +0x14f
        created by github.com/offchainlabs/nitro/daprovider/data_streaming.testBasic in goroutine 292
        	/home/runner/work/nitro/nitro/daprovider/data_streaming/protocol_test.go:223 +0x85
        
    protocol_test.go:230: �[31;1m [] too much time has elapsed since request was signed �[0;0m
--- FAIL: TestDataStreaming_PositiveScenario/Many_senders,_long_messages (0.07s)
TestDataStreaming_PositiveScenario
Stack Traces | 0.090s run time
=== RUN   TestDataStreaming_PositiveScenario
--- FAIL: TestDataStreaming_PositiveScenario (0.09s)
TestVersion30
Stack Traces | 6.440s run time
... [CONTENT TRUNCATED: Keeping last 20 lines]
=== PAUSE TestVersion30
=== CONT  TestVersion30
    precompile_inclusion_test.go:94: goroutine 624297 [running]:
        runtime/debug.Stack()
        	/opt/hostedtoolcache/go/1.25.5/x64/src/runtime/debug/stack.go:26 +0x5e
        github.com/offchainlabs/nitro/util/testhelpers.RequireImpl({0x4101dd0, 0xc050fab500}, {0x40bed60, 0xc0be0bc690}, {0x0, 0x0, 0x0})
        	/home/runner/work/nitro/nitro/util/testhelpers/testhelpers.go:29 +0x55
        github.com/offchainlabs/nitro/system_tests.Require(0xc050fab500, {0x40bed60, 0xc0be0bc690}, {0x0, 0x0, 0x0})
        	/home/runner/work/nitro/nitro/system_tests/common_test.go:2034 +0x5d
        github.com/offchainlabs/nitro/system_tests.testPrecompiles(0xc050fab500, 0x1e, {0xc0a9077db0, 0x6, 0xc00b9d5c10?})
        	/home/runner/work/nitro/nitro/system_tests/precompile_inclusion_test.go:94 +0x371
        github.com/offchainlabs/nitro/system_tests.TestVersion30(0xc050fab500?)
        	/home/runner/work/nitro/nitro/system_tests/precompile_inclusion_test.go:67 +0x798
        testing.tRunner(0xc050fab500, 0x3d403a0)
        	/opt/hostedtoolcache/go/1.25.5/x64/src/testing/testing.go:1934 +0xea
        created by testing.(*T).Run in goroutine 1
        	/opt/hostedtoolcache/go/1.25.5/x64/src/testing/testing.go:1997 +0x465
        
    precompile_inclusion_test.go:94: �[31;1m [] execution aborted (timeout = 5s) �[0;0m
--- FAIL: TestVersion30 (6.44s)

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

Copy link
Contributor

@bragaigor bragaigor left a comment

Choose a reason for hiding this comment

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

Do we still need to implement ExecutionRecorder methods for ExecutionRPCServer? Something like:

func (c *ExecutionRPCServer) RecordBlockCreation(
	ctx context.Context,
	pos arbutil.MessageIndex,
	msg *arbostypes.MessageWithMetadata,
	wasmTargets []rawdb.WasmTarget,
) (*execution.RecordResult, error) {
	return c.executionRecorder.RecordBlockCreation(ctx, pos, msg, wasmTargets).Await(ctx)
}

and same for PrepareForRecord? But then we would need to add executionRecorder to ExecutionRPCServer or modify ExecutionClient. Or that's be part of another PR? CC: @diegoximenes

@pmikolajczyk41
Copy link
Member Author

@bragaigor yes, definitely, but I didn't want to do it in the same PR to keep changes short and granular; this PR is just a part of NIT-4063 (see the description)

@bragaigor
Copy link
Contributor

@pmikolajczyk41 got it, apologies I missread the description. Also prefers smaller increment PRs

bragaigor
bragaigor previously approved these changes Dec 31, 2025
Copy link
Contributor

@bragaigor bragaigor left a comment

Choose a reason for hiding this comment

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

LGTM

diegoximenes
diegoximenes previously approved these changes Jan 6, 2026
) (*execution.RecordResult, error) {
return n.Recorder.RecordBlockCreation(ctx, pos, msg, wasmTargets)
) containers.PromiseInterface[*execution.RecordResult] {
return stopwaiter.LaunchPromiseThread(n.ExecEngine, func(ctx context.Context) (*execution.RecordResult, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nothing to do about this right now, this is more a question to @tsahee when he reviews this PR 🙂.
Since Promises/LaunchPromiseThread/etc are not a golang native way to handle concurrency, it is not clear to me what would be the ideal scenario here.

It is not clear to me why StopWaiter.LaunchPromiseThread accepts a ThreadLauncher (a StopWaiter "implements" a ThreadLauncher), while StopWaiter.LaunchThread doesn't, for example.

Here ExecutionEngine's StopWaiter is being used to launch a thread in ExecutionNode, and the ctx related to this thread is being used to interact with RecordingDatabase.
Not sure if there is an issue with this.

@diegoximenes diegoximenes assigned tsahee and unassigned diegoximenes Jan 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.

5 participants