Skip to content

Conversation

Tristan-Wilson
Copy link
Member

This PR is a merge of customda-provider-interface (#3600) back into custom-da (#3237), which it was originally split off from, but has changed as it's been updated to address PR comments. There were significant conflicts that have now been resolved on this branch. Assuming #3600 doesn't change too much, then we won't have to rework the merge conflict resolutions that we've already made on this branch and can just merge it to custom-da after first merging in master. Basically I'm hoping that I've been able to frontload the merge conflict resolutions before #3600 is "done".

In the meantime we can target this branch instead of custom-da for further Custom DA project development.

Tristan-Wilson and others added 26 commits September 9, 2025 13:58
This is part of a series of changes for the Custom DA project.

Summary:
- Added a new daprovider.Validator interface with methods for generating
  proofs for Custom DA systems.
- Added a reference implementation of a Custom DA provider.
- Added a daprovider factory that supports anytrust and referenceda
  modes. In a follow-up PR the nitro node startup sequence will be
  modified to use this. Currently only the separate daprovider server uses
  this.
- Replaced the AnyTrust-specific (aka das) provider server with a
  unified provider server that works with anytrust or referenceda modes.
- Extended the DA Client with new RPC methods for generating proofs.

Notes: The separate provider server executable is a thin RPC server
wrapper around the anytrust and referenceda implementations. The idea is
that people wanting to integrate their own DA system can use this as a
guide for how to implement their own RPC service that lives outside the
nitro codebase; we won't be including support for any additional DA
implementations in provider server executable that we distribute. For
legacy AnyTrust deployments we will most likely continue to have nitro
spawn the daprovider server in-process to avoid needing to run an extra
service, but by channeling everything through the JSON-RPC interface it
reduces surface area of what we have to support.

The Reference DA (referenceda) implementation is a minimal working
example of how one could implement a daprovider, including support for
validating the certificate against trusted signers. It uses an in-memory
data storage backend.

In various places there is commented out code related to the osp
contract bindings that haven't yet been committed to a nitro-contracts
branch that we want to use in nitro master.

This PR shouldn't change any existing functionality or behavior, except
the daprovider executable (which isn't used in production) has some
new configuration options:
```
 --mode               must be "anytrust" or "referenceda"
 --provider-server.*  server config eg address, port, etc
 --anytrust.*         was previosly called das-server
 --referenceda.*      referenceda specific options
```

As much as possible we will try to rename references to "das" to
"anytrust". When we launched Anytrust, we only had one offchain data
availability mode so we just called it "das" at the time.

This PR doesn't include new test code, but testing was done with the
end-to-end block validator and challenge system tests on the custom-da
branch.
We will add DACertificateMessageHeaderFlag back to KnownHeaderBits in
a future PR; removing it for now avoids changing the replay binary
unnecessarily when merging in this PR.
daprovider.Readers are now registered with their respective header bytes
at initialization. For external DA providers where the RPC client is used
this becomes single call at init to daprovider_getSupportedHeaderBytes.

Where previously in the inbox and block validator components we had
loops over each provider, checking each provider if they handle that
type of message, we now just check if we have a provider registered for
that message.

This means less RPC calls and makes the interface that providers need to
implement a bit simpler, with room for taking it out completely for
CustomDA if we can detect from other config that the external provider
is expected to be a CustomDA provider.
We moved the contents of dasserver to provider_server on the custom-da
branch and I accidentally left dasserver in place on this branch when
moving things across. I don't want to bring over the changes to the
daprovider construction logic in node.go yet so I just made the
das_migration.go file which we'll delete later.
In normal execution we only care about the payload, and in validation we
only care about the preimages (we will reconstruct the payload using the
preimages). This change separates these concerns and simplifies the
signatures of these methods.
For DAS and ReferenceDA we almost always want to validate the
certificate. The only time we don't is in the replay binary when we want
to panic instead if it's invalid on the first read of the message,
otherwise we want to ignore it and assume it's already valid. So this
means that it doesn't make sense for validateSeqMsg to be part of the
reader API at all, which is great because it means we can simplify the
API. We can pass into the reader at construction time how to handle this
because in replay it always constructs a new (fake, non-network calling)
reader for each invocation.
#3700 was opened to address docker authentication issues, but turns out original problem was caused simply because docker hub was down
The DbStorageService has been deprecated for over a year, with a
warning printed for any remaining users during that time informing them
of how to migrate and that if they didn't, continuing to try to use it
would be a fatal error in future. The future is here.

This also lets us remove badgerdb is a dependency.
…block snapshot (#3619)

Co-authored-by: Raul Jordan <[email protected]>
Co-authored-by: Joshua Colvin <[email protected]>
Co-authored-by: Pepper Lebeck-Jobe <[email protected]>
…tools (#3702)

* fix inconsistent setup-go versions across workflows

* update golangci-lint to v2.5.0 (latest stable release)

* Update _fast.yml

* upgrade Go version from 1.24.5 to 1.25

* Update Dockerfile

* Update Dockerfile

---------

Co-authored-by: Pepper Lebeck-Jobe <[email protected]>
* fix(events): use stable subscription ids and remove by id

* Update producer.go

* Update producer.go

* Update producer_test.go

* Update producer.go

* Update producer_test.go

---------

Co-authored-by: Pepper Lebeck-Jobe <[email protected]>
…tomda-daprovider-interface

Resolved conflicts from changes on customda-daprovider-interface branch,
mostly keep changes from that branch except where code had been
temporarily commented out.
Also update the evil_da_provider to use the new separate RecoverPayload
and CollectPreimages.
@Tristan-Wilson Tristan-Wilson marked this pull request as draft September 26, 2025 10:10
avorylli and others added 26 commits September 29, 2025 05:47
Co-authored-by: Pepper Lebeck-Jobe <[email protected]>
The RUN_URL needs to be interpolated by the github actions framework. This
doesn't happen if without the double braces. Also, the action expects valid JSON
input, so even more braces are applied to the payload argument.

Fixes: NIT-3924
* Update sequencer.go

* Update restful_server.go

* Update dasRpcServer.go

* Update dasRpcClient.go

* Update validation_client.go

* Update dasRpcClient.go

* Update dasRpcServer.go

* Update restful_server.go

* Update validation_client.go

* lint

* ci fix

---------

Co-authored-by: Pepper Lebeck-Jobe <[email protected]>
Co-authored-by: Tristan-Wilson <[email protected]>
…der-interface' into pmikolajczyk/nit-3515

# Conflicts:
#	daprovider/server/das_migration.go
Co-authored-by: Ganesh Vanahalli <[email protected]>
* Add multi-dimensional gas metrics

* Add total multigas metrics

* Change multigas metrics from histograms to counters

---------

Co-authored-by: Pepper Lebeck-Jobe <[email protected]>
Use streaming protocol between DA client and DA provider server
* Instrument multi-gas in precompiles

Close NIT-1557

* Bump go-ethereum

* Change balance multi-gas dimension

* Test for context burn, burned and gas left

* Fix lint warning
* Reduce CI

* Run basic test results action

* Parse junitfile argument for gotestsum

* Add permissions: pull-requests: write

* ... in a right place. Also fail if tests fail

* Fail test intentionally

* Inspect the problem

* parse single file

* fail another test

* print why 22 tests failed

* single rerun

* run for defaults

* fix l3challenge test mode

* revert geth update

* shortening script

* run script in CI

* keep last 20 lines instead of first 2048 characters

* move codecov steps just after testing

* revert changes to ci.yml

* Try nextest

* Upload Rust results

* Upload go test results

* revert changes to docker

* merge results from different workflows

* needs

* line breaks

* line breaks

* rm icon

* minor fixes

* restore CI

* needs fix

* permissions:
      pull-requests: write

* revert

* whitechars
* Refactor caller context creationi and remove redundant argument

* fir merge conflicts
* Instrument multi-gas in precompiles

Close NIT-1557

* Bump go-ethereum

* Change balance multi-gas dimension

* Test for context burn, burned and gas left

* Fix lint warning

* Merge v1.16.4

---------

Co-authored-by: Gabriel de Quadros Ligneul <[email protected]>
Co-authored-by: Pepper Lebeck-Jobe <[email protected]>
Co-authored-by: Pepper Lebeck-Jobe <[email protected]>
… and persistent checks (#3735)

Co-authored-by: Pepper Lebeck-Jobe <[email protected]>
* s/github.ref/github.head_ref

* actually... both

* add fallback value
* remove: delete unused HashPlusInt function from arbos/util

* Update util.go

---------

Co-authored-by: Pepper Lebeck-Jobe <[email protected]>
* Add DA proof support to daprovider interface

This is part of a series of changes for the Custom DA project.

Summary:
- Added a new daprovider.Validator interface with methods for generating
  proofs for Custom DA systems.
- Added a reference implementation of a Custom DA provider.
- Added a daprovider factory that supports anytrust and referenceda
  modes. In a follow-up PR the nitro node startup sequence will be
  modified to use this. Currently only the separate daprovider server uses
  this.
- Replaced the AnyTrust-specific (aka das) provider server with a
  unified provider server that works with anytrust or referenceda modes.
- Extended the DA Client with new RPC methods for generating proofs.

Notes: The separate provider server executable is a thin RPC server
wrapper around the anytrust and referenceda implementations. The idea is
that people wanting to integrate their own DA system can use this as a
guide for how to implement their own RPC service that lives outside the
nitro codebase; we won't be including support for any additional DA
implementations in provider server executable that we distribute. For
legacy AnyTrust deployments we will most likely continue to have nitro
spawn the daprovider server in-process to avoid needing to run an extra
service, but by channeling everything through the JSON-RPC interface it
reduces surface area of what we have to support.

The Reference DA (referenceda) implementation is a minimal working
example of how one could implement a daprovider, including support for
validating the certificate against trusted signers. It uses an in-memory
data storage backend.

In various places there is commented out code related to the osp
contract bindings that haven't yet been committed to a nitro-contracts
branch that we want to use in nitro master.

This PR shouldn't change any existing functionality or behavior, except
the daprovider executable (which isn't used in production) has some
new configuration options:
```
 --mode               must be "anytrust" or "referenceda"
 --provider-server.*  server config eg address, port, etc
 --anytrust.*         was previosly called das-server
 --referenceda.*      referenceda specific options
```

As much as possible we will try to rename references to "das" to
"anytrust". When we launched Anytrust, we only had one offchain data
availability mode so we just called it "das" at the time.

This PR doesn't include new test code, but testing was done with the
end-to-end block validator and challenge system tests on the custom-da
branch.

* Reduce code duplication in factory, more cert validation

* Fix for interface change on master

* Remove DACert flag from KnownHeaderBits for now

We will add DACertificateMessageHeaderFlag back to KnownHeaderBits in
a future PR; removing it for now avoids changing the replay binary
unnecessarily when merging in this PR.

* Remove preimageType from daprovider.Validator

* Remove IsValidHeaderByte from RPC API

daprovider.Readers are now registered with their respective header bytes
at initialization. For external DA providers where the RPC client is used
this becomes single call at init to daprovider_getSupportedHeaderBytes.

Where previously in the inbox and block validator components we had
loops over each provider, checking each provider if they handle that
type of message, we now just check if we have a provider registered for
that message.

This means less RPC calls and makes the interface that providers need to
implement a bit simpler, with room for taking it out completely for
CustomDA if we can detect from other config that the external provider
is expected to be a CustomDA provider.

* Move daprovider api types to own go pkg

* Use Promises with daprovider.Reader iface

* dasserver migration to provider_server

We moved the contents of dasserver to provider_server on the custom-da
branch and I accidentally left dasserver in place on this branch when
moving things across. I don't want to bring over the changes to the
daprovider construction logic in node.go yet so I just made the
das_migration.go file which we'll delete later.

* Split rpc payload and preimage methods

In normal execution we only care about the payload, and in validation we
only care about the preimages (we will reconstruct the payload using the
preimages). This change separates these concerns and simplifies the
signatures of these methods.

* Removed the validateSeqMsg param from Reader

For DAS and ReferenceDA we almost always want to validate the
certificate. The only time we don't is in the replay binary when we want
to panic instead if it's invalid on the first read of the message,
otherwise we want to ignore it and assume it's already valid. So this
means that it doesn't make sense for validateSeqMsg to be part of the
reader API at all, which is great because it means we can simplify the
API. We can pass into the reader at construction time how to handle this
because in replay it always constructs a new (fake, non-network calling)
reader for each invocation.

* Use Promises with Validator interface

* Add missing import

* Resgister DAS reader with both flag variants

* Use cancelable promises

* Fix reader registration for batch correctness checking

* Use promise for GetSupportedHeaderBytes too
…tomda-daprovider-interface

Fix conflicts related to Promises, streaming store, commented out usages
of contracts.
@Tristan-Wilson Tristan-Wilson marked this pull request as ready for review October 2, 2025 11:18
@Tristan-Wilson Tristan-Wilson merged commit 7ab608d into custom-da Oct 2, 2025
14 checks passed
@Tristan-Wilson Tristan-Wilson deleted the custom-da-merge-customda-daprovider-interface branch October 2, 2025 11:18
Copy link

github-actions bot commented Oct 2, 2025

❌ 11 Tests Failed:

Tests completed Failed Passed Skipped
2171 11 2160 0
View the top 3 failed tests by shortest run time
TestTimeboostBulkBlockMetadataAPI
Stack Traces | 2.920s run time
... [CONTENT TRUNCATED: Keeping last 20 lines]
INFO [10-02|11:14:01.471] Persisted trie from memory database      nodes=19  flushnodes=0 size=3.36KiB   flushsize=0.00B time="110.368µs" flushtime=0s gcnodes=0    gcsize=0.00B      gctime=0s          livenodes=193   livesize=32.96KiB
INFO [10-02|11:14:01.471] Writing cached state to disk             block=2    hash=4b0f72..5db462 root=b3090d..8ca8c4
INFO [10-02|11:14:01.471] Persisted trie from memory database      nodes=19  flushnodes=0 size=3.14KiB   flushsize=0.00B time="129.464µs" flushtime=0s gcnodes=0    gcsize=0.00B      gctime=0s          livenodes=174   livesize=29.83KiB
INFO [10-02|11:14:01.471] Writing snapshot state to disk           root=9dfbf2..cb68b4
INFO [10-02|11:14:01.471] Persisted trie from memory database      nodes=0   flushnodes=0 size=0.00B     flushsize=0.00B time="1.332µs"   flushtime=0s gcnodes=0    gcsize=0.00B      gctime=0s          livenodes=174   livesize=29.83KiB
DEBUG[10-02|11:14:01.471] Dereferenced trie from memory database   nodes=0   size=0.00B     time=671ns       gcnodes=0    gcsize=0.00B      gctime=401ns       livenodes=174   livesize=29.83KiB
DEBUG[10-02|11:14:01.471] Dereferenced trie from memory database   nodes=19  size=3.17KiB   time="60.403µs"  gcnodes=19   gcsize=3.17KiB    gctime="60.674µs"  livenodes=155   livesize=26.66KiB
DEBUG[10-02|11:14:01.471] Dereferenced trie from memory database   nodes=19  size=3.20KiB   time="44.473µs"  gcnodes=38   gcsize=6.37KiB    gctime="105.017µs" livenodes=136   livesize=23.46KiB
DEBUG[10-02|11:14:01.471] Dereferenced trie from memory database   nodes=19  size=3.23KiB   time="34.395µs"  gcnodes=57   gcsize=9.60KiB    gctime="139.291µs" livenodes=117   livesize=20.22KiB
DEBUG[10-02|11:14:01.471] Dereferenced trie from memory database   nodes=19  size=3.26KiB   time="38.893µs"  gcnodes=76   gcsize=12.87KiB   gctime="178.074µs" livenodes=98    livesize=16.96KiB
DEBUG[10-02|11:14:01.472] Dereferenced trie from memory database   nodes=19  size=3.29KiB   time="46.798µs"  gcnodes=95   gcsize=16.16KiB   gctime="224.752µs" livenodes=79    livesize=13.66KiB
DEBUG[10-02|11:14:01.472] Dereferenced trie from memory database   nodes=20  size=3.42KiB   time="38.963µs"  gcnodes=115  gcsize=19.59KiB   gctime="263.615µs" livenodes=59    livesize=10.24KiB
DEBUG[10-02|11:14:01.472] Dereferenced trie from memory database   nodes=19  size=3.33KiB   time="42.57µs"   gcnodes=134  gcsize=22.91KiB   gctime="306.064µs" livenodes=40    livesize=6.91KiB
DEBUG[10-02|11:14:01.472] Dereferenced trie from memory database   nodes=20  size=3.46KiB   time="36.849µs"  gcnodes=154  gcsize=26.37KiB   gctime="342.803µs" livenodes=20    livesize=3.46KiB
DEBUG[10-02|11:14:01.472] Dereferenced trie from memory database   nodes=20  size=3.46KiB   time="35.768µs"  gcnodes=174  gcsize=29.83KiB   gctime="378.471µs" livenodes=0     livesize=0.00B
DEBUG[10-02|11:14:01.472] Dereferenced trie from memory database   nodes=0   size=0.00B     time=171ns       gcnodes=174  gcsize=29.83KiB   gctime="378.551µs" livenodes=0     livesize=0.00B
DEBUG[10-02|11:14:01.472] Dereferenced trie from memory database   nodes=0   size=0.00B     time=150ns       gcnodes=174  gcsize=29.83KiB   gctime="378.611µs" livenodes=0     livesize=0.00B
INFO [10-02|11:14:01.472] Blockchain stopped
TRACE[10-02|11:14:01.494] P2P networking is spinning down
--- FAIL: TestTimeboostBulkBlockMetadataAPI (2.92s)
TestVersion30
Stack Traces | 9.790s run time
... [CONTENT TRUNCATED: Keeping last 20 lines]
=== CONT  TestVersion30
    precompile_inclusion_test.go:90: goroutine 557276 [running]:
        runtime/debug.Stack()
        	/opt/hostedtoolcache/go/1.25.1/x64/src/runtime/debug/stack.go:26 +0x5e
        github.com/offchainlabs/nitro/util/testhelpers.RequireImpl({0x4078d30, 0xc0c517c540}, {0x4036da0, 0xc0dc5fac30}, {0x0, 0x0, 0x0})
        	/home/runner/work/nitro/nitro/util/testhelpers/testhelpers.go:29 +0x55
        github.com/offchainlabs/nitro/system_tests.Require(0xc0c517c540, {0x4036da0, 0xc0dc5fac30}, {0x0, 0x0, 0x0})
        	/home/runner/work/nitro/nitro/system_tests/common_test.go:1818 +0x5d
        github.com/offchainlabs/nitro/system_tests.testPrecompiles(0xc0c517c540, 0x1e, {0xc093775db0, 0x6, 0x0?})
        	/home/runner/work/nitro/nitro/system_tests/precompile_inclusion_test.go:90 +0x371
        github.com/offchainlabs/nitro/system_tests.TestVersion30(0xc0c517c540?)
        	/home/runner/work/nitro/nitro/system_tests/precompile_inclusion_test.go:67 +0x798
        testing.tRunner(0xc0c517c540, 0x3cc1038)
        	/opt/hostedtoolcache/go/1.25.1/x64/src/testing/testing.go:1934 +0xea
        created by testing.(*T).Run in goroutine 1
        	/opt/hostedtoolcache/go/1.25.1/x64/src/testing/testing.go:1997 +0x465
        
    precompile_inclusion_test.go:90: �[31;1m [] execution aborted (timeout = 5s) �[0;0m
�[38;5;48;1myay!! we validated block 8 in 101.22ms�[0;0m
--- FAIL: TestVersion30 (9.79s)
TestVersion40
Stack Traces | 9.800s run time
... [CONTENT TRUNCATED: Keeping last 20 lines]
=== PAUSE TestVersion40
=== CONT  TestVersion40
    precompile_inclusion_test.go:90: goroutine 557277 [running]:
        runtime/debug.Stack()
        	/opt/hostedtoolcache/go/1.25.1/x64/src/runtime/debug/stack.go:26 +0x5e
        github.com/offchainlabs/nitro/util/testhelpers.RequireImpl({0x4078d30, 0xc0c517c700}, {0x4036da0, 0xc08a5caa80}, {0x0, 0x0, 0x0})
        	/home/runner/work/nitro/nitro/util/testhelpers/testhelpers.go:29 +0x55
        github.com/offchainlabs/nitro/system_tests.Require(0xc0c517c700, {0x4036da0, 0xc08a5caa80}, {0x0, 0x0, 0x0})
        	/home/runner/work/nitro/nitro/system_tests/common_test.go:1818 +0x5d
        github.com/offchainlabs/nitro/system_tests.testPrecompiles(0xc0c517c700, 0x28, {0xc120b87df8, 0x5, 0x39?})
        	/home/runner/work/nitro/nitro/system_tests/precompile_inclusion_test.go:90 +0x371
        github.com/offchainlabs/nitro/system_tests.TestVersion40(0xc0c517c700?)
        	/home/runner/work/nitro/nitro/system_tests/precompile_inclusion_test.go:71 +0x64b
        testing.tRunner(0xc0c517c700, 0x3cc1040)
        	/opt/hostedtoolcache/go/1.25.1/x64/src/testing/testing.go:1934 +0xea
        created by testing.(*T).Run in goroutine 1
        	/opt/hostedtoolcache/go/1.25.1/x64/src/testing/testing.go:1997 +0x465
        
    precompile_inclusion_test.go:90: �[31;1m [] execution aborted (timeout = 5s) �[0;0m
--- FAIL: TestVersion40 (9.80s)

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

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.