align filestorage with constant-size proof verification#373
align filestorage with constant-size proof verification#373dime-squanderer wants to merge 4 commits into
Conversation
# Conflicts: # core/Cargo.lock # core/indexer/Cargo.toml # core/indexer/src/bin/generate_por_fixtures.rs # core/indexer/src/database/queries.rs # core/indexer/src/database/sql/schema.sql # core/indexer/tests/contracts/file_storage_tests/proof_verification_e2e.rs # core/indexer/tests/database.rs # core/indexer/tests/fixtures/por_proof_fixtures.json # native-contracts/binaries/filestorage.wasm.br # native-contracts/binaries/registry.wasm.br # native-contracts/binaries/staking.wasm.br # native-contracts/binaries/token.wasm.br
|
bugbot run |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit f0084f0. Configure here.
| shard_challenges.update_next_seq(|seq| seq.saturating_add(1)); | ||
| shard_challenges | ||
| .by_seq() | ||
| .set(&shard_seq, challenge_id.clone()); |
There was a problem hiding this comment.
Duplicated shard initialization logic across two functions
Low Severity
The ~30-line block that initializes ProverChallenges / ShardChallenges, assigns the next shard_seq, increments next_seq, and inserts into by_seq is copy-pasted between generate_challenges_for_block and create_challenge_for_agreement. A shared helper (e.g., taking the model and returning (shard_id, shard_seq)) would reduce maintenance burden and eliminate the risk of one copy diverging from the other during future edits.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit f0084f0. Configure here.


Note
High Risk
High risk because it changes on-chain filestorage contract storage/layout and
verify_proof/join/leave APIs, plus modifies the indexer DB schema and ledger reconstruction ordering; mistakes could break proof verification or require state migrations.Overview
Aligns proof verification with constant-size proofs by removing proof-derived challenge lists and instead verifying against a caller-specified
(shard_id, start_seq, end_seq)range of challenges deterministically indexed per prover/shard, with new view APIs to query shard sequences and challenge IDs.Updates filestorage participation semantics so
join_agreement/leave_agreementderivenode_idfromctx.signer().to_string(), and extendschallenge-datawithshard_id/shard_seqwhile indexing challenges during generation/creation.Makes indexer file-ledger reconstruction stable by adding a
ledger_indexcolumn (unique, ordered) tofile_metadata, persisting it on insert, and loading rows ordered byledger_index; updates WIT host bindings/tests accordingly and switcheskontor-cryptoto a git dependency/branch. Removes static POR proof fixtures and generates proofs inline in E2E tests due to prover-id changes.Reviewed by Cursor Bugbot for commit f0084f0. Bugbot is set up for automated code reviews on this repo. Configure here.