Skip to content

Receipts working with Generic Struct Extraction#430

Open
Zyouell wants to merge 318 commits into
mainfrom
zyouell/receipt-rebase
Open

Receipts working with Generic Struct Extraction#430
Zyouell wants to merge 318 commits into
mainfrom
zyouell/receipt-rebase

Conversation

@Zyouell

@Zyouell Zyouell commented Jan 14, 2025

Copy link
Copy Markdown
Contributor

This PR closes CRY-21 upon merge.

A very sizeable PR that makes the Generic Struct Extraction Code and Receipt Extraction Code work together.

It has made reasonably large differences to both. The most noticeable is the change to ColumnData, ColumnDataGadget and MetadataGadget. Since the EVM only works in bytes I have removed the bit_offset aspects of the code and rewritten the extraction circuits to reflect this. They now no longer use lookups which should result in an overall speed up in proving time (since you no longer have to run the lookup PIOP).

In addition to this, instead of just having ColumnInfo we now have ExtractedColumnInfo and InputColumnInfo. This is to reduce work done when computing value digests but still keep everything grouped together.

The Receipt extraction now uses the new TableMetadata struct just like struct extraction does and I have also made a From<EventLogInfo> implementation to easily construct columns with identifiers.

I tried to remove some of the unnecessary generic constants (for instance those on storage leaf nodes and MPT extension nodes) that have a fixed length when viewed in a circuit. In order to make the compiler stop complaining about unconstrained generic constant I had to use the actual number values rather than being able to declare a constant and use that.

For Receipt proving in the integration test we use the code in mp2_v1/src/value_extraction/planner.rs since we don't need to keep track of previous value extraction in the receipt case.

nikkolasg and others added 30 commits September 23, 2024 20:02
…et_unsafe` for initializing with one target.
Comment thread mp2-v1/src/final_extraction/receipt_circuit.rs Outdated
Comment thread mp2-v1/src/final_extraction/receipt_circuit.rs Outdated
Comment thread mp2-v1/src/values_extraction/gadgets/column_info.rs Outdated
Comment thread mp2-v1/src/values_extraction/gadgets/column_info.rs Outdated
Comment thread mp2-v1/src/values_extraction/gadgets/column_info.rs Outdated
Comment thread mp2-v1/src/values_extraction/gadgets/metadata_gadget.rs
Comment thread mp2-v1/src/values_extraction/gadgets/metadata_gadget.rs Outdated
Comment thread mp2-v1/src/values_extraction/leaf_receipt.rs
Comment thread mp2-v1/src/values_extraction/gadgets/column_info.rs Outdated
Comment thread mp2-v1/src/values_extraction/gadgets/column_info.rs Outdated

@nicholas-mainardi nicholas-mainardi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Took a look at the circuit code again to see changes done. Nice improvements but I think there are still a couple of changes to be done to circuits and APIs

Comment thread mp2-v1/src/values_extraction/gadgets/column_info.rs

@nicholas-mainardi nicholas-mainardi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks definitely better now, thanks for all the changes! I think that in terms of circuits the only thing left is binding the extraction ids of extracted columns to the data found in the receipt trie node, and the potential issue with the RLP decoding of the transaction index. Other previous issues look solved now to me. All other comments are all minor/quick things. I will take a look to all the non circuit code as well next.

Comment thread mp2-common/src/array.rs
Comment thread mp2-common/src/keccak.rs
Comment thread mp2-common/src/rlp.rs
Comment thread mp2-common/src/rlp.rs
Comment thread mp2-v1/src/values_extraction/gadgets/column_info.rs
Comment thread mp2-common/src/array.rs
Comment thread mp2-common/src/serialization/circuit_data_serialization.rs
Comment thread mp2-v1/src/values_extraction/dummy.rs
Comment thread mp2-v1/src/values_extraction/api.rs
Comment thread mp2-common/src/keccak.rs
Comment thread mp2-common/src/eth.rs
Comment thread mp2-common/src/eth.rs
Comment thread mp2-common/src/eth.rs
Comment thread mp2-common/src/eth.rs
}
}

pub struct BlockUtil {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why not moving it to test module given that it seems to be used only in tests?

Comment thread mp2-common/src/eth.rs
Comment thread mp2-v1/tests/common/cases/table_source.rs
Comment thread mp2-v1/tests/common/cases/indexing.rs
Comment thread mp2-v1/src/values_extraction/planner.rs
Comment thread mp2-v1/src/values_extraction/planner.rs
Comment thread mp2-v1/src/values_extraction/planner.rs
Base automatically changed from generic-extraction-integration-test-mapping-of-mappings to generic-extraction-integration-test March 5, 2025 11:16
Base automatically changed from generic-extraction-integration-test to generic-extraction-row-id-update March 5, 2025 14:24
Base automatically changed from generic-extraction-row-id-update to generic-extraction-tree-creation March 5, 2025 14:51
Base automatically changed from generic-extraction-tree-creation to generic-mpt-extraction March 5, 2025 15:41
Base automatically changed from generic-mpt-extraction to feat/new_extraction_features March 5, 2025 21:04
@nicholas-mainardi nicholas-mainardi force-pushed the feat/new_extraction_features branch from 9d292a7 to 0d3f1d4 Compare April 4, 2025 11:09
@delehef delehef force-pushed the feat/new_extraction_features branch 2 times, most recently from 1345edd to 9a0932c Compare April 10, 2025 17:10
Base automatically changed from feat/new_extraction_features to main April 16, 2025 15:54
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.

5 participants