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

perf(storage)!: not save event_offset in the events table #2062

Merged
merged 1 commit into from
Jun 10, 2024

Conversation

DvirYo-starkware
Copy link
Contributor

@DvirYo-starkware DvirYo-starkware commented May 28, 2024

This change is Reviewable

Copy link

codecov bot commented May 28, 2024

Codecov Report

Attention: Patch coverage is 82.25806% with 11 lines in your changes missing coverage. Please review.

Project coverage is 69.02%. Comparing base (afef1e6) to head (f164dbf).

Files Patch % Lines
crates/papyrus_storage/src/body/events.rs 83.01% 2 Missing and 7 partials ⚠️
crates/papyrus_storage/src/body/mod.rs 77.77% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2062   +/-   ##
=======================================
  Coverage   69.01%   69.02%           
=======================================
  Files         130      130           
  Lines       17426    17447   +21     
  Branches    17426    17447   +21     
=======================================
+ Hits        12026    12042   +16     
- Misses       4068     4069    +1     
- Partials     1332     1336    +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@dan-starkware dan-starkware left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 5 files at r1, all commit messages.
Reviewable status: 2 of 5 files reviewed, 4 unresolved discussions (waiting on @DvirYo-starkware and @ShahakShama)

a discussion (no related file):
Please check and add TODO in case we don't really need the capability of iterating by more than one contract.



crates/papyrus_storage/src/body/events.rs line 144 at r2 (raw file):

    txn: &'txn DbTransaction<'env, RO>,
    file_handles: &'txn FileHandlers<RO>,
    // This value is the next event to return. If it is None there are no more events.

Please rephrase better
Also, rename to something along next_entry_in_event_table

Code quote:

// This value is the next event to return. If it is None there are no more events.

crates/papyrus_storage/src/body/events.rs line 151 at r2 (raw file):

    cursor: EventsTableCursor<'txn>,
    transaction_metadata_table: TransactionMetadataTable<'env>,
    current_event_index: usize,

This is the offset in the transaction output, right?

Code quote:

current_event_index

crates/papyrus_storage/src/body/events.rs line 321 at r2 (raw file):

            transaction_metadata_table,
            current_event_index: key.1.1.0,
            current_contract_address: key.0,

Should be taken from current?

Code quote:

current_contract_address: key.0,

Copy link
Contributor Author

@DvirYo-starkware DvirYo-starkware left a comment

Choose a reason for hiding this comment

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

Reviewable status: 2 of 5 files reviewed, 3 unresolved discussions (waiting on @ShahakShama)


crates/papyrus_storage/src/body/events_test.rs line 22 at r1 (raw file):

    let from_addresses =
        vec![ContractAddress(patricia_key!("0x22")), ContractAddress(patricia_key!("0x23"))];
    let block = get_test_block(4, Some(5), Some(from_addresses), None);

added more blocks for the test for more coverage


crates/papyrus_storage/src/body/events_test.rs line 100 at r3 (raw file):

        EventIndexInTransactionOutput(2),
    );
    let txn = storage_reader.begin_ro_txn().unwrap();

fix the bug in the test also for the event iter by index test

@DvirYo-starkware DvirYo-starkware force-pushed the dvir/remove_event_index branch 2 times, most recently from 621a8d9 to b15362a Compare June 9, 2024 12:41
Copy link
Collaborator

@dan-starkware dan-starkware left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 5 of 5 files at r6, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @ShahakShama)

@DvirYo-starkware DvirYo-starkware added this pull request to the merge queue Jun 10, 2024
Merged via the queue into main with commit 1faf8c3 Jun 10, 2024
18 of 19 checks passed
@DvirYo-starkware DvirYo-starkware deleted the dvir/remove_event_index branch June 10, 2024 11:59
@github-actions github-actions bot locked and limited conversation to collaborators Jun 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants