Skip to content
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

Partial verification of blob #401

Merged
merged 23 commits into from
Jun 16, 2023
Merged

Partial verification of blob #401

merged 23 commits into from
Jun 16, 2023

Conversation

theochap
Copy link
Contributor

@theochap theochap commented Jun 8, 2023

Description

This PR enables partial verification of blobs. It solves the issue #268

Meaningful changes

  • The method hash has been added to the BlobTransactionTrait, it returns a [u8; 32] array, to be compliant with the internal hash representations used in the template.
  • The structure BufWithCounter has been created, which is a wrapper around Buf. This wrapper maintains an internal counter which tracks the number of bytes read from the inner buffer.
  • The get_extraction_proof function has been added, it produces proofs that the data have been correctly extracted from the block. The extract_relevant_txs_with_proof has been kept for legacy reasons but it should simply calls extract_relevant_txs followed by get_extraction_proof. The get_extraction_proof should be called after the rollup has processed the transaction so that we can track how far we've read from the blob (and hence do the partial blob verification optimization).
  • This PR simplified the structure of the apply_blob function of the module_stf_template. Mainly it avoids reading the whole buffer before checking the headers.
  • The Celestia adapters have been modified to take into account the changes.

Linked Issues

Tests

The test suite has been ran, no other new tests have been created

@codecov
Copy link

codecov bot commented Jun 9, 2023

Codecov Report

Merging #401 (e958ae1) into main (5106884) will decrease coverage by 0.3%.
The diff coverage is 50.4%.

Impacted Files Coverage Δ
adapters/celestia/src/celestia.rs 61.1% <ø> (ø)
adapters/celestia/src/da_service.rs 13.6% <0.0%> (-0.2%) ⬇️
adapters/celestia/src/shares.rs 46.1% <0.0%> (ø)
adapters/celestia/src/verifier/mod.rs 0.0% <0.0%> (ø)
adapters/celestia/src/verifier/proofs.rs 0.0% <0.0%> (ø)
rollup-interface/src/node/services/da.rs 0.0% <0.0%> (ø)
rollup-interface/src/state_machine/stf.rs 61.5% <ø> (ø)
...mplementations/sov-sequencer-registry/src/hooks.rs 93.7% <66.6%> (-0.2%) ⬇️
rollup-interface/src/state_machine/da.rs 75.8% <75.8%> (ø)
rollup-interface/src/state_machine/mocks.rs 61.9% <85.7%> (+0.7%) ⬆️
... and 3 more

... and 6 files with indirect coverage changes

@theochap theochap marked this pull request as ready for review June 9, 2023 16:33
@theochap theochap requested a review from bkolad June 12, 2023 22:53
adapters/celestia/src/da_service.rs Outdated Show resolved Hide resolved
rollup-interface/src/state_machine/da.rs Outdated Show resolved Hide resolved
@theochap
Copy link
Contributor Author

Also, I realized now that merging this PR will very likely solve #298

@theochap theochap linked an issue Jun 14, 2023 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants