feat: Rebrand Polkadot/Substrate references to PezkuwiChain
This commit systematically rebrands various references from Parity Technologies' Polkadot/Substrate ecosystem to PezkuwiChain within the kurdistan-sdk. Key changes include: - Updated external repository URLs (zombienet-sdk, parity-db, parity-scale-codec, wasm-instrument) to point to pezkuwichain forks. - Modified internal documentation and code comments to reflect PezkuwiChain naming and structure. - Replaced direct references to with or specific paths within the for XCM, Pezkuwi, and other modules. - Cleaned up deprecated issue and PR references in various and files, particularly in and modules. - Adjusted image and logo URLs in documentation to point to PezkuwiChain assets. - Removed or rephrased comments related to external Polkadot/Substrate PRs and issues. This is a significant step towards fully customizing the SDK for the PezkuwiChain ecosystem.
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
[package]
|
||||
description = "Bizinikiwi light network protocol"
|
||||
name = "pezsc-network-light"
|
||||
version = "0.33.0"
|
||||
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
||||
authors.workspace = true
|
||||
edition.workspace = true
|
||||
homepage.workspace = true
|
||||
repository.workspace = true
|
||||
documentation = "https://docs.rs/pezsc-network-light"
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
[dependencies]
|
||||
array-bytes = { workspace = true, default-features = true }
|
||||
async-channel = { workspace = true }
|
||||
codec = { features = ["derive"], workspace = true, default-features = true }
|
||||
futures = { workspace = true }
|
||||
log = { workspace = true, default-features = true }
|
||||
prost = { workspace = true }
|
||||
pezsc-client-api = { workspace = true, default-features = true }
|
||||
pezsc-network = { workspace = true, default-features = true }
|
||||
pezsc-network-types = { workspace = true, default-features = true }
|
||||
pezsp-blockchain = { workspace = true, default-features = true }
|
||||
pezsp-core = { workspace = true, default-features = true }
|
||||
pezsp-runtime = { workspace = true, default-features = true }
|
||||
thiserror = { workspace = true }
|
||||
|
||||
[build-dependencies]
|
||||
prost-build = { workspace = true }
|
||||
|
||||
[features]
|
||||
runtime-benchmarks = [
|
||||
"pezsc-client-api/runtime-benchmarks",
|
||||
"pezsc-network/runtime-benchmarks",
|
||||
"pezsp-blockchain/runtime-benchmarks",
|
||||
"pezsp-runtime/runtime-benchmarks",
|
||||
]
|
||||
@@ -0,0 +1,23 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) Parity Technologies (UK) Ltd.
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
const PROTOS: &[&str] = &["src/schema/light.v1.proto"];
|
||||
|
||||
fn main() {
|
||||
prost_build::compile_protos(PROTOS, &["src/schema"]).unwrap();
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) Parity Technologies (UK) Ltd.
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
//! Light client data structures of the networking layer.
|
||||
|
||||
pub mod light_client_requests;
|
||||
mod schema;
|
||||
@@ -0,0 +1,66 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) Parity Technologies (UK) Ltd.
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
//! Helpers for outgoing and incoming light client requests.
|
||||
|
||||
use pezsc_network::{
|
||||
config::ProtocolId, request_responses::IncomingRequest, NetworkBackend, MAX_RESPONSE_SIZE,
|
||||
};
|
||||
use pezsp_runtime::traits::Block;
|
||||
|
||||
use std::time::Duration;
|
||||
|
||||
/// For incoming light client requests.
|
||||
pub mod handler;
|
||||
|
||||
/// Generate the light client protocol name from the genesis hash and fork id.
|
||||
fn generate_protocol_name<Hash: AsRef<[u8]>>(genesis_hash: Hash, fork_id: Option<&str>) -> String {
|
||||
let genesis_hash = genesis_hash.as_ref();
|
||||
if let Some(fork_id) = fork_id {
|
||||
format!("/{}/{}/light/2", array_bytes::bytes2hex("", genesis_hash), fork_id)
|
||||
} else {
|
||||
format!("/{}/light/2", array_bytes::bytes2hex("", genesis_hash))
|
||||
}
|
||||
}
|
||||
|
||||
/// Generate the legacy light client protocol name from chain specific protocol identifier.
|
||||
fn generate_legacy_protocol_name(protocol_id: &ProtocolId) -> String {
|
||||
format!("/{}/light/2", protocol_id.as_ref())
|
||||
}
|
||||
|
||||
/// Generates a `RequestResponseProtocolConfig` for the light client request protocol, refusing
|
||||
/// incoming requests.
|
||||
pub fn generate_protocol_config<
|
||||
Hash: AsRef<[u8]>,
|
||||
B: Block,
|
||||
N: NetworkBackend<B, <B as Block>::Hash>,
|
||||
>(
|
||||
protocol_id: &ProtocolId,
|
||||
genesis_hash: Hash,
|
||||
fork_id: Option<&str>,
|
||||
inbound_queue: async_channel::Sender<IncomingRequest>,
|
||||
) -> N::RequestResponseProtocolConfig {
|
||||
N::request_response_config(
|
||||
generate_protocol_name(genesis_hash, fork_id).into(),
|
||||
std::iter::once(generate_legacy_protocol_name(protocol_id).into()).collect(),
|
||||
1 * 1024 * 1024,
|
||||
MAX_RESPONSE_SIZE,
|
||||
Duration::from_secs(15),
|
||||
Some(inbound_queue),
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,313 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) Parity Technologies (UK) Ltd.
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
//! Helper for incoming light client requests.
|
||||
//!
|
||||
//! Handle (i.e. answer) incoming light client requests from a remote peer received via
|
||||
//! `crate::request_responses::RequestResponsesBehaviour` with
|
||||
//! [`LightClientRequestHandler`](handler::LightClientRequestHandler).
|
||||
|
||||
use crate::schema;
|
||||
use codec::{self, Decode, Encode};
|
||||
use futures::prelude::*;
|
||||
use log::{debug, trace};
|
||||
use prost::Message;
|
||||
use pezsc_client_api::{BlockBackend, ProofProvider};
|
||||
use pezsc_network::{
|
||||
config::ProtocolId,
|
||||
request_responses::{IncomingRequest, OutgoingResponse},
|
||||
NetworkBackend, ReputationChange,
|
||||
};
|
||||
use pezsc_network_types::PeerId;
|
||||
use pezsp_core::{
|
||||
hexdisplay::HexDisplay,
|
||||
storage::{ChildInfo, ChildType, PrefixedStorageKey},
|
||||
};
|
||||
use pezsp_runtime::traits::Block;
|
||||
use std::{marker::PhantomData, sync::Arc};
|
||||
|
||||
const LOG_TARGET: &str = "light-client-request-handler";
|
||||
|
||||
/// Incoming requests bounded queue size. For now due to lack of data on light client request
|
||||
/// handling in production systems, this value is chosen to match the block request limit.
|
||||
const MAX_LIGHT_REQUEST_QUEUE: usize = 20;
|
||||
|
||||
/// Handler for incoming light client requests from a remote peer.
|
||||
pub struct LightClientRequestHandler<B, Client> {
|
||||
request_receiver: async_channel::Receiver<IncomingRequest>,
|
||||
/// Blockchain client.
|
||||
client: Arc<Client>,
|
||||
_block: PhantomData<B>,
|
||||
}
|
||||
|
||||
impl<B, Client> LightClientRequestHandler<B, Client>
|
||||
where
|
||||
B: Block,
|
||||
Client: BlockBackend<B> + ProofProvider<B> + Send + Sync + 'static,
|
||||
{
|
||||
/// Create a new [`LightClientRequestHandler`].
|
||||
pub fn new<N: NetworkBackend<B, <B as Block>::Hash>>(
|
||||
protocol_id: &ProtocolId,
|
||||
fork_id: Option<&str>,
|
||||
client: Arc<Client>,
|
||||
) -> (Self, N::RequestResponseProtocolConfig) {
|
||||
let (tx, request_receiver) = async_channel::bounded(MAX_LIGHT_REQUEST_QUEUE);
|
||||
|
||||
let protocol_config = super::generate_protocol_config::<_, B, N>(
|
||||
protocol_id,
|
||||
client
|
||||
.block_hash(0u32.into())
|
||||
.ok()
|
||||
.flatten()
|
||||
.expect("Genesis block exists; qed"),
|
||||
fork_id,
|
||||
tx,
|
||||
);
|
||||
|
||||
(Self { client, request_receiver, _block: PhantomData::default() }, protocol_config)
|
||||
}
|
||||
|
||||
/// Run [`LightClientRequestHandler`].
|
||||
pub async fn run(mut self) {
|
||||
while let Some(request) = self.request_receiver.next().await {
|
||||
let IncomingRequest { peer, payload, pending_response } = request;
|
||||
|
||||
match self.handle_request(peer, payload) {
|
||||
Ok(response_data) => {
|
||||
let response = OutgoingResponse {
|
||||
result: Ok(response_data),
|
||||
reputation_changes: Vec::new(),
|
||||
sent_feedback: None,
|
||||
};
|
||||
|
||||
match pending_response.send(response) {
|
||||
Ok(()) => trace!(
|
||||
target: LOG_TARGET,
|
||||
"Handled light client request from {}.",
|
||||
peer,
|
||||
),
|
||||
Err(_) => debug!(
|
||||
target: LOG_TARGET,
|
||||
"Failed to handle light client request from {}: {}",
|
||||
peer,
|
||||
HandleRequestError::SendResponse,
|
||||
),
|
||||
};
|
||||
},
|
||||
Err(e) => {
|
||||
debug!(
|
||||
target: LOG_TARGET,
|
||||
"Failed to handle light client request from {}: {}", peer, e,
|
||||
);
|
||||
|
||||
let reputation_changes = match e {
|
||||
HandleRequestError::BadRequest(_) => {
|
||||
vec![ReputationChange::new(-(1 << 12), "bad request")]
|
||||
},
|
||||
_ => Vec::new(),
|
||||
};
|
||||
|
||||
let response = OutgoingResponse {
|
||||
result: Err(()),
|
||||
reputation_changes,
|
||||
sent_feedback: None,
|
||||
};
|
||||
|
||||
if pending_response.send(response).is_err() {
|
||||
debug!(
|
||||
target: LOG_TARGET,
|
||||
"Failed to handle light client request from {}: {}",
|
||||
peer,
|
||||
HandleRequestError::SendResponse,
|
||||
);
|
||||
};
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn handle_request(
|
||||
&mut self,
|
||||
peer: PeerId,
|
||||
payload: Vec<u8>,
|
||||
) -> Result<Vec<u8>, HandleRequestError> {
|
||||
let request = schema::v1::light::Request::decode(&payload[..])?;
|
||||
|
||||
let response = match &request.request {
|
||||
Some(schema::v1::light::request::Request::RemoteCallRequest(r)) =>
|
||||
self.on_remote_call_request(&peer, r)?,
|
||||
Some(schema::v1::light::request::Request::RemoteReadRequest(r)) =>
|
||||
self.on_remote_read_request(&peer, r)?,
|
||||
Some(schema::v1::light::request::Request::RemoteReadChildRequest(r)) =>
|
||||
self.on_remote_read_child_request(&peer, r)?,
|
||||
None =>
|
||||
return Err(HandleRequestError::BadRequest("Remote request without request data.")),
|
||||
};
|
||||
|
||||
let mut data = Vec::new();
|
||||
response.encode(&mut data)?;
|
||||
|
||||
Ok(data)
|
||||
}
|
||||
|
||||
fn on_remote_call_request(
|
||||
&mut self,
|
||||
peer: &PeerId,
|
||||
request: &schema::v1::light::RemoteCallRequest,
|
||||
) -> Result<schema::v1::light::Response, HandleRequestError> {
|
||||
trace!("Remote call request from {} ({} at {:?}).", peer, request.method, request.block,);
|
||||
|
||||
let block = Decode::decode(&mut request.block.as_ref())?;
|
||||
|
||||
let response = match self.client.execution_proof(block, &request.method, &request.data) {
|
||||
Ok((_, proof)) => schema::v1::light::RemoteCallResponse { proof: Some(proof.encode()) },
|
||||
Err(e) => {
|
||||
trace!(
|
||||
"remote call request from {} ({} at {:?}) failed with: {}",
|
||||
peer,
|
||||
request.method,
|
||||
request.block,
|
||||
e,
|
||||
);
|
||||
schema::v1::light::RemoteCallResponse { proof: None }
|
||||
},
|
||||
};
|
||||
|
||||
Ok(schema::v1::light::Response {
|
||||
response: Some(schema::v1::light::response::Response::RemoteCallResponse(response)),
|
||||
})
|
||||
}
|
||||
|
||||
fn on_remote_read_request(
|
||||
&mut self,
|
||||
peer: &PeerId,
|
||||
request: &schema::v1::light::RemoteReadRequest,
|
||||
) -> Result<schema::v1::light::Response, HandleRequestError> {
|
||||
if request.keys.is_empty() {
|
||||
debug!("Invalid remote read request sent by {}.", peer);
|
||||
return Err(HandleRequestError::BadRequest("Remote read request without keys."));
|
||||
}
|
||||
|
||||
trace!(
|
||||
"Remote read request from {} ({} at {:?}).",
|
||||
peer,
|
||||
fmt_keys(request.keys.first(), request.keys.last()),
|
||||
request.block,
|
||||
);
|
||||
|
||||
let block = Decode::decode(&mut request.block.as_ref())?;
|
||||
|
||||
let response =
|
||||
match self.client.read_proof(block, &mut request.keys.iter().map(AsRef::as_ref)) {
|
||||
Ok(proof) => schema::v1::light::RemoteReadResponse { proof: Some(proof.encode()) },
|
||||
Err(error) => {
|
||||
trace!(
|
||||
"remote read request from {} ({} at {:?}) failed with: {}",
|
||||
peer,
|
||||
fmt_keys(request.keys.first(), request.keys.last()),
|
||||
request.block,
|
||||
error,
|
||||
);
|
||||
schema::v1::light::RemoteReadResponse { proof: None }
|
||||
},
|
||||
};
|
||||
|
||||
Ok(schema::v1::light::Response {
|
||||
response: Some(schema::v1::light::response::Response::RemoteReadResponse(response)),
|
||||
})
|
||||
}
|
||||
|
||||
fn on_remote_read_child_request(
|
||||
&mut self,
|
||||
peer: &PeerId,
|
||||
request: &schema::v1::light::RemoteReadChildRequest,
|
||||
) -> Result<schema::v1::light::Response, HandleRequestError> {
|
||||
if request.keys.is_empty() {
|
||||
debug!("Invalid remote child read request sent by {}.", peer);
|
||||
return Err(HandleRequestError::BadRequest("Remove read child request without keys."));
|
||||
}
|
||||
|
||||
trace!(
|
||||
"Remote read child request from {} ({} {} at {:?}).",
|
||||
peer,
|
||||
HexDisplay::from(&request.storage_key),
|
||||
fmt_keys(request.keys.first(), request.keys.last()),
|
||||
request.block,
|
||||
);
|
||||
|
||||
let block = Decode::decode(&mut request.block.as_ref())?;
|
||||
|
||||
let prefixed_key = PrefixedStorageKey::new_ref(&request.storage_key);
|
||||
let child_info = match ChildType::from_prefixed_key(prefixed_key) {
|
||||
Some((ChildType::ParentKeyId, storage_key)) => Ok(ChildInfo::new_default(storage_key)),
|
||||
None => Err(pezsp_blockchain::Error::InvalidChildStorageKey),
|
||||
};
|
||||
let response = match child_info.and_then(|child_info| {
|
||||
self.client.read_child_proof(
|
||||
block,
|
||||
&child_info,
|
||||
&mut request.keys.iter().map(AsRef::as_ref),
|
||||
)
|
||||
}) {
|
||||
Ok(proof) => schema::v1::light::RemoteReadResponse { proof: Some(proof.encode()) },
|
||||
Err(error) => {
|
||||
trace!(
|
||||
"remote read child request from {} ({} {} at {:?}) failed with: {}",
|
||||
peer,
|
||||
HexDisplay::from(&request.storage_key),
|
||||
fmt_keys(request.keys.first(), request.keys.last()),
|
||||
request.block,
|
||||
error,
|
||||
);
|
||||
schema::v1::light::RemoteReadResponse { proof: None }
|
||||
},
|
||||
};
|
||||
|
||||
Ok(schema::v1::light::Response {
|
||||
response: Some(schema::v1::light::response::Response::RemoteReadResponse(response)),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
enum HandleRequestError {
|
||||
#[error("Failed to decode request: {0}.")]
|
||||
DecodeProto(#[from] prost::DecodeError),
|
||||
#[error("Failed to encode response: {0}.")]
|
||||
EncodeProto(#[from] prost::EncodeError),
|
||||
#[error("Failed to send response.")]
|
||||
SendResponse,
|
||||
/// A bad request has been received.
|
||||
#[error("bad request: {0}")]
|
||||
BadRequest(&'static str),
|
||||
/// Encoding or decoding of some data failed.
|
||||
#[error("codec error: {0}")]
|
||||
Codec(#[from] codec::Error),
|
||||
}
|
||||
|
||||
fn fmt_keys(first: Option<&Vec<u8>>, last: Option<&Vec<u8>>) -> String {
|
||||
if let (Some(first), Some(last)) = (first, last) {
|
||||
if first == last {
|
||||
HexDisplay::from(first).to_string()
|
||||
} else {
|
||||
format!("{}..{}", HexDisplay::from(first), HexDisplay::from(last))
|
||||
}
|
||||
} else {
|
||||
String::from("n/a")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) Parity Technologies (UK) Ltd.
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
//! Include sources generated from protobuf definitions.
|
||||
|
||||
pub(crate) mod v1 {
|
||||
pub(crate) mod light {
|
||||
include!(concat!(env!("OUT_DIR"), "/api.v1.light.rs"));
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use prost::Message as _;
|
||||
|
||||
#[test]
|
||||
fn empty_proof_encodes_correctly() {
|
||||
let encoded = super::v1::light::Response {
|
||||
response: Some(super::v1::light::response::Response::RemoteReadResponse(
|
||||
super::v1::light::RemoteReadResponse { proof: Some(Vec::new()) },
|
||||
)),
|
||||
}
|
||||
.encode_to_vec();
|
||||
|
||||
// Make sure that the response contains one field of number 2 and wire type 2 (message),
|
||||
// then another field of number 2 and wire type 2 (bytes), then a length of 0.
|
||||
assert_eq!(encoded, vec![(2 << 3) | 2, 2, (2 << 3) | 2, 0]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn no_proof_encodes_correctly() {
|
||||
let encoded = super::v1::light::Response {
|
||||
response: Some(super::v1::light::response::Response::RemoteReadResponse(
|
||||
super::v1::light::RemoteReadResponse { proof: None },
|
||||
)),
|
||||
}
|
||||
.encode_to_vec();
|
||||
|
||||
// Make sure that the response contains one field of number 2 and wire type 2 (message).
|
||||
assert_eq!(encoded, vec![(2 << 3) | 2, 0]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn proof_encodes_correctly() {
|
||||
let encoded = super::v1::light::Response {
|
||||
response: Some(super::v1::light::response::Response::RemoteReadResponse(
|
||||
super::v1::light::RemoteReadResponse { proof: Some(vec![1, 2, 3, 4]) },
|
||||
)),
|
||||
}
|
||||
.encode_to_vec();
|
||||
|
||||
assert_eq!(encoded, vec![(2 << 3) | 2, 6, (2 << 3) | 2, 4, 1, 2, 3, 4]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
// Schema definition for light client messages.
|
||||
|
||||
syntax = "proto2";
|
||||
|
||||
package api.v1.light;
|
||||
|
||||
// Enumerate all possible light client request messages.
|
||||
message Request {
|
||||
oneof request {
|
||||
RemoteCallRequest remote_call_request = 1;
|
||||
RemoteReadRequest remote_read_request = 2;
|
||||
RemoteReadChildRequest remote_read_child_request = 4;
|
||||
// Note: ids 3 and 5 were used in the past. It would be preferable to not re-use them.
|
||||
}
|
||||
}
|
||||
|
||||
// Enumerate all possible light client response messages.
|
||||
message Response {
|
||||
oneof response {
|
||||
RemoteCallResponse remote_call_response = 1;
|
||||
RemoteReadResponse remote_read_response = 2;
|
||||
// Note: ids 3 and 4 were used in the past. It would be preferable to not re-use them.
|
||||
}
|
||||
}
|
||||
|
||||
// Remote call request.
|
||||
message RemoteCallRequest {
|
||||
// Block at which to perform call.
|
||||
required bytes block = 2;
|
||||
// Method name.
|
||||
required string method = 3;
|
||||
// Call data.
|
||||
required bytes data = 4;
|
||||
}
|
||||
|
||||
// Remote call response.
|
||||
message RemoteCallResponse {
|
||||
// Execution proof. If missing, indicates that the remote couldn't answer, for example because
|
||||
// the block is pruned.
|
||||
optional bytes proof = 2;
|
||||
}
|
||||
|
||||
// Remote storage read request.
|
||||
message RemoteReadRequest {
|
||||
// Block at which to perform call.
|
||||
required bytes block = 2;
|
||||
// Storage keys.
|
||||
repeated bytes keys = 3;
|
||||
}
|
||||
|
||||
// Remote read response.
|
||||
message RemoteReadResponse {
|
||||
// Read proof. If missing, indicates that the remote couldn't answer, for example because
|
||||
// the block is pruned.
|
||||
optional bytes proof = 2;
|
||||
}
|
||||
|
||||
// Remote storage read child request.
|
||||
message RemoteReadChildRequest {
|
||||
// Block at which to perform call.
|
||||
required bytes block = 2;
|
||||
// Child Storage key, this is relative
|
||||
// to the child type storage location.
|
||||
required bytes storage_key = 3;
|
||||
// Storage keys.
|
||||
repeated bytes keys = 6;
|
||||
}
|
||||
Reference in New Issue
Block a user