refactor: extract challenge responder into provider-challenge (2) - #334
Open
danielbui12 wants to merge 1 commit into
Open
refactor: extract challenge responder into provider-challenge (2)#334danielbui12 wants to merge 1 commit into
danielbui12 wants to merge 1 commit into
Conversation
- Read challenges through the StorageProviderApi::provider_challenges runtime API, which filters to this provider on-chain, replacing the dynamic Challenges map iteration and its hand-computed 62-byte key offsets - Build respond_to_challenge as a static payload instead of scale_value trees, dropping the u128 widening casts the dynamic encoder relied on - Return the response transaction's finalized block hash instead of a zero placeholder; None when success is inferred from a duplicate rejection, where the block is genuinely unknown - Make submit_and_finalize, try_submit and submit_once generic over subxt's Payload trait so static and dynamic payloads share one retry path - Validate every static address, removing the unvalidated() escapes so a runtime that has drifted from the tracked metadata fails at the call site - Delete the fixed-offset Challenge SCALE decoder, its stale layout docs and the byte-level integration test that pinned them - The deleted decoder documented a flat Challenge, but the pallet nests leaf_index and chunk_index under target: ChunkLocation; the offsets only still worked because SCALE structs are transparent
danielbui12
commented
Aug 4, 2026
| let storage_address = storage_subxt::api::storage() | ||
| .storage_provider() | ||
| .challenges() | ||
| .unvalidated(); |
Member
Author
There was a problem hiding this comment.
IMO, it is better to make it thrown any errors at compile step, avoid unexpected bug since we maintain every crates
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
Wire
provider-challengepath tostorage-subxtstatic bindings