-
Notifications
You must be signed in to change notification settings - Fork 35
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
feat(starknet_os,starknet_patricia,starknet_committer): deserializable commitment info #3990
Conversation
1cc02e1
to
26bbea3
Compare
26bbea3
to
2f63798
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 12 files reviewed, all discussions resolved (waiting on @aner-starkware and @Yoni-Starkware)
crates/starknet_patricia/Cargo.toml
line 13 at r2 (raw file):
[features] deserialize = ["ethnum/serde"]
required to deserialize EdgePath (which wraps U256 from ethnum crate)
Code quote:
deserialize = ["ethnum/serde"]
Cargo.toml
line 244 at r2 (raw file):
starknet_mempool_types = { path = "crates/starknet_mempool_types", version = "0.0.0" } starknet_monitoring_endpoint = { path = "crates/starknet_monitoring_endpoint", version = "0.0.0" } starknet_os = { path = "crates/starknet_os", version = "0.0.0" }
not actually related to this PR, but it was missing
Code quote:
starknet_os = { path = "crates/starknet_os", version = "0.0.0" }
2f63798
to
dbd0440
Compare
Benchmark movements: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 12 files reviewed, all discussions resolved (waiting on @aner-starkware and @Yoni-Starkware)
crates/starknet_os/src/io/os_input.rs
line 17 at r3 (raw file):
_updated_root: HashOutput, _tree_height: SubTreeHeight, _commitment_facts: HashMap<HashOutput, NodeData<L>>,
I'm not sure we really need this type of mapping...
We only really need
- initial + final values of all accessed leaves
- patricia witnesses for (1)
(1) can be structured without a hash->preimage map; leaf_index->value is better.
for (2), we don't actually need the node data of any node; only hashes along the path.
perhaps it would be better to create a specific Witnesses
struct in the starknet_patricia crate, with only the required data?
(i.e, given a set of leaf indices, store all required node hashes to verify the leaves)
internally (in the struct) we can have a HashMap<NodeIndex, HashOutput>
field; in the future we will be able to construct witnesses from a "real" state, for now we can simply deserialize in the CLI and verify (on construction of a Witnesses
instance) that all required NodeIndex
es are set.
@aner-starkware @Yoni-Starkware WDYT?
Code quote:
_commitment_facts: HashMap<HashOutput, NodeData<L>>,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 10 of 12 files at r1, 1 of 1 files at r3, all commit messages.
Reviewable status: 11 of 12 files reviewed, 1 unresolved discussion (waiting on @aner-starkware and @dorimedini-starkware)
crates/starknet_os/src/io/os_input.rs
line 17 at r3 (raw file):
Previously, dorimedini-starkware wrote…
I'm not sure we really need this type of mapping...
We only really need
- initial + final values of all accessed leaves
- patricia witnesses for (1)
(1) can be structured without a hash->preimage map; leaf_index->value is better.
for (2), we don't actually need the node data of any node; only hashes along the path.
perhaps it would be better to create a specificWitnesses
struct in the starknet_patricia crate, with only the required data?
(i.e, given a set of leaf indices, store all required node hashes to verify the leaves)
internally (in the struct) we can have aHashMap<NodeIndex, HashOutput>
field; in the future we will be able to construct witnesses from a "real" state, for now we can simply deserialize in the CLI and verify (on construction of aWitnesses
instance) that all requiredNodeIndex
es are set.
Wait, the py type was BinaryFactDict = Dict[int, Tuple[int, ...]]
and worked with the patricia.cairo
impl.
I think we should first integrate with MS code before changing stuff there. I don't know the technical details
crates/starknet_os/src/io/os_input.rs
line 27 at r3 (raw file):
_contract_commitments: CommitmentInfo<ContractState>, _storage_commitments: HashMap<ContractAddress, CommitmentInfo<StarknetStorageValue>>, _class_commitments: CommitmentInfo<CompiledClassHash>,
Suggestion:
pub struct StarknetOsInput {
_contract_state_commitment_info: CommitmentInfo<ContractState>,
_address_to_storage_commitment_info: HashMap<ContractAddress, CommitmentInfo<StarknetStorageValue>>,
_contract_class_commitment_info: CommitmentInfo<CompiledClassHash>,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 11 of 12 files reviewed, 1 unresolved discussion (waiting on @aner-starkware and @Yoni-Starkware)
crates/starknet_os/src/io/os_input.rs
line 17 at r3 (raw file):
Previously, Yoni-Starkware (Yoni) wrote…
Wait, the py type was
BinaryFactDict = Dict[int, Tuple[int, ...]]
and worked with thepatricia.cairo
impl.
I think we should first integrate with MS code before changing stuff there. I don't know the technical details
So I should keep the type as is?
crates/starknet_os/src/io/os_input.rs
line 27 at r3 (raw file):
_contract_commitments: CommitmentInfo<ContractState>, _storage_commitments: HashMap<ContractAddress, CommitmentInfo<StarknetStorageValue>>, _class_commitments: CommitmentInfo<CompiledClassHash>,
Done.
dbd0440
to
a8826c7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r4, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @aner-starkware)
crates/starknet_os/src/io/os_input.rs
line 17 at r3 (raw file):
Previously, dorimedini-starkware wrote…
So I should keep the type as is?
How are you going to convert BinaryFactDict
into something the MS expect? what are they working with?
It would be best to use their impl for Patricia update at first
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status:
complete! all files reviewed, all discussions resolved (waiting on @aner-starkware)
crates/starknet_os/src/io/os_input.rs
line 17 at r3 (raw file):
Previously, Yoni-Starkware (Yoni) wrote…
How are you going to convert
BinaryFactDict
into something the MS expect? what are they working with?
It would be best to use their impl for Patricia update at first
We won't be using patricia update on the rust side: the py side patricia update is only used to collect the witnesses.
We can collect witnesses on the py side and load everything required by the OS into these commitment maps;
no patricia code required on the rust side.
Am I missing something?
6a36944
to
d026208
Compare
…e commitment info
d026208
to
5e84d22
Compare
Benchmark movements: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 11 of 11 files at r5, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @aner-starkware)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 4 of 11 files at r5, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @aner-starkware)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 12 files at r1, 7 of 11 files at r5.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @aner-starkware)
No description provided.