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

Update L1Tx ref types to include multiple proto ops per tx #618

Merged
merged 22 commits into from
Feb 6, 2025

Conversation

bewakes
Copy link
Contributor

@bewakes bewakes commented Jan 20, 2025

Description

This PR does the following:

  1. Adds trait BlockIndexer that takes L1 blocks and parses/extracts/processes relevant data and OpsVisitor that is to be used by a "BlockIndexer" which allows for different processing of relevant info found in transactions.
  2. There are two implementations of OpsVisitor: ClientOpsVisitor and ProverOpsVisitor which differ in that ProverOpsVisitor is intended to just extract DA commitments from transactions efficiently without actually storing/processing the whole da content.
  3. Remove the use of filter_protocol_op_tx_refs function whose functionality is better provided by BlockIndexer and OpsVisitors.
  4. Adds unit test that tests multiple protocol ops(checkpoint and deposit in particular) can be parsed from a single transaction. Previously, only one operation could be parsed from a transaction. Also updates tests accordingly.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature/Enhancement (non-breaking change which adds functionality or enhances an existing one)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactor
  • New or updated tests
  • Dependency Update

Notes to Reviewers

Checklist

  • I have performed a self-review of my code.
  • I have commented my code where necessary.
  • I have updated the documentation if needed.
  • My changes do not introduce new warnings.
  • I have added tests that prove my changes are effective or that my feature works.
  • New and existing tests pass with my changes.

Related Issues

STR-935

@bewakes bewakes force-pushed the STR-807-inscription-changes branch from da8be4c to e78e71d Compare January 20, 2025 10:12
Copy link
Contributor

github-actions bot commented Jan 20, 2025

Commit: 1278523

SP1 Performance Test Results

program cycles success
BTC_BLOCKSPACE 30,370,449
EL_BLOCK 97,975
CL_BLOCK 91,422
L1_BATCH 30,420,181
L2_BATCH 5,473
CHECKPOINT 28,014

@bewakes bewakes force-pushed the STR-807-inscription-changes branch 4 times, most recently from 0a66e86 to d8f04ee Compare January 21, 2025 11:26
@bewakes bewakes force-pushed the STR-402-rework-protocol-op-types branch 2 times, most recently from 6c885d6 to 505735d Compare January 21, 2025 12:18
@bewakes bewakes marked this pull request as ready for review January 21, 2025 13:03
@bewakes bewakes requested review from a team as code owners January 21, 2025 13:03
Copy link

codecov bot commented Jan 21, 2025

Codecov Report

Attention: Patch coverage is 82.68349% with 151 lines in your changes missing coverage. Please review.

Project coverage is 54.87%. Comparing base (2830f20) to head (aecb268).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
crates/l1tx/src/messages.rs 29.72% 52 Missing ⚠️
crates/state/src/tx.rs 0.00% 21 Missing ⚠️
crates/btcio/src/reader/tx_indexer.rs 91.62% 19 Missing ⚠️
crates/consensus-logic/src/l1_handler.rs 0.00% 13 Missing ⚠️
crates/proof-impl/btc-blockspace/src/tx_indexer.rs 92.52% 13 Missing ⚠️
crates/btcio/src/reader/query.rs 47.05% 9 Missing ⚠️
crates/l1tx/src/filter/indexer.rs 77.50% 9 Missing ⚠️
crates/l1tx/src/filter/mod.rs 96.24% 5 Missing ⚠️
...tes/sequencer/src/block_template/block_assembly.rs 0.00% 4 Missing ⚠️
crates/proof-impl/btc-blockspace/src/filter.rs 50.00% 2 Missing ⚠️
... and 3 more
@@            Coverage Diff             @@
##             main     #618      +/-   ##
==========================================
+ Coverage   54.68%   54.87%   +0.18%     
==========================================
  Files         314      317       +3     
  Lines       33580    33973     +393     
==========================================
+ Hits        18363    18641     +278     
- Misses      15217    15332     +115     
Files with missing lines Coverage Δ
crates/btcio/src/test_utils.rs 62.10% <100.00%> (+6.00%) ⬆️
crates/btcio/src/writer/builder.rs 98.03% <ø> (ø)
crates/chaintsn/src/transition.rs 82.86% <100.00%> (ø)
crates/l1tx/src/deposit/deposit_request.rs 98.84% <ø> (ø)
crates/l1tx/src/deposit/deposit_tx.rs 96.10% <ø> (ø)
crates/l1tx/src/deposit/test_utils.rs 100.00% <ø> (ø)
crates/l1tx/src/envelope/parser.rs 97.50% <100.00%> (ø)
crates/rocksdb-store/src/l1/db.rs 97.65% <100.00%> (ø)
crates/rocksdb-store/src/l2/db.rs 99.42% <100.00%> (ø)
crates/state/src/l1/tx.rs 64.70% <100.00%> (-2.95%) ⬇️
... and 15 more

... and 5 files with indirect coverage changes

Copy link
Contributor

@delbonis delbonis left a comment

Choose a reason for hiding this comment

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

Need to rework the data structures a little bit to make them more accurately reflect the design we have now.

Also, see the visitor-oriented approach. The goal with that was to decouple the "figuring out what to do with protocol ops we get" from the "actually finding the protocol ops" parts so that handling can be different depending on if it's in the proof or in the reader.

crates/l1tx/src/filter.rs Outdated Show resolved Hide resolved
crates/state/src/tx.rs Outdated Show resolved Hide resolved
crates/state/src/state_op.rs Outdated Show resolved Hide resolved
crates/l1tx/src/messages.rs Outdated Show resolved Hide resolved
@bewakes bewakes mentioned this pull request Jan 22, 2025
13 tasks
@bewakes bewakes force-pushed the STR-807-inscription-changes branch from d8f04ee to 3eb992c Compare January 23, 2025 10:01
@bewakes bewakes requested a review from a team as a code owner January 23, 2025 10:01
@bewakes bewakes force-pushed the STR-402-rework-protocol-op-types branch from 9991efb to 501dbc9 Compare January 23, 2025 10:10
@bewakes bewakes requested a review from delbonis January 23, 2025 10:28
Copy link
Contributor

@delbonis delbonis left a comment

Choose a reason for hiding this comment

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

(Discussed in core sync, leaving review here to continue work.)

crates/l1tx/src/filter/visitor.rs Outdated Show resolved Hide resolved
crates/l1tx/src/filter/visitor.rs Outdated Show resolved Hide resolved
@bewakes bewakes force-pushed the STR-807-inscription-changes branch from 3eb992c to d7dc0a9 Compare January 24, 2025 05:53
@bewakes bewakes force-pushed the STR-402-rework-protocol-op-types branch from fcf9d7c to 5365d49 Compare January 27, 2025 06:43
@bewakes bewakes requested review from a team as code owners January 27, 2025 06:43
@bewakes
Copy link
Contributor Author

bewakes commented Jan 28, 2025

Updated the description and made changes.

@bewakes bewakes force-pushed the STR-402-rework-protocol-op-types branch from e8ee5db to c3f0ec2 Compare February 5, 2025 07:20
@bewakes bewakes requested a review from delbonis February 5, 2025 07:35
@bewakes bewakes force-pushed the STR-402-rework-protocol-op-types branch from b93aed9 to 16b29d2 Compare February 6, 2025 07:01
@bewakes bewakes force-pushed the STR-402-rework-protocol-op-types branch from 16b29d2 to aecb268 Compare February 6, 2025 11:39
@delbonis
Copy link
Contributor

delbonis commented Feb 6, 2025

Merging to unblock some new work.

@delbonis delbonis merged commit 4dd699f into main Feb 6, 2025
18 of 19 checks passed
@delbonis delbonis deleted the STR-402-rework-protocol-op-types branch February 6, 2025 17:18
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.

2 participants