Refactoring Checkpoint: (WIP)

This commit is contained in:
2025-12-14 10:29:31 +03:00
parent 09735eb97a
commit c89d7cac55
1424 changed files with 6415 additions and 6064 deletions
+1 -1
View File
@@ -24,7 +24,7 @@ alloy-trie = { workspace = true }
codec = { features = ["derive", "max-encoded-len"], workspace = true }
derive_more = { workspace = true, features = ["from", "try_into"] }
environmental = { workspace = true }
ethereum-standards = { workspace = true }
pez-ethereum-standards = { workspace = true }
ethereum-types = { workspace = true, features = ["codec", "rlp", "serialize"] }
hex-literal = { workspace = true }
humantime-serde = { optional = true, workspace = true }
@@ -1,5 +1,5 @@
[package]
name = "revive-dev-node"
name = "pez-revive-dev-node"
description = "A development Bizinikiwi-based Bizinikiwi node, equipped with pezpallet-revive."
version = "0.0.0"
authors.workspace = true
@@ -8,7 +8,7 @@ repository.workspace = true
edition.workspace = true
publish = false
build = "build.rs"
documentation = "https://docs.rs/revive-dev-node"
documentation = "https://docs.rs/pez-revive-dev-node"
license = { workspace = true }
[package.metadata.docs.rs]
@@ -25,15 +25,15 @@ futures-timer = { workspace = true }
jsonrpsee = { features = ["server"], workspace = true }
pezkuwi-sdk = { workspace = true, features = ["experimental", "node"] }
revive-dev-runtime = { workspace = true }
pez-revive-dev-runtime = { workspace = true }
[build-dependencies]
pezkuwi-sdk = { workspace = true, features = ["bizinikiwi-build-script-utils"] }
[features]
default = ["std"]
std = ["pezkuwi-sdk/std", "revive-dev-runtime/std"]
std = ["pezkuwi-sdk/std", "pez-revive-dev-runtime/std"]
runtime-benchmarks = [
"pezkuwi-sdk/runtime-benchmarks",
"revive-dev-runtime/runtime-benchmarks",
"pez-revive-dev-runtime/runtime-benchmarks",
]
@@ -19,7 +19,7 @@ use pezkuwi_sdk::{
pezsc_service::{ChainType, Properties},
*,
};
use revive_dev_runtime::WASM_BINARY;
use pez_revive_dev_runtime::WASM_BINARY;
/// This is a specialization of the general Bizinikiwi ChainSpec type.
pub type ChainSpec = pezsc_service::GenericChainSpec;
@@ -119,7 +119,7 @@ pub fn run_with_args(args: Vec<String>) -> pezsc_cli::Result<()> {
},
Some(Subcommand::ChainInfo(cmd)) => {
let runner = cli.create_runner(cmd)?;
runner.sync_run(|config| cmd.run::<revive_dev_runtime::OpaqueBlock>(&config))
runner.sync_run(|config| cmd.run::<pez_revive_dev_runtime::OpaqueBlock>(&config))
},
None => {
// Enforce dev
@@ -29,7 +29,7 @@ use pezkuwi_sdk::{
pezsp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata},
*,
};
use revive_dev_runtime::{AccountId, Nonce, OpaqueBlock};
use pez_revive_dev_runtime::{AccountId, Nonce, OpaqueBlock};
use std::sync::Arc;
/// Full client dependencies.
@@ -24,7 +24,7 @@ use pezkuwi_sdk::{
pezsp_runtime::traits::Block as BlockT,
*,
};
use revive_dev_runtime::{OpaqueBlock as Block, Runtime, RuntimeApi};
use pez_revive_dev_runtime::{OpaqueBlock as Block, Runtime, RuntimeApi};
use std::sync::Arc;
type HostFunctions = pezsp_io::BizinikiwiHostFunctions;
@@ -1,5 +1,5 @@
[package]
name = "revive-dev-runtime"
name = "pez-revive-dev-runtime"
description = "A solochain dev runtime for revive."
version = "0.1.0"
license = "Apache-2.0"
@@ -7,7 +7,7 @@ authors.workspace = true
homepage.workspace = true
repository.workspace = true
edition.workspace = true
documentation = "https://docs.rs/revive-dev-runtime"
documentation = "https://docs.rs/pez-revive-dev-runtime"
[dependencies]
array-bytes = { workspace = true }
@@ -136,8 +136,8 @@ pub mod genesis_config_presets {
/// The runtime version.
#[runtime_version]
pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: alloc::borrow::Cow::Borrowed("revive-dev-runtime"),
impl_name: alloc::borrow::Cow::Borrowed("revive-dev-runtime"),
spec_name: alloc::borrow::Cow::Borrowed("pez-revive-dev-runtime"),
impl_name: alloc::borrow::Cow::Borrowed("pez-revive-dev-runtime"),
authoring_version: 1,
spec_version: 0,
impl_version: 1,
+4 -4
View File
@@ -59,20 +59,20 @@ tokio = { workspace = true, features = ["full"] }
env_logger = { workspace = true }
pezpallet-revive-fixtures = { workspace = true, default-features = true }
pretty_assertions = { workspace = true }
revive-dev-node = { workspace = true }
pez-revive-dev-node = { workspace = true }
pezsp-io = { workspace = true, default-features = true }
[build-dependencies]
git2 = { workspace = true }
revive-dev-runtime = { workspace = true, default-features = true }
pez-revive-dev-runtime = { workspace = true, default-features = true }
pezsp-io = { workspace = true, default-features = true }
pezsp-runtime = { workspace = true, default-features = true }
[features]
runtime-benchmarks = [
"pezpallet-revive/runtime-benchmarks",
"revive-dev-node/runtime-benchmarks",
"revive-dev-runtime/runtime-benchmarks",
"pez-revive-dev-node/runtime-benchmarks",
"pez-revive-dev-runtime/runtime-benchmarks",
"pezsc-cli/runtime-benchmarks",
"pezsc-rpc-api/runtime-benchmarks",
"pezsc-rpc/runtime-benchmarks",
+1 -1
View File
@@ -55,7 +55,7 @@ fn generate_git_revision() {
fn generate_metadata_file() {
let mut ext = pezsp_io::TestExternalities::new(Default::default());
ext.execute_with(|| {
let metadata = revive_dev_runtime::Runtime::metadata_at_version(16).unwrap();
let metadata = pez_revive_dev_runtime::Runtime::metadata_at_version(16).unwrap();
let bytes: &[u8] = &metadata;
fs::write("revive_chain.scale", bytes).unwrap();
});
@@ -93,7 +93,7 @@ fn start_docker(docker_bin: &str, docker_image: &str) -> anyhow::Result<Child> {
"-p",
"8545:8545",
&format!("docker.io/paritypr/{docker_image}"),
"--node-rpc-url",
"--pez-node-rpc-url",
"wss://zagros-asset-hub-rpc.pezkuwichain.io",
"--rpc-cors",
"all",
+5 -5
View File
@@ -45,7 +45,7 @@ const IN_MEMORY_DB: &str = "sqlite::memory:";
pub struct CliCommand {
/// The node url to connect to
#[clap(long, default_value = "ws://127.0.0.1:9944")]
pub node_rpc_url: String,
pub pez_node_rpc_url: String,
/// The maximum number of blocks to cache in memory.
#[clap(long, default_value = "256")]
@@ -103,12 +103,12 @@ fn build_client(
tokio_handle: &tokio::runtime::Handle,
cache_size: usize,
earliest_receipt_block: Option<BizinikiwiBlockNumber>,
node_rpc_url: &str,
pez_node_rpc_url: &str,
database_url: &str,
abort_signal: Signals,
) -> anyhow::Result<Client> {
let fut = async {
let (api, rpc_client, rpc) = connect(node_rpc_url).await?;
let (api, rpc_client, rpc) = connect(pez_node_rpc_url).await?;
let block_provider = SubxtBlockInfoProvider::new( api.clone(), rpc.clone()).await?;
let (pool, keep_latest_n_blocks) = if database_url == IN_MEMORY_DB {
@@ -158,7 +158,7 @@ pub fn run(cmd: CliCommand) -> anyhow::Result<()> {
let CliCommand {
rpc_params,
prometheus_params,
node_rpc_url,
pez_node_rpc_url,
cache_size,
database_url,
earliest_receipt_block,
@@ -204,7 +204,7 @@ pub fn run(cmd: CliCommand) -> anyhow::Result<()> {
tokio_handle,
cache_size,
earliest_receipt_block,
&node_rpc_url,
&pez_node_rpc_url,
&database_url,
tokio_runtime.block_on(async { Signals::capture() })?,
)?;
+4 -4
View File
@@ -208,16 +208,16 @@ async fn get_automine(rpc_client: &RpcClient) -> bool {
/// Connect to a node at the given URL, and return the underlying API, RPC client, and legacy RPC
/// clients.
pub async fn connect(
node_rpc_url: &str,
pez_node_rpc_url: &str,
) -> Result<(OnlineClient<SrcChainConfig>, RpcClient, LegacyRpcMethods<SrcChainConfig>), ClientError>
{
log::info!(target: LOG_TARGET, "🌐 Connecting to node at: {node_rpc_url} ...");
log::info!(target: LOG_TARGET, "🌐 Connecting to node at: {pez_node_rpc_url} ...");
let rpc_client = ReconnectingRpcClient::builder()
.retry_policy(ExponentialBackoff::from_millis(100).max_delay(Duration::from_secs(10)))
.build(node_rpc_url.to_string())
.build(pez_node_rpc_url.to_string())
.await?;
let rpc_client = RpcClient::new(rpc_client);
log::info!(target: LOG_TARGET, "🌟 Connected to node at: {node_rpc_url}");
log::info!(target: LOG_TARGET, "🌟 Connected to node at: {pez_node_rpc_url}");
let api = OnlineClient::<SrcChainConfig>::from_rpc_client(rpc_client.clone()).await?;
let rpc = LegacyRpcMethods::<SrcChainConfig>::new(rpc_client.clone());
+13 -13
View File
@@ -70,9 +70,9 @@ struct SharedResources {
impl SharedResources {
fn start() -> Self {
// Start revive-dev-node
// Start pez-revive-dev-node
let _node_handle = thread::spawn(move || {
if let Err(e) = revive_dev_node::command::run_with_args(vec![
if let Err(e) = pez_revive_dev_node::command::run_with_args(vec![
"--dev".to_string(),
"--rpc-port=45789".to_string(),
"-lerror,pezsc_rpc_server=info,runtime::revive=debug".to_string(),
@@ -85,7 +85,7 @@ impl SharedResources {
let args = CliCommand::parse_from([
"--dev",
"--rpc-port=45788",
"--node-rpc-url=ws://localhost:45789",
"--pez-node-rpc-url=ws://localhost:45789",
"--no-prometheus",
"-linfo,eth-rpc=debug",
]);
@@ -103,7 +103,7 @@ impl SharedResources {
ws_client_with_retry("ws://localhost:45788").await
}
fn node_rpc_url() -> &'static str {
fn pez_node_rpc_url() -> &'static str {
"ws://localhost:45789"
}
}
@@ -464,10 +464,10 @@ async fn test_invalid_transaction(client: Arc<WsClient>) -> anyhow::Result<()> {
async fn get_evm_block_from_storage(
node_client: &OnlineClient<SrcChainConfig>,
node_rpc_client: &RpcClient,
pez_node_rpc_client: &RpcClient,
block_number: U256,
) -> anyhow::Result<Block> {
let block_hash: H256 = node_rpc_client
let block_hash: H256 = pez_node_rpc_client
.request("chain_getBlockHash", rpc_params![block_number])
.await
.unwrap();
@@ -480,8 +480,8 @@ async fn get_evm_block_from_storage(
}
async fn test_evm_blocks_should_match(client: Arc<WsClient>) -> anyhow::Result<()> {
let (node_client, node_rpc_client, _) =
client::connect(SharedResources::node_rpc_url()).await.unwrap();
let (node_client, pez_node_rpc_client, _) =
client::connect(SharedResources::pez_node_rpc_url()).await.unwrap();
// Deploy a contract to have some interesting blocks
let (bytes, _) = pezpallet_revive_fixtures::compile_module("dummy")?;
@@ -499,7 +499,7 @@ async fn test_evm_blocks_should_match(client: Arc<WsClient>) -> anyhow::Result<(
log::trace!(target: LOG_TARGET, "tx hash = {:?}", tx.hash());
let evm_block_from_storage =
get_evm_block_from_storage(&node_client, &node_rpc_client, block_number).await?;
get_evm_block_from_storage(&node_client, &pez_node_rpc_client, block_number).await?;
// Fetch the block immediately (should come from storage EthereumBlock)
let evm_block_from_rpc_by_number = client
@@ -700,7 +700,7 @@ async fn test_mixed_evm_bizinikiwi_transactions(client: Arc<WsClient>) -> anyhow
// Prepare bizinikiwi transactions (simple remarks)
log::trace!(target: LOG_TARGET, "Creating {num_bizinikiwi_txs} bizinikiwi remark transactions");
let alice_signer = subxt_signer::sr25519::dev::alice();
let (node_client, _, _) = client::connect(SharedResources::node_rpc_url()).await.unwrap();
let (node_client, _, _) = client::connect(SharedResources::pez_node_rpc_url()).await.unwrap();
let bizinikiwi_txs =
prepare_bizinikiwi_transactions(&node_client, &alice_signer, num_bizinikiwi_txs).await?;
@@ -730,15 +730,15 @@ async fn test_mixed_evm_bizinikiwi_transactions(client: Arc<WsClient>) -> anyhow
}
async fn test_runtime_pallets_address_upload_code(client: Arc<WsClient>) -> anyhow::Result<()> {
let (node_client, node_rpc_client, _) =
client::connect(SharedResources::node_rpc_url()).await?;
let (node_client, pez_node_rpc_client, _) =
client::connect(SharedResources::pez_node_rpc_url()).await?;
let (bytecode, _) = pezpallet_revive_fixtures::compile_module("dummy")?;
let signer = Account::default();
// Helper function to get bizinikiwi block hash from EVM block number
let get_bizinikiwi_block_hash = |block_number: U256| {
let rpc_client = node_rpc_client.clone();
let rpc_client = pez_node_rpc_client.clone();
async move {
rpc_client
.request::<pezsp_core::H256>("chain_getBlockHash", rpc_params![block_number])
@@ -43,7 +43,7 @@ use pezsp_core::{H160, U256};
use pezsp_runtime::{traits::AccountIdConversion, DispatchError};
use super::{address::AddressMapper, pallet, Config, ContractResult, ExecConfig, Pallet, Weight};
use ethereum_standards::IERC20;
use pez_ethereum_standards::IERC20;
const GAS_LIMIT: Weight = Weight::from_parts(500_000_000_000, 10 * 1024 * 1024);
+1 -1
View File
@@ -24,4 +24,4 @@ pub mod v1;
pub mod v2;
/// A unique identifier across all pallets.
const PALLET_MIGRATIONS_ID: &[u8; 17] = b"pezpallet-revive-mbm";
const PALLET_MIGRATIONS_ID: &[u8; 20] = b"pezpallet-revive-mbm";
@@ -51,7 +51,7 @@ pub struct Migration<T: Config>(PhantomData<T>);
impl<T: Config> SteppedMigration for Migration<T> {
type Cursor = H160;
type Identifier = MigrationId<17>;
type Identifier = MigrationId<20>;
fn id() -> Self::Identifier {
MigrationId { pezpallet_id: *PALLET_MIGRATIONS_ID, version_from: 0, version_to: 1 }
@@ -92,7 +92,7 @@ pub struct Migration<T: Config>(PhantomData<T>);
impl<T: Config> SteppedMigration for Migration<T> {
type Cursor = H256;
type Identifier = MigrationId<17>;
type Identifier = MigrationId<20>;
fn id() -> Self::Identifier {
MigrationId { pezpallet_id: *PALLET_MIGRATIONS_ID, version_from: 1, version_to: 2 }
+1 -1
View File
@@ -46,7 +46,7 @@
// benchmark
// pallet
// --extrinsic=*
// --runtime=target/production/wbuild/kitchensink-runtime/kitchensink_runtime.wasm
// --runtime=target/production/wbuild/pez-kitchensink-runtime/pez_kitchensink_runtime.wasm
// --pallet=pezpallet_revive
// --header=/__w/pezkuwi-sdk/pezkuwi-sdk/bizinikiwi/HEADER-APACHE2
// --output=/__w/pezkuwi-sdk/pezkuwi-sdk/bizinikiwi/pezframe/revive/src/weights.rs