mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 22:47:56 +00:00
Don't include :code by default in storage proofs (#5060)
* Adds test to verify that the runtime currently is always contained in the proof * Start passing the runtime wasm code from the outside * Fix compilation * More build fixes * Make the test work as expected now :) * Last fixes * Fixes benchmarks * Review feedback * Apply suggestions from code review Co-Authored-By: Sergei Pepyakin <sergei@parity.io> * Review feedback * Fix compilation Co-authored-by: Sergei Pepyakin <s.pepyakin@gmail.com>
This commit is contained in:
committed by
GitHub
parent
67837c6233
commit
6ee39261c8
@@ -62,7 +62,12 @@ pub trait Client<Block: BlockT>: Send + Sync {
|
||||
) -> Result<StorageProof, Error>;
|
||||
|
||||
/// Get method execution proof.
|
||||
fn execution_proof(&self, block: &Block::Hash, method: &str, data: &[u8]) -> Result<(Vec<u8>, StorageProof), Error>;
|
||||
fn execution_proof(
|
||||
&self,
|
||||
block: &Block::Hash,
|
||||
method: &str,
|
||||
data: &[u8],
|
||||
) -> Result<(Vec<u8>, StorageProof), Error>;
|
||||
|
||||
/// Get key changes proof.
|
||||
fn key_changes_proof(
|
||||
@@ -152,11 +157,7 @@ impl<B, E, Block, RA> Client<Block> for SubstrateClient<B, E, Block, RA> where
|
||||
method: &str,
|
||||
data: &[u8],
|
||||
) -> Result<(Vec<u8>, StorageProof), Error> {
|
||||
(self as &SubstrateClient<B, E, Block, RA>).execution_proof(
|
||||
&BlockId::Hash(block.clone()),
|
||||
method,
|
||||
data,
|
||||
)
|
||||
SubstrateClient::execution_proof(self, &BlockId::Hash(block.clone()), method, data)
|
||||
}
|
||||
|
||||
fn key_changes_proof(
|
||||
@@ -168,7 +169,14 @@ impl<B, E, Block, RA> Client<Block> for SubstrateClient<B, E, Block, RA> where
|
||||
storage_key: Option<&StorageKey>,
|
||||
key: &StorageKey,
|
||||
) -> Result<ChangesProof<Block::Header>, Error> {
|
||||
(self as &SubstrateClient<B, E, Block, RA>).key_changes_proof(first, last, min, max, storage_key, key)
|
||||
(self as &SubstrateClient<B, E, Block, RA>).key_changes_proof(
|
||||
first,
|
||||
last,
|
||||
min,
|
||||
max,
|
||||
storage_key,
|
||||
key,
|
||||
)
|
||||
}
|
||||
|
||||
fn is_descendent_of(&self, base: &Block::Hash, block: &Block::Hash) -> Result<bool, Error> {
|
||||
|
||||
@@ -254,13 +254,12 @@ where
|
||||
B: Block,
|
||||
{
|
||||
/// Construct a new light client handler.
|
||||
pub fn new
|
||||
( cfg: Config
|
||||
, chain: Arc<dyn Client<B>>
|
||||
, checker: Arc<dyn fetcher::FetchChecker<B>>
|
||||
, peerset: sc_peerset::PeersetHandle
|
||||
) -> Self
|
||||
{
|
||||
pub fn new(
|
||||
cfg: Config,
|
||||
chain: Arc<dyn Client<B>>,
|
||||
checker: Arc<dyn fetcher::FetchChecker<B>>,
|
||||
peerset: sc_peerset::PeersetHandle,
|
||||
) -> Self {
|
||||
LightClientHandler {
|
||||
config: cfg,
|
||||
chain,
|
||||
@@ -425,7 +424,8 @@ where
|
||||
log::trace!("remote call request from {} ({} at {:?})",
|
||||
peer,
|
||||
request.method,
|
||||
request.block);
|
||||
request.block,
|
||||
);
|
||||
|
||||
let block = Decode::decode(&mut request.block.as_ref())?;
|
||||
|
||||
@@ -436,7 +436,8 @@ where
|
||||
peer,
|
||||
request.method,
|
||||
request.block,
|
||||
e);
|
||||
e,
|
||||
);
|
||||
StorageProof::empty()
|
||||
}
|
||||
};
|
||||
|
||||
@@ -750,7 +750,11 @@ pub mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
fn check_execution_proof(&self, _: &RemoteCallRequest<B::Header>, _: StorageProof) -> ClientResult<Vec<u8>> {
|
||||
fn check_execution_proof(
|
||||
&self,
|
||||
_: &RemoteCallRequest<B::Header>,
|
||||
_: StorageProof,
|
||||
) -> ClientResult<Vec<u8>> {
|
||||
match self.ok {
|
||||
true => Ok(vec![42]),
|
||||
false => Err(ClientError::Backend("Test error".into())),
|
||||
|
||||
Reference in New Issue
Block a user