-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Conversation
Also related to paritytech/smoldot#576 CC\ @tomaka |
I did put the PR under 'D5-nice-to-have-audit', because the changes to state-machine, even if pretty trivial are exposing an api which breaks on error while the common api does skip error, so even if it looks rather trivial, this is related to some existing assumption of state-machine assertion. |
This PR should not change any existing behavior for runtime or externalities function. In this sense runtime audit should just be checking that point, it is actually pretty trivial so I switch back to 'D1-trivial'. |
Limiting response by key count rather than byte size may cause trouble. You never now if given 1000 keys are over the hardcoded packet limit, which will result in error. If this is used to reconstruct the whole state, the syncing algorithm would need to account for such an error and reduce requested count. |
client/light/src/backend.rs
Outdated
@@ -461,6 +461,21 @@ impl<H: Hasher> StateBackend<H> for GenesisOrUnavailableState<H> | |||
} | |||
} | |||
|
|||
fn apply_to_key_values_while<A: FnMut(&[u8], &[u8]) -> bool>( |
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.
Could be FnMut(Vec<u8>, Vec<u8>)
to avoid copying data
client/api/src/light.rs
Outdated
pub count: u32, | ||
/// Maximum total size of value to query. | ||
/// Acts as a threshold. | ||
pub value_size: u32, |
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.
I'd suggest this to be called max_value_size
or value_size_limit
here and everywhere.
This PR implements state iteration for light client.
It should also provide an implementation for 'state_getKeysPaged' rpc for light clients.
There is a lot of boilerplate code but most logic is in prove and check function in state-machine.
Also depends on paritytech/trie#127 (could be implemented without but would fetch and additional node in all proofs).