starknet_transaction_prover: add compute_missing_sibling_keys helper#14118
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
PR SummaryMedium Risk Overview Introduces supporting helpers to map contract addresses to storage roots/proof nodes, traverse Reviewed by Cursor Bugbot for commit faa7f62. Bugbot is set up for automated code reviews on this repo. Configure here. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit faa7f62. Configure here.
| (0..edge_len).all(|i| edge_bits[edge_start + i] == key_bits[key_start + i]); | ||
| if !edge_matches { | ||
| // Phantom delete: the key doesn't exist in this trie. | ||
| return crafted; |
There was a problem hiding this comment.
Phantom delete returns non-empty crafted keys unnecessarily
Low Severity
When an edge path doesn't match the key (phantom delete — the key doesn't exist in the trie), collect_missing_siblings_for_key returns crafted which may already contain entries accumulated from binary nodes traversed earlier on the path. Since the deletion is a no-op, no sibling preimages are needed. The outer function compute_missing_sibling_keys documents it "returns an empty vec when…the deleted keys don't exist in the trie," but the implementation violates this contract. Returning Vec::new() instead of crafted on the phantom-delete branch would match the documented behavior.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit faa7f62. Configure here.
| contract_address: *addr.0.key(), | ||
| storage_keys: keys.into_iter().collect(), | ||
| }) | ||
| .collect() |
There was a problem hiding this comment.
Non-deterministic contract ordering in output vector
Low Severity
keys_by_contract is a HashMap, so into_iter() yields contracts in non-deterministic order across runs. The codebase explicitly cares about deterministic ordering — prepare_query sorts contract addresses "for deterministic ordering (for offline replay mode)." When this helper is wired into get_storage_proofs in the follow-up PR, the non-deterministic Vec<ContractStorageKeys> output could break replay reproducibility or cause mismatched positional pairing with RPC responses. Using a BTreeMap (or sorting the output) would match the codebase convention.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit faa7f62. Configure here.



No description provided.