-
Notifications
You must be signed in to change notification settings - Fork 293
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Madara <> Celestia #967
Closed
Closed
Madara <> Celestia #967
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Co-authored-by: Lucas @ StarkWare <LucasLvy@users.noreply.github.com> Co-authored-by: drspacemn <dontpanicdao@gmail.com>
Hey @sfyll, |
yes, let's close this. I'll open another one unifying the 3 PRs. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Integrate Celestia as Data Availability Layer:
Continuation of Lambda ZK Week hackathon project Madara <> Celestia.
Integrate Celestia into the Madara client by using it as a Data Availability Layer. To do so, we implement a Celestia module. Within that module, we use the builder pattern to spawn a
CelestiaClient
which is a wrapper around the celestia-node-rs library. We then make available the public methodpublish_state_diff_and_verify_inclusion
, with self-explanatory functionality with the caveat that we verify inclusion by checking that our blob is present in the Namespaced Merkle Tree (NMT), but we don't verify the merkle tree integrity itself by running a merkle inclusion proof.As such, on every
update_state
function call within theDataAvailabilityWorker
struct, we’ll first push the state diff into Celestia and then verify that our Blobs are in the NMT at a specific block height. Sinceupdate_state
is spawned as a non blocking task, we take an optimistic approach whereby it can accumulates n state diffs and fail anywhere in the range [current, n] states.The user can point to different http and ws endpoints by passing these as parameters when launching the Madara client as these will be parsed by
command.rs
using theExtendedRunCommand
struct. By the same token, users will be able to pass in theirauth_token
as parameters so that they can call Celestia RPC endpoints with different access rights.One caveat is that Madara now relies on an external party which might impact its robustness. Nonetheless, given Celestia significantly lower costs for storing data, exploring design patterns so that the client can have some kind of fallback logic might be more than amortized for in the long run.
Summary of Changes
ExtendedRunCommand
:http_endpoint
,ws_endpoint
,auth_token
state_diff
to Celestia and verify that thestate_diff
blob is included in the given heightOpen Questions
State_diff Posting: Should
state_diff
be posted to Celestia asynchronously? Should there be no communication between the STF and thestate_diff
poster? What would be a good fallback strategy in case of an issue when postingstate_diff
and verifying their inclusion?Client Scaling: As the client scales, should we implement the Merkle inclusion proof on the client side to minimize the number of HTTP requests? This would allow for testing the integrity of the Merkle tree.
DA Layer Change: If the Madara user wants to change the DA layer, what would be a good migration mechanism? Should that be a Madara or Celestia task? While Celestia offers some modularity properties such as separation of concern, one cannot switch away from it, breaking the so-called "modular continuity".
How To Run Tests
To set up and run a Celestia light node
Requires the installation of the celestia CLI tool (available here). Once you have that set up, run the following:
Next, we need to generate a JWT to access our light node:
To run a Madara node
We'll just add the generated JWT to the usual command so that we can have the needed access rights. From root, run the following: