Skip to content

Commit

Permalink
Integrate runtime APIs into lib.rs and enhance metadata testing (#821)
Browse files Browse the repository at this point in the history
* move  macro to same file as

* clippy and lint issues

* metadata test

* fix metadata

* bump 2201

* update Cargo.lock

* test passing

* refactoring

* fix clippy

* fix test

---------

Co-authored-by: Alessandro Siniscalchi <[email protected]>
  • Loading branch information
magecnion and asiniscalchi authored Oct 16, 2024
1 parent a71e24c commit 9dd5ad2
Show file tree
Hide file tree
Showing 10 changed files with 44,930 additions and 485 deletions.
17 changes: 15 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description = "The LAOS parachain node."
repository = "https://github.com/freeverseio/laos.git"
homepage = "https://www.laosfoundation.io"
authors = ["Freeverse"]
version = "0.22.0"
version = "0.22.1"

[workspace]
resolver = "2"
Expand Down Expand Up @@ -32,6 +32,8 @@ sha3 = { version = "0.10.1", default-features = false }
similar-asserts = { version = "1.1.0" }
serde_json = { version = "1.0.104", default-features = true }
rustc-hex = { version = "2.1", default-features = false }
frame-metadata = "16.0.0"
assert-json-diff = "2.0.2"

# Wasm builder
substrate-wasm-builder = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0" }
Expand Down
2 changes: 1 addition & 1 deletion e2e-tests/tests/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import ParachainStaking from "../build/contracts/ParachainStaking.json";

// Node config
export const RUNTIME_SPEC_NAME = "laos";
export const RUNTIME_SPEC_VERSION = 2200;
export const RUNTIME_SPEC_VERSION = 2201;
export const RUNTIME_IMPL_VERSION = 0;
export const LOCAL_NODE_URL = "http://127.0.0.1:9999";

Expand Down
6 changes: 3 additions & 3 deletions node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use std::{path::Path, sync::Arc, time::Duration};

use cumulus_client_cli::CollatorOptions;
// Local Runtime Types
use laos_runtime::{apis::RuntimeApi, opaque::Block, types::TransactionConverter, Hash};
use laos_runtime::{opaque::Block, types::TransactionConverter, Hash};

// Cumulus Imports
use cumulus_client_collator::service::CollatorService;
Expand All @@ -39,6 +39,7 @@ use cumulus_relay_chain_interface::{OverseerHandle, RelayChainInterface};
use fc_rpc::{StorageOverride, StorageOverrideHandler};
use frame_benchmarking_cli::SUBSTRATE_REFERENCE_HARDWARE;
use futures::FutureExt;
use laos_runtime::RuntimeApi;
use sc_client_api::Backend;
use sc_consensus::ImportQueue;
use sc_executor::{
Expand All @@ -52,7 +53,6 @@ use sc_transaction_pool_api::OffchainTransactionPoolFactory;
use sp_core::U256;
use sp_keystore::KeystorePtr;
use substrate_prometheus_endpoint::Registry;

// Frontier
use crate::eth::{
db_config_dir, new_frontier_partial, spawn_frontier_tasks, BackendType, EthConfiguration,
Expand All @@ -66,7 +66,7 @@ impl sc_executor::NativeExecutionDispatch for ParachainNativeExecutor {
type ExtendHostFunctions = ParachainHostFunctions;

fn dispatch(method: &str, data: &[u8]) -> Option<Vec<u8>> {
laos_runtime::apis::api::dispatch(method, data)
laos_runtime::api::dispatch(method, data)
}

fn native_version() -> sc_executor::NativeVersion {
Expand Down
3 changes: 3 additions & 0 deletions runtime/laos/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ polkadot-runtime-parachains = { workspace = true }
pallet-assets = { workspace = true }
test-utils = { workspace = true }
ethereum = { workspace = true }
serde_json = { workspace = true }
frame-metadata = { workspace = true }
assert-json-diff = { workspace = true }

[features]
fast-runtime=[]
Expand Down
Loading

0 comments on commit 9dd5ad2

Please sign in to comment.