feat: Vendor pezkuwi-subxt and pezkuwi-zombienet-sdk into monorepo

- Add pezkuwi-subxt crates to vendor/pezkuwi-subxt
- Add pezkuwi-zombienet-sdk crates to vendor/pezkuwi-zombienet-sdk
- Convert git dependencies to path dependencies
- Add vendor crates to workspace members
- Remove test/example crates from vendor (not needed for SDK)
- Fix feature propagation issues detected by zepter
- Fix workspace inheritance for internal dependencies
- All 606 crates now in workspace
- All 6919 internal dependency links verified correct
- No git dependencies remaining
This commit is contained in:
2025-12-22 23:31:24 +03:00
parent 4c8f281051
commit 70ddb6516f
386 changed files with 76759 additions and 36 deletions
+14
View File
@@ -0,0 +1,14 @@
// Copyright 2019-2025 Parity Technologies (UK) Ltd.
// This file is dual-licensed as Apache-2.0 or GPL-3.0.
// see LICENSE for license details.
//! Types associated with executing runtime API calls.
mod runtime_client;
mod runtime_types;
pub use pezkuwi_subxt_core::runtime_api::payload::{
DynamicPayload, Payload, StaticPayload, dynamic,
};
pub use runtime_client::RuntimeApiClient;
pub use runtime_types::RuntimeApi;
@@ -0,0 +1,58 @@
// Copyright 2019-2025 Parity Technologies (UK) Ltd.
// This file is dual-licensed as Apache-2.0 or GPL-3.0.
// see LICENSE for license details.
use super::runtime_types::RuntimeApi;
use crate::{
backend::BlockRef,
client::OnlineClientT,
config::{Config, HashFor},
error::RuntimeApiError,
};
use derive_where::derive_where;
use std::{future::Future, marker::PhantomData};
/// Execute runtime API calls.
#[derive_where(Clone; Client)]
pub struct RuntimeApiClient<T, Client> {
client: Client,
_marker: PhantomData<T>,
}
impl<T, Client> RuntimeApiClient<T, Client> {
/// Create a new [`RuntimeApiClient`]
pub fn new(client: Client) -> Self {
Self { client, _marker: PhantomData }
}
}
impl<T, Client> RuntimeApiClient<T, Client>
where
T: Config,
Client: OnlineClientT<T>,
{
/// Obtain a runtime API interface at some block hash.
pub fn at(&self, block_ref: impl Into<BlockRef<HashFor<T>>>) -> RuntimeApi<T, Client> {
RuntimeApi::new(self.client.clone(), block_ref.into())
}
/// Obtain a runtime API interface at the latest finalized block.
pub fn at_latest(
&self,
) -> impl Future<Output = Result<RuntimeApi<T, Client>, RuntimeApiError>> + Send + 'static {
// Clone and pass the client in like this so that we can explicitly
// return a Future that's Send + 'static, rather than tied to &self.
let client = self.client.clone();
async move {
// get the ref for the latest finalized block and use that.
let block_ref = client
.backend()
.latest_finalized_block_ref()
.await
.map_err(RuntimeApiError::CannotGetLatestFinalizedBlock)?;
Ok(RuntimeApi::new(client, block_ref))
}
}
}
@@ -0,0 +1,97 @@
// Copyright 2019-2025 Parity Technologies (UK) Ltd.
// This file is dual-licensed as Apache-2.0 or GPL-3.0.
// see LICENSE for license details.
use super::Payload;
use crate::{
backend::BlockRef,
client::OnlineClientT,
config::{Config, HashFor},
error::RuntimeApiError,
};
use derive_where::derive_where;
use std::{future::Future, marker::PhantomData};
/// Execute runtime API calls.
#[derive_where(Clone; Client)]
pub struct RuntimeApi<T: Config, Client> {
client: Client,
block_ref: BlockRef<HashFor<T>>,
_marker: PhantomData<T>,
}
impl<T: Config, Client> RuntimeApi<T, Client> {
/// Create a new [`RuntimeApi`]
pub(crate) fn new(client: Client, block_ref: BlockRef<HashFor<T>>) -> Self {
Self { client, block_ref, _marker: PhantomData }
}
}
impl<T, Client> RuntimeApi<T, Client>
where
T: Config,
Client: OnlineClientT<T>,
{
/// Run the validation logic against some runtime API payload you'd like to use. Returns
/// `Ok(())` if the payload is valid (or if it's not possible to check since the payload has no
/// validation hash). Return an error if the payload was not valid or something went wrong
/// trying to validate it (ie the runtime API in question do not exist at all)
pub fn validate<Call: Payload>(&self, payload: Call) -> Result<(), RuntimeApiError> {
pezkuwi_subxt_core::runtime_api::validate(payload, &self.client.metadata())
.map_err(Into::into)
}
/// Execute a raw runtime API call. This returns the raw bytes representing the result
/// of this call. The caller is responsible for decoding the result.
pub fn call_raw<'a>(
&self,
function: &'a str,
call_parameters: Option<&'a [u8]>,
) -> impl Future<Output = Result<Vec<u8>, RuntimeApiError>> + use<'a, Client, T> {
let client = self.client.clone();
let block_hash = self.block_ref.hash();
// Ensure that the returned future doesn't have a lifetime tied to api.runtime_api(),
// which is a temporary thing we'll be throwing away quickly:
async move {
let data = client
.backend()
.call(function, call_parameters, block_hash)
.await
.map_err(RuntimeApiError::CannotCallApi)?;
Ok(data)
}
}
/// Execute a runtime API call.
pub fn call<Call: Payload>(
&self,
payload: Call,
) -> impl Future<Output = Result<Call::ReturnType, RuntimeApiError>> + use<Call, Client, T> {
let client = self.client.clone();
let block_hash = self.block_ref.hash();
// Ensure that the returned future doesn't have a lifetime tied to api.runtime_api(),
// which is a temporary thing we'll be throwing away quickly:
async move {
let metadata = client.metadata();
// Validate the runtime API payload hash against the compile hash from codegen.
pezkuwi_subxt_core::runtime_api::validate(&payload, &metadata)?;
// Encode the arguments of the runtime call.
let call_name = pezkuwi_subxt_core::runtime_api::call_name(&payload);
let call_args = pezkuwi_subxt_core::runtime_api::call_args(&payload, &metadata)?;
// Make the call.
let bytes = client
.backend()
.call(&call_name, Some(call_args.as_slice()), block_hash)
.await
.map_err(RuntimeApiError::CannotCallApi)?;
// Decode the response.
let value =
pezkuwi_subxt_core::runtime_api::decode_value(&mut &*bytes, &payload, &metadata)?;
Ok(value)
}
}
}