From 5afdde5033ea4416a2f993ccd59ddeda1656fd8a Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Thu, 29 Feb 2024 09:50:13 +0000 Subject: [PATCH 01/30] Adding template pallet --- Cargo.lock | 16 +++ pallets/template/Cargo.toml | 53 +++++++ pallets/template/src/benchmarking.rs | 35 +++++ pallets/template/src/lib.rs | 202 +++++++++++++++++++++++++++ pallets/template/src/mock.rs | 58 ++++++++ pallets/template/src/tests.rs | 27 ++++ pallets/template/src/weights.rs | 90 ++++++++++++ runtime/Cargo.toml | 3 + 8 files changed, 484 insertions(+) create mode 100644 pallets/template/Cargo.toml create mode 100644 pallets/template/src/benchmarking.rs create mode 100644 pallets/template/src/lib.rs create mode 100644 pallets/template/src/mock.rs create mode 100644 pallets/template/src/tests.rs create mode 100644 pallets/template/src/weights.rs diff --git a/Cargo.lock b/Cargo.lock index 0168238..b4811da 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1631,6 +1631,7 @@ dependencies = [ "pallet-grandpa", "pallet-insecure-randomness-collective-flip", "pallet-sudo", + "pallet-template", "pallet-timestamp", "pallet-transaction-payment", "pallet-transaction-payment-rpc-runtime-api", @@ -7293,6 +7294,21 @@ dependencies = [ "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=e76b244853c52d523e1d5c7a28948573df60df46)", ] +[[package]] +name = "pallet-template" +version = "4.0.0-dev" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=e76b244853c52d523e1d5c7a28948573df60df46)", +] + [[package]] name = "pallet-timestamp" version = "27.0.0" diff --git a/pallets/template/Cargo.toml b/pallets/template/Cargo.toml new file mode 100644 index 0000000..4ebf913 --- /dev/null +++ b/pallets/template/Cargo.toml @@ -0,0 +1,53 @@ +[package] +name = "pallet-template" +version = "4.0.0-dev" +description = "FRAME pallet template for defining custom runtime logic." +authors = ["Substrate DevHub "] +homepage = "https://substrate.io" +edition.workspace = true +license = "MIT-0" +publish = false +repository = "https://github.com/paritytech/substrate-contracts-node" + +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + +[dependencies] +codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false, features = [ + "derive", +] } +scale-info = { version = "2.10.0", default-features = false, features = ["derive"] } +frame-benchmarking = { workspace = true, default-features = false, optional = true } +frame-support = { workspace = true, default-features = false } +frame-system = { workspace = true, default-features = false } +sp-std = { workspace = true, default-features = false } + +[dev-dependencies] +sp-core = { workspace = true } +sp-io = { workspace = true } +sp-runtime = { workspace = true } + +[features] +default = ["std"] +std = [ + "codec/std", + "frame-benchmarking?/std", + "frame-support/std", + "frame-system/std", + "scale-info/std", + "sp-core/std", + "sp-io/std", + "sp-runtime/std", + "sp-std/std", +] +runtime-benchmarks = [ + "frame-benchmarking/runtime-benchmarks", + "frame-support/runtime-benchmarks", + "frame-system/runtime-benchmarks", + "sp-runtime/runtime-benchmarks", +] +try-runtime = [ + "frame-support/try-runtime", + "frame-system/try-runtime", + "sp-runtime/try-runtime", +] diff --git a/pallets/template/src/benchmarking.rs b/pallets/template/src/benchmarking.rs new file mode 100644 index 0000000..5a26241 --- /dev/null +++ b/pallets/template/src/benchmarking.rs @@ -0,0 +1,35 @@ +//! Benchmarking setup for pallet-template +#![cfg(feature = "runtime-benchmarks")] +use super::*; + +#[allow(unused)] +use crate::Pallet as Template; +use frame_benchmarking::v2::*; +use frame_system::RawOrigin; + +#[benchmarks] +mod benchmarks { + use super::*; + + #[benchmark] + fn do_something() { + let value = 100u32.into(); + let caller: T::AccountId = whitelisted_caller(); + #[extrinsic_call] + do_something(RawOrigin::Signed(caller), value); + + assert_eq!(Something::::get(), Some(value)); + } + + #[benchmark] + fn cause_error() { + Something::::put(100u32); + let caller: T::AccountId = whitelisted_caller(); + #[extrinsic_call] + cause_error(RawOrigin::Signed(caller)); + + assert_eq!(Something::::get(), Some(101u32)); + } + + impl_benchmark_test_suite!(Template, crate::mock::new_test_ext(), crate::mock::Test); +} diff --git a/pallets/template/src/lib.rs b/pallets/template/src/lib.rs new file mode 100644 index 0000000..90dfe37 --- /dev/null +++ b/pallets/template/src/lib.rs @@ -0,0 +1,202 @@ +//! # Template Pallet +//! +//! A pallet with minimal functionality to help developers understand the essential components of +//! writing a FRAME pallet. It is typically used in beginner tutorials or in Substrate template +//! nodes as a starting point for creating a new pallet and **not meant to be used in production**. +//! +//! ## Overview +//! +//! This template pallet contains basic examples of: +//! - declaring a storage item that stores a single `u32` value +//! - declaring and using events +//! - declaring and using errors +//! - a dispatchable function that allows a user to set a new value to storage and emits an event +//! upon success +//! - another dispatchable function that causes a custom error to be thrown +//! +//! Each pallet section is annotated with an attribute using the `#[pallet::...]` procedural macro. +//! This macro generates the necessary code for a pallet to be aggregated into a FRAME runtime. +//! +//! Learn more about FRAME macros [here](https://docs.substrate.io/reference/frame-macros/). +//! +//! ### Pallet Sections +//! +//! The pallet sections in this template are: +//! +//! - A **configuration trait** that defines the types and parameters which the pallet depends on +//! (denoted by the `#[pallet::config]` attribute). See: [`Config`]. +//! - A **means to store pallet-specific data** (denoted by the `#[pallet::storage]` attribute). +//! See: [`storage_types`]. +//! - A **declaration of the events** this pallet emits (denoted by the `#[pallet::event]` +//! attribute). See: [`Event`]. +//! - A **declaration of the errors** that this pallet can throw (denoted by the `#[pallet::error]` +//! attribute). See: [`Error`]. +//! - A **set of dispatchable functions** that define the pallet's functionality (denoted by the +//! `#[pallet::call]` attribute). See: [`dispatchables`]. +//! +//! Run `cargo doc --package pallet-template --open` to view this pallet's documentation. + +// We make sure this pallet uses `no_std` for compiling to Wasm. +#![cfg_attr(not(feature = "std"), no_std)] + +// Re-export pallet items so that they can be accessed from the crate namespace. +pub use pallet::*; + +// FRAME pallets require their own "mock runtimes" to be able to run unit tests. This module +// contains a mock runtime specific for testing this pallet's functionality. +#[cfg(test)] +mod mock; + +// This module contains the unit tests for this pallet. +// Learn about pallet unit testing here: https://docs.substrate.io/test/unit-testing/ +#[cfg(test)] +mod tests; + +// Every callable function or "dispatchable" a pallet exposes must have weight values that correctly +// estimate a dispatchable's execution time. The benchmarking module is used to calculate weights +// for each dispatchable and generates this pallet's weight.rs file. Learn more about benchmarking here: https://docs.substrate.io/test/benchmark/ +#[cfg(feature = "runtime-benchmarks")] +mod benchmarking; +pub mod weights; +pub use weights::*; + +// All pallet logic is defined in its own module and must be annotated by the `pallet` attribute. +#[frame_support::pallet] +pub mod pallet { + // Import various useful types required by all FRAME pallets. + use super::*; + use frame_support::pallet_prelude::*; + use frame_system::pallet_prelude::*; + + // The `Pallet` struct serves as a placeholder to implement traits, methods and dispatchables + // (`Call`s) in this pallet. + #[pallet::pallet] + pub struct Pallet(_); + + /// The pallet's configuration trait. + /// + /// All our types and constants a pallet depends on must be declared here. + /// These types are defined generically and made concrete when the pallet is declared in the + /// `runtime/src/lib.rs` file of your chain. + #[pallet::config] + pub trait Config: frame_system::Config { + /// The overarching runtime event type. + type RuntimeEvent: From> + IsType<::RuntimeEvent>; + /// A type representing the weights required by the dispatchables of this pallet. + type WeightInfo: WeightInfo; + } + + /// A storage item for this pallet. + /// + /// In this template, we are declaring a storage item called `Something` that stores a single + /// `u32` value. Learn more about runtime storage here: + #[pallet::storage] + pub type Something = StorageValue<_, u32>; + + /// Events that functions in this pallet can emit. + /// + /// Events are a simple means of indicating to the outside world (such as dApps, chain explorers + /// or other users) that some notable update in the runtime has occurred. In a FRAME pallet, the + /// documentation for each event field and its parameters is added to a node's metadata so it + /// can be used by external interfaces or tools. + /// + /// The `generate_deposit` macro generates a function on `Pallet` called `deposit_event` which + /// will convert the event type of your pallet into `RuntimeEvent` (declared in the pallet's + /// [`Config`] trait) and deposit it using [`frame_system::Pallet::deposit_event`]. + #[pallet::event] + #[pallet::generate_deposit(pub(super) fn deposit_event)] + pub enum Event { + /// A user has successfully set a new value. + SomethingStored { + /// The new value set. + something: u32, + /// The account who set the new value. + who: T::AccountId, + }, + } + + /// Errors that can be returned by this pallet. + /// + /// Errors tell users that something went wrong so it's important that their naming is + /// informative. Similar to events, error documentation is added to a node's metadata so it's + /// equally important that they have helpful documentation associated with them. + /// + /// This type of runtime error can be up to 4 bytes in size should you want to return additional + /// information. + #[pallet::error] + pub enum Error { + /// The value retrieved was `None` as no value was previously set. + NoneValue, + /// There was an attempt to increment the value in storage over `u32::MAX`. + StorageOverflow, + } + + /// The pallet's dispatchable functions ([`Call`]s). + /// + /// Dispatchable functions allows users to interact with the pallet and invoke state changes. + /// These functions materialize as "extrinsics", which are often compared to transactions. + /// They must always return a `DispatchResult` and be annotated with a weight and call index. + /// + /// The [`call_index`] macro is used to explicitly + /// define an index for calls in the [`Call`] enum. This is useful for pallets that may + /// introduce new dispatchables over time. If the order of a dispatchable changes, its index + /// will also change which will break backwards compatibility. + /// + /// The [`weight`] macro is used to assign a weight to each call. + #[pallet::call] + impl Pallet { + /// An example dispatchable that takes a single u32 value as a parameter, writes the value + /// to storage and emits an event. + /// + /// It checks that the _origin_ for this call is _Signed_ and returns a dispatch + /// error if it isn't. Learn more about origins here: + #[pallet::call_index(0)] + #[pallet::weight(T::WeightInfo::do_something())] + pub fn do_something(origin: OriginFor, something: u32) -> DispatchResult { + // Check that the extrinsic was signed and get the signer. + let who = ensure_signed(origin)?; + + // Update storage. + Something::::put(something); + + // Emit an event. + Self::deposit_event(Event::SomethingStored { something, who }); + + // Return a successful `DispatchResult` + Ok(()) + } + + /// An example dispatchable that may throw a custom error. + /// + /// It checks that the caller is a signed origin and reads the current value from the + /// `Something` storage item. If a current value exists, it is incremented by 1 and then + /// written back to storage. + /// + /// ## Errors + /// + /// The function will return an error under the following conditions: + /// + /// - If no value has been set ([`Error::NoneValue`]) + /// - If incrementing the value in storage causes an arithmetic overflow + /// ([`Error::StorageOverflow`]) + #[pallet::call_index(1)] + #[pallet::weight(T::WeightInfo::cause_error())] + pub fn cause_error(origin: OriginFor) -> DispatchResult { + let _who = ensure_signed(origin)?; + + // Read a value from storage. + match Something::::get() { + // Return an error if the value has not been set. + None => Err(Error::::NoneValue.into()), + Some(old) => { + // Increment the value read from storage. This will cause an error in the event + // of overflow. + let new = old.checked_add(1).ok_or(Error::::StorageOverflow)?; + // Update the value in storage with the incremented result. + Something::::put(new); + Ok(()) + }, + } + } + } +} diff --git a/pallets/template/src/mock.rs b/pallets/template/src/mock.rs new file mode 100644 index 0000000..8346461 --- /dev/null +++ b/pallets/template/src/mock.rs @@ -0,0 +1,58 @@ +use crate as pallet_template; +use frame_support::{ + derive_impl, + traits::{ConstU16, ConstU64}, +}; +use sp_core::H256; +use sp_runtime::{ + traits::{BlakeTwo256, IdentityLookup}, + BuildStorage, +}; + +type Block = frame_system::mocking::MockBlock; + +// Configure a mock runtime to test the pallet. +frame_support::construct_runtime!( + pub enum Test + { + System: frame_system, + TemplateModule: pallet_template, + } +); + +#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)] +impl frame_system::Config for Test { + type BaseCallFilter = frame_support::traits::Everything; + type BlockWeights = (); + type BlockLength = (); + type DbWeight = (); + type RuntimeOrigin = RuntimeOrigin; + type RuntimeCall = RuntimeCall; + type Nonce = u64; + type Hash = H256; + type Hashing = BlakeTwo256; + type AccountId = u64; + type Lookup = IdentityLookup; + type Block = Block; + type RuntimeEvent = RuntimeEvent; + type BlockHashCount = ConstU64<250>; + type Version = (); + type PalletInfo = PalletInfo; + type AccountData = (); + type OnNewAccount = (); + type OnKilledAccount = (); + type SystemWeightInfo = (); + type SS58Prefix = ConstU16<42>; + type OnSetCode = (); + type MaxConsumers = frame_support::traits::ConstU32<16>; +} + +impl pallet_template::Config for Test { + type RuntimeEvent = RuntimeEvent; + type WeightInfo = (); +} + +// Build genesis storage according to the mock runtime. +pub fn new_test_ext() -> sp_io::TestExternalities { + frame_system::GenesisConfig::::default().build_storage().unwrap().into() +} diff --git a/pallets/template/src/tests.rs b/pallets/template/src/tests.rs new file mode 100644 index 0000000..83e4bea --- /dev/null +++ b/pallets/template/src/tests.rs @@ -0,0 +1,27 @@ +use crate::{mock::*, Error, Event, Something}; +use frame_support::{assert_noop, assert_ok}; + +#[test] +fn it_works_for_default_value() { + new_test_ext().execute_with(|| { + // Go past genesis block so events get deposited + System::set_block_number(1); + // Dispatch a signed extrinsic. + assert_ok!(TemplateModule::do_something(RuntimeOrigin::signed(1), 42)); + // Read pallet storage and assert an expected result. + assert_eq!(Something::::get(), Some(42)); + // Assert that the correct event was deposited + System::assert_last_event(Event::SomethingStored { something: 42, who: 1 }.into()); + }); +} + +#[test] +fn correct_error_for_none_value() { + new_test_ext().execute_with(|| { + // Ensure the expected error is thrown when no value is present. + assert_noop!( + TemplateModule::cause_error(RuntimeOrigin::signed(1)), + Error::::NoneValue + ); + }); +} diff --git a/pallets/template/src/weights.rs b/pallets/template/src/weights.rs new file mode 100644 index 0000000..7c42936 --- /dev/null +++ b/pallets/template/src/weights.rs @@ -0,0 +1,90 @@ + +//! Autogenerated weights for pallet_template +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-04-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `Alexs-MacBook-Pro-2.local`, CPU: `` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 + +// Executed Command: +// ../../target/release/node-template +// benchmark +// pallet +// --chain +// dev +// --pallet +// pallet_template +// --extrinsic +// * +// --steps=50 +// --repeat=20 +// --wasm-execution=compiled +// --output +// pallets/template/src/weights.rs +// --template +// ../../.maintain/frame-weight-template.hbs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use core::marker::PhantomData; + +/// Weight functions needed for pallet_template. +pub trait WeightInfo { + fn do_something() -> Weight; + fn cause_error() -> Weight; +} + +/// Weights for pallet_template using the Substrate node and recommended hardware. +pub struct SubstrateWeight(PhantomData); +impl WeightInfo for SubstrateWeight { + /// Storage: TemplateModule Something (r:0 w:1) + /// Proof: TemplateModule Something (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + fn do_something() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 8_000_000 picoseconds. + Weight::from_parts(9_000_000, 0) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: TemplateModule Something (r:1 w:1) + /// Proof: TemplateModule Something (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + fn cause_error() -> Weight { + // Proof Size summary in bytes: + // Measured: `32` + // Estimated: `1489` + // Minimum execution time: 6_000_000 picoseconds. + Weight::from_parts(6_000_000, 1489) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } +} + +// For backwards compatibility and tests +impl WeightInfo for () { + /// Storage: TemplateModule Something (r:0 w:1) + /// Proof: TemplateModule Something (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + fn do_something() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 8_000_000 picoseconds. + Weight::from_parts(9_000_000, 0) + .saturating_add(RocksDbWeight::get().writes(1_u64)) + } + /// Storage: TemplateModule Something (r:1 w:1) + /// Proof: TemplateModule Something (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + fn cause_error() -> Weight { + // Proof Size summary in bytes: + // Measured: `32` + // Estimated: `1489` + // Minimum execution time: 6_000_000 picoseconds. + Weight::from_parts(6_000_000, 1489) + .saturating_add(RocksDbWeight::get().reads(1_u64)) + .saturating_add(RocksDbWeight::get().writes(1_u64)) + } +} diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index 15896f5..a7b3148 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -57,6 +57,9 @@ pallet-utility = { workspace = true } frame-benchmarking = { workspace = true, optional = true } frame-system-benchmarking = { workspace = true , optional = true} +# Local Dependencies +pallet-template = { path = "../pallets/template", default-features = false } + [build-dependencies] substrate-wasm-builder = { workspace = true, optional = true } From 6226cfc203f3d8f977512dc52246152d1f1635c7 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Fri, 1 Mar 2024 14:27:25 +0000 Subject: [PATCH 02/30] Rename template to contract-caller --- Cargo.lock | 32 +++++++++---------- .../{template => contract-caller}/Cargo.toml | 4 +-- .../src/benchmarking.rs | 2 +- .../{template => contract-caller}/src/lib.rs | 0 .../{template => contract-caller}/src/mock.rs | 0 .../src/tests.rs | 0 .../src/weights.rs | 0 runtime/Cargo.toml | 2 +- 8 files changed, 20 insertions(+), 20 deletions(-) rename pallets/{template => contract-caller}/Cargo.toml (93%) rename pallets/{template => contract-caller}/src/benchmarking.rs (93%) rename pallets/{template => contract-caller}/src/lib.rs (100%) rename pallets/{template => contract-caller}/src/mock.rs (100%) rename pallets/{template => contract-caller}/src/tests.rs (100%) rename pallets/{template => contract-caller}/src/weights.rs (100%) diff --git a/Cargo.lock b/Cargo.lock index b4811da..795bd0b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1627,11 +1627,11 @@ dependencies = [ "pallet-aura", "pallet-authorship", "pallet-balances", + "pallet-contract-caller", "pallet-contracts", "pallet-grandpa", "pallet-insecure-randomness-collective-flip", "pallet-sudo", - "pallet-template", "pallet-timestamp", "pallet-transaction-payment", "pallet-transaction-payment-rpc-runtime-api", @@ -6600,6 +6600,21 @@ dependencies = [ "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=e76b244853c52d523e1d5c7a28948573df60df46)", ] +[[package]] +name = "pallet-contract-caller" +version = "4.0.0-dev" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=e76b244853c52d523e1d5c7a28948573df60df46)", +] + [[package]] name = "pallet-contracts" version = "27.0.0" @@ -7294,21 +7309,6 @@ dependencies = [ "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=e76b244853c52d523e1d5c7a28948573df60df46)", ] -[[package]] -name = "pallet-template" -version = "4.0.0-dev" -dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "parity-scale-codec", - "scale-info", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=e76b244853c52d523e1d5c7a28948573df60df46)", -] - [[package]] name = "pallet-timestamp" version = "27.0.0" diff --git a/pallets/template/Cargo.toml b/pallets/contract-caller/Cargo.toml similarity index 93% rename from pallets/template/Cargo.toml rename to pallets/contract-caller/Cargo.toml index 4ebf913..afe0bd4 100644 --- a/pallets/template/Cargo.toml +++ b/pallets/contract-caller/Cargo.toml @@ -1,7 +1,7 @@ [package] -name = "pallet-template" +name = "pallet-contract-caller" version = "4.0.0-dev" -description = "FRAME pallet template for defining custom runtime logic." +description = "Demonstrate calling an ink! contract from a pallet" authors = ["Substrate DevHub "] homepage = "https://substrate.io" edition.workspace = true diff --git a/pallets/template/src/benchmarking.rs b/pallets/contract-caller/src/benchmarking.rs similarity index 93% rename from pallets/template/src/benchmarking.rs rename to pallets/contract-caller/src/benchmarking.rs index 5a26241..4bcc891 100644 --- a/pallets/template/src/benchmarking.rs +++ b/pallets/contract-caller/src/benchmarking.rs @@ -1,4 +1,4 @@ -//! Benchmarking setup for pallet-template +//! Benchmarking setup for pallet-contract-caller #![cfg(feature = "runtime-benchmarks")] use super::*; diff --git a/pallets/template/src/lib.rs b/pallets/contract-caller/src/lib.rs similarity index 100% rename from pallets/template/src/lib.rs rename to pallets/contract-caller/src/lib.rs diff --git a/pallets/template/src/mock.rs b/pallets/contract-caller/src/mock.rs similarity index 100% rename from pallets/template/src/mock.rs rename to pallets/contract-caller/src/mock.rs diff --git a/pallets/template/src/tests.rs b/pallets/contract-caller/src/tests.rs similarity index 100% rename from pallets/template/src/tests.rs rename to pallets/contract-caller/src/tests.rs diff --git a/pallets/template/src/weights.rs b/pallets/contract-caller/src/weights.rs similarity index 100% rename from pallets/template/src/weights.rs rename to pallets/contract-caller/src/weights.rs diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index a7b3148..e9b0ed3 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -58,7 +58,7 @@ frame-benchmarking = { workspace = true, optional = true } frame-system-benchmarking = { workspace = true , optional = true} # Local Dependencies -pallet-template = { path = "../pallets/template", default-features = false } +pallet-contract-caller = { path = "../pallets/contract-caller", default-features = false } [build-dependencies] substrate-wasm-builder = { workspace = true, optional = true } From d06e6664f19723738a8163d930d1080bd0c0e248 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Tue, 5 Mar 2024 14:29:53 +0000 Subject: [PATCH 03/30] Add `contracts` dir with basic flipper --- Cargo.toml | 3 + contracts/.gitignore | 2 + contracts/flipper/Cargo.toml | 24 ++++++ contracts/flipper/lib.rs | 142 +++++++++++++++++++++++++++++++++++ 4 files changed, 171 insertions(+) create mode 100755 contracts/.gitignore create mode 100755 contracts/flipper/Cargo.toml create mode 100755 contracts/flipper/lib.rs diff --git a/Cargo.toml b/Cargo.toml index 12b7d0c..6ec2f1b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,6 +13,9 @@ members = [ "runtime", "parachain-runtime", ] +exclude = [ + "contracts", +] [profile.release] panic = 'unwind' diff --git a/contracts/.gitignore b/contracts/.gitignore new file mode 100755 index 0000000..ca98cd9 --- /dev/null +++ b/contracts/.gitignore @@ -0,0 +1,2 @@ +/target/ +Cargo.lock diff --git a/contracts/flipper/Cargo.toml b/contracts/flipper/Cargo.toml new file mode 100755 index 0000000..e08b249 --- /dev/null +++ b/contracts/flipper/Cargo.toml @@ -0,0 +1,24 @@ +[package] +name = "flipper" +version = "0.1.0" +authors = ["[your_name] <[your_email]>"] +edition = "2021" + +[dependencies] +ink = { version = "5.0.0-rc.2", default-features = false } + +scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } +scale-info = { version = "2.6", default-features = false, features = ["derive"], optional = true } + +[lib] +path = "lib.rs" + +[features] +default = ["std"] +std = [ + "ink/std", + "scale/std", + "scale-info/std", +] +ink-as-dependency = [] +e2e-tests = [] diff --git a/contracts/flipper/lib.rs b/contracts/flipper/lib.rs new file mode 100755 index 0000000..487f0b4 --- /dev/null +++ b/contracts/flipper/lib.rs @@ -0,0 +1,142 @@ +#![cfg_attr(not(feature = "std"), no_std, no_main)] + +#[ink::contract] +mod flipper { + + /// Defines the storage of your contract. + /// Add new fields to the below struct in order + /// to add new static storage fields to your contract. + #[ink(storage)] + pub struct Flipper { + /// Stores a single `bool` value on the storage. + value: bool, + } + + impl Flipper { + /// Constructor that initializes the `bool` value to the given `init_value`. + #[ink(constructor)] + pub fn new(init_value: bool) -> Self { + Self { value: init_value } + } + + /// Constructor that initializes the `bool` value to `false`. + /// + /// Constructors can delegate to other constructors. + #[ink(constructor)] + pub fn default() -> Self { + Self::new(Default::default()) + } + + /// A message that can be called on instantiated contracts. + /// This one flips the value of the stored `bool` from `true` + /// to `false` and vice versa. + #[ink(message)] + pub fn flip(&mut self) { + self.value = !self.value; + } + + /// Simply returns the current value of our `bool`. + #[ink(message)] + pub fn get(&self) -> bool { + self.value + } + } + + /// Unit tests in Rust are normally defined within such a `#[cfg(test)]` + /// module and test functions are marked with a `#[test]` attribute. + /// The below code is technically just normal Rust code. + #[cfg(test)] + mod tests { + /// Imports all the definitions from the outer scope so we can use them here. + use super::*; + + /// We test if the default constructor does its job. + #[ink::test] + fn default_works() { + let flipper = Flipper::default(); + assert_eq!(flipper.get(), false); + } + + /// We test a simple use case of our contract. + #[ink::test] + fn it_works() { + let mut flipper = Flipper::new(false); + assert_eq!(flipper.get(), false); + flipper.flip(); + assert_eq!(flipper.get(), true); + } + } + + + /// This is how you'd write end-to-end (E2E) or integration tests for ink! contracts. + /// + /// When running these you need to make sure that you: + /// - Compile the tests with the `e2e-tests` feature flag enabled (`--features e2e-tests`) + /// - Are running a Substrate node which contains `pallet-contracts` in the background + #[cfg(all(test, feature = "e2e-tests"))] + mod e2e_tests { + /// Imports all the definitions from the outer scope so we can use them here. + use super::*; + + /// A helper function used for calling contract messages. + use ink_e2e::build_message; + + /// The End-to-End test `Result` type. + type E2EResult = std::result::Result>; + + /// We test that we can upload and instantiate the contract using its default constructor. + #[ink_e2e::test] + async fn default_works(mut client: ink_e2e::Client) -> E2EResult<()> { + // Given + let constructor = FlipperRef::default(); + + // When + let contract_account_id = client + .instantiate("flipper", &ink_e2e::alice(), constructor, 0, None) + .await + .expect("instantiate failed") + .account_id; + + // Then + let get = build_message::(contract_account_id.clone()) + .call(|flipper| flipper.get()); + let get_result = client.call_dry_run(&ink_e2e::alice(), &get, 0, None).await; + assert!(matches!(get_result.return_value(), false)); + + Ok(()) + } + + /// We test that we can read and write a value from the on-chain contract contract. + #[ink_e2e::test] + async fn it_works(mut client: ink_e2e::Client) -> E2EResult<()> { + // Given + let constructor = FlipperRef::new(false); + let contract_account_id = client + .instantiate("flipper", &ink_e2e::bob(), constructor, 0, None) + .await + .expect("instantiate failed") + .account_id; + + let get = build_message::(contract_account_id.clone()) + .call(|flipper| flipper.get()); + let get_result = client.call_dry_run(&ink_e2e::bob(), &get, 0, None).await; + assert!(matches!(get_result.return_value(), false)); + + // When + let flip = build_message::(contract_account_id.clone()) + .call(|flipper| flipper.flip()); + let _flip_result = client + .call(&ink_e2e::bob(), flip, 0, None) + .await + .expect("flip failed"); + + // Then + let get = build_message::(contract_account_id.clone()) + .call(|flipper| flipper.get()); + let get_result = client.call_dry_run(&ink_e2e::bob(), &get, 0, None).await; + assert!(matches!(get_result.return_value(), true)); + + Ok(()) + } + } +} From 999e4218cb260205f1ccbe135662440758bcaff8 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Fri, 8 Mar 2024 17:50:33 +0000 Subject: [PATCH 04/30] WIP add e2e tests --- contracts/flipper/e2e_tests.rs | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 contracts/flipper/e2e_tests.rs diff --git a/contracts/flipper/e2e_tests.rs b/contracts/flipper/e2e_tests.rs new file mode 100644 index 0000000..e69de29 From ef2b1f1ee5dc0dfac970a6f0034d56c020e9e7c8 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Fri, 8 Mar 2024 18:18:51 +0000 Subject: [PATCH 05/30] Cargo.lock --- Cargo.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 7a38886..8992e1c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6392,7 +6392,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=e76b244853c52d523e1d5c7a28948573df60df46)", + "sp-std", ] [[package]] From 89803f063b3690c1804bb25fc5eefb263a7ff446 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Mon, 11 Mar 2024 10:22:52 +0000 Subject: [PATCH 06/30] Move flipper inside pallet --- Cargo.lock | 453 +++++++++++++++++- Cargo.toml | 3 - pallets/contract-caller/Cargo.toml | 3 + .../contract-caller/contracts}/.gitignore | 0 .../contracts}/flipper/Cargo.toml | 0 .../contracts}/flipper/e2e_tests.rs | 0 .../contract-caller/contracts}/flipper/lib.rs | 0 7 files changed, 452 insertions(+), 7 deletions(-) rename {contracts => pallets/contract-caller/contracts}/.gitignore (100%) rename {contracts => pallets/contract-caller/contracts}/flipper/Cargo.toml (100%) rename {contracts => pallets/contract-caller/contracts}/flipper/e2e_tests.rs (100%) rename {contracts => pallets/contract-caller/contracts}/flipper/lib.rs (100%) diff --git a/Cargo.lock b/Cargo.lock index 8992e1c..88c4c4f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -358,6 +358,12 @@ version = "6.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f840fb7195bcfc5e17ea40c26e5ce6d5b9ce5d584466e17703209657e459ae0" +[[package]] +name = "array-init" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d62b7694a562cdf5a74227903507c56ab2cc8bdd1f781ed5cb4cf9c9f810bfc" + [[package]] name = "arrayref" version = "0.3.7" @@ -404,7 +410,7 @@ dependencies = [ "proc-macro2", "quote", "syn 1.0.109", - "synstructure", + "synstructure 0.12.6", ] [[package]] @@ -1171,7 +1177,7 @@ dependencies = [ "anstream", "anstyle", "clap_lex", - "strsim", + "strsim 0.11.0", "terminal_size", ] @@ -1306,6 +1312,26 @@ dependencies = [ "tiny-keccak", ] +[[package]] +name = "const_env" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e9e4f72c6e3398ca6da372abd9affd8f89781fe728869bbf986206e9af9627e" +dependencies = [ + "const_env_impl", +] + +[[package]] +name = "const_env_impl" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a4f51209740b5e1589e702b3044cdd4562cef41b6da404904192ffffb852d62" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "constant_time_eq" version = "0.1.5" @@ -2484,6 +2510,41 @@ dependencies = [ "syn 2.0.52", ] +[[package]] +name = "darling" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b750cb3417fd1b327431a470f388520309479ab0bf5e323505daf0290cd3850" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "109c1ca6e6b7f82cc233a97004ea8ed7ca123a9af07a8230878fcfda9b158bf0" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim 0.10.0", + "syn 1.0.109", +] + +[[package]] +name = "darling_macro" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4aab4dbc9f7611d8b55048a3a16d2d010c2c8334e46304b40ac1cc14bf3b48e" +dependencies = [ + "darling_core", + "quote", + "syn 1.0.109", +] + [[package]] name = "dashmap" version = "5.5.3" @@ -3168,6 +3229,15 @@ dependencies = [ "miniz_oxide", ] +[[package]] +name = "flipper" +version = "0.1.0" +dependencies = [ + "ink", + "parity-scale-codec", + "scale-info", +] + [[package]] name = "float-cmp" version = "0.9.0" @@ -4115,6 +4185,12 @@ version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "25a2bc672d1148e28034f176e01fffebb08b35768468cc954630da77a1449005" +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + [[package]] name = "idna" version = "0.2.3" @@ -4253,6 +4329,206 @@ dependencies = [ "unicode-width", ] +[[package]] +name = "ink" +version = "5.0.0-rc.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "529130b4fcd9b369c6eb710511c222fd33d165b1884d224855b18deb6b98f7a1" +dependencies = [ + "derive_more", + "ink_env", + "ink_macro", + "ink_metadata", + "ink_prelude", + "ink_primitives", + "ink_storage", + "pallet-contracts-uapi-next", + "parity-scale-codec", + "scale-info", +] + +[[package]] +name = "ink_allocator" +version = "5.0.0-rc.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4509501e7eaee3988cc7f22a044f3be6599c8532a303b80b0c5761c8d940e413" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "ink_codegen" +version = "5.0.0-rc.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32bbb845e3ee52b86d4b8907c6dd9de174bed224eb353fcf6bce92ae472b8fde" +dependencies = [ + "blake2 0.10.6", + "derive_more", + "either", + "heck", + "impl-serde", + "ink_ir", + "ink_primitives", + "itertools 0.12.1", + "parity-scale-codec", + "proc-macro2", + "quote", + "serde", + "serde_json", + "syn 2.0.52", +] + +[[package]] +name = "ink_engine" +version = "5.0.0-rc.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc1967c441dd9cca93af1cea6601115b8ac5a596befd01090ddf68607259dc57" +dependencies = [ + "blake2 0.10.6", + "derive_more", + "ink_primitives", + "pallet-contracts-uapi-next", + "parity-scale-codec", + "secp256k1", + "sha2 0.10.8", + "sha3", +] + +[[package]] +name = "ink_env" +version = "5.0.0-rc.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff8e745688bfe87f6d5ecb39ad3e3d712465a756f4a7b76fd9214b8310061c" +dependencies = [ + "blake2 0.10.6", + "cfg-if", + "const_env", + "derive_more", + "ink_allocator", + "ink_engine", + "ink_prelude", + "ink_primitives", + "ink_storage_traits", + "num-traits", + "pallet-contracts-uapi-next", + "parity-scale-codec", + "paste", + "rlibc", + "scale-decode", + "scale-encode", + "scale-info", + "schnorrkel 0.11.4", + "secp256k1", + "sha2 0.10.8", + "sha3", + "static_assertions", +] + +[[package]] +name = "ink_ir" +version = "5.0.0-rc.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f25523803443aa3d7911407edca9f9de3b0bbc2ca60ede1f20b183619801e673" +dependencies = [ + "blake2 0.10.6", + "either", + "impl-serde", + "ink_prelude", + "itertools 0.12.1", + "proc-macro2", + "quote", + "syn 2.0.52", +] + +[[package]] +name = "ink_macro" +version = "5.0.0-rc.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f2c7267bc9b616447f4a29790f8a9083f574540b9a1cdde0530ceb2aa625180" +dependencies = [ + "ink_codegen", + "ink_ir", + "ink_primitives", + "parity-scale-codec", + "proc-macro2", + "quote", + "syn 2.0.52", + "synstructure 0.13.1", +] + +[[package]] +name = "ink_metadata" +version = "5.0.0-rc.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e7a6dbb5dee1ed28e022cd99866ae426cae4e8172d66f40349fe1c022034579" +dependencies = [ + "derive_more", + "impl-serde", + "ink_prelude", + "ink_primitives", + "linkme", + "parity-scale-codec", + "scale-info", + "schemars", + "serde", +] + +[[package]] +name = "ink_prelude" +version = "5.0.0-rc.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddfed647babce3e9f2ca528866b16edce8156b49550fa971bf11e52410239703" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "ink_primitives" +version = "5.0.0-rc.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22dcad2912e7faadd116fc7952956c87225fe751a99da77d051a83d8fa404ca7" +dependencies = [ + "derive_more", + "ink_prelude", + "parity-scale-codec", + "scale-decode", + "scale-encode", + "scale-info", + "xxhash-rust", +] + +[[package]] +name = "ink_storage" +version = "5.0.0-rc.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9f7a599f0fdb8ce93e8e8b86dde7dc1d951f2f78ccda5bfd883a5c8caa39d66" +dependencies = [ + "array-init", + "cfg-if", + "derive_more", + "ink_env", + "ink_metadata", + "ink_prelude", + "ink_primitives", + "ink_storage_traits", + "pallet-contracts-uapi-next", + "parity-scale-codec", + "scale-info", +] + +[[package]] +name = "ink_storage_traits" +version = "5.0.0-rc.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "782122a6be4e7a0022d4e9ad70d99311adc64402635731436d26bbee5eb3c590" +dependencies = [ + "ink_metadata", + "ink_prelude", + "ink_primitives", + "parity-scale-codec", + "scale-info", +] + [[package]] name = "inout" version = "0.1.3" @@ -4359,6 +4635,15 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.10" @@ -5163,6 +5448,26 @@ dependencies = [ "linked-hash-map", ] +[[package]] +name = "linkme" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb2cfee0de9bd869589fb9a015e155946d1be5ff415cb844c2caccc6cc4b5db9" +dependencies = [ + "linkme-impl", +] + +[[package]] +name = "linkme-impl" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adf157a4dc5a29b7b464aa8fe7edeff30076e07e13646a1c3874f58477dc99f8" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.52", +] + [[package]] name = "linregress" version = "0.5.3" @@ -5645,7 +5950,7 @@ dependencies = [ "proc-macro2", "quote", "syn 1.0.109", - "synstructure", + "synstructure 0.12.6", ] [[package]] @@ -5670,7 +5975,7 @@ dependencies = [ "proc-macro2", "quote", "syn 1.0.109", - "synstructure", + "synstructure 0.12.6", ] [[package]] @@ -6384,6 +6689,7 @@ dependencies = [ name = "pallet-contract-caller" version = "4.0.0-dev" dependencies = [ + "flipper", "frame-benchmarking", "frame-support", "frame-system", @@ -6452,6 +6758,17 @@ dependencies = [ "scale-info", ] +[[package]] +name = "pallet-contracts-uapi-next" +version = "6.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd549c16296ea5b2eb7c65c56aba548b286c1be4d7675b424ff6ccb8319c97a9" +dependencies = [ + "bitflags 1.3.2", + "paste", + "polkavm-derive 0.5.0", +] + [[package]] name = "pallet-conviction-voting" version = "30.0.0" @@ -9605,6 +9922,12 @@ dependencies = [ "digest 0.10.7", ] +[[package]] +name = "rlibc" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc874b127765f014d792f16763a81245ab80500e2ad921ed4ee9e82481ee08fe" + [[package]] name = "rocksdb" version = "0.21.0" @@ -11263,6 +11586,69 @@ dependencies = [ "sp-arithmetic", ] +[[package]] +name = "scale-bits" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "036575c29af9b6e4866ffb7fa055dbf623fe7a9cc159b33786de6013a6969d89" +dependencies = [ + "parity-scale-codec", + "scale-info", +] + +[[package]] +name = "scale-decode" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7caaf753f8ed1ab4752c6afb20174f03598c664724e0e32628e161c21000ff76" +dependencies = [ + "derive_more", + "parity-scale-codec", + "scale-bits", + "scale-decode-derive", + "scale-info", + "smallvec", +] + +[[package]] +name = "scale-decode-derive" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3475108a1b62c7efd1b5c65974f30109a598b2f45f23c9ae030acb9686966db" +dependencies = [ + "darling", + "proc-macro-crate 1.3.1", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "scale-encode" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d70cb4b29360105483fac1ed567ff95d65224a14dd275b6303ed0a654c78de5" +dependencies = [ + "derive_more", + "parity-scale-codec", + "scale-encode-derive", + "scale-info", + "smallvec", +] + +[[package]] +name = "scale-encode-derive" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "995491f110efdc6bea96d6a746140e32bfceb4ea47510750a5467295a4707a25" +dependencies = [ + "darling", + "proc-macro-crate 1.3.1", + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "scale-info" version = "2.10.0" @@ -11274,6 +11660,7 @@ dependencies = [ "derive_more", "parity-scale-codec", "scale-info-derive", + "schemars", "serde", ] @@ -11298,6 +11685,30 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "schemars" +version = "0.8.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45a28f4c49489add4ce10783f7911893516f15afe45d015608d41faca6bc4d29" +dependencies = [ + "dyn-clone", + "schemars_derive", + "serde", + "serde_json", +] + +[[package]] +name = "schemars_derive" +version = "0.8.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c767fd6fa65d9ccf9cf026122c1b555f2ef9a4f0cea69da4d7dbc3e258d30967" +dependencies = [ + "proc-macro2", + "quote", + "serde_derive_internals", + "syn 1.0.109", +] + [[package]] name = "schnellru" version = "0.2.1" @@ -11501,6 +11912,17 @@ dependencies = [ "syn 2.0.52", ] +[[package]] +name = "serde_derive_internals" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85bf8229e7920a9f636479437026331ce11aa132b4dde37d121944a44d6e5f3c" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "serde_json" version = "1.0.114" @@ -12835,6 +13257,12 @@ dependencies = [ "zeroize", ] +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + [[package]] name = "strsim" version = "0.11.0" @@ -13038,6 +13466,17 @@ dependencies = [ "unicode-xid", ] +[[package]] +name = "synstructure" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.52", +] + [[package]] name = "system-configuration" version = "0.5.1" @@ -14924,6 +15363,12 @@ dependencies = [ "syn 2.0.52", ] +[[package]] +name = "xxhash-rust" +version = "0.8.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "927da81e25be1e1a2901d59b81b37dd2efd1fc9c9345a55007f09bf5a2d3ee03" + [[package]] name = "yamux" version = "0.10.2" diff --git a/Cargo.toml b/Cargo.toml index 82d754c..f97a1d1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,9 +13,6 @@ members = [ "runtime", "parachain-runtime", ] -exclude = [ - "contracts", -] [profile.release] panic = 'unwind' diff --git a/pallets/contract-caller/Cargo.toml b/pallets/contract-caller/Cargo.toml index afe0bd4..e4d30f9 100644 --- a/pallets/contract-caller/Cargo.toml +++ b/pallets/contract-caller/Cargo.toml @@ -22,6 +22,9 @@ frame-support = { workspace = true, default-features = false } frame-system = { workspace = true, default-features = false } sp-std = { workspace = true, default-features = false } +# Contracts +flipper = { path = "contracts/flipper", default-features = false, features = ["ink-as-dependency"] } + [dev-dependencies] sp-core = { workspace = true } sp-io = { workspace = true } diff --git a/contracts/.gitignore b/pallets/contract-caller/contracts/.gitignore similarity index 100% rename from contracts/.gitignore rename to pallets/contract-caller/contracts/.gitignore diff --git a/contracts/flipper/Cargo.toml b/pallets/contract-caller/contracts/flipper/Cargo.toml similarity index 100% rename from contracts/flipper/Cargo.toml rename to pallets/contract-caller/contracts/flipper/Cargo.toml diff --git a/contracts/flipper/e2e_tests.rs b/pallets/contract-caller/contracts/flipper/e2e_tests.rs similarity index 100% rename from contracts/flipper/e2e_tests.rs rename to pallets/contract-caller/contracts/flipper/e2e_tests.rs diff --git a/contracts/flipper/lib.rs b/pallets/contract-caller/contracts/flipper/lib.rs similarity index 100% rename from contracts/flipper/lib.rs rename to pallets/contract-caller/contracts/flipper/lib.rs From 0fe55307a57b9d5d28cf042be83a43084045fc77 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Mon, 11 Mar 2024 10:24:49 +0000 Subject: [PATCH 07/30] Revert "Move flipper inside pallet" This reverts commit 89803f063b3690c1804bb25fc5eefb263a7ff446. --- Cargo.lock | 453 +----------------- Cargo.toml | 3 + .../contracts => contracts}/.gitignore | 0 .../flipper/Cargo.toml | 0 .../flipper/e2e_tests.rs | 0 .../contracts => contracts}/flipper/lib.rs | 0 pallets/contract-caller/Cargo.toml | 3 - 7 files changed, 7 insertions(+), 452 deletions(-) rename {pallets/contract-caller/contracts => contracts}/.gitignore (100%) rename {pallets/contract-caller/contracts => contracts}/flipper/Cargo.toml (100%) rename {pallets/contract-caller/contracts => contracts}/flipper/e2e_tests.rs (100%) rename {pallets/contract-caller/contracts => contracts}/flipper/lib.rs (100%) diff --git a/Cargo.lock b/Cargo.lock index 88c4c4f..8992e1c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -358,12 +358,6 @@ version = "6.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f840fb7195bcfc5e17ea40c26e5ce6d5b9ce5d584466e17703209657e459ae0" -[[package]] -name = "array-init" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d62b7694a562cdf5a74227903507c56ab2cc8bdd1f781ed5cb4cf9c9f810bfc" - [[package]] name = "arrayref" version = "0.3.7" @@ -410,7 +404,7 @@ dependencies = [ "proc-macro2", "quote", "syn 1.0.109", - "synstructure 0.12.6", + "synstructure", ] [[package]] @@ -1177,7 +1171,7 @@ dependencies = [ "anstream", "anstyle", "clap_lex", - "strsim 0.11.0", + "strsim", "terminal_size", ] @@ -1312,26 +1306,6 @@ dependencies = [ "tiny-keccak", ] -[[package]] -name = "const_env" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e9e4f72c6e3398ca6da372abd9affd8f89781fe728869bbf986206e9af9627e" -dependencies = [ - "const_env_impl", -] - -[[package]] -name = "const_env_impl" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a4f51209740b5e1589e702b3044cdd4562cef41b6da404904192ffffb852d62" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "constant_time_eq" version = "0.1.5" @@ -2510,41 +2484,6 @@ dependencies = [ "syn 2.0.52", ] -[[package]] -name = "darling" -version = "0.14.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b750cb3417fd1b327431a470f388520309479ab0bf5e323505daf0290cd3850" -dependencies = [ - "darling_core", - "darling_macro", -] - -[[package]] -name = "darling_core" -version = "0.14.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "109c1ca6e6b7f82cc233a97004ea8ed7ca123a9af07a8230878fcfda9b158bf0" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim 0.10.0", - "syn 1.0.109", -] - -[[package]] -name = "darling_macro" -version = "0.14.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4aab4dbc9f7611d8b55048a3a16d2d010c2c8334e46304b40ac1cc14bf3b48e" -dependencies = [ - "darling_core", - "quote", - "syn 1.0.109", -] - [[package]] name = "dashmap" version = "5.5.3" @@ -3229,15 +3168,6 @@ dependencies = [ "miniz_oxide", ] -[[package]] -name = "flipper" -version = "0.1.0" -dependencies = [ - "ink", - "parity-scale-codec", - "scale-info", -] - [[package]] name = "float-cmp" version = "0.9.0" @@ -4185,12 +4115,6 @@ version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "25a2bc672d1148e28034f176e01fffebb08b35768468cc954630da77a1449005" -[[package]] -name = "ident_case" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" - [[package]] name = "idna" version = "0.2.3" @@ -4329,206 +4253,6 @@ dependencies = [ "unicode-width", ] -[[package]] -name = "ink" -version = "5.0.0-rc.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "529130b4fcd9b369c6eb710511c222fd33d165b1884d224855b18deb6b98f7a1" -dependencies = [ - "derive_more", - "ink_env", - "ink_macro", - "ink_metadata", - "ink_prelude", - "ink_primitives", - "ink_storage", - "pallet-contracts-uapi-next", - "parity-scale-codec", - "scale-info", -] - -[[package]] -name = "ink_allocator" -version = "5.0.0-rc.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4509501e7eaee3988cc7f22a044f3be6599c8532a303b80b0c5761c8d940e413" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "ink_codegen" -version = "5.0.0-rc.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32bbb845e3ee52b86d4b8907c6dd9de174bed224eb353fcf6bce92ae472b8fde" -dependencies = [ - "blake2 0.10.6", - "derive_more", - "either", - "heck", - "impl-serde", - "ink_ir", - "ink_primitives", - "itertools 0.12.1", - "parity-scale-codec", - "proc-macro2", - "quote", - "serde", - "serde_json", - "syn 2.0.52", -] - -[[package]] -name = "ink_engine" -version = "5.0.0-rc.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc1967c441dd9cca93af1cea6601115b8ac5a596befd01090ddf68607259dc57" -dependencies = [ - "blake2 0.10.6", - "derive_more", - "ink_primitives", - "pallet-contracts-uapi-next", - "parity-scale-codec", - "secp256k1", - "sha2 0.10.8", - "sha3", -] - -[[package]] -name = "ink_env" -version = "5.0.0-rc.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ff8e745688bfe87f6d5ecb39ad3e3d712465a756f4a7b76fd9214b8310061c" -dependencies = [ - "blake2 0.10.6", - "cfg-if", - "const_env", - "derive_more", - "ink_allocator", - "ink_engine", - "ink_prelude", - "ink_primitives", - "ink_storage_traits", - "num-traits", - "pallet-contracts-uapi-next", - "parity-scale-codec", - "paste", - "rlibc", - "scale-decode", - "scale-encode", - "scale-info", - "schnorrkel 0.11.4", - "secp256k1", - "sha2 0.10.8", - "sha3", - "static_assertions", -] - -[[package]] -name = "ink_ir" -version = "5.0.0-rc.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f25523803443aa3d7911407edca9f9de3b0bbc2ca60ede1f20b183619801e673" -dependencies = [ - "blake2 0.10.6", - "either", - "impl-serde", - "ink_prelude", - "itertools 0.12.1", - "proc-macro2", - "quote", - "syn 2.0.52", -] - -[[package]] -name = "ink_macro" -version = "5.0.0-rc.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f2c7267bc9b616447f4a29790f8a9083f574540b9a1cdde0530ceb2aa625180" -dependencies = [ - "ink_codegen", - "ink_ir", - "ink_primitives", - "parity-scale-codec", - "proc-macro2", - "quote", - "syn 2.0.52", - "synstructure 0.13.1", -] - -[[package]] -name = "ink_metadata" -version = "5.0.0-rc.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e7a6dbb5dee1ed28e022cd99866ae426cae4e8172d66f40349fe1c022034579" -dependencies = [ - "derive_more", - "impl-serde", - "ink_prelude", - "ink_primitives", - "linkme", - "parity-scale-codec", - "scale-info", - "schemars", - "serde", -] - -[[package]] -name = "ink_prelude" -version = "5.0.0-rc.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddfed647babce3e9f2ca528866b16edce8156b49550fa971bf11e52410239703" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "ink_primitives" -version = "5.0.0-rc.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22dcad2912e7faadd116fc7952956c87225fe751a99da77d051a83d8fa404ca7" -dependencies = [ - "derive_more", - "ink_prelude", - "parity-scale-codec", - "scale-decode", - "scale-encode", - "scale-info", - "xxhash-rust", -] - -[[package]] -name = "ink_storage" -version = "5.0.0-rc.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9f7a599f0fdb8ce93e8e8b86dde7dc1d951f2f78ccda5bfd883a5c8caa39d66" -dependencies = [ - "array-init", - "cfg-if", - "derive_more", - "ink_env", - "ink_metadata", - "ink_prelude", - "ink_primitives", - "ink_storage_traits", - "pallet-contracts-uapi-next", - "parity-scale-codec", - "scale-info", -] - -[[package]] -name = "ink_storage_traits" -version = "5.0.0-rc.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "782122a6be4e7a0022d4e9ad70d99311adc64402635731436d26bbee5eb3c590" -dependencies = [ - "ink_metadata", - "ink_prelude", - "ink_primitives", - "parity-scale-codec", - "scale-info", -] - [[package]] name = "inout" version = "0.1.3" @@ -4635,15 +4359,6 @@ dependencies = [ "either", ] -[[package]] -name = "itertools" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" -dependencies = [ - "either", -] - [[package]] name = "itoa" version = "1.0.10" @@ -5448,26 +5163,6 @@ dependencies = [ "linked-hash-map", ] -[[package]] -name = "linkme" -version = "0.3.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb2cfee0de9bd869589fb9a015e155946d1be5ff415cb844c2caccc6cc4b5db9" -dependencies = [ - "linkme-impl", -] - -[[package]] -name = "linkme-impl" -version = "0.3.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adf157a4dc5a29b7b464aa8fe7edeff30076e07e13646a1c3874f58477dc99f8" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.52", -] - [[package]] name = "linregress" version = "0.5.3" @@ -5950,7 +5645,7 @@ dependencies = [ "proc-macro2", "quote", "syn 1.0.109", - "synstructure 0.12.6", + "synstructure", ] [[package]] @@ -5975,7 +5670,7 @@ dependencies = [ "proc-macro2", "quote", "syn 1.0.109", - "synstructure 0.12.6", + "synstructure", ] [[package]] @@ -6689,7 +6384,6 @@ dependencies = [ name = "pallet-contract-caller" version = "4.0.0-dev" dependencies = [ - "flipper", "frame-benchmarking", "frame-support", "frame-system", @@ -6758,17 +6452,6 @@ dependencies = [ "scale-info", ] -[[package]] -name = "pallet-contracts-uapi-next" -version = "6.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd549c16296ea5b2eb7c65c56aba548b286c1be4d7675b424ff6ccb8319c97a9" -dependencies = [ - "bitflags 1.3.2", - "paste", - "polkavm-derive 0.5.0", -] - [[package]] name = "pallet-conviction-voting" version = "30.0.0" @@ -9922,12 +9605,6 @@ dependencies = [ "digest 0.10.7", ] -[[package]] -name = "rlibc" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc874b127765f014d792f16763a81245ab80500e2ad921ed4ee9e82481ee08fe" - [[package]] name = "rocksdb" version = "0.21.0" @@ -11586,69 +11263,6 @@ dependencies = [ "sp-arithmetic", ] -[[package]] -name = "scale-bits" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "036575c29af9b6e4866ffb7fa055dbf623fe7a9cc159b33786de6013a6969d89" -dependencies = [ - "parity-scale-codec", - "scale-info", -] - -[[package]] -name = "scale-decode" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7caaf753f8ed1ab4752c6afb20174f03598c664724e0e32628e161c21000ff76" -dependencies = [ - "derive_more", - "parity-scale-codec", - "scale-bits", - "scale-decode-derive", - "scale-info", - "smallvec", -] - -[[package]] -name = "scale-decode-derive" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3475108a1b62c7efd1b5c65974f30109a598b2f45f23c9ae030acb9686966db" -dependencies = [ - "darling", - "proc-macro-crate 1.3.1", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "scale-encode" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d70cb4b29360105483fac1ed567ff95d65224a14dd275b6303ed0a654c78de5" -dependencies = [ - "derive_more", - "parity-scale-codec", - "scale-encode-derive", - "scale-info", - "smallvec", -] - -[[package]] -name = "scale-encode-derive" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "995491f110efdc6bea96d6a746140e32bfceb4ea47510750a5467295a4707a25" -dependencies = [ - "darling", - "proc-macro-crate 1.3.1", - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "scale-info" version = "2.10.0" @@ -11660,7 +11274,6 @@ dependencies = [ "derive_more", "parity-scale-codec", "scale-info-derive", - "schemars", "serde", ] @@ -11685,30 +11298,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "schemars" -version = "0.8.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45a28f4c49489add4ce10783f7911893516f15afe45d015608d41faca6bc4d29" -dependencies = [ - "dyn-clone", - "schemars_derive", - "serde", - "serde_json", -] - -[[package]] -name = "schemars_derive" -version = "0.8.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c767fd6fa65d9ccf9cf026122c1b555f2ef9a4f0cea69da4d7dbc3e258d30967" -dependencies = [ - "proc-macro2", - "quote", - "serde_derive_internals", - "syn 1.0.109", -] - [[package]] name = "schnellru" version = "0.2.1" @@ -11912,17 +11501,6 @@ dependencies = [ "syn 2.0.52", ] -[[package]] -name = "serde_derive_internals" -version = "0.26.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85bf8229e7920a9f636479437026331ce11aa132b4dde37d121944a44d6e5f3c" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "serde_json" version = "1.0.114" @@ -13257,12 +12835,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "strsim" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" - [[package]] name = "strsim" version = "0.11.0" @@ -13466,17 +13038,6 @@ dependencies = [ "unicode-xid", ] -[[package]] -name = "synstructure" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.52", -] - [[package]] name = "system-configuration" version = "0.5.1" @@ -15363,12 +14924,6 @@ dependencies = [ "syn 2.0.52", ] -[[package]] -name = "xxhash-rust" -version = "0.8.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "927da81e25be1e1a2901d59b81b37dd2efd1fc9c9345a55007f09bf5a2d3ee03" - [[package]] name = "yamux" version = "0.10.2" diff --git a/Cargo.toml b/Cargo.toml index f97a1d1..82d754c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,6 +13,9 @@ members = [ "runtime", "parachain-runtime", ] +exclude = [ + "contracts", +] [profile.release] panic = 'unwind' diff --git a/pallets/contract-caller/contracts/.gitignore b/contracts/.gitignore similarity index 100% rename from pallets/contract-caller/contracts/.gitignore rename to contracts/.gitignore diff --git a/pallets/contract-caller/contracts/flipper/Cargo.toml b/contracts/flipper/Cargo.toml similarity index 100% rename from pallets/contract-caller/contracts/flipper/Cargo.toml rename to contracts/flipper/Cargo.toml diff --git a/pallets/contract-caller/contracts/flipper/e2e_tests.rs b/contracts/flipper/e2e_tests.rs similarity index 100% rename from pallets/contract-caller/contracts/flipper/e2e_tests.rs rename to contracts/flipper/e2e_tests.rs diff --git a/pallets/contract-caller/contracts/flipper/lib.rs b/contracts/flipper/lib.rs similarity index 100% rename from pallets/contract-caller/contracts/flipper/lib.rs rename to contracts/flipper/lib.rs diff --git a/pallets/contract-caller/Cargo.toml b/pallets/contract-caller/Cargo.toml index e4d30f9..afe0bd4 100644 --- a/pallets/contract-caller/Cargo.toml +++ b/pallets/contract-caller/Cargo.toml @@ -22,9 +22,6 @@ frame-support = { workspace = true, default-features = false } frame-system = { workspace = true, default-features = false } sp-std = { workspace = true, default-features = false } -# Contracts -flipper = { path = "contracts/flipper", default-features = false, features = ["ink-as-dependency"] } - [dev-dependencies] sp-core = { workspace = true } sp-io = { workspace = true } From a358ece12f344a52ea81e7e5717648ece7759b79 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Mon, 11 Mar 2024 14:26:59 +0000 Subject: [PATCH 08/30] Flipper std --- Cargo.lock | 453 ++++++++++++++++++++++++++++- pallets/contract-caller/Cargo.toml | 2 + 2 files changed, 451 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8992e1c..88c4c4f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -358,6 +358,12 @@ version = "6.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f840fb7195bcfc5e17ea40c26e5ce6d5b9ce5d584466e17703209657e459ae0" +[[package]] +name = "array-init" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d62b7694a562cdf5a74227903507c56ab2cc8bdd1f781ed5cb4cf9c9f810bfc" + [[package]] name = "arrayref" version = "0.3.7" @@ -404,7 +410,7 @@ dependencies = [ "proc-macro2", "quote", "syn 1.0.109", - "synstructure", + "synstructure 0.12.6", ] [[package]] @@ -1171,7 +1177,7 @@ dependencies = [ "anstream", "anstyle", "clap_lex", - "strsim", + "strsim 0.11.0", "terminal_size", ] @@ -1306,6 +1312,26 @@ dependencies = [ "tiny-keccak", ] +[[package]] +name = "const_env" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e9e4f72c6e3398ca6da372abd9affd8f89781fe728869bbf986206e9af9627e" +dependencies = [ + "const_env_impl", +] + +[[package]] +name = "const_env_impl" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a4f51209740b5e1589e702b3044cdd4562cef41b6da404904192ffffb852d62" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "constant_time_eq" version = "0.1.5" @@ -2484,6 +2510,41 @@ dependencies = [ "syn 2.0.52", ] +[[package]] +name = "darling" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b750cb3417fd1b327431a470f388520309479ab0bf5e323505daf0290cd3850" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "109c1ca6e6b7f82cc233a97004ea8ed7ca123a9af07a8230878fcfda9b158bf0" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim 0.10.0", + "syn 1.0.109", +] + +[[package]] +name = "darling_macro" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4aab4dbc9f7611d8b55048a3a16d2d010c2c8334e46304b40ac1cc14bf3b48e" +dependencies = [ + "darling_core", + "quote", + "syn 1.0.109", +] + [[package]] name = "dashmap" version = "5.5.3" @@ -3168,6 +3229,15 @@ dependencies = [ "miniz_oxide", ] +[[package]] +name = "flipper" +version = "0.1.0" +dependencies = [ + "ink", + "parity-scale-codec", + "scale-info", +] + [[package]] name = "float-cmp" version = "0.9.0" @@ -4115,6 +4185,12 @@ version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "25a2bc672d1148e28034f176e01fffebb08b35768468cc954630da77a1449005" +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + [[package]] name = "idna" version = "0.2.3" @@ -4253,6 +4329,206 @@ dependencies = [ "unicode-width", ] +[[package]] +name = "ink" +version = "5.0.0-rc.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "529130b4fcd9b369c6eb710511c222fd33d165b1884d224855b18deb6b98f7a1" +dependencies = [ + "derive_more", + "ink_env", + "ink_macro", + "ink_metadata", + "ink_prelude", + "ink_primitives", + "ink_storage", + "pallet-contracts-uapi-next", + "parity-scale-codec", + "scale-info", +] + +[[package]] +name = "ink_allocator" +version = "5.0.0-rc.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4509501e7eaee3988cc7f22a044f3be6599c8532a303b80b0c5761c8d940e413" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "ink_codegen" +version = "5.0.0-rc.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32bbb845e3ee52b86d4b8907c6dd9de174bed224eb353fcf6bce92ae472b8fde" +dependencies = [ + "blake2 0.10.6", + "derive_more", + "either", + "heck", + "impl-serde", + "ink_ir", + "ink_primitives", + "itertools 0.12.1", + "parity-scale-codec", + "proc-macro2", + "quote", + "serde", + "serde_json", + "syn 2.0.52", +] + +[[package]] +name = "ink_engine" +version = "5.0.0-rc.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc1967c441dd9cca93af1cea6601115b8ac5a596befd01090ddf68607259dc57" +dependencies = [ + "blake2 0.10.6", + "derive_more", + "ink_primitives", + "pallet-contracts-uapi-next", + "parity-scale-codec", + "secp256k1", + "sha2 0.10.8", + "sha3", +] + +[[package]] +name = "ink_env" +version = "5.0.0-rc.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff8e745688bfe87f6d5ecb39ad3e3d712465a756f4a7b76fd9214b8310061c" +dependencies = [ + "blake2 0.10.6", + "cfg-if", + "const_env", + "derive_more", + "ink_allocator", + "ink_engine", + "ink_prelude", + "ink_primitives", + "ink_storage_traits", + "num-traits", + "pallet-contracts-uapi-next", + "parity-scale-codec", + "paste", + "rlibc", + "scale-decode", + "scale-encode", + "scale-info", + "schnorrkel 0.11.4", + "secp256k1", + "sha2 0.10.8", + "sha3", + "static_assertions", +] + +[[package]] +name = "ink_ir" +version = "5.0.0-rc.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f25523803443aa3d7911407edca9f9de3b0bbc2ca60ede1f20b183619801e673" +dependencies = [ + "blake2 0.10.6", + "either", + "impl-serde", + "ink_prelude", + "itertools 0.12.1", + "proc-macro2", + "quote", + "syn 2.0.52", +] + +[[package]] +name = "ink_macro" +version = "5.0.0-rc.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f2c7267bc9b616447f4a29790f8a9083f574540b9a1cdde0530ceb2aa625180" +dependencies = [ + "ink_codegen", + "ink_ir", + "ink_primitives", + "parity-scale-codec", + "proc-macro2", + "quote", + "syn 2.0.52", + "synstructure 0.13.1", +] + +[[package]] +name = "ink_metadata" +version = "5.0.0-rc.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e7a6dbb5dee1ed28e022cd99866ae426cae4e8172d66f40349fe1c022034579" +dependencies = [ + "derive_more", + "impl-serde", + "ink_prelude", + "ink_primitives", + "linkme", + "parity-scale-codec", + "scale-info", + "schemars", + "serde", +] + +[[package]] +name = "ink_prelude" +version = "5.0.0-rc.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddfed647babce3e9f2ca528866b16edce8156b49550fa971bf11e52410239703" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "ink_primitives" +version = "5.0.0-rc.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22dcad2912e7faadd116fc7952956c87225fe751a99da77d051a83d8fa404ca7" +dependencies = [ + "derive_more", + "ink_prelude", + "parity-scale-codec", + "scale-decode", + "scale-encode", + "scale-info", + "xxhash-rust", +] + +[[package]] +name = "ink_storage" +version = "5.0.0-rc.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9f7a599f0fdb8ce93e8e8b86dde7dc1d951f2f78ccda5bfd883a5c8caa39d66" +dependencies = [ + "array-init", + "cfg-if", + "derive_more", + "ink_env", + "ink_metadata", + "ink_prelude", + "ink_primitives", + "ink_storage_traits", + "pallet-contracts-uapi-next", + "parity-scale-codec", + "scale-info", +] + +[[package]] +name = "ink_storage_traits" +version = "5.0.0-rc.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "782122a6be4e7a0022d4e9ad70d99311adc64402635731436d26bbee5eb3c590" +dependencies = [ + "ink_metadata", + "ink_prelude", + "ink_primitives", + "parity-scale-codec", + "scale-info", +] + [[package]] name = "inout" version = "0.1.3" @@ -4359,6 +4635,15 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.10" @@ -5163,6 +5448,26 @@ dependencies = [ "linked-hash-map", ] +[[package]] +name = "linkme" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb2cfee0de9bd869589fb9a015e155946d1be5ff415cb844c2caccc6cc4b5db9" +dependencies = [ + "linkme-impl", +] + +[[package]] +name = "linkme-impl" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adf157a4dc5a29b7b464aa8fe7edeff30076e07e13646a1c3874f58477dc99f8" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.52", +] + [[package]] name = "linregress" version = "0.5.3" @@ -5645,7 +5950,7 @@ dependencies = [ "proc-macro2", "quote", "syn 1.0.109", - "synstructure", + "synstructure 0.12.6", ] [[package]] @@ -5670,7 +5975,7 @@ dependencies = [ "proc-macro2", "quote", "syn 1.0.109", - "synstructure", + "synstructure 0.12.6", ] [[package]] @@ -6384,6 +6689,7 @@ dependencies = [ name = "pallet-contract-caller" version = "4.0.0-dev" dependencies = [ + "flipper", "frame-benchmarking", "frame-support", "frame-system", @@ -6452,6 +6758,17 @@ dependencies = [ "scale-info", ] +[[package]] +name = "pallet-contracts-uapi-next" +version = "6.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd549c16296ea5b2eb7c65c56aba548b286c1be4d7675b424ff6ccb8319c97a9" +dependencies = [ + "bitflags 1.3.2", + "paste", + "polkavm-derive 0.5.0", +] + [[package]] name = "pallet-conviction-voting" version = "30.0.0" @@ -9605,6 +9922,12 @@ dependencies = [ "digest 0.10.7", ] +[[package]] +name = "rlibc" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc874b127765f014d792f16763a81245ab80500e2ad921ed4ee9e82481ee08fe" + [[package]] name = "rocksdb" version = "0.21.0" @@ -11263,6 +11586,69 @@ dependencies = [ "sp-arithmetic", ] +[[package]] +name = "scale-bits" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "036575c29af9b6e4866ffb7fa055dbf623fe7a9cc159b33786de6013a6969d89" +dependencies = [ + "parity-scale-codec", + "scale-info", +] + +[[package]] +name = "scale-decode" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7caaf753f8ed1ab4752c6afb20174f03598c664724e0e32628e161c21000ff76" +dependencies = [ + "derive_more", + "parity-scale-codec", + "scale-bits", + "scale-decode-derive", + "scale-info", + "smallvec", +] + +[[package]] +name = "scale-decode-derive" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3475108a1b62c7efd1b5c65974f30109a598b2f45f23c9ae030acb9686966db" +dependencies = [ + "darling", + "proc-macro-crate 1.3.1", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "scale-encode" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d70cb4b29360105483fac1ed567ff95d65224a14dd275b6303ed0a654c78de5" +dependencies = [ + "derive_more", + "parity-scale-codec", + "scale-encode-derive", + "scale-info", + "smallvec", +] + +[[package]] +name = "scale-encode-derive" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "995491f110efdc6bea96d6a746140e32bfceb4ea47510750a5467295a4707a25" +dependencies = [ + "darling", + "proc-macro-crate 1.3.1", + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "scale-info" version = "2.10.0" @@ -11274,6 +11660,7 @@ dependencies = [ "derive_more", "parity-scale-codec", "scale-info-derive", + "schemars", "serde", ] @@ -11298,6 +11685,30 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "schemars" +version = "0.8.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45a28f4c49489add4ce10783f7911893516f15afe45d015608d41faca6bc4d29" +dependencies = [ + "dyn-clone", + "schemars_derive", + "serde", + "serde_json", +] + +[[package]] +name = "schemars_derive" +version = "0.8.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c767fd6fa65d9ccf9cf026122c1b555f2ef9a4f0cea69da4d7dbc3e258d30967" +dependencies = [ + "proc-macro2", + "quote", + "serde_derive_internals", + "syn 1.0.109", +] + [[package]] name = "schnellru" version = "0.2.1" @@ -11501,6 +11912,17 @@ dependencies = [ "syn 2.0.52", ] +[[package]] +name = "serde_derive_internals" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85bf8229e7920a9f636479437026331ce11aa132b4dde37d121944a44d6e5f3c" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "serde_json" version = "1.0.114" @@ -12835,6 +13257,12 @@ dependencies = [ "zeroize", ] +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + [[package]] name = "strsim" version = "0.11.0" @@ -13038,6 +13466,17 @@ dependencies = [ "unicode-xid", ] +[[package]] +name = "synstructure" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.52", +] + [[package]] name = "system-configuration" version = "0.5.1" @@ -14924,6 +15363,12 @@ dependencies = [ "syn 2.0.52", ] +[[package]] +name = "xxhash-rust" +version = "0.8.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "927da81e25be1e1a2901d59b81b37dd2efd1fc9c9345a55007f09bf5a2d3ee03" + [[package]] name = "yamux" version = "0.10.2" diff --git a/pallets/contract-caller/Cargo.toml b/pallets/contract-caller/Cargo.toml index afe0bd4..0baf730 100644 --- a/pallets/contract-caller/Cargo.toml +++ b/pallets/contract-caller/Cargo.toml @@ -21,6 +21,7 @@ frame-benchmarking = { workspace = true, default-features = false, optional = tr frame-support = { workspace = true, default-features = false } frame-system = { workspace = true, default-features = false } sp-std = { workspace = true, default-features = false } +flipper = { path = "../../contracts/flipper", default-features = false, features = ["ink-as-dependency"] } [dev-dependencies] sp-core = { workspace = true } @@ -39,6 +40,7 @@ std = [ "sp-io/std", "sp-runtime/std", "sp-std/std", + "flipper/std" ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", From a1dbf4247c31a27a25b7e4ef4791b912b785ce14 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Mon, 11 Mar 2024 14:29:57 +0000 Subject: [PATCH 09/30] Move contracts back into pallet --- Cargo.toml | 3 --- contracts/.gitignore | 2 -- pallets/contract-caller/Cargo.toml | 2 +- .../contract-caller/contracts}/flipper/Cargo.toml | 0 .../contract-caller/contracts}/flipper/e2e_tests.rs | 0 .../contract-caller/contracts}/flipper/lib.rs | 0 6 files changed, 1 insertion(+), 6 deletions(-) delete mode 100755 contracts/.gitignore rename {contracts => pallets/contract-caller/contracts}/flipper/Cargo.toml (100%) rename {contracts => pallets/contract-caller/contracts}/flipper/e2e_tests.rs (100%) rename {contracts => pallets/contract-caller/contracts}/flipper/lib.rs (100%) diff --git a/Cargo.toml b/Cargo.toml index 82d754c..f97a1d1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,9 +13,6 @@ members = [ "runtime", "parachain-runtime", ] -exclude = [ - "contracts", -] [profile.release] panic = 'unwind' diff --git a/contracts/.gitignore b/contracts/.gitignore deleted file mode 100755 index ca98cd9..0000000 --- a/contracts/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/target/ -Cargo.lock diff --git a/pallets/contract-caller/Cargo.toml b/pallets/contract-caller/Cargo.toml index 0baf730..a8e2e1d 100644 --- a/pallets/contract-caller/Cargo.toml +++ b/pallets/contract-caller/Cargo.toml @@ -21,7 +21,7 @@ frame-benchmarking = { workspace = true, default-features = false, optional = tr frame-support = { workspace = true, default-features = false } frame-system = { workspace = true, default-features = false } sp-std = { workspace = true, default-features = false } -flipper = { path = "../../contracts/flipper", default-features = false, features = ["ink-as-dependency"] } +flipper = { path = "contracts/flipper", default-features = false, features = ["ink-as-dependency"] } [dev-dependencies] sp-core = { workspace = true } diff --git a/contracts/flipper/Cargo.toml b/pallets/contract-caller/contracts/flipper/Cargo.toml similarity index 100% rename from contracts/flipper/Cargo.toml rename to pallets/contract-caller/contracts/flipper/Cargo.toml diff --git a/contracts/flipper/e2e_tests.rs b/pallets/contract-caller/contracts/flipper/e2e_tests.rs similarity index 100% rename from contracts/flipper/e2e_tests.rs rename to pallets/contract-caller/contracts/flipper/e2e_tests.rs diff --git a/contracts/flipper/lib.rs b/pallets/contract-caller/contracts/flipper/lib.rs similarity index 100% rename from contracts/flipper/lib.rs rename to pallets/contract-caller/contracts/flipper/lib.rs From 0fe975620420ebd66abff350642cdefe8b0dcfa8 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Mon, 11 Mar 2024 16:59:35 +0000 Subject: [PATCH 10/30] Add e2e tests --- Cargo.lock | 1236 +++++++++++++++-- .../contracts/flipper/Cargo.toml | 8 +- .../contracts/flipper/e2e_tests.rs | 16 + .../contract-caller/contracts/flipper/lib.rs | 177 +-- 4 files changed, 1171 insertions(+), 266 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 88c4c4f..69bb4a4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -480,6 +480,17 @@ dependencies = [ "futures-lite 1.13.0", ] +[[package]] +name = "async-fs" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc19683171f287921f2405677dd2ed2549c3b3bda697a563ebc3a121ace2aba1" +dependencies = [ + "async-lock 3.3.0", + "blocking", + "futures-lite 2.2.0", +] + [[package]] name = "async-io" version = "1.13.0" @@ -550,6 +561,17 @@ dependencies = [ "futures-lite 1.13.0", ] +[[package]] +name = "async-net" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b948000fad4873c1c9339d60f2623323a0cfd3816e5181033c6a5cb68b2accf7" +dependencies = [ + "async-io 2.3.1", + "blocking", + "futures-lite 2.2.0", +] + [[package]] name = "async-process" version = "1.8.1" @@ -567,6 +589,24 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "async-process" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "451e3cf68011bd56771c79db04a9e333095ab6349f7e47592b788e9b98720cc8" +dependencies = [ + "async-channel 2.2.0", + "async-io 2.3.1", + "async-lock 3.3.0", + "async-signal", + "blocking", + "cfg-if", + "event-listener 5.2.0", + "futures-lite 2.2.0", + "rustix 0.38.31", + "windows-sys 0.52.0", +] + [[package]] name = "async-signal" version = "0.2.5" @@ -660,6 +700,12 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" +[[package]] +name = "base58" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6107fe1be6682a68940da878d9e9f5e90ca5745b3dec9fd1bb393c8777d4f581" + [[package]] name = "base64" version = "0.13.1" @@ -871,6 +917,50 @@ dependencies = [ "tracing", ] +[[package]] +name = "bollard" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83545367eb6428eb35c29cdec3a1f350fa8d6d9085d59a7d7bcb637f2e38db5a" +dependencies = [ + "base64 0.21.7", + "bollard-stubs", + "bytes", + "futures-core", + "futures-util", + "hex", + "http 1.1.0", + "http-body-util", + "hyper 1.2.0", + "hyper-named-pipe", + "hyper-util", + "hyperlocal-next", + "log", + "pin-project-lite 0.2.13", + "serde", + "serde_derive", + "serde_json", + "serde_repr", + "serde_urlencoded", + "thiserror", + "tokio", + "tokio-util", + "tower-service", + "url", + "winapi", +] + +[[package]] +name = "bollard-stubs" +version = "1.44.0-rc.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "709d9aa1c37abb89d40f19f5d0ad6f0d88cb1581264e571c9350fc5bb89cf1c5" +dependencies = [ + "serde", + "serde_repr", + "serde_with", +] + [[package]] name = "bounded-collections" version = "0.2.0" @@ -1017,6 +1107,20 @@ dependencies = [ "thiserror", ] +[[package]] +name = "cargo_metadata" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d886547e41f740c616ae73108f6eb70afe6d940c7bc697cb30f13daec073037" +dependencies = [ + "camino", + "cargo-platform", + "semver 1.0.22", + "serde", + "serde_json", + "thiserror", +] + [[package]] name = "cc" version = "1.0.90" @@ -1101,6 +1205,7 @@ dependencies = [ "iana-time-zone", "js-sys", "num-traits", + "serde", "wasm-bindgen", "windows-targets 0.52.4", ] @@ -1247,6 +1352,16 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" +[[package]] +name = "colored" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbf2150cce219b664a8a70df7a1f933836724b503f8a413af9365b4dcc4d90b8" +dependencies = [ + "lazy_static", + "windows-sys 0.48.0", +] + [[package]] name = "comfy-table" version = "7.1.0" @@ -1350,6 +1465,60 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cd7e35aee659887cbfb97aaf227ac12cad1a9d7c71e55ff3376839ed4e282d08" +[[package]] +name = "contract-build" +version = "4.0.0-rc.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0cace153488962932541d89bc7e8e515cf1c4606ea45fe55826d59505078fa4" +dependencies = [ + "anyhow", + "blake2 0.10.6", + "bollard", + "cargo_metadata 0.18.1", + "clap", + "colored", + "contract-metadata", + "crossterm", + "duct", + "heck", + "hex", + "impl-serde", + "parity-scale-codec", + "parity-wasm", + "regex", + "rustc_version 0.4.0", + "semver 1.0.22", + "serde", + "serde_json", + "strum 0.26.2", + "tempfile", + "term_size", + "tokio", + "tokio-stream", + "toml 0.8.10", + "tracing", + "url", + "uzers", + "walkdir", + "wasm-opt", + "which 6.0.0", + "zip", +] + +[[package]] +name = "contract-metadata" +version = "4.0.0-rc.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "664ab6d50dbdba63b7c4e61ca9830252c69e0e507a20f2f74fc2c6b6582e3bf1" +dependencies = [ + "anyhow", + "impl-serde", + "semver 1.0.22", + "serde", + "serde_json", + "url", +] + [[package]] name = "contracts-node" version = "0.39.0" @@ -1370,7 +1539,7 @@ dependencies = [ "frame-benchmarking", "frame-benchmarking-cli", "futures", - "jsonrpsee", + "jsonrpsee 0.22.2", "log", "pallet-transaction-payment-rpc", "parity-scale-codec", @@ -1722,6 +1891,31 @@ version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" +[[package]] +name = "crossterm" +version = "0.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f476fe445d41c9e991fd07515a6f463074b782242ccf4a5b7b1d1012e70824df" +dependencies = [ + "bitflags 2.4.2", + "crossterm_winapi", + "libc", + "mio", + "parking_lot 0.12.1", + "signal-hook", + "signal-hook-mio", + "winapi", +] + +[[package]] +name = "crossterm_winapi" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acdd7c62a3665c7f6830a51635d9ac9b23ed385797f70a83bb8bafe9c572ab2b" +dependencies = [ + "winapi", +] + [[package]] name = "crunchy" version = "0.2.2" @@ -2305,7 +2499,7 @@ dependencies = [ "async-trait", "cumulus-primitives-core", "futures", - "jsonrpsee-core", + "jsonrpsee-core 0.22.2", "parity-scale-codec", "polkadot-overseer", "sc-client-api", @@ -2369,7 +2563,7 @@ dependencies = [ "either", "futures", "futures-timer", - "jsonrpsee", + "jsonrpsee 0.22.2", "parity-scale-codec", "pin-project", "polkadot-overseer", @@ -2380,8 +2574,8 @@ dependencies = [ "schnellru", "serde", "serde_json", - "smoldot", - "smoldot-light", + "smoldot 0.11.0", + "smoldot-light 0.9.0", "sp-api", "sp-authority-discovery", "sp-consensus-babe", @@ -2516,8 +2710,18 @@ version = "0.14.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7b750cb3417fd1b327431a470f388520309479ab0bf5e323505daf0290cd3850" dependencies = [ - "darling_core", - "darling_macro", + "darling_core 0.14.4", + "darling_macro 0.14.4", +] + +[[package]] +name = "darling" +version = "0.20.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54e36fcd13ed84ffdfda6f5be89b31287cbb80c439841fe69e04841435464391" +dependencies = [ + "darling_core 0.20.8", + "darling_macro 0.20.8", ] [[package]] @@ -2534,17 +2738,42 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "darling_core" +version = "0.20.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c2cf1c23a687a1feeb728783b993c4e1ad83d99f351801977dd809b48d0a70f" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim 0.10.0", + "syn 2.0.52", +] + [[package]] name = "darling_macro" version = "0.14.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4aab4dbc9f7611d8b55048a3a16d2d010c2c8334e46304b40ac1cc14bf3b48e" dependencies = [ - "darling_core", + "darling_core 0.14.4", "quote", "syn 1.0.109", ] +[[package]] +name = "darling_macro" +version = "0.20.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a668eda54683121533a393014d8692171709ff57a7d61f187b6e782719f8933f" +dependencies = [ + "darling_core 0.20.8", + "quote", + "syn 2.0.52", +] + [[package]] name = "dashmap" version = "5.5.3" @@ -2615,6 +2844,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" dependencies = [ "powerfmt", + "serde", ] [[package]] @@ -2786,6 +3016,18 @@ version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dcbb2bf8e87535c23f7a8a321e364ce21462d0ff10cb6407820e8e96dfff6653" +[[package]] +name = "duct" +version = "0.13.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4ab5718d1224b63252cd0c6f74f6480f9ffeb117438a2e0f5cf6d9a4798929c" +dependencies = [ + "libc", + "once_cell", + "os_pipe", + "shared_child", +] + [[package]] name = "dyn-clonable" version = "0.9.0" @@ -3234,8 +3476,7 @@ name = "flipper" version = "0.1.0" dependencies = [ "ink", - "parity-scale-codec", - "scale-info", + "ink_e2e", ] [[package]] @@ -3401,6 +3642,17 @@ dependencies = [ "sp-tracing", ] +[[package]] +name = "frame-metadata" +version = "15.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "878babb0b136e731cc77ec2fd883ff02745ff21e6fb662729953d44923df009c" +dependencies = [ + "cfg-if", + "parity-scale-codec", + "scale-info", +] + [[package]] name = "frame-metadata" version = "16.0.0" @@ -3421,7 +3673,7 @@ checksum = "2e11f19ac2855385880d96366287a52fa4cc513e2d5ec53b891a5f7ac7be2a71" dependencies = [ "futures", "indicatif", - "jsonrpsee", + "jsonrpsee 0.22.2", "log", "parity-scale-codec", "serde", @@ -3447,7 +3699,7 @@ dependencies = [ "bitflags 1.3.2", "docify", "environmental", - "frame-metadata", + "frame-metadata 16.0.0", "frame-support-procedural", "impl-trait-for-tuples", "k256", @@ -3902,7 +4154,7 @@ dependencies = [ "futures-core", "futures-sink", "futures-util", - "http", + "http 0.2.12", "indexmap 2.2.5", "slab", "tokio", @@ -4081,6 +4333,17 @@ dependencies = [ "itoa", ] +[[package]] +name = "http" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + [[package]] name = "http-body" version = "0.4.6" @@ -4088,7 +4351,30 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" dependencies = [ "bytes", - "http", + "http 0.2.12", + "pin-project-lite 0.2.13", +] + +[[package]] +name = "http-body" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" +dependencies = [ + "bytes", + "http 1.1.0", +] + +[[package]] +name = "http-body-util" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41cb79eb393015dadd30fc252023adb0b2400a0caee0fa2a077e6e21a551e840" +dependencies = [ + "bytes", + "futures-util", + "http 1.1.0", + "http-body 1.0.0", "pin-project-lite 0.2.13", ] @@ -4127,8 +4413,8 @@ dependencies = [ "futures-core", "futures-util", "h2", - "http", - "http-body", + "http 0.2.12", + "http-body 0.4.6", "httparse", "httpdate", "itoa", @@ -4140,6 +4426,40 @@ dependencies = [ "want", ] +[[package]] +name = "hyper" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "186548d73ac615b32a73aafe38fb4f56c0d340e110e5a200bcadbaf2e199263a" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http 1.1.0", + "http-body 1.0.0", + "httparse", + "itoa", + "pin-project-lite 0.2.13", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-named-pipe" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73b7d8abf35697b81a825e386fc151e0d503e8cb5fcb93cc8669c376dfd6f278" +dependencies = [ + "hex", + "hyper 1.2.0", + "hyper-util", + "pin-project-lite 0.2.13", + "tokio", + "tower-service", + "winapi", +] + [[package]] name = "hyper-rustls" version = "0.24.2" @@ -4147,8 +4467,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" dependencies = [ "futures-util", - "http", - "hyper", + "http 0.2.12", + "hyper 0.14.28", "log", "rustls 0.21.10", "rustls-native-certs 0.6.3", @@ -4157,18 +4477,53 @@ dependencies = [ ] [[package]] -name = "iana-time-zone" -version = "0.1.60" +name = "hyper-util" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" +checksum = "ca38ef113da30126bbff9cd1705f9273e15d45498615d138b0c20279ac7a76aa" dependencies = [ - "android_system_properties", - "core-foundation-sys", - "iana-time-zone-haiku", - "js-sys", - "wasm-bindgen", - "windows-core 0.52.0", -] + "bytes", + "futures-channel", + "futures-util", + "http 1.1.0", + "http-body 1.0.0", + "hyper 1.2.0", + "pin-project-lite 0.2.13", + "socket2 0.5.6", + "tokio", + "tower", + "tower-service", + "tracing", +] + +[[package]] +name = "hyperlocal-next" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acf569d43fa9848e510358c07b80f4adf34084ddc28c6a4a651ee8474c070dcc" +dependencies = [ + "hex", + "http-body-util", + "hyper 1.2.0", + "hyper-util", + "pin-project-lite 0.2.13", + "tokio", + "tower-service", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "wasm-bindgen", + "windows-core 0.52.0", +] [[package]] name = "iana-time-zone-haiku" @@ -4308,6 +4663,7 @@ checksum = "7b0b929d511467233429c45a44ac1dcaa21ba0f5ba11e4879e6ed28ddb4f9df4" dependencies = [ "equivalent", "hashbrown 0.14.3", + "serde", ] [[package]] @@ -4332,8 +4688,6 @@ dependencies = [ [[package]] name = "ink" version = "5.0.0-rc.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "529130b4fcd9b369c6eb710511c222fd33d165b1884d224855b18deb6b98f7a1" dependencies = [ "derive_more", "ink_env", @@ -4350,8 +4704,6 @@ dependencies = [ [[package]] name = "ink_allocator" version = "5.0.0-rc.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4509501e7eaee3988cc7f22a044f3be6599c8532a303b80b0c5761c8d940e413" dependencies = [ "cfg-if", ] @@ -4359,8 +4711,6 @@ dependencies = [ [[package]] name = "ink_codegen" version = "5.0.0-rc.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32bbb845e3ee52b86d4b8907c6dd9de174bed224eb353fcf6bce92ae472b8fde" dependencies = [ "blake2 0.10.6", "derive_more", @@ -4378,11 +4728,54 @@ dependencies = [ "syn 2.0.52", ] +[[package]] +name = "ink_e2e" +version = "5.0.0-rc.3" +dependencies = [ + "cargo_metadata 0.18.1", + "contract-build", + "funty", + "impl-serde", + "ink", + "ink_e2e_macro", + "ink_env", + "ink_primitives", + "jsonrpsee 0.22.2", + "pallet-contracts", + "parity-scale-codec", + "serde", + "serde_json", + "sp-core", + "sp-keyring", + "sp-runtime", + "sp-weights", + "subxt", + "subxt-signer", + "thiserror", + "tokio", + "tracing", + "tracing-subscriber 0.3.18", + "wasm-instrument", + "which 6.0.0", +] + +[[package]] +name = "ink_e2e_macro" +version = "5.0.0-rc.3" +dependencies = [ + "darling 0.20.8", + "derive_more", + "ink_ir", + "proc-macro2", + "quote", + "serde_json", + "syn 2.0.52", + "tracing-subscriber 0.3.18", +] + [[package]] name = "ink_engine" version = "5.0.0-rc.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc1967c441dd9cca93af1cea6601115b8ac5a596befd01090ddf68607259dc57" dependencies = [ "blake2 0.10.6", "derive_more", @@ -4397,8 +4790,6 @@ dependencies = [ [[package]] name = "ink_env" version = "5.0.0-rc.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ff8e745688bfe87f6d5ecb39ad3e3d712465a756f4a7b76fd9214b8310061c" dependencies = [ "blake2 0.10.6", "cfg-if", @@ -4427,8 +4818,6 @@ dependencies = [ [[package]] name = "ink_ir" version = "5.0.0-rc.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f25523803443aa3d7911407edca9f9de3b0bbc2ca60ede1f20b183619801e673" dependencies = [ "blake2 0.10.6", "either", @@ -4443,8 +4832,6 @@ dependencies = [ [[package]] name = "ink_macro" version = "5.0.0-rc.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f2c7267bc9b616447f4a29790f8a9083f574540b9a1cdde0530ceb2aa625180" dependencies = [ "ink_codegen", "ink_ir", @@ -4459,8 +4846,6 @@ dependencies = [ [[package]] name = "ink_metadata" version = "5.0.0-rc.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e7a6dbb5dee1ed28e022cd99866ae426cae4e8172d66f40349fe1c022034579" dependencies = [ "derive_more", "impl-serde", @@ -4476,8 +4861,6 @@ dependencies = [ [[package]] name = "ink_prelude" version = "5.0.0-rc.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddfed647babce3e9f2ca528866b16edce8156b49550fa971bf11e52410239703" dependencies = [ "cfg-if", ] @@ -4485,8 +4868,6 @@ dependencies = [ [[package]] name = "ink_primitives" version = "5.0.0-rc.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22dcad2912e7faadd116fc7952956c87225fe751a99da77d051a83d8fa404ca7" dependencies = [ "derive_more", "ink_prelude", @@ -4500,8 +4881,6 @@ dependencies = [ [[package]] name = "ink_storage" version = "5.0.0-rc.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9f7a599f0fdb8ce93e8e8b86dde7dc1d951f2f78ccda5bfd883a5c8caa39d66" dependencies = [ "array-init", "cfg-if", @@ -4519,8 +4898,6 @@ dependencies = [ [[package]] name = "ink_storage_traits" version = "5.0.0-rc.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "782122a6be4e7a0022d4e9ad70d99311adc64402635731436d26bbee5eb3c590" dependencies = [ "ink_metadata", "ink_prelude", @@ -4688,22 +5065,55 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "jsonrpsee" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9579d0ca9fb30da026bac2f0f7d9576ec93489aeb7cd4971dd5b4617d82c79b2" +dependencies = [ + "jsonrpsee-client-transport 0.21.0", + "jsonrpsee-core 0.21.0", + "jsonrpsee-http-client 0.21.0", + "jsonrpsee-types 0.21.0", +] + [[package]] name = "jsonrpsee" version = "0.22.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "87f3ae45a64cfc0882934f963be9431b2a165d667f53140358181f262aca0702" dependencies = [ - "jsonrpsee-core", - "jsonrpsee-http-client", + "jsonrpsee-core 0.22.2", + "jsonrpsee-http-client 0.22.2", "jsonrpsee-proc-macros", "jsonrpsee-server", - "jsonrpsee-types", + "jsonrpsee-types 0.22.2", "jsonrpsee-ws-client", "tokio", "tracing", ] +[[package]] +name = "jsonrpsee-client-transport" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9f9ed46590a8d5681975f126e22531698211b926129a40a2db47cbca429220" +dependencies = [ + "futures-util", + "http 0.2.12", + "jsonrpsee-core 0.21.0", + "pin-project", + "rustls-native-certs 0.7.0", + "rustls-pki-types", + "soketto", + "thiserror", + "tokio", + "tokio-rustls 0.25.0", + "tokio-util", + "tracing", + "url", +] + [[package]] name = "jsonrpsee-client-transport" version = "0.22.2" @@ -4711,8 +5121,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "455fc882e56f58228df2aee36b88a1340eafd707c76af2fa68cf94b37d461131" dependencies = [ "futures-util", - "http", - "jsonrpsee-core", + "http 0.2.12", + "jsonrpsee-core 0.22.2", "pin-project", "rustls-native-certs 0.7.0", "rustls-pki-types", @@ -4725,6 +5135,30 @@ dependencies = [ "url", ] +[[package]] +name = "jsonrpsee-core" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "776d009e2f591b78c038e0d053a796f94575d66ca4e77dd84bfc5e81419e436c" +dependencies = [ + "anyhow", + "async-lock 3.3.0", + "async-trait", + "beef", + "futures-timer", + "futures-util", + "hyper 0.14.28", + "jsonrpsee-types 0.21.0", + "pin-project", + "rustc-hash", + "serde", + "serde_json", + "thiserror", + "tokio", + "tokio-stream", + "tracing", +] + [[package]] name = "jsonrpsee-core" version = "0.22.2" @@ -4737,8 +5171,8 @@ dependencies = [ "beef", "futures-timer", "futures-util", - "hyper", - "jsonrpsee-types", + "hyper 0.14.28", + "jsonrpsee-types 0.22.2", "parking_lot 0.12.1", "pin-project", "rand", @@ -4751,6 +5185,26 @@ dependencies = [ "tracing", ] +[[package]] +name = "jsonrpsee-http-client" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78b7de9f3219d95985eb77fd03194d7c1b56c19bce1abfcc9d07462574b15572" +dependencies = [ + "async-trait", + "hyper 0.14.28", + "hyper-rustls", + "jsonrpsee-core 0.21.0", + "jsonrpsee-types 0.21.0", + "serde", + "serde_json", + "thiserror", + "tokio", + "tower", + "tracing", + "url", +] + [[package]] name = "jsonrpsee-http-client" version = "0.22.2" @@ -4758,10 +5212,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e7a95e346f55df84fb167b7e06470e196e7d5b9488a21d69c5d9732043ba7ba" dependencies = [ "async-trait", - "hyper", + "hyper 0.14.28", "hyper-rustls", - "jsonrpsee-core", - "jsonrpsee-types", + "jsonrpsee-core 0.22.2", + "jsonrpsee-types 0.22.2", "serde", "serde_json", "thiserror", @@ -4791,10 +5245,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0e29c1bd1f9bba83c864977c73404e505f74f730fa0db89dd490ec174e36d7f0" dependencies = [ "futures-util", - "http", - "hyper", - "jsonrpsee-core", - "jsonrpsee-types", + "http 0.2.12", + "hyper 0.14.28", + "jsonrpsee-core 0.22.2", + "jsonrpsee-types 0.22.2", "pin-project", "route-recognizer", "serde", @@ -4808,6 +5262,19 @@ dependencies = [ "tracing", ] +[[package]] +name = "jsonrpsee-types" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3266dfb045c9174b24c77c2dfe0084914bb23a6b2597d70c9dc6018392e1cd1b" +dependencies = [ + "anyhow", + "beef", + "serde", + "serde_json", + "thiserror", +] + [[package]] name = "jsonrpsee-types" version = "0.22.2" @@ -4827,10 +5294,10 @@ version = "0.22.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68ca71e74983f624c0cb67828e480a981586074da8ad3a2f214c6a3f884edab9" dependencies = [ - "http", - "jsonrpsee-client-transport", - "jsonrpsee-core", - "jsonrpsee-types", + "http 0.2.12", + "jsonrpsee-client-transport 0.22.2", + "jsonrpsee-core 0.22.2", + "jsonrpsee-types 0.22.2", "url", ] @@ -5538,6 +6005,15 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4a83fb7698b3643a0e34f9ae6f2e8f0178c0fd42f8b59d493aa271ff3a5bf21" +[[package]] +name = "lru" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3262e75e648fce39813cb56ac41f3c3e3f65217ebf3844d818d1f9398cfb0dc" +dependencies = [ + "hashbrown 0.14.3", +] + [[package]] name = "lru-cache" version = "0.1.2" @@ -5645,6 +6121,15 @@ dependencies = [ "regex-automata 0.1.10", ] +[[package]] +name = "matchers" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +dependencies = [ + "regex-automata 0.1.10", +] + [[package]] name = "matches" version = "0.1.10" @@ -5757,6 +6242,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" dependencies = [ "libc", + "log", "wasi 0.11.0+wasi-snapshot-preview1", "windows-sys 0.48.0", ] @@ -5812,7 +6298,7 @@ version = "30.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "93c2b8a657edbe89a72f0d95e31d7f31837035a067f0316499aaa9bddf6dda78" dependencies = [ - "jsonrpsee", + "jsonrpsee 0.22.2", "parity-scale-codec", "serde", "sp-api", @@ -6174,6 +6660,16 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61807f77802ff30975e01f4f071c8ba10c022052f98b3294119f3e615d13e5be" +[[package]] +name = "nu-ansi-term" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +dependencies = [ + "overload", + "winapi", +] + [[package]] name = "num-bigint" version = "0.4.4" @@ -6359,6 +6855,22 @@ dependencies = [ "num-traits", ] +[[package]] +name = "os_pipe" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57119c3b893986491ec9aa85056780d3a0f3cf4da7cc09dd3650dbd6c6738fb9" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "overload" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" + [[package]] name = "pallet-asset-conversion" version = "12.0.0" @@ -7510,7 +8022,7 @@ version = "32.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4fac4e459db3c002ddebfbce82d055dbe8885eb4c2f9dcd9da5675eafef9bb7" dependencies = [ - "jsonrpsee", + "jsonrpsee 0.22.2", "pallet-transaction-payment-rpc-runtime-api", "parity-scale-codec", "sp-api", @@ -7695,7 +8207,7 @@ dependencies = [ "memmap2 0.5.10", "parking_lot 0.12.1", "rand", - "siphasher", + "siphasher 0.3.11", "snap", "winapi", ] @@ -8786,7 +9298,7 @@ version = "9.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9c02431c0f9947cf931113d492512b99478b4aefe2a3a2e49b59e45219f5d6f" dependencies = [ - "jsonrpsee", + "jsonrpsee 0.22.2", "mmr-rpc", "pallet-transaction-payment-rpc", "polkadot-primitives", @@ -9473,7 +9985,7 @@ dependencies = [ "regex", "syn 1.0.109", "tempfile", - "which", + "which 4.4.2", ] [[package]] @@ -10306,6 +10818,17 @@ dependencies = [ "twox-hash", ] +[[package]] +name = "ruzstd" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58c4eb8a81997cf040a091d1f7e1938aeab6749d3a0dfa73af43cdc32393483d" +dependencies = [ + "byteorder", + "derive_more", + "twox-hash", +] + [[package]] name = "rw-stream-sink" version = "0.3.0" @@ -10667,7 +11190,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "83ad369cae7dbeb4da4007dc8b1b27b905bf027172bbbf6dbede15e2539f0b2b" dependencies = [ "futures", - "jsonrpsee", + "jsonrpsee 0.22.2", "sc-consensus-babe", "sc-consensus-epochs", "sc-rpc-api", @@ -10727,7 +11250,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "36862ae5859008621ae53fcf6f8e5a960637aedf4de6995344672ba2619053ce" dependencies = [ "futures", - "jsonrpsee", + "jsonrpsee 0.22.2", "log", "parity-scale-codec", "parking_lot 0.12.1", @@ -10806,7 +11329,7 @@ checksum = "df4f1fb2262e1f96c66664da4b7045069013ffcaefbf44730913d5ac74f77c2f" dependencies = [ "finality-grandpa", "futures", - "jsonrpsee", + "jsonrpsee 0.22.2", "log", "parity-scale-codec", "sc-client-api", @@ -10829,7 +11352,7 @@ dependencies = [ "async-trait", "futures", "futures-timer", - "jsonrpsee", + "jsonrpsee 0.22.2", "log", "parity-scale-codec", "sc-client-api", @@ -11190,7 +11713,7 @@ dependencies = [ "fnv", "futures", "futures-timer", - "hyper", + "hyper 0.14.28", "hyper-rustls", "libp2p", "log", @@ -11231,7 +11754,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61faa018966cb794e36be31af4ed4d19deaa93c751ff32512637c7bca104e9e8" dependencies = [ "futures", - "jsonrpsee", + "jsonrpsee 0.22.2", "log", "parity-scale-codec", "parking_lot 0.12.1", @@ -11263,7 +11786,7 @@ version = "0.35.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f716a273af4f4782430ebe4fe6d0f8b1490ff7c103dc78193706bfff370c250f" dependencies = [ - "jsonrpsee", + "jsonrpsee 0.22.2", "parity-scale-codec", "sc-chain-spec", "sc-mixnet", @@ -11286,9 +11809,9 @@ checksum = "42ae724afa9862381f77b6d3a205baef5daceec9e584f17069546eb7dfca5400" dependencies = [ "futures", "governor", - "http", - "hyper", - "jsonrpsee", + "http 0.2.12", + "hyper 0.14.28", + "jsonrpsee 0.22.2", "log", "pin-project", "serde_json", @@ -11308,7 +11831,7 @@ dependencies = [ "futures", "futures-util", "hex", - "jsonrpsee", + "jsonrpsee 0.22.2", "log", "parity-scale-codec", "parking_lot 0.12.1", @@ -11341,7 +11864,7 @@ dependencies = [ "exit-future", "futures", "futures-timer", - "jsonrpsee", + "jsonrpsee 0.22.2", "log", "parity-scale-codec", "parking_lot 0.12.1", @@ -11426,7 +11949,7 @@ version = "0.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e2a59d517a60a3fdc0b12e7a1f112a2affbc9caf4f93b53d44c5e0edb485945" dependencies = [ - "jsonrpsee", + "jsonrpsee 0.22.2", "parity-scale-codec", "sc-chain-spec", "sc-client-api", @@ -11509,8 +12032,8 @@ dependencies = [ "sp-tracing", "thiserror", "tracing", - "tracing-log", - "tracing-subscriber", + "tracing-log 0.1.4", + "tracing-subscriber 0.2.25", ] [[package]] @@ -11594,6 +12117,7 @@ checksum = "036575c29af9b6e4866ffb7fa055dbf623fe7a9cc159b33786de6013a6969d89" dependencies = [ "parity-scale-codec", "scale-info", + "serde", ] [[package]] @@ -11604,6 +12128,7 @@ checksum = "7caaf753f8ed1ab4752c6afb20174f03598c664724e0e32628e161c21000ff76" dependencies = [ "derive_more", "parity-scale-codec", + "primitive-types", "scale-bits", "scale-decode-derive", "scale-info", @@ -11616,7 +12141,7 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3475108a1b62c7efd1b5c65974f30109a598b2f45f23c9ae030acb9686966db" dependencies = [ - "darling", + "darling 0.14.4", "proc-macro-crate 1.3.1", "proc-macro2", "quote", @@ -11631,6 +12156,8 @@ checksum = "6d70cb4b29360105483fac1ed567ff95d65224a14dd275b6303ed0a654c78de5" dependencies = [ "derive_more", "parity-scale-codec", + "primitive-types", + "scale-bits", "scale-encode-derive", "scale-info", "smallvec", @@ -11642,7 +12169,7 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "995491f110efdc6bea96d6a746140e32bfceb4ea47510750a5467295a4707a25" dependencies = [ - "darling", + "darling 0.14.4", "proc-macro-crate 1.3.1", "proc-macro2", "quote", @@ -11676,6 +12203,39 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "scale-typegen" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00860983481ac590ac87972062909bef0d6a658013b592ccc0f2feb272feab11" +dependencies = [ + "proc-macro2", + "quote", + "scale-info", + "syn 2.0.52", + "thiserror", +] + +[[package]] +name = "scale-value" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58223c7691bf0bd46b43c9aea6f0472d1067f378d574180232358d7c6e0a8089" +dependencies = [ + "base58", + "blake2 0.10.6", + "derive_more", + "either", + "frame-metadata 15.1.0", + "parity-scale-codec", + "scale-bits", + "scale-decode", + "scale-encode", + "scale-info", + "serde", + "yap", +] + [[package]] name = "schannel" version = "0.1.23" @@ -11934,6 +12494,17 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_repr" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b2e6b945e9d3df726b65d6ee24060aff8e3533d431f677a9695db04eff9dfdb" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.52", +] + [[package]] name = "serde_spanned" version = "0.6.5" @@ -11944,26 +12515,55 @@ dependencies = [ ] [[package]] -name = "sha-1" -version = "0.9.8" +name = "serde_urlencoded" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99cd6713db3cf16b6c84e06321e049a9b9f699826e16096d23bbcc44d15d51a6" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" dependencies = [ - "block-buffer 0.9.0", - "cfg-if", - "cpufeatures", - "digest 0.9.0", - "opaque-debug 0.3.1", + "form_urlencoded", + "itoa", + "ryu", + "serde", ] [[package]] -name = "sha1" -version = "0.10.6" +name = "serde_with" +version = "3.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" +checksum = "15d167997bd841ec232f5b2b8e0e26606df2e7caa4c31b95ea9ca52b200bd270" dependencies = [ - "cfg-if", - "cpufeatures", + "base64 0.21.7", + "chrono", + "hex", + "indexmap 1.9.3", + "indexmap 2.2.5", + "serde", + "serde_derive", + "serde_json", + "time", +] + +[[package]] +name = "sha-1" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99cd6713db3cf16b6c84e06321e049a9b9f699826e16096d23bbcc44d15d51a6" +dependencies = [ + "block-buffer 0.9.0", + "cfg-if", + "cpufeatures", + "digest 0.9.0", + "opaque-debug 0.3.1", +] + +[[package]] +name = "sha1" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" +dependencies = [ + "cfg-if", + "cpufeatures", "digest 0.10.7", ] @@ -12010,12 +12610,43 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "shared_child" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0d94659ad3c2137fef23ae75b03d5241d633f8acded53d672decfa0e6e0caef" +dependencies = [ + "libc", + "winapi", +] + [[package]] name = "shlex" version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" +[[package]] +name = "signal-hook" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8621587d4798caf8eb44879d42e56b9a93ea5dcd315a6487c357130095b62801" +dependencies = [ + "libc", + "signal-hook-registry", +] + +[[package]] +name = "signal-hook-mio" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29ad2e15f37ec9a6cc544097b78a1ec90001e9f71b81338ca39f430adaca99af" +dependencies = [ + "libc", + "mio", + "signal-hook", +] + [[package]] name = "signal-hook-registry" version = "1.4.1" @@ -12060,6 +12691,12 @@ version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" +[[package]] +name = "siphasher" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54ac45299ccbd390721be55b412d41931911f654fa99e2cb8bfb57184b2061fe" + [[package]] name = "slab" version = "0.4.9" @@ -12111,15 +12748,32 @@ checksum = "13f2b548cd8447f8de0fdf1c592929f70f4fc7039a05e47404b0d096ec6987a1" dependencies = [ "async-channel 1.9.0", "async-executor", - "async-fs", + "async-fs 1.6.0", "async-io 1.13.0", "async-lock 2.8.0", - "async-net", - "async-process", + "async-net 1.8.0", + "async-process 1.8.1", "blocking", "futures-lite 1.13.0", ] +[[package]] +name = "smol" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e635339259e51ef85ac7aa29a1cd991b957047507288697a690e80ab97d07cad" +dependencies = [ + "async-channel 2.2.0", + "async-executor", + "async-fs 2.1.1", + "async-io 2.3.1", + "async-lock 3.3.0", + "async-net 2.0.0", + "async-process 2.1.0", + "blocking", + "futures-lite 2.2.0", +] + [[package]] name = "smoldot" version = "0.11.0" @@ -12158,13 +12812,68 @@ dependencies = [ "poly1305", "rand", "rand_chacha 0.3.1", - "ruzstd", + "ruzstd 0.4.0", "schnorrkel 0.10.2", "serde", "serde_json", "sha2 0.10.8", "sha3", - "siphasher", + "siphasher 0.3.11", + "slab", + "smallvec", + "soketto", + "twox-hash", + "wasmi", + "x25519-dalek 2.0.1", + "zeroize", +] + +[[package]] +name = "smoldot" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d1eaa97d77be4d026a1e7ffad1bb3b78448763b357ea6f8188d3e6f736a9b9" +dependencies = [ + "arrayvec 0.7.4", + "async-lock 3.3.0", + "atomic-take", + "base64 0.21.7", + "bip39", + "blake2-rfc", + "bs58 0.5.0", + "chacha20", + "crossbeam-queue", + "derive_more", + "ed25519-zebra 4.0.3", + "either", + "event-listener 4.0.3", + "fnv", + "futures-lite 2.2.0", + "futures-util", + "hashbrown 0.14.3", + "hex", + "hmac 0.12.1", + "itertools 0.12.1", + "libm", + "libsecp256k1", + "merlin", + "no-std-net", + "nom", + "num-bigint", + "num-rational", + "num-traits", + "pbkdf2 0.12.2", + "pin-project", + "poly1305", + "rand", + "rand_chacha 0.3.1", + "ruzstd 0.5.0", + "schnorrkel 0.11.4", + "serde", + "serde_json", + "sha2 0.10.8", + "sha3", + "siphasher 1.0.0", "slab", "smallvec", "soketto", @@ -12203,10 +12912,46 @@ dependencies = [ "rand_chacha 0.3.1", "serde", "serde_json", - "siphasher", + "siphasher 0.3.11", "slab", - "smol", - "smoldot", + "smol 1.3.0", + "smoldot 0.11.0", + "zeroize", +] + +[[package]] +name = "smoldot-light" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5496f2d116b7019a526b1039ec2247dd172b8670633b1a64a614c9ea12c9d8c7" +dependencies = [ + "async-channel 2.2.0", + "async-lock 3.3.0", + "base64 0.21.7", + "blake2-rfc", + "derive_more", + "either", + "event-listener 4.0.3", + "fnv", + "futures-channel", + "futures-lite 2.2.0", + "futures-util", + "hashbrown 0.14.3", + "hex", + "itertools 0.12.1", + "log", + "lru 0.12.3", + "no-std-net", + "parking_lot 0.12.1", + "pin-project", + "rand", + "rand_chacha 0.3.1", + "serde", + "serde_json", + "siphasher 1.0.0", + "slab", + "smol 2.0.0", + "smoldot 0.16.0", "zeroize", ] @@ -12263,7 +13008,7 @@ dependencies = [ "bytes", "flate2", "futures", - "http", + "http 0.2.12", "httparse", "log", "rand", @@ -12536,6 +13281,20 @@ dependencies = [ "zeroize", ] +[[package]] +name = "sp-core-hashing" +version = "15.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e0f4990add7b2cefdeca883c0efa99bb4d912cb2196120e1500c0cc099553b0" +dependencies = [ + "blake2b_simd", + "byteorder", + "digest 0.10.7", + "sha2 0.10.8", + "sha3", + "twox-hash", +] + [[package]] name = "sp-crypto-hashing" version = "0.1.0" @@ -12686,7 +13445,7 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fa0b5e87e56c1bb26d9524d48dd127121d630f895bd5914a34f0b017489f7c1d" dependencies = [ - "frame-metadata", + "frame-metadata 16.0.0", "parity-scale-codec", "scale-info", "sp-std", @@ -12954,7 +13713,7 @@ dependencies = [ "sp-std", "tracing", "tracing-core", - "tracing-subscriber", + "tracing-subscriber 0.2.25", ] [[package]] @@ -13284,6 +14043,15 @@ version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" +[[package]] +name = "strum" +version = "0.26.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d8cec3501a5194c432b2b7976db6b7d10ec95c253208b45f83f7136aa985e29" +dependencies = [ + "strum_macros 0.26.2", +] + [[package]] name = "strum_macros" version = "0.24.3" @@ -13310,6 +14078,19 @@ dependencies = [ "syn 2.0.52", ] +[[package]] +name = "strum_macros" +version = "0.26.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6cf59daf282c0a494ba14fd21610a0325f9f90ec9d1231dea26bcb1d696c946" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.52", +] + [[package]] name = "substrate-bip39" version = "0.4.6" @@ -13337,7 +14118,7 @@ checksum = "74fba95234990a0eecb3199ee2589112a1a3763db1fa7739a316f3e26f7693c9" dependencies = [ "frame-system-rpc-runtime-api", "futures", - "jsonrpsee", + "jsonrpsee 0.22.2", "log", "parity-scale-codec", "sc-rpc-api", @@ -13355,7 +14136,7 @@ version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0d8fe06b03b8a291c09507c42f92a2c2c10dd3d62975d02c7f64a92d87bfe09b" dependencies = [ - "hyper", + "hyper 0.14.28", "log", "prometheus", "thiserror", @@ -13369,7 +14150,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0aa04291d8b0e96b475c2abc26fe96f59478e23af38307c294a6f6c3d2a06fc8" dependencies = [ "async-trait", - "jsonrpsee", + "jsonrpsee 0.22.2", "log", "sc-rpc-api", "serde", @@ -13382,7 +14163,7 @@ version = "29.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a62395e13acaff44193068733ca986dd5b5be54055cabcee9cdad075b3a5f496" dependencies = [ - "jsonrpsee", + "jsonrpsee 0.22.2", "parity-scale-codec", "sc-client-api", "sc-rpc-api", @@ -13401,7 +14182,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d182ae093d473b5947e32c392b10fb12125318c4470ff8adf32b0cbf2e9e6611" dependencies = [ "build-helper", - "cargo_metadata", + "cargo_metadata 0.15.4", "console", "filetime", "parity-wasm", @@ -13432,6 +14213,130 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "734676eb262c623cec13c3155096e08d1f8f29adce39ba17948b18dad1e54142" +[[package]] +name = "subxt" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3323d5c27898b139d043dc1ee971f602f937b99354ee33ee933bd90e0009fbd" +dependencies = [ + "async-trait", + "base58", + "blake2 0.10.6", + "derivative", + "either", + "frame-metadata 16.0.0", + "futures", + "hex", + "impl-serde", + "instant", + "jsonrpsee 0.21.0", + "parity-scale-codec", + "primitive-types", + "scale-bits", + "scale-decode", + "scale-encode", + "scale-info", + "scale-value", + "serde", + "serde_json", + "sp-core-hashing", + "subxt-lightclient", + "subxt-macro", + "subxt-metadata", + "thiserror", + "tokio-util", + "tracing", + "url", +] + +[[package]] +name = "subxt-codegen" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d0e58c3f88651cff26aa52bae0a0a85f806a2e923a20eb438c16474990743ea" +dependencies = [ + "frame-metadata 16.0.0", + "heck", + "hex", + "jsonrpsee 0.21.0", + "parity-scale-codec", + "proc-macro2", + "quote", + "scale-info", + "scale-typegen", + "subxt-metadata", + "syn 2.0.52", + "thiserror", + "tokio", +] + +[[package]] +name = "subxt-lightclient" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecec7066ba7bc0c3608fcd1d0c7d9584390990cd06095b6ae4f114f74c4b8550" +dependencies = [ + "futures", + "futures-util", + "serde", + "serde_json", + "smoldot-light 0.14.0", + "thiserror", + "tokio", + "tokio-stream", + "tracing", +] + +[[package]] +name = "subxt-macro" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "365251668613323064803427af8c7c7bc366cd8b28e33639640757669dafebd5" +dependencies = [ + "darling 0.20.8", + "parity-scale-codec", + "proc-macro-error", + "quote", + "scale-typegen", + "subxt-codegen", + "syn 2.0.52", +] + +[[package]] +name = "subxt-metadata" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c02aca8d39a1f6c55fff3a8fd81557d30a610fedc1cef03f889a81bc0f8f0b52" +dependencies = [ + "frame-metadata 16.0.0", + "parity-scale-codec", + "scale-info", + "sp-core-hashing", + "thiserror", +] + +[[package]] +name = "subxt-signer" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f88a76a5d114bfae2f6f9cc1491c46173ecc3fb2b9e53948eb3c8d43d4b43ab5" +dependencies = [ + "bip39", + "hex", + "hmac 0.12.1", + "parity-scale-codec", + "pbkdf2 0.12.2", + "regex", + "schnorrkel 0.11.4", + "secp256k1", + "secrecy", + "sha2 0.10.8", + "sp-core-hashing", + "subxt", + "thiserror", + "zeroize", +] + [[package]] name = "syn" version = "1.0.109" @@ -13522,6 +14427,16 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "term_size" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e4129646ca0ed8f45d09b929036bafad5377103edd06e50bf574b353d2b08d9" +dependencies = [ + "libc", + "winapi", +] + [[package]] name = "termcolor" version = "1.4.1" @@ -13876,6 +14791,7 @@ dependencies = [ "futures-util", "pin-project", "pin-project-lite 0.2.13", + "tokio", "tower-layer", "tower-service", "tracing", @@ -13891,8 +14807,8 @@ dependencies = [ "bytes", "futures-core", "futures-util", - "http", - "http-body", + "http 0.2.12", + "http-body 0.4.6", "http-range-header", "pin-project-lite 0.2.13", "tower-layer", @@ -13990,6 +14906,17 @@ dependencies = [ "tracing-core", ] +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + [[package]] name = "tracing-serde" version = "0.1.3" @@ -14009,7 +14936,7 @@ dependencies = [ "ansi_term", "chrono", "lazy_static", - "matchers", + "matchers 0.0.1", "parking_lot 0.11.2", "regex", "serde", @@ -14019,10 +14946,28 @@ dependencies = [ "thread_local", "tracing", "tracing-core", - "tracing-log", + "tracing-log 0.1.4", "tracing-serde", ] +[[package]] +name = "tracing-subscriber" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" +dependencies = [ + "matchers 0.1.0", + "nu-ansi-term", + "once_cell", + "regex", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log 0.2.0", +] + [[package]] name = "trie-db" version = "0.28.0" @@ -14261,6 +15206,7 @@ dependencies = [ "form_urlencoded", "idna 0.5.0", "percent-encoding", + "serde", ] [[package]] @@ -14269,6 +15215,16 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" +[[package]] +name = "uzers" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76d283dc7e8c901e79e32d077866eaf599156cbf427fffa8289aecc52c5c3f63" +dependencies = [ + "libc", + "log", +] + [[package]] name = "valuable" version = "0.1.0" @@ -14985,6 +15941,19 @@ dependencies = [ "rustix 0.38.31", ] +[[package]] +name = "which" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fa5e0c10bf77f44aac573e498d1a82d5fbd5e91f6fc0a99e7be4b38e85e101c" +dependencies = [ + "either", + "home", + "once_cell", + "rustix 0.38.31", + "windows-sys 0.52.0", +] + [[package]] name = "wide" version = "0.7.15" @@ -15383,6 +16352,12 @@ dependencies = [ "static_assertions", ] +[[package]] +name = "yap" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff4524214bc4629eba08d78ceb1d6507070cc0bcbbed23af74e19e6e924a24cf" + [[package]] name = "yasna" version = "0.5.2" @@ -15432,6 +16407,17 @@ dependencies = [ "syn 2.0.52", ] +[[package]] +name = "zip" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "760394e246e4c28189f19d488c058bf16f564016aefac5d32bb1f3b51d5e9261" +dependencies = [ + "byteorder", + "crc32fast", + "crossbeam-utils", +] + [[package]] name = "zstd" version = "0.11.2+zstd.1.5.2" diff --git a/pallets/contract-caller/contracts/flipper/Cargo.toml b/pallets/contract-caller/contracts/flipper/Cargo.toml index e08b249..b6e4022 100755 --- a/pallets/contract-caller/contracts/flipper/Cargo.toml +++ b/pallets/contract-caller/contracts/flipper/Cargo.toml @@ -5,10 +5,10 @@ authors = ["[your_name] <[your_email]>"] edition = "2021" [dependencies] -ink = { version = "5.0.0-rc.2", default-features = false } +ink = { path = "/home/andrew/code/ink/crates/ink", default-features = false } -scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } -scale-info = { version = "2.6", default-features = false, features = ["derive"], optional = true } +[dev-dependencies] +ink_e2e = { path = "/home/andrew/code/ink/crates/e2e" } [lib] path = "lib.rs" @@ -17,8 +17,6 @@ path = "lib.rs" default = ["std"] std = [ "ink/std", - "scale/std", - "scale-info/std", ] ink-as-dependency = [] e2e-tests = [] diff --git a/pallets/contract-caller/contracts/flipper/e2e_tests.rs b/pallets/contract-caller/contracts/flipper/e2e_tests.rs index e69de29..38714e5 100644 --- a/pallets/contract-caller/contracts/flipper/e2e_tests.rs +++ b/pallets/contract-caller/contracts/flipper/e2e_tests.rs @@ -0,0 +1,16 @@ +use super::flipper::*; +use ink_e2e::ContractsBackend; + +type E2EResult = Result>; + +#[ink_e2e::test] +async fn instantiate_and_get(mut client: Client) -> E2EResult<()> { + // given + let flipper_code = client + .upload("flipper", &ink_e2e::alice()) + .submit() + .await + .expect("flipper upload failed"); + + Ok(()) +} diff --git a/pallets/contract-caller/contracts/flipper/lib.rs b/pallets/contract-caller/contracts/flipper/lib.rs index 487f0b4..9f01b95 100755 --- a/pallets/contract-caller/contracts/flipper/lib.rs +++ b/pallets/contract-caller/contracts/flipper/lib.rs @@ -3,140 +3,45 @@ #[ink::contract] mod flipper { - /// Defines the storage of your contract. - /// Add new fields to the below struct in order - /// to add new static storage fields to your contract. - #[ink(storage)] - pub struct Flipper { - /// Stores a single `bool` value on the storage. - value: bool, - } - - impl Flipper { - /// Constructor that initializes the `bool` value to the given `init_value`. - #[ink(constructor)] - pub fn new(init_value: bool) -> Self { - Self { value: init_value } - } - - /// Constructor that initializes the `bool` value to `false`. - /// - /// Constructors can delegate to other constructors. - #[ink(constructor)] - pub fn default() -> Self { - Self::new(Default::default()) - } - - /// A message that can be called on instantiated contracts. - /// This one flips the value of the stored `bool` from `true` - /// to `false` and vice versa. - #[ink(message)] - pub fn flip(&mut self) { - self.value = !self.value; - } - - /// Simply returns the current value of our `bool`. - #[ink(message)] - pub fn get(&self) -> bool { - self.value - } - } - - /// Unit tests in Rust are normally defined within such a `#[cfg(test)]` - /// module and test functions are marked with a `#[test]` attribute. - /// The below code is technically just normal Rust code. - #[cfg(test)] - mod tests { - /// Imports all the definitions from the outer scope so we can use them here. - use super::*; - - /// We test if the default constructor does its job. - #[ink::test] - fn default_works() { - let flipper = Flipper::default(); - assert_eq!(flipper.get(), false); - } - - /// We test a simple use case of our contract. - #[ink::test] - fn it_works() { - let mut flipper = Flipper::new(false); - assert_eq!(flipper.get(), false); - flipper.flip(); - assert_eq!(flipper.get(), true); - } - } - - - /// This is how you'd write end-to-end (E2E) or integration tests for ink! contracts. - /// - /// When running these you need to make sure that you: - /// - Compile the tests with the `e2e-tests` feature flag enabled (`--features e2e-tests`) - /// - Are running a Substrate node which contains `pallet-contracts` in the background - #[cfg(all(test, feature = "e2e-tests"))] - mod e2e_tests { - /// Imports all the definitions from the outer scope so we can use them here. - use super::*; - - /// A helper function used for calling contract messages. - use ink_e2e::build_message; - - /// The End-to-End test `Result` type. - type E2EResult = std::result::Result>; - - /// We test that we can upload and instantiate the contract using its default constructor. - #[ink_e2e::test] - async fn default_works(mut client: ink_e2e::Client) -> E2EResult<()> { - // Given - let constructor = FlipperRef::default(); - - // When - let contract_account_id = client - .instantiate("flipper", &ink_e2e::alice(), constructor, 0, None) - .await - .expect("instantiate failed") - .account_id; - - // Then - let get = build_message::(contract_account_id.clone()) - .call(|flipper| flipper.get()); - let get_result = client.call_dry_run(&ink_e2e::alice(), &get, 0, None).await; - assert!(matches!(get_result.return_value(), false)); - - Ok(()) - } - - /// We test that we can read and write a value from the on-chain contract contract. - #[ink_e2e::test] - async fn it_works(mut client: ink_e2e::Client) -> E2EResult<()> { - // Given - let constructor = FlipperRef::new(false); - let contract_account_id = client - .instantiate("flipper", &ink_e2e::bob(), constructor, 0, None) - .await - .expect("instantiate failed") - .account_id; - - let get = build_message::(contract_account_id.clone()) - .call(|flipper| flipper.get()); - let get_result = client.call_dry_run(&ink_e2e::bob(), &get, 0, None).await; - assert!(matches!(get_result.return_value(), false)); - - // When - let flip = build_message::(contract_account_id.clone()) - .call(|flipper| flipper.flip()); - let _flip_result = client - .call(&ink_e2e::bob(), flip, 0, None) - .await - .expect("flip failed"); - - // Then - let get = build_message::(contract_account_id.clone()) - .call(|flipper| flipper.get()); - let get_result = client.call_dry_run(&ink_e2e::bob(), &get, 0, None).await; - assert!(matches!(get_result.return_value(), true)); - - Ok(()) - } - } + /// Defines the storage of your contract. + /// Add new fields to the below struct in order + /// to add new static storage fields to your contract. + #[ink(storage)] + pub struct Flipper { + /// Stores a single `bool` value on the storage. + value: bool, + } + + impl Flipper { + /// Constructor that initializes the `bool` value to the given `init_value`. + #[ink(constructor)] + pub fn new(init_value: bool) -> Self { + Self { value: init_value } + } + + /// Constructor that initializes the `bool` value to `false`. + /// + /// Constructors can delegate to other constructors. + #[ink(constructor)] + pub fn default() -> Self { + Self::new(Default::default()) + } + + /// A message that can be called on instantiated contracts. + /// This one flips the value of the stored `bool` from `true` + /// to `false` and vice versa. + #[ink(message)] + pub fn flip(&mut self) { + self.value = !self.value; + } + + /// Simply returns the current value of our `bool`. + #[ink(message)] + pub fn get(&self) -> bool { + self.value + } + } } + +#[cfg(all(test, feature = "e2e-tests"))] +mod e2e_tests; From f7d57f678ecfa03f3dc1af3052b1a1d104cc8de3 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Wed, 13 Mar 2024 13:02:24 +0000 Subject: [PATCH 11/30] Cargo.lock --- Cargo.lock | 49 +++++++++++++++++++++++++------------------------ 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 69bb4a4..fa51f2a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1467,9 +1467,9 @@ checksum = "cd7e35aee659887cbfb97aaf227ac12cad1a9d7c71e55ff3376839ed4e282d08" [[package]] name = "contract-build" -version = "4.0.0-rc.4" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0cace153488962932541d89bc7e8e515cf1c4606ea45fe55826d59505078fa4" +checksum = "9f4e6c03a261bc36c858fb67f12c21045d372b731b2239372584ded4648b3538" dependencies = [ "anyhow", "blake2 0.10.6", @@ -1507,9 +1507,9 @@ dependencies = [ [[package]] name = "contract-metadata" -version = "4.0.0-rc.4" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "664ab6d50dbdba63b7c4e61ca9830252c69e0e507a20f2f74fc2c6b6582e3bf1" +checksum = "71d239a78947aa2d0c63a9936754927551f275d3064a221384427c2c2ff1504b" dependencies = [ "anyhow", "impl-serde", @@ -4687,7 +4687,7 @@ dependencies = [ [[package]] name = "ink" -version = "5.0.0-rc.3" +version = "5.0.0" dependencies = [ "derive_more", "ink_env", @@ -4703,14 +4703,14 @@ dependencies = [ [[package]] name = "ink_allocator" -version = "5.0.0-rc.3" +version = "5.0.0" dependencies = [ "cfg-if", ] [[package]] name = "ink_codegen" -version = "5.0.0-rc.3" +version = "5.0.0" dependencies = [ "blake2 0.10.6", "derive_more", @@ -4730,10 +4730,11 @@ dependencies = [ [[package]] name = "ink_e2e" -version = "5.0.0-rc.3" +version = "5.0.0" dependencies = [ "cargo_metadata 0.18.1", "contract-build", + "frame-support", "funty", "impl-serde", "ink", @@ -4761,7 +4762,7 @@ dependencies = [ [[package]] name = "ink_e2e_macro" -version = "5.0.0-rc.3" +version = "5.0.0" dependencies = [ "darling 0.20.8", "derive_more", @@ -4775,7 +4776,7 @@ dependencies = [ [[package]] name = "ink_engine" -version = "5.0.0-rc.3" +version = "5.0.0" dependencies = [ "blake2 0.10.6", "derive_more", @@ -4789,7 +4790,7 @@ dependencies = [ [[package]] name = "ink_env" -version = "5.0.0-rc.3" +version = "5.0.0" dependencies = [ "blake2 0.10.6", "cfg-if", @@ -4817,7 +4818,7 @@ dependencies = [ [[package]] name = "ink_ir" -version = "5.0.0-rc.3" +version = "5.0.0" dependencies = [ "blake2 0.10.6", "either", @@ -4831,7 +4832,7 @@ dependencies = [ [[package]] name = "ink_macro" -version = "5.0.0-rc.3" +version = "5.0.0" dependencies = [ "ink_codegen", "ink_ir", @@ -4845,7 +4846,7 @@ dependencies = [ [[package]] name = "ink_metadata" -version = "5.0.0-rc.3" +version = "5.0.0" dependencies = [ "derive_more", "impl-serde", @@ -4860,14 +4861,14 @@ dependencies = [ [[package]] name = "ink_prelude" -version = "5.0.0-rc.3" +version = "5.0.0" dependencies = [ "cfg-if", ] [[package]] name = "ink_primitives" -version = "5.0.0-rc.3" +version = "5.0.0" dependencies = [ "derive_more", "ink_prelude", @@ -4880,7 +4881,7 @@ dependencies = [ [[package]] name = "ink_storage" -version = "5.0.0-rc.3" +version = "5.0.0" dependencies = [ "array-init", "cfg-if", @@ -4897,7 +4898,7 @@ dependencies = [ [[package]] name = "ink_storage_traits" -version = "5.0.0-rc.3" +version = "5.0.0" dependencies = [ "ink_metadata", "ink_prelude", @@ -12178,9 +12179,9 @@ dependencies = [ [[package]] name = "scale-info" -version = "2.10.0" +version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f7d66a1128282b7ef025a8ead62a4a9fcf017382ec53b8ffbf4d7bf77bd3c60" +checksum = "2ef2175c2907e7c8bc0a9c3f86aeb5ec1f3b275300ad58a44d0c3ae379a5e52e" dependencies = [ "bitvec", "cfg-if", @@ -14464,9 +14465,9 @@ checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76" [[package]] name = "thiserror" -version = "1.0.57" +version = "1.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e45bcbe8ed29775f228095caf2cd67af7a4ccf756ebff23a306bf3e8b47b24b" +checksum = "03468839009160513471e86a034bb2c5c0e4baae3b43f79ffc55c4a5427b3297" dependencies = [ "thiserror-impl", ] @@ -14493,9 +14494,9 @@ dependencies = [ [[package]] name = "thiserror-impl" -version = "1.0.57" +version = "1.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" +checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7" dependencies = [ "proc-macro2", "quote", From 1913ec6ea9e01abe4d30eb654733a4c8e93123d8 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Wed, 13 Mar 2024 15:01:22 +0000 Subject: [PATCH 12/30] Add instantiate flipper dispatchable and use pallet_contracts benchmarks --- Cargo.lock | 2 +- pallets/contract-caller/Cargo.toml | 11 +-- pallets/contract-caller/src/benchmarking.rs | 35 --------- pallets/contract-caller/src/lib.rs | 83 +++++---------------- 4 files changed, 24 insertions(+), 107 deletions(-) delete mode 100644 pallets/contract-caller/src/benchmarking.rs diff --git a/Cargo.lock b/Cargo.lock index fa51f2a..40c1f08 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7203,9 +7203,9 @@ name = "pallet-contract-caller" version = "4.0.0-dev" dependencies = [ "flipper", - "frame-benchmarking", "frame-support", "frame-system", + "pallet-contracts", "parity-scale-codec", "scale-info", "sp-core", diff --git a/pallets/contract-caller/Cargo.toml b/pallets/contract-caller/Cargo.toml index a8e2e1d..a5191a0 100644 --- a/pallets/contract-caller/Cargo.toml +++ b/pallets/contract-caller/Cargo.toml @@ -17,10 +17,11 @@ codec = { package = "parity-scale-codec", version = "3.6.1", default-features = "derive", ] } scale-info = { version = "2.10.0", default-features = false, features = ["derive"] } -frame-benchmarking = { workspace = true, default-features = false, optional = true } frame-support = { workspace = true, default-features = false } frame-system = { workspace = true, default-features = false } sp-std = { workspace = true, default-features = false } + +pallet-contracts = { workspace = true, default-features = false } flipper = { path = "contracts/flipper", default-features = false, features = ["ink-as-dependency"] } [dev-dependencies] @@ -32,7 +33,6 @@ sp-runtime = { workspace = true } default = ["std"] std = [ "codec/std", - "frame-benchmarking?/std", "frame-support/std", "frame-system/std", "scale-info/std", @@ -40,14 +40,9 @@ std = [ "sp-io/std", "sp-runtime/std", "sp-std/std", + "pallet-contracts/std", "flipper/std" ] -runtime-benchmarks = [ - "frame-benchmarking/runtime-benchmarks", - "frame-support/runtime-benchmarks", - "frame-system/runtime-benchmarks", - "sp-runtime/runtime-benchmarks", -] try-runtime = [ "frame-support/try-runtime", "frame-system/try-runtime", diff --git a/pallets/contract-caller/src/benchmarking.rs b/pallets/contract-caller/src/benchmarking.rs deleted file mode 100644 index 4bcc891..0000000 --- a/pallets/contract-caller/src/benchmarking.rs +++ /dev/null @@ -1,35 +0,0 @@ -//! Benchmarking setup for pallet-contract-caller -#![cfg(feature = "runtime-benchmarks")] -use super::*; - -#[allow(unused)] -use crate::Pallet as Template; -use frame_benchmarking::v2::*; -use frame_system::RawOrigin; - -#[benchmarks] -mod benchmarks { - use super::*; - - #[benchmark] - fn do_something() { - let value = 100u32.into(); - let caller: T::AccountId = whitelisted_caller(); - #[extrinsic_call] - do_something(RawOrigin::Signed(caller), value); - - assert_eq!(Something::::get(), Some(value)); - } - - #[benchmark] - fn cause_error() { - Something::::put(100u32); - let caller: T::AccountId = whitelisted_caller(); - #[extrinsic_call] - cause_error(RawOrigin::Signed(caller)); - - assert_eq!(Something::::get(), Some(101u32)); - } - - impl_benchmark_test_suite!(Template, crate::mock::new_test_ext(), crate::mock::Test); -} diff --git a/pallets/contract-caller/src/lib.rs b/pallets/contract-caller/src/lib.rs index 90dfe37..cc7af03 100644 --- a/pallets/contract-caller/src/lib.rs +++ b/pallets/contract-caller/src/lib.rs @@ -52,14 +52,6 @@ mod mock; #[cfg(test)] mod tests; -// Every callable function or "dispatchable" a pallet exposes must have weight values that correctly -// estimate a dispatchable's execution time. The benchmarking module is used to calculate weights -// for each dispatchable and generates this pallet's weight.rs file. Learn more about benchmarking here: https://docs.substrate.io/test/benchmark/ -#[cfg(feature = "runtime-benchmarks")] -mod benchmarking; -pub mod weights; -pub use weights::*; - // All pallet logic is defined in its own module and must be annotated by the `pallet` attribute. #[frame_support::pallet] pub mod pallet { @@ -68,6 +60,8 @@ pub mod pallet { use frame_support::pallet_prelude::*; use frame_system::pallet_prelude::*; + type AccountIdOf = ::AccountId; + // The `Pallet` struct serves as a placeholder to implement traits, methods and dispatchables // (`Call`s) in this pallet. #[pallet::pallet] @@ -79,19 +73,14 @@ pub mod pallet { /// These types are defined generically and made concrete when the pallet is declared in the /// `runtime/src/lib.rs` file of your chain. #[pallet::config] - pub trait Config: frame_system::Config { + pub trait Config: frame_system::Config + pallet_contracts::Config { /// The overarching runtime event type. type RuntimeEvent: From> + IsType<::RuntimeEvent>; - /// A type representing the weights required by the dispatchables of this pallet. - type WeightInfo: WeightInfo; } - /// A storage item for this pallet. - /// - /// In this template, we are declaring a storage item called `Something` that stores a single - /// `u32` value. Learn more about runtime storage here: + /// The account of the flipper contract to call #[pallet::storage] - pub type Something = StorageValue<_, u32>; + pub type FlipperContract = StorageValue<_, AccountIdOf>; /// Events that functions in this pallet can emit. /// @@ -106,12 +95,12 @@ pub mod pallet { #[pallet::event] #[pallet::generate_deposit(pub(super) fn deposit_event)] pub enum Event { - /// A user has successfully set a new value. - SomethingStored { - /// The new value set. - something: u32, + /// The account of the flipper contract has been updated. + NewFlipperContract { + /// The new account set. + contract: AccountIdOf, /// The account who set the new value. - who: T::AccountId, + who: AccountIdOf, }, } @@ -151,52 +140,20 @@ pub mod pallet { /// It checks that the _origin_ for this call is _Signed_ and returns a dispatch /// error if it isn't. Learn more about origins here: #[pallet::call_index(0)] - #[pallet::weight(T::WeightInfo::do_something())] - pub fn do_something(origin: OriginFor, something: u32) -> DispatchResult { - // Check that the extrinsic was signed and get the signer. + #[pallet::weight(::instantiate(0u32, 0u32).saturating_add(*gas_limit))] + pub fn instantiate_flipper( + origin: OriginFor, + code_hash: T::Hash, + gas_limit: Weight, + ) -> DispatchResult { let who = ensure_signed(origin)?; - // Update storage. - Something::::put(something); + // Instantiate the contract + let contract = todo!(); - // Emit an event. - Self::deposit_event(Event::SomethingStored { something, who }); - - // Return a successful `DispatchResult` + FlipperContract::::put(contract); + Self::deposit_event(Event::NewFlipperContract { contract, who }); Ok(()) } - - /// An example dispatchable that may throw a custom error. - /// - /// It checks that the caller is a signed origin and reads the current value from the - /// `Something` storage item. If a current value exists, it is incremented by 1 and then - /// written back to storage. - /// - /// ## Errors - /// - /// The function will return an error under the following conditions: - /// - /// - If no value has been set ([`Error::NoneValue`]) - /// - If incrementing the value in storage causes an arithmetic overflow - /// ([`Error::StorageOverflow`]) - #[pallet::call_index(1)] - #[pallet::weight(T::WeightInfo::cause_error())] - pub fn cause_error(origin: OriginFor) -> DispatchResult { - let _who = ensure_signed(origin)?; - - // Read a value from storage. - match Something::::get() { - // Return an error if the value has not been set. - None => Err(Error::::NoneValue.into()), - Some(old) => { - // Increment the value read from storage. This will cause an error in the event - // of overflow. - let new = old.checked_add(1).ok_or(Error::::StorageOverflow)?; - // Update the value in storage with the incremented result. - Something::::put(new); - Ok(()) - }, - } - } } } From 2d32d86fc0f0bb9c1d32aba6ba3e3fde575cfed7 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Wed, 13 Mar 2024 18:32:20 +0000 Subject: [PATCH 13/30] Add Flipper trait --- Cargo.lock | 8 ++++++++ .../contracts/flipper/Cargo.toml | 2 ++ .../contract-caller/contracts/flipper/lib.rs | 20 +++++++------------ .../contracts/traits/Cargo.toml | 18 +++++++++++++++++ .../contract-caller/contracts/traits/lib.rs | 14 +++++++++++++ 5 files changed, 49 insertions(+), 13 deletions(-) create mode 100644 pallets/contract-caller/contracts/traits/Cargo.toml create mode 100644 pallets/contract-caller/contracts/traits/lib.rs diff --git a/Cargo.lock b/Cargo.lock index 40c1f08..440b654 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1519,6 +1519,13 @@ dependencies = [ "url", ] +[[package]] +name = "contract-traits" +version = "5.0.0" +dependencies = [ + "ink", +] + [[package]] name = "contracts-node" version = "0.39.0" @@ -3475,6 +3482,7 @@ dependencies = [ name = "flipper" version = "0.1.0" dependencies = [ + "contract-traits", "ink", "ink_e2e", ] diff --git a/pallets/contract-caller/contracts/flipper/Cargo.toml b/pallets/contract-caller/contracts/flipper/Cargo.toml index b6e4022..d70d64e 100755 --- a/pallets/contract-caller/contracts/flipper/Cargo.toml +++ b/pallets/contract-caller/contracts/flipper/Cargo.toml @@ -6,6 +6,7 @@ edition = "2021" [dependencies] ink = { path = "/home/andrew/code/ink/crates/ink", default-features = false } +contract-traits = { path = "../traits", default-features = false } [dev-dependencies] ink_e2e = { path = "/home/andrew/code/ink/crates/e2e" } @@ -17,6 +18,7 @@ path = "lib.rs" default = ["std"] std = [ "ink/std", + "contract-traits/std", ] ink-as-dependency = [] e2e-tests = [] diff --git a/pallets/contract-caller/contracts/flipper/lib.rs b/pallets/contract-caller/contracts/flipper/lib.rs index 9f01b95..4ea4d65 100755 --- a/pallets/contract-caller/contracts/flipper/lib.rs +++ b/pallets/contract-caller/contracts/flipper/lib.rs @@ -2,6 +2,7 @@ #[ink::contract] mod flipper { + use contract_traits::Flip; /// Defines the storage of your contract. /// Add new fields to the below struct in order @@ -18,26 +19,19 @@ mod flipper { pub fn new(init_value: bool) -> Self { Self { value: init_value } } + } - /// Constructor that initializes the `bool` value to `false`. - /// - /// Constructors can delegate to other constructors. - #[ink(constructor)] - pub fn default() -> Self { - Self::new(Default::default()) - } - - /// A message that can be called on instantiated contracts. - /// This one flips the value of the stored `bool` from `true` + impl Flip for Flipper { + /// Flip the value of the stored `bool` from `true` /// to `false` and vice versa. #[ink(message)] - pub fn flip(&mut self) { + fn flip(&mut self) { self.value = !self.value; } - /// Simply returns the current value of our `bool`. + /// Returns the current value of our `bool`. #[ink(message)] - pub fn get(&self) -> bool { + fn get(&self) -> bool { self.value } } diff --git a/pallets/contract-caller/contracts/traits/Cargo.toml b/pallets/contract-caller/contracts/traits/Cargo.toml new file mode 100644 index 0000000..f92836a --- /dev/null +++ b/pallets/contract-caller/contracts/traits/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "contract-traits" +version = "5.0.0" +authors = ["Parity Technologies "] +edition = "2021" +publish = false + +[dependencies] +ink = { path = "/home/andrew/code/ink/crates/ink", default-features = false } + +[lib] +path = "lib.rs" + +[features] +default = ["std"] +std = [ + "ink/std", +] diff --git a/pallets/contract-caller/contracts/traits/lib.rs b/pallets/contract-caller/contracts/traits/lib.rs new file mode 100644 index 0000000..294077a --- /dev/null +++ b/pallets/contract-caller/contracts/traits/lib.rs @@ -0,0 +1,14 @@ +#![cfg_attr(not(feature = "std"), no_std, no_main)] + +/// Allows to flip and get a bool value. +#[ink::trait_definition] +pub trait Flip { + /// Flip the value of the stored `bool` from `true` + /// to `false` and vice versa. + #[ink(message)] + fn flip(&mut self); + + /// Returns the current value of our `bool`. + #[ink(message)] + fn get(&self) -> bool; +} From e18a81b277bd7c0d02a6310e406740a818a41144 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Thu, 14 Mar 2024 11:18:56 +0000 Subject: [PATCH 14/30] WIP calling contract from pallet with e2e test --- .../contracts/flipper/e2e_tests.rs | 24 +++- .../contract-caller/contracts/traits/lib.rs | 14 +-- pallets/contract-caller/src/lib.rs | 119 ++---------------- 3 files changed, 35 insertions(+), 122 deletions(-) diff --git a/pallets/contract-caller/contracts/flipper/e2e_tests.rs b/pallets/contract-caller/contracts/flipper/e2e_tests.rs index 38714e5..1ba75d2 100644 --- a/pallets/contract-caller/contracts/flipper/e2e_tests.rs +++ b/pallets/contract-caller/contracts/flipper/e2e_tests.rs @@ -1,16 +1,30 @@ use super::flipper::*; -use ink_e2e::ContractsBackend; +use ink_e2e::{ChainBackend, ContractsBackend, Value}; type E2EResult = Result>; #[ink_e2e::test] async fn instantiate_and_get(mut client: Client) -> E2EResult<()> { - // given - let flipper_code = client - .upload("flipper", &ink_e2e::alice()) + let mut constructor = FlipperRef::new(false); + + let contract = client + .instantiate("flipper", &ink_e2e::alice(), &mut constructor) .submit() .await - .expect("flipper upload failed"); + .expect("instantiate failed"); + + // call pallet dispatchable + client + .runtime_call( + &ink_e2e::alice(), + "ContractCaller", + "contract_call_flip", + vec![Value::from_bytes(contract.account_id)], + ) + .await + .expect("runtime call failed"); + + println!("contract: {:?}", contract.account_id); Ok(()) } diff --git a/pallets/contract-caller/contracts/traits/lib.rs b/pallets/contract-caller/contracts/traits/lib.rs index 294077a..a89a05c 100644 --- a/pallets/contract-caller/contracts/traits/lib.rs +++ b/pallets/contract-caller/contracts/traits/lib.rs @@ -3,12 +3,12 @@ /// Allows to flip and get a bool value. #[ink::trait_definition] pub trait Flip { - /// Flip the value of the stored `bool` from `true` - /// to `false` and vice versa. - #[ink(message)] - fn flip(&mut self); + /// Flip the value of the stored `bool` from `true` + /// to `false` and vice versa. + #[ink(message)] + fn flip(&mut self); - /// Returns the current value of our `bool`. - #[ink(message)] - fn get(&self) -> bool; + /// Returns the current value of our `bool`. + #[ink(message)] + fn get(&self) -> bool; } diff --git a/pallets/contract-caller/src/lib.rs b/pallets/contract-caller/src/lib.rs index cc7af03..0bf4bdb 100644 --- a/pallets/contract-caller/src/lib.rs +++ b/pallets/contract-caller/src/lib.rs @@ -1,158 +1,57 @@ -//! # Template Pallet +//! # Contract Caller //! -//! A pallet with minimal functionality to help developers understand the essential components of -//! writing a FRAME pallet. It is typically used in beginner tutorials or in Substrate template -//! nodes as a starting point for creating a new pallet and **not meant to be used in production**. -//! -//! ## Overview -//! -//! This template pallet contains basic examples of: -//! - declaring a storage item that stores a single `u32` value -//! - declaring and using events -//! - declaring and using errors -//! - a dispatchable function that allows a user to set a new value to storage and emits an event -//! upon success -//! - another dispatchable function that causes a custom error to be thrown -//! -//! Each pallet section is annotated with an attribute using the `#[pallet::...]` procedural macro. -//! This macro generates the necessary code for a pallet to be aggregated into a FRAME runtime. -//! -//! Learn more about FRAME macros [here](https://docs.substrate.io/reference/frame-macros/). -//! -//! ### Pallet Sections -//! -//! The pallet sections in this template are: -//! -//! - A **configuration trait** that defines the types and parameters which the pallet depends on -//! (denoted by the `#[pallet::config]` attribute). See: [`Config`]. -//! - A **means to store pallet-specific data** (denoted by the `#[pallet::storage]` attribute). -//! See: [`storage_types`]. -//! - A **declaration of the events** this pallet emits (denoted by the `#[pallet::event]` -//! attribute). See: [`Event`]. -//! - A **declaration of the errors** that this pallet can throw (denoted by the `#[pallet::error]` -//! attribute). See: [`Error`]. -//! - A **set of dispatchable functions** that define the pallet's functionality (denoted by the -//! `#[pallet::call]` attribute). See: [`dispatchables`]. -//! -//! Run `cargo doc --package pallet-template --open` to view this pallet's documentation. +//! todo: [AJ] docs -// We make sure this pallet uses `no_std` for compiling to Wasm. #![cfg_attr(not(feature = "std"), no_std)] -// Re-export pallet items so that they can be accessed from the crate namespace. pub use pallet::*; -// FRAME pallets require their own "mock runtimes" to be able to run unit tests. This module -// contains a mock runtime specific for testing this pallet's functionality. #[cfg(test)] mod mock; -// This module contains the unit tests for this pallet. -// Learn about pallet unit testing here: https://docs.substrate.io/test/unit-testing/ #[cfg(test)] mod tests; -// All pallet logic is defined in its own module and must be annotated by the `pallet` attribute. #[frame_support::pallet] pub mod pallet { - // Import various useful types required by all FRAME pallets. use super::*; use frame_support::pallet_prelude::*; use frame_system::pallet_prelude::*; type AccountIdOf = ::AccountId; - // The `Pallet` struct serves as a placeholder to implement traits, methods and dispatchables - // (`Call`s) in this pallet. #[pallet::pallet] pub struct Pallet(_); - /// The pallet's configuration trait. - /// - /// All our types and constants a pallet depends on must be declared here. - /// These types are defined generically and made concrete when the pallet is declared in the - /// `runtime/src/lib.rs` file of your chain. #[pallet::config] pub trait Config: frame_system::Config + pallet_contracts::Config { /// The overarching runtime event type. type RuntimeEvent: From> + IsType<::RuntimeEvent>; } - /// The account of the flipper contract to call - #[pallet::storage] - pub type FlipperContract = StorageValue<_, AccountIdOf>; - - /// Events that functions in this pallet can emit. - /// - /// Events are a simple means of indicating to the outside world (such as dApps, chain explorers - /// or other users) that some notable update in the runtime has occurred. In a FRAME pallet, the - /// documentation for each event field and its parameters is added to a node's metadata so it - /// can be used by external interfaces or tools. - /// - /// The `generate_deposit` macro generates a function on `Pallet` called `deposit_event` which - /// will convert the event type of your pallet into `RuntimeEvent` (declared in the pallet's - /// [`Config`] trait) and deposit it using [`frame_system::Pallet::deposit_event`]. #[pallet::event] #[pallet::generate_deposit(pub(super) fn deposit_event)] - pub enum Event { - /// The account of the flipper contract has been updated. - NewFlipperContract { - /// The new account set. - contract: AccountIdOf, - /// The account who set the new value. - who: AccountIdOf, - }, - } + pub enum Event {} - /// Errors that can be returned by this pallet. - /// - /// Errors tell users that something went wrong so it's important that their naming is - /// informative. Similar to events, error documentation is added to a node's metadata so it's - /// equally important that they have helpful documentation associated with them. - /// - /// This type of runtime error can be up to 4 bytes in size should you want to return additional - /// information. #[pallet::error] pub enum Error { - /// The value retrieved was `None` as no value was previously set. - NoneValue, - /// There was an attempt to increment the value in storage over `u32::MAX`. - StorageOverflow, + // ContractCallError(pallet_contracts::Error), } - /// The pallet's dispatchable functions ([`Call`]s). - /// - /// Dispatchable functions allows users to interact with the pallet and invoke state changes. - /// These functions materialize as "extrinsics", which are often compared to transactions. - /// They must always return a `DispatchResult` and be annotated with a weight and call index. - /// - /// The [`call_index`] macro is used to explicitly - /// define an index for calls in the [`Call`] enum. This is useful for pallets that may - /// introduce new dispatchables over time. If the order of a dispatchable changes, its index - /// will also change which will break backwards compatibility. - /// - /// The [`weight`] macro is used to assign a weight to each call. #[pallet::call] impl Pallet { - /// An example dispatchable that takes a single u32 value as a parameter, writes the value - /// to storage and emits an event. - /// - /// It checks that the _origin_ for this call is _Signed_ and returns a dispatch - /// error if it isn't. Learn more about origins here: + /// Call the flip method on the contract at the given `contract` account. #[pallet::call_index(0)] - #[pallet::weight(::instantiate(0u32, 0u32).saturating_add(*gas_limit))] - pub fn instantiate_flipper( + #[pallet::weight(::call().saturating_add(*gas_limit))] + pub fn contract_call_flip( origin: OriginFor, - code_hash: T::Hash, + contract: AccountIdOf, gas_limit: Weight, ) -> DispatchResult { let who = ensure_signed(origin)?; - // Instantiate the contract - let contract = todo!(); + // todo: call the contract.. - FlipperContract::::put(contract); - Self::deposit_event(Event::NewFlipperContract { contract, who }); Ok(()) } } From 8c7360f905681fe26ca5ccb73490971ff43d0f9f Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Thu, 14 Mar 2024 15:03:35 +0000 Subject: [PATCH 15/30] Remove unused testing stuff, wire up pallet --- pallets/contract-caller/src/lib.rs | 8 +-- pallets/contract-caller/src/mock.rs | 58 ----------------- pallets/contract-caller/src/tests.rs | 27 -------- pallets/contract-caller/src/weights.rs | 90 -------------------------- runtime/Cargo.toml | 1 + runtime/src/lib.rs | 5 ++ 6 files changed, 7 insertions(+), 182 deletions(-) delete mode 100644 pallets/contract-caller/src/mock.rs delete mode 100644 pallets/contract-caller/src/tests.rs delete mode 100644 pallets/contract-caller/src/weights.rs diff --git a/pallets/contract-caller/src/lib.rs b/pallets/contract-caller/src/lib.rs index 0bf4bdb..e6f13e3 100644 --- a/pallets/contract-caller/src/lib.rs +++ b/pallets/contract-caller/src/lib.rs @@ -6,12 +6,6 @@ pub use pallet::*; -#[cfg(test)] -mod mock; - -#[cfg(test)] -mod tests; - #[frame_support::pallet] pub mod pallet { use super::*; @@ -35,7 +29,7 @@ pub mod pallet { #[pallet::error] pub enum Error { - // ContractCallError(pallet_contracts::Error), + NoOp, // ContractCallError(pallet_contracts::Error), } #[pallet::call] diff --git a/pallets/contract-caller/src/mock.rs b/pallets/contract-caller/src/mock.rs deleted file mode 100644 index 8346461..0000000 --- a/pallets/contract-caller/src/mock.rs +++ /dev/null @@ -1,58 +0,0 @@ -use crate as pallet_template; -use frame_support::{ - derive_impl, - traits::{ConstU16, ConstU64}, -}; -use sp_core::H256; -use sp_runtime::{ - traits::{BlakeTwo256, IdentityLookup}, - BuildStorage, -}; - -type Block = frame_system::mocking::MockBlock; - -// Configure a mock runtime to test the pallet. -frame_support::construct_runtime!( - pub enum Test - { - System: frame_system, - TemplateModule: pallet_template, - } -); - -#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)] -impl frame_system::Config for Test { - type BaseCallFilter = frame_support::traits::Everything; - type BlockWeights = (); - type BlockLength = (); - type DbWeight = (); - type RuntimeOrigin = RuntimeOrigin; - type RuntimeCall = RuntimeCall; - type Nonce = u64; - type Hash = H256; - type Hashing = BlakeTwo256; - type AccountId = u64; - type Lookup = IdentityLookup; - type Block = Block; - type RuntimeEvent = RuntimeEvent; - type BlockHashCount = ConstU64<250>; - type Version = (); - type PalletInfo = PalletInfo; - type AccountData = (); - type OnNewAccount = (); - type OnKilledAccount = (); - type SystemWeightInfo = (); - type SS58Prefix = ConstU16<42>; - type OnSetCode = (); - type MaxConsumers = frame_support::traits::ConstU32<16>; -} - -impl pallet_template::Config for Test { - type RuntimeEvent = RuntimeEvent; - type WeightInfo = (); -} - -// Build genesis storage according to the mock runtime. -pub fn new_test_ext() -> sp_io::TestExternalities { - frame_system::GenesisConfig::::default().build_storage().unwrap().into() -} diff --git a/pallets/contract-caller/src/tests.rs b/pallets/contract-caller/src/tests.rs deleted file mode 100644 index 83e4bea..0000000 --- a/pallets/contract-caller/src/tests.rs +++ /dev/null @@ -1,27 +0,0 @@ -use crate::{mock::*, Error, Event, Something}; -use frame_support::{assert_noop, assert_ok}; - -#[test] -fn it_works_for_default_value() { - new_test_ext().execute_with(|| { - // Go past genesis block so events get deposited - System::set_block_number(1); - // Dispatch a signed extrinsic. - assert_ok!(TemplateModule::do_something(RuntimeOrigin::signed(1), 42)); - // Read pallet storage and assert an expected result. - assert_eq!(Something::::get(), Some(42)); - // Assert that the correct event was deposited - System::assert_last_event(Event::SomethingStored { something: 42, who: 1 }.into()); - }); -} - -#[test] -fn correct_error_for_none_value() { - new_test_ext().execute_with(|| { - // Ensure the expected error is thrown when no value is present. - assert_noop!( - TemplateModule::cause_error(RuntimeOrigin::signed(1)), - Error::::NoneValue - ); - }); -} diff --git a/pallets/contract-caller/src/weights.rs b/pallets/contract-caller/src/weights.rs deleted file mode 100644 index 7c42936..0000000 --- a/pallets/contract-caller/src/weights.rs +++ /dev/null @@ -1,90 +0,0 @@ - -//! Autogenerated weights for pallet_template -//! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-04-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `Alexs-MacBook-Pro-2.local`, CPU: `` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 - -// Executed Command: -// ../../target/release/node-template -// benchmark -// pallet -// --chain -// dev -// --pallet -// pallet_template -// --extrinsic -// * -// --steps=50 -// --repeat=20 -// --wasm-execution=compiled -// --output -// pallets/template/src/weights.rs -// --template -// ../../.maintain/frame-weight-template.hbs - -#![cfg_attr(rustfmt, rustfmt_skip)] -#![allow(unused_parens)] -#![allow(unused_imports)] - -use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use core::marker::PhantomData; - -/// Weight functions needed for pallet_template. -pub trait WeightInfo { - fn do_something() -> Weight; - fn cause_error() -> Weight; -} - -/// Weights for pallet_template using the Substrate node and recommended hardware. -pub struct SubstrateWeight(PhantomData); -impl WeightInfo for SubstrateWeight { - /// Storage: TemplateModule Something (r:0 w:1) - /// Proof: TemplateModule Something (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) - fn do_something() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 8_000_000 picoseconds. - Weight::from_parts(9_000_000, 0) - .saturating_add(T::DbWeight::get().writes(1_u64)) - } - /// Storage: TemplateModule Something (r:1 w:1) - /// Proof: TemplateModule Something (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) - fn cause_error() -> Weight { - // Proof Size summary in bytes: - // Measured: `32` - // Estimated: `1489` - // Minimum execution time: 6_000_000 picoseconds. - Weight::from_parts(6_000_000, 1489) - .saturating_add(T::DbWeight::get().reads(1_u64)) - .saturating_add(T::DbWeight::get().writes(1_u64)) - } -} - -// For backwards compatibility and tests -impl WeightInfo for () { - /// Storage: TemplateModule Something (r:0 w:1) - /// Proof: TemplateModule Something (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) - fn do_something() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 8_000_000 picoseconds. - Weight::from_parts(9_000_000, 0) - .saturating_add(RocksDbWeight::get().writes(1_u64)) - } - /// Storage: TemplateModule Something (r:1 w:1) - /// Proof: TemplateModule Something (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) - fn cause_error() -> Weight { - // Proof Size summary in bytes: - // Measured: `32` - // Estimated: `1489` - // Minimum execution time: 6_000_000 picoseconds. - Weight::from_parts(6_000_000, 1489) - .saturating_add(RocksDbWeight::get().reads(1_u64)) - .saturating_add(RocksDbWeight::get().writes(1_u64)) - } -} diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index e9b0ed3..e627aa1 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -79,6 +79,7 @@ std = [ "pallet-authorship/std", "pallet-balances/std", "pallet-contracts/std", + "pallet-contract-caller/std", "pallet-grandpa/std", "pallet-insecure-randomness-collective-flip/std", "pallet-sudo/std", diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 0138851..1568af4 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -266,6 +266,10 @@ impl pallet_utility::Config for Runtime { type WeightInfo = pallet_utility::weights::SubstrateWeight; } +impl pallet_contract_caller::Config for Runtime { + type RuntimeEvent = RuntimeEvent; +} + // Create the runtime by composing the FRAME pallets that were previously configured. construct_runtime!( pub struct Runtime { @@ -279,6 +283,7 @@ construct_runtime!( Sudo: pallet_sudo, Contracts: pallet_contracts, Assets: pallet_assets, + ContractCaller: pallet_contract_caller, } ); From 148275aa1abde3fac9252becbb09e66d38edc70e Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Fri, 15 Mar 2024 09:18:43 +0000 Subject: [PATCH 16/30] Calling runtime works --- Cargo.lock | 2 ++ pallets/contract-caller/contracts/flipper/Cargo.toml | 2 ++ pallets/contract-caller/contracts/flipper/e2e_tests.rs | 9 +++++++-- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 440b654..191b416 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3483,8 +3483,10 @@ name = "flipper" version = "0.1.0" dependencies = [ "contract-traits", + "frame-support", "ink", "ink_e2e", + "scale-value", ] [[package]] diff --git a/pallets/contract-caller/contracts/flipper/Cargo.toml b/pallets/contract-caller/contracts/flipper/Cargo.toml index d70d64e..2515e43 100755 --- a/pallets/contract-caller/contracts/flipper/Cargo.toml +++ b/pallets/contract-caller/contracts/flipper/Cargo.toml @@ -10,6 +10,8 @@ contract-traits = { path = "../traits", default-features = false } [dev-dependencies] ink_e2e = { path = "/home/andrew/code/ink/crates/e2e" } +frame-support = { workspace = true } +scale-value = "0.13.0" [lib] path = "lib.rs" diff --git a/pallets/contract-caller/contracts/flipper/e2e_tests.rs b/pallets/contract-caller/contracts/flipper/e2e_tests.rs index 1ba75d2..5852243 100644 --- a/pallets/contract-caller/contracts/flipper/e2e_tests.rs +++ b/pallets/contract-caller/contracts/flipper/e2e_tests.rs @@ -1,5 +1,5 @@ use super::flipper::*; -use ink_e2e::{ChainBackend, ContractsBackend, Value}; +use ink_e2e::{ChainBackend, ContractsBackend}; type E2EResult = Result>; @@ -19,7 +19,12 @@ async fn instantiate_and_get(mut client: Client) -> E2EResul &ink_e2e::alice(), "ContractCaller", "contract_call_flip", - vec![Value::from_bytes(contract.account_id)], + vec![ + scale_value::Value::from_bytes(contract.account_id), + scale_value::serde::to_value( + frame_support::weights::Weight::from_parts(1_000_000_000, 0), + ).unwrap(), + ], ) .await .expect("runtime call failed"); From 8aed71f62a26cd3ff55963a72828db35483f02e8 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Fri, 15 Mar 2024 12:17:20 +0000 Subject: [PATCH 17/30] Folder structure, test works --- Cargo.lock | 1198 ++--------------- Cargo.toml | 1 + pallets/contract-caller/Cargo.toml | 5 +- pallets/contract-caller/contracts/.gitignore | 2 + .../contracts/flipper/Cargo.toml | 11 +- .../contract-caller/contracts/flipper/lib.rs | 2 +- .../contracts/{ => flipper}/traits/Cargo.toml | 2 +- .../contracts/{ => flipper}/traits/lib.rs | 0 pallets/contract-caller/src/lib.rs | 44 +- 9 files changed, 144 insertions(+), 1121 deletions(-) create mode 100755 pallets/contract-caller/contracts/.gitignore rename pallets/contract-caller/contracts/{ => flipper}/traits/Cargo.toml (91%) rename pallets/contract-caller/contracts/{ => flipper}/traits/lib.rs (100%) diff --git a/Cargo.lock b/Cargo.lock index 191b416..9160637 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -190,9 +190,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.80" +version = "1.0.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ad32ce52e4161730f7098c077cd2ed6229b5804ccf99e5366be1ab72a98b4e1" +checksum = "0952808a6c2afd1aa8947271f3a60f1a6763c7b912d210184c5149b5cf147247" [[package]] name = "approx" @@ -480,17 +480,6 @@ dependencies = [ "futures-lite 1.13.0", ] -[[package]] -name = "async-fs" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc19683171f287921f2405677dd2ed2549c3b3bda697a563ebc3a121ace2aba1" -dependencies = [ - "async-lock 3.3.0", - "blocking", - "futures-lite 2.2.0", -] - [[package]] name = "async-io" version = "1.13.0" @@ -561,17 +550,6 @@ dependencies = [ "futures-lite 1.13.0", ] -[[package]] -name = "async-net" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b948000fad4873c1c9339d60f2623323a0cfd3816e5181033c6a5cb68b2accf7" -dependencies = [ - "async-io 2.3.1", - "blocking", - "futures-lite 2.2.0", -] - [[package]] name = "async-process" version = "1.8.1" @@ -589,24 +567,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "async-process" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "451e3cf68011bd56771c79db04a9e333095ab6349f7e47592b788e9b98720cc8" -dependencies = [ - "async-channel 2.2.0", - "async-io 2.3.1", - "async-lock 3.3.0", - "async-signal", - "blocking", - "cfg-if", - "event-listener 5.2.0", - "futures-lite 2.2.0", - "rustix 0.38.31", - "windows-sys 0.52.0", -] - [[package]] name = "async-signal" version = "0.2.5" @@ -700,12 +660,6 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" -[[package]] -name = "base58" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6107fe1be6682a68940da878d9e9f5e90ca5745b3dec9fd1bb393c8777d4f581" - [[package]] name = "base64" version = "0.13.1" @@ -917,50 +871,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "bollard" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83545367eb6428eb35c29cdec3a1f350fa8d6d9085d59a7d7bcb637f2e38db5a" -dependencies = [ - "base64 0.21.7", - "bollard-stubs", - "bytes", - "futures-core", - "futures-util", - "hex", - "http 1.1.0", - "http-body-util", - "hyper 1.2.0", - "hyper-named-pipe", - "hyper-util", - "hyperlocal-next", - "log", - "pin-project-lite 0.2.13", - "serde", - "serde_derive", - "serde_json", - "serde_repr", - "serde_urlencoded", - "thiserror", - "tokio", - "tokio-util", - "tower-service", - "url", - "winapi", -] - -[[package]] -name = "bollard-stubs" -version = "1.44.0-rc.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "709d9aa1c37abb89d40f19f5d0ad6f0d88cb1581264e571c9350fc5bb89cf1c5" -dependencies = [ - "serde", - "serde_repr", - "serde_with", -] - [[package]] name = "bounded-collections" version = "0.2.0" @@ -1107,20 +1017,6 @@ dependencies = [ "thiserror", ] -[[package]] -name = "cargo_metadata" -version = "0.18.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d886547e41f740c616ae73108f6eb70afe6d940c7bc697cb30f13daec073037" -dependencies = [ - "camino", - "cargo-platform", - "semver 1.0.22", - "serde", - "serde_json", - "thiserror", -] - [[package]] name = "cc" version = "1.0.90" @@ -1205,7 +1101,6 @@ dependencies = [ "iana-time-zone", "js-sys", "num-traits", - "serde", "wasm-bindgen", "windows-targets 0.52.4", ] @@ -1352,16 +1247,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" -[[package]] -name = "colored" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbf2150cce219b664a8a70df7a1f933836724b503f8a413af9365b4dcc4d90b8" -dependencies = [ - "lazy_static", - "windows-sys 0.48.0", -] - [[package]] name = "comfy-table" version = "7.1.0" @@ -1465,67 +1350,6 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cd7e35aee659887cbfb97aaf227ac12cad1a9d7c71e55ff3376839ed4e282d08" -[[package]] -name = "contract-build" -version = "4.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f4e6c03a261bc36c858fb67f12c21045d372b731b2239372584ded4648b3538" -dependencies = [ - "anyhow", - "blake2 0.10.6", - "bollard", - "cargo_metadata 0.18.1", - "clap", - "colored", - "contract-metadata", - "crossterm", - "duct", - "heck", - "hex", - "impl-serde", - "parity-scale-codec", - "parity-wasm", - "regex", - "rustc_version 0.4.0", - "semver 1.0.22", - "serde", - "serde_json", - "strum 0.26.2", - "tempfile", - "term_size", - "tokio", - "tokio-stream", - "toml 0.8.10", - "tracing", - "url", - "uzers", - "walkdir", - "wasm-opt", - "which 6.0.0", - "zip", -] - -[[package]] -name = "contract-metadata" -version = "4.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71d239a78947aa2d0c63a9936754927551f275d3064a221384427c2c2ff1504b" -dependencies = [ - "anyhow", - "impl-serde", - "semver 1.0.22", - "serde", - "serde_json", - "url", -] - -[[package]] -name = "contract-traits" -version = "5.0.0" -dependencies = [ - "ink", -] - [[package]] name = "contracts-node" version = "0.39.0" @@ -1546,7 +1370,7 @@ dependencies = [ "frame-benchmarking", "frame-benchmarking-cli", "futures", - "jsonrpsee 0.22.2", + "jsonrpsee", "log", "pallet-transaction-payment-rpc", "parity-scale-codec", @@ -1898,31 +1722,6 @@ version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" -[[package]] -name = "crossterm" -version = "0.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f476fe445d41c9e991fd07515a6f463074b782242ccf4a5b7b1d1012e70824df" -dependencies = [ - "bitflags 2.4.2", - "crossterm_winapi", - "libc", - "mio", - "parking_lot 0.12.1", - "signal-hook", - "signal-hook-mio", - "winapi", -] - -[[package]] -name = "crossterm_winapi" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acdd7c62a3665c7f6830a51635d9ac9b23ed385797f70a83bb8bafe9c572ab2b" -dependencies = [ - "winapi", -] - [[package]] name = "crunchy" version = "0.2.2" @@ -2506,7 +2305,7 @@ dependencies = [ "async-trait", "cumulus-primitives-core", "futures", - "jsonrpsee-core 0.22.2", + "jsonrpsee-core", "parity-scale-codec", "polkadot-overseer", "sc-client-api", @@ -2570,7 +2369,7 @@ dependencies = [ "either", "futures", "futures-timer", - "jsonrpsee 0.22.2", + "jsonrpsee", "parity-scale-codec", "pin-project", "polkadot-overseer", @@ -2581,8 +2380,8 @@ dependencies = [ "schnellru", "serde", "serde_json", - "smoldot 0.11.0", - "smoldot-light 0.9.0", + "smoldot", + "smoldot-light", "sp-api", "sp-authority-discovery", "sp-consensus-babe", @@ -2717,18 +2516,8 @@ version = "0.14.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7b750cb3417fd1b327431a470f388520309479ab0bf5e323505daf0290cd3850" dependencies = [ - "darling_core 0.14.4", - "darling_macro 0.14.4", -] - -[[package]] -name = "darling" -version = "0.20.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54e36fcd13ed84ffdfda6f5be89b31287cbb80c439841fe69e04841435464391" -dependencies = [ - "darling_core 0.20.8", - "darling_macro 0.20.8", + "darling_core", + "darling_macro", ] [[package]] @@ -2745,42 +2534,17 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "darling_core" -version = "0.20.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c2cf1c23a687a1feeb728783b993c4e1ad83d99f351801977dd809b48d0a70f" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim 0.10.0", - "syn 2.0.52", -] - [[package]] name = "darling_macro" version = "0.14.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4aab4dbc9f7611d8b55048a3a16d2d010c2c8334e46304b40ac1cc14bf3b48e" dependencies = [ - "darling_core 0.14.4", + "darling_core", "quote", "syn 1.0.109", ] -[[package]] -name = "darling_macro" -version = "0.20.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a668eda54683121533a393014d8692171709ff57a7d61f187b6e782719f8933f" -dependencies = [ - "darling_core 0.20.8", - "quote", - "syn 2.0.52", -] - [[package]] name = "dashmap" version = "5.5.3" @@ -2851,7 +2615,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" dependencies = [ "powerfmt", - "serde", ] [[package]] @@ -3023,18 +2786,6 @@ version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dcbb2bf8e87535c23f7a8a321e364ce21462d0ff10cb6407820e8e96dfff6653" -[[package]] -name = "duct" -version = "0.13.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4ab5718d1224b63252cd0c6f74f6480f9ffeb117438a2e0f5cf6d9a4798929c" -dependencies = [ - "libc", - "once_cell", - "os_pipe", - "shared_child", -] - [[package]] name = "dyn-clonable" version = "0.9.0" @@ -3479,14 +3230,10 @@ dependencies = [ ] [[package]] -name = "flipper" -version = "0.1.0" +name = "flipper-traits" +version = "5.0.0" dependencies = [ - "contract-traits", - "frame-support", "ink", - "ink_e2e", - "scale-value", ] [[package]] @@ -3652,17 +3399,6 @@ dependencies = [ "sp-tracing", ] -[[package]] -name = "frame-metadata" -version = "15.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "878babb0b136e731cc77ec2fd883ff02745ff21e6fb662729953d44923df009c" -dependencies = [ - "cfg-if", - "parity-scale-codec", - "scale-info", -] - [[package]] name = "frame-metadata" version = "16.0.0" @@ -3683,7 +3419,7 @@ checksum = "2e11f19ac2855385880d96366287a52fa4cc513e2d5ec53b891a5f7ac7be2a71" dependencies = [ "futures", "indicatif", - "jsonrpsee 0.22.2", + "jsonrpsee", "log", "parity-scale-codec", "serde", @@ -3709,7 +3445,7 @@ dependencies = [ "bitflags 1.3.2", "docify", "environmental", - "frame-metadata 16.0.0", + "frame-metadata", "frame-support-procedural", "impl-trait-for-tuples", "k256", @@ -4164,7 +3900,7 @@ dependencies = [ "futures-core", "futures-sink", "futures-util", - "http 0.2.12", + "http", "indexmap 2.2.5", "slab", "tokio", @@ -4343,17 +4079,6 @@ dependencies = [ "itoa", ] -[[package]] -name = "http" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" -dependencies = [ - "bytes", - "fnv", - "itoa", -] - [[package]] name = "http-body" version = "0.4.6" @@ -4361,30 +4086,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" dependencies = [ "bytes", - "http 0.2.12", - "pin-project-lite 0.2.13", -] - -[[package]] -name = "http-body" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" -dependencies = [ - "bytes", - "http 1.1.0", -] - -[[package]] -name = "http-body-util" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41cb79eb393015dadd30fc252023adb0b2400a0caee0fa2a077e6e21a551e840" -dependencies = [ - "bytes", - "futures-util", - "http 1.1.0", - "http-body 1.0.0", + "http", "pin-project-lite 0.2.13", ] @@ -4423,8 +4125,8 @@ dependencies = [ "futures-core", "futures-util", "h2", - "http 0.2.12", - "http-body 0.4.6", + "http", + "http-body", "httparse", "httpdate", "itoa", @@ -4436,40 +4138,6 @@ dependencies = [ "want", ] -[[package]] -name = "hyper" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "186548d73ac615b32a73aafe38fb4f56c0d340e110e5a200bcadbaf2e199263a" -dependencies = [ - "bytes", - "futures-channel", - "futures-util", - "http 1.1.0", - "http-body 1.0.0", - "httparse", - "itoa", - "pin-project-lite 0.2.13", - "smallvec", - "tokio", - "want", -] - -[[package]] -name = "hyper-named-pipe" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73b7d8abf35697b81a825e386fc151e0d503e8cb5fcb93cc8669c376dfd6f278" -dependencies = [ - "hex", - "hyper 1.2.0", - "hyper-util", - "pin-project-lite 0.2.13", - "tokio", - "tower-service", - "winapi", -] - [[package]] name = "hyper-rustls" version = "0.24.2" @@ -4477,8 +4145,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" dependencies = [ "futures-util", - "http 0.2.12", - "hyper 0.14.28", + "http", + "hyper", "log", "rustls 0.21.10", "rustls-native-certs 0.6.3", @@ -4487,45 +4155,10 @@ dependencies = [ ] [[package]] -name = "hyper-util" -version = "0.1.3" +name = "iana-time-zone" +version = "0.1.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca38ef113da30126bbff9cd1705f9273e15d45498615d138b0c20279ac7a76aa" -dependencies = [ - "bytes", - "futures-channel", - "futures-util", - "http 1.1.0", - "http-body 1.0.0", - "hyper 1.2.0", - "pin-project-lite 0.2.13", - "socket2 0.5.6", - "tokio", - "tower", - "tower-service", - "tracing", -] - -[[package]] -name = "hyperlocal-next" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acf569d43fa9848e510358c07b80f4adf34084ddc28c6a4a651ee8474c070dcc" -dependencies = [ - "hex", - "http-body-util", - "hyper 1.2.0", - "hyper-util", - "pin-project-lite 0.2.13", - "tokio", - "tower-service", -] - -[[package]] -name = "iana-time-zone" -version = "0.1.60" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" +checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -4673,7 +4306,6 @@ checksum = "7b0b929d511467233429c45a44ac1dcaa21ba0f5ba11e4879e6ed28ddb4f9df4" dependencies = [ "equivalent", "hashbrown 0.14.3", - "serde", ] [[package]] @@ -4738,52 +4370,6 @@ dependencies = [ "syn 2.0.52", ] -[[package]] -name = "ink_e2e" -version = "5.0.0" -dependencies = [ - "cargo_metadata 0.18.1", - "contract-build", - "frame-support", - "funty", - "impl-serde", - "ink", - "ink_e2e_macro", - "ink_env", - "ink_primitives", - "jsonrpsee 0.22.2", - "pallet-contracts", - "parity-scale-codec", - "serde", - "serde_json", - "sp-core", - "sp-keyring", - "sp-runtime", - "sp-weights", - "subxt", - "subxt-signer", - "thiserror", - "tokio", - "tracing", - "tracing-subscriber 0.3.18", - "wasm-instrument", - "which 6.0.0", -] - -[[package]] -name = "ink_e2e_macro" -version = "5.0.0" -dependencies = [ - "darling 0.20.8", - "derive_more", - "ink_ir", - "proc-macro2", - "quote", - "serde_json", - "syn 2.0.52", - "tracing-subscriber 0.3.18", -] - [[package]] name = "ink_engine" version = "5.0.0" @@ -5076,55 +4662,22 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "jsonrpsee" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9579d0ca9fb30da026bac2f0f7d9576ec93489aeb7cd4971dd5b4617d82c79b2" -dependencies = [ - "jsonrpsee-client-transport 0.21.0", - "jsonrpsee-core 0.21.0", - "jsonrpsee-http-client 0.21.0", - "jsonrpsee-types 0.21.0", -] - [[package]] name = "jsonrpsee" version = "0.22.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "87f3ae45a64cfc0882934f963be9431b2a165d667f53140358181f262aca0702" dependencies = [ - "jsonrpsee-core 0.22.2", - "jsonrpsee-http-client 0.22.2", + "jsonrpsee-core", + "jsonrpsee-http-client", "jsonrpsee-proc-macros", "jsonrpsee-server", - "jsonrpsee-types 0.22.2", + "jsonrpsee-types", "jsonrpsee-ws-client", "tokio", "tracing", ] -[[package]] -name = "jsonrpsee-client-transport" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9f9ed46590a8d5681975f126e22531698211b926129a40a2db47cbca429220" -dependencies = [ - "futures-util", - "http 0.2.12", - "jsonrpsee-core 0.21.0", - "pin-project", - "rustls-native-certs 0.7.0", - "rustls-pki-types", - "soketto", - "thiserror", - "tokio", - "tokio-rustls 0.25.0", - "tokio-util", - "tracing", - "url", -] - [[package]] name = "jsonrpsee-client-transport" version = "0.22.2" @@ -5132,8 +4685,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "455fc882e56f58228df2aee36b88a1340eafd707c76af2fa68cf94b37d461131" dependencies = [ "futures-util", - "http 0.2.12", - "jsonrpsee-core 0.22.2", + "http", + "jsonrpsee-core", "pin-project", "rustls-native-certs 0.7.0", "rustls-pki-types", @@ -5146,30 +4699,6 @@ dependencies = [ "url", ] -[[package]] -name = "jsonrpsee-core" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "776d009e2f591b78c038e0d053a796f94575d66ca4e77dd84bfc5e81419e436c" -dependencies = [ - "anyhow", - "async-lock 3.3.0", - "async-trait", - "beef", - "futures-timer", - "futures-util", - "hyper 0.14.28", - "jsonrpsee-types 0.21.0", - "pin-project", - "rustc-hash", - "serde", - "serde_json", - "thiserror", - "tokio", - "tokio-stream", - "tracing", -] - [[package]] name = "jsonrpsee-core" version = "0.22.2" @@ -5182,8 +4711,8 @@ dependencies = [ "beef", "futures-timer", "futures-util", - "hyper 0.14.28", - "jsonrpsee-types 0.22.2", + "hyper", + "jsonrpsee-types", "parking_lot 0.12.1", "pin-project", "rand", @@ -5196,26 +4725,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "jsonrpsee-http-client" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78b7de9f3219d95985eb77fd03194d7c1b56c19bce1abfcc9d07462574b15572" -dependencies = [ - "async-trait", - "hyper 0.14.28", - "hyper-rustls", - "jsonrpsee-core 0.21.0", - "jsonrpsee-types 0.21.0", - "serde", - "serde_json", - "thiserror", - "tokio", - "tower", - "tracing", - "url", -] - [[package]] name = "jsonrpsee-http-client" version = "0.22.2" @@ -5223,10 +4732,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e7a95e346f55df84fb167b7e06470e196e7d5b9488a21d69c5d9732043ba7ba" dependencies = [ "async-trait", - "hyper 0.14.28", + "hyper", "hyper-rustls", - "jsonrpsee-core 0.22.2", - "jsonrpsee-types 0.22.2", + "jsonrpsee-core", + "jsonrpsee-types", "serde", "serde_json", "thiserror", @@ -5256,10 +4765,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0e29c1bd1f9bba83c864977c73404e505f74f730fa0db89dd490ec174e36d7f0" dependencies = [ "futures-util", - "http 0.2.12", - "hyper 0.14.28", - "jsonrpsee-core 0.22.2", - "jsonrpsee-types 0.22.2", + "http", + "hyper", + "jsonrpsee-core", + "jsonrpsee-types", "pin-project", "route-recognizer", "serde", @@ -5273,19 +4782,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "jsonrpsee-types" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3266dfb045c9174b24c77c2dfe0084914bb23a6b2597d70c9dc6018392e1cd1b" -dependencies = [ - "anyhow", - "beef", - "serde", - "serde_json", - "thiserror", -] - [[package]] name = "jsonrpsee-types" version = "0.22.2" @@ -5305,10 +4801,10 @@ version = "0.22.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68ca71e74983f624c0cb67828e480a981586074da8ad3a2f214c6a3f884edab9" dependencies = [ - "http 0.2.12", - "jsonrpsee-client-transport 0.22.2", - "jsonrpsee-core 0.22.2", - "jsonrpsee-types 0.22.2", + "http", + "jsonrpsee-client-transport", + "jsonrpsee-core", + "jsonrpsee-types", "url", ] @@ -6016,15 +5512,6 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4a83fb7698b3643a0e34f9ae6f2e8f0178c0fd42f8b59d493aa271ff3a5bf21" -[[package]] -name = "lru" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3262e75e648fce39813cb56ac41f3c3e3f65217ebf3844d818d1f9398cfb0dc" -dependencies = [ - "hashbrown 0.14.3", -] - [[package]] name = "lru-cache" version = "0.1.2" @@ -6132,15 +5619,6 @@ dependencies = [ "regex-automata 0.1.10", ] -[[package]] -name = "matchers" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" -dependencies = [ - "regex-automata 0.1.10", -] - [[package]] name = "matches" version = "0.1.10" @@ -6253,7 +5731,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" dependencies = [ "libc", - "log", "wasi 0.11.0+wasi-snapshot-preview1", "windows-sys 0.48.0", ] @@ -6309,7 +5786,7 @@ version = "30.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "93c2b8a657edbe89a72f0d95e31d7f31837035a067f0316499aaa9bddf6dda78" dependencies = [ - "jsonrpsee 0.22.2", + "jsonrpsee", "parity-scale-codec", "serde", "sp-api", @@ -6671,16 +6148,6 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61807f77802ff30975e01f4f071c8ba10c022052f98b3294119f3e615d13e5be" -[[package]] -name = "nu-ansi-term" -version = "0.46.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" -dependencies = [ - "overload", - "winapi", -] - [[package]] name = "num-bigint" version = "0.4.4" @@ -6866,22 +6333,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "os_pipe" -version = "1.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57119c3b893986491ec9aa85056780d3a0f3cf4da7cc09dd3650dbd6c6738fb9" -dependencies = [ - "libc", - "windows-sys 0.52.0", -] - -[[package]] -name = "overload" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" - [[package]] name = "pallet-asset-conversion" version = "12.0.0" @@ -7212,9 +6663,10 @@ dependencies = [ name = "pallet-contract-caller" version = "4.0.0-dev" dependencies = [ - "flipper", + "flipper-traits", "frame-support", "frame-system", + "ink", "pallet-contracts", "parity-scale-codec", "scale-info", @@ -8033,7 +7485,7 @@ version = "32.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4fac4e459db3c002ddebfbce82d055dbe8885eb4c2f9dcd9da5675eafef9bb7" dependencies = [ - "jsonrpsee 0.22.2", + "jsonrpsee", "pallet-transaction-payment-rpc-runtime-api", "parity-scale-codec", "sp-api", @@ -8218,7 +7670,7 @@ dependencies = [ "memmap2 0.5.10", "parking_lot 0.12.1", "rand", - "siphasher 0.3.11", + "siphasher", "snap", "winapi", ] @@ -9309,7 +8761,7 @@ version = "9.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9c02431c0f9947cf931113d492512b99478b4aefe2a3a2e49b59e45219f5d6f" dependencies = [ - "jsonrpsee 0.22.2", + "jsonrpsee", "mmr-rpc", "pallet-transaction-payment-rpc", "polkadot-primitives", @@ -9996,7 +9448,7 @@ dependencies = [ "regex", "syn 1.0.109", "tempfile", - "which 4.4.2", + "which", ] [[package]] @@ -10829,17 +10281,6 @@ dependencies = [ "twox-hash", ] -[[package]] -name = "ruzstd" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58c4eb8a81997cf040a091d1f7e1938aeab6749d3a0dfa73af43cdc32393483d" -dependencies = [ - "byteorder", - "derive_more", - "twox-hash", -] - [[package]] name = "rw-stream-sink" version = "0.3.0" @@ -11201,7 +10642,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "83ad369cae7dbeb4da4007dc8b1b27b905bf027172bbbf6dbede15e2539f0b2b" dependencies = [ "futures", - "jsonrpsee 0.22.2", + "jsonrpsee", "sc-consensus-babe", "sc-consensus-epochs", "sc-rpc-api", @@ -11261,7 +10702,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "36862ae5859008621ae53fcf6f8e5a960637aedf4de6995344672ba2619053ce" dependencies = [ "futures", - "jsonrpsee 0.22.2", + "jsonrpsee", "log", "parity-scale-codec", "parking_lot 0.12.1", @@ -11340,7 +10781,7 @@ checksum = "df4f1fb2262e1f96c66664da4b7045069013ffcaefbf44730913d5ac74f77c2f" dependencies = [ "finality-grandpa", "futures", - "jsonrpsee 0.22.2", + "jsonrpsee", "log", "parity-scale-codec", "sc-client-api", @@ -11363,7 +10804,7 @@ dependencies = [ "async-trait", "futures", "futures-timer", - "jsonrpsee 0.22.2", + "jsonrpsee", "log", "parity-scale-codec", "sc-client-api", @@ -11724,7 +11165,7 @@ dependencies = [ "fnv", "futures", "futures-timer", - "hyper 0.14.28", + "hyper", "hyper-rustls", "libp2p", "log", @@ -11765,7 +11206,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61faa018966cb794e36be31af4ed4d19deaa93c751ff32512637c7bca104e9e8" dependencies = [ "futures", - "jsonrpsee 0.22.2", + "jsonrpsee", "log", "parity-scale-codec", "parking_lot 0.12.1", @@ -11797,7 +11238,7 @@ version = "0.35.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f716a273af4f4782430ebe4fe6d0f8b1490ff7c103dc78193706bfff370c250f" dependencies = [ - "jsonrpsee 0.22.2", + "jsonrpsee", "parity-scale-codec", "sc-chain-spec", "sc-mixnet", @@ -11820,9 +11261,9 @@ checksum = "42ae724afa9862381f77b6d3a205baef5daceec9e584f17069546eb7dfca5400" dependencies = [ "futures", "governor", - "http 0.2.12", - "hyper 0.14.28", - "jsonrpsee 0.22.2", + "http", + "hyper", + "jsonrpsee", "log", "pin-project", "serde_json", @@ -11842,7 +11283,7 @@ dependencies = [ "futures", "futures-util", "hex", - "jsonrpsee 0.22.2", + "jsonrpsee", "log", "parity-scale-codec", "parking_lot 0.12.1", @@ -11875,7 +11316,7 @@ dependencies = [ "exit-future", "futures", "futures-timer", - "jsonrpsee 0.22.2", + "jsonrpsee", "log", "parity-scale-codec", "parking_lot 0.12.1", @@ -11960,7 +11401,7 @@ version = "0.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e2a59d517a60a3fdc0b12e7a1f112a2affbc9caf4f93b53d44c5e0edb485945" dependencies = [ - "jsonrpsee 0.22.2", + "jsonrpsee", "parity-scale-codec", "sc-chain-spec", "sc-client-api", @@ -12043,8 +11484,8 @@ dependencies = [ "sp-tracing", "thiserror", "tracing", - "tracing-log 0.1.4", - "tracing-subscriber 0.2.25", + "tracing-log", + "tracing-subscriber", ] [[package]] @@ -12128,7 +11569,6 @@ checksum = "036575c29af9b6e4866ffb7fa055dbf623fe7a9cc159b33786de6013a6969d89" dependencies = [ "parity-scale-codec", "scale-info", - "serde", ] [[package]] @@ -12139,7 +11579,6 @@ checksum = "7caaf753f8ed1ab4752c6afb20174f03598c664724e0e32628e161c21000ff76" dependencies = [ "derive_more", "parity-scale-codec", - "primitive-types", "scale-bits", "scale-decode-derive", "scale-info", @@ -12152,7 +11591,7 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3475108a1b62c7efd1b5c65974f30109a598b2f45f23c9ae030acb9686966db" dependencies = [ - "darling 0.14.4", + "darling", "proc-macro-crate 1.3.1", "proc-macro2", "quote", @@ -12167,8 +11606,6 @@ checksum = "6d70cb4b29360105483fac1ed567ff95d65224a14dd275b6303ed0a654c78de5" dependencies = [ "derive_more", "parity-scale-codec", - "primitive-types", - "scale-bits", "scale-encode-derive", "scale-info", "smallvec", @@ -12180,7 +11617,7 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "995491f110efdc6bea96d6a746140e32bfceb4ea47510750a5467295a4707a25" dependencies = [ - "darling 0.14.4", + "darling", "proc-macro-crate 1.3.1", "proc-macro2", "quote", @@ -12214,39 +11651,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "scale-typegen" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00860983481ac590ac87972062909bef0d6a658013b592ccc0f2feb272feab11" -dependencies = [ - "proc-macro2", - "quote", - "scale-info", - "syn 2.0.52", - "thiserror", -] - -[[package]] -name = "scale-value" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58223c7691bf0bd46b43c9aea6f0472d1067f378d574180232358d7c6e0a8089" -dependencies = [ - "base58", - "blake2 0.10.6", - "derive_more", - "either", - "frame-metadata 15.1.0", - "parity-scale-codec", - "scale-bits", - "scale-decode", - "scale-encode", - "scale-info", - "serde", - "yap", -] - [[package]] name = "schannel" version = "0.1.23" @@ -12505,17 +11909,6 @@ dependencies = [ "serde", ] -[[package]] -name = "serde_repr" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b2e6b945e9d3df726b65d6ee24060aff8e3533d431f677a9695db04eff9dfdb" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.52", -] - [[package]] name = "serde_spanned" version = "0.6.5" @@ -12525,35 +11918,6 @@ dependencies = [ "serde", ] -[[package]] -name = "serde_urlencoded" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" -dependencies = [ - "form_urlencoded", - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "serde_with" -version = "3.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15d167997bd841ec232f5b2b8e0e26606df2e7caa4c31b95ea9ca52b200bd270" -dependencies = [ - "base64 0.21.7", - "chrono", - "hex", - "indexmap 1.9.3", - "indexmap 2.2.5", - "serde", - "serde_derive", - "serde_json", - "time", -] - [[package]] name = "sha-1" version = "0.9.8" @@ -12621,16 +11985,6 @@ dependencies = [ "lazy_static", ] -[[package]] -name = "shared_child" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0d94659ad3c2137fef23ae75b03d5241d633f8acded53d672decfa0e6e0caef" -dependencies = [ - "libc", - "winapi", -] - [[package]] name = "shlex" version = "1.3.0" @@ -12638,31 +11992,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] -name = "signal-hook" -version = "0.3.17" +name = "signal-hook-registry" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8621587d4798caf8eb44879d42e56b9a93ea5dcd315a6487c357130095b62801" -dependencies = [ - "libc", - "signal-hook-registry", -] - -[[package]] -name = "signal-hook-mio" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29ad2e15f37ec9a6cc544097b78a1ec90001e9f71b81338ca39f430adaca99af" -dependencies = [ - "libc", - "mio", - "signal-hook", -] - -[[package]] -name = "signal-hook-registry" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" +checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" dependencies = [ "libc", ] @@ -12702,12 +12035,6 @@ version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" -[[package]] -name = "siphasher" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54ac45299ccbd390721be55b412d41931911f654fa99e2cb8bfb57184b2061fe" - [[package]] name = "slab" version = "0.4.9" @@ -12759,32 +12086,15 @@ checksum = "13f2b548cd8447f8de0fdf1c592929f70f4fc7039a05e47404b0d096ec6987a1" dependencies = [ "async-channel 1.9.0", "async-executor", - "async-fs 1.6.0", + "async-fs", "async-io 1.13.0", "async-lock 2.8.0", - "async-net 1.8.0", - "async-process 1.8.1", + "async-net", + "async-process", "blocking", "futures-lite 1.13.0", ] -[[package]] -name = "smol" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e635339259e51ef85ac7aa29a1cd991b957047507288697a690e80ab97d07cad" -dependencies = [ - "async-channel 2.2.0", - "async-executor", - "async-fs 2.1.1", - "async-io 2.3.1", - "async-lock 3.3.0", - "async-net 2.0.0", - "async-process 2.1.0", - "blocking", - "futures-lite 2.2.0", -] - [[package]] name = "smoldot" version = "0.11.0" @@ -12823,68 +12133,13 @@ dependencies = [ "poly1305", "rand", "rand_chacha 0.3.1", - "ruzstd 0.4.0", + "ruzstd", "schnorrkel 0.10.2", "serde", "serde_json", "sha2 0.10.8", "sha3", - "siphasher 0.3.11", - "slab", - "smallvec", - "soketto", - "twox-hash", - "wasmi", - "x25519-dalek 2.0.1", - "zeroize", -] - -[[package]] -name = "smoldot" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6d1eaa97d77be4d026a1e7ffad1bb3b78448763b357ea6f8188d3e6f736a9b9" -dependencies = [ - "arrayvec 0.7.4", - "async-lock 3.3.0", - "atomic-take", - "base64 0.21.7", - "bip39", - "blake2-rfc", - "bs58 0.5.0", - "chacha20", - "crossbeam-queue", - "derive_more", - "ed25519-zebra 4.0.3", - "either", - "event-listener 4.0.3", - "fnv", - "futures-lite 2.2.0", - "futures-util", - "hashbrown 0.14.3", - "hex", - "hmac 0.12.1", - "itertools 0.12.1", - "libm", - "libsecp256k1", - "merlin", - "no-std-net", - "nom", - "num-bigint", - "num-rational", - "num-traits", - "pbkdf2 0.12.2", - "pin-project", - "poly1305", - "rand", - "rand_chacha 0.3.1", - "ruzstd 0.5.0", - "schnorrkel 0.11.4", - "serde", - "serde_json", - "sha2 0.10.8", - "sha3", - "siphasher 1.0.0", + "siphasher", "slab", "smallvec", "soketto", @@ -12923,46 +12178,10 @@ dependencies = [ "rand_chacha 0.3.1", "serde", "serde_json", - "siphasher 0.3.11", - "slab", - "smol 1.3.0", - "smoldot 0.11.0", - "zeroize", -] - -[[package]] -name = "smoldot-light" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5496f2d116b7019a526b1039ec2247dd172b8670633b1a64a614c9ea12c9d8c7" -dependencies = [ - "async-channel 2.2.0", - "async-lock 3.3.0", - "base64 0.21.7", - "blake2-rfc", - "derive_more", - "either", - "event-listener 4.0.3", - "fnv", - "futures-channel", - "futures-lite 2.2.0", - "futures-util", - "hashbrown 0.14.3", - "hex", - "itertools 0.12.1", - "log", - "lru 0.12.3", - "no-std-net", - "parking_lot 0.12.1", - "pin-project", - "rand", - "rand_chacha 0.3.1", - "serde", - "serde_json", - "siphasher 1.0.0", + "siphasher", "slab", - "smol 2.0.0", - "smoldot 0.16.0", + "smol", + "smoldot", "zeroize", ] @@ -13019,7 +12238,7 @@ dependencies = [ "bytes", "flate2", "futures", - "http 0.2.12", + "http", "httparse", "log", "rand", @@ -13292,20 +12511,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "sp-core-hashing" -version = "15.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e0f4990add7b2cefdeca883c0efa99bb4d912cb2196120e1500c0cc099553b0" -dependencies = [ - "blake2b_simd", - "byteorder", - "digest 0.10.7", - "sha2 0.10.8", - "sha3", - "twox-hash", -] - [[package]] name = "sp-crypto-hashing" version = "0.1.0" @@ -13456,7 +12661,7 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fa0b5e87e56c1bb26d9524d48dd127121d630f895bd5914a34f0b017489f7c1d" dependencies = [ - "frame-metadata 16.0.0", + "frame-metadata", "parity-scale-codec", "scale-info", "sp-std", @@ -13724,7 +12929,7 @@ dependencies = [ "sp-std", "tracing", "tracing-core", - "tracing-subscriber 0.2.25", + "tracing-subscriber", ] [[package]] @@ -14054,15 +13259,6 @@ version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" -[[package]] -name = "strum" -version = "0.26.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d8cec3501a5194c432b2b7976db6b7d10ec95c253208b45f83f7136aa985e29" -dependencies = [ - "strum_macros 0.26.2", -] - [[package]] name = "strum_macros" version = "0.24.3" @@ -14089,19 +13285,6 @@ dependencies = [ "syn 2.0.52", ] -[[package]] -name = "strum_macros" -version = "0.26.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6cf59daf282c0a494ba14fd21610a0325f9f90ec9d1231dea26bcb1d696c946" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "rustversion", - "syn 2.0.52", -] - [[package]] name = "substrate-bip39" version = "0.4.6" @@ -14129,7 +13312,7 @@ checksum = "74fba95234990a0eecb3199ee2589112a1a3763db1fa7739a316f3e26f7693c9" dependencies = [ "frame-system-rpc-runtime-api", "futures", - "jsonrpsee 0.22.2", + "jsonrpsee", "log", "parity-scale-codec", "sc-rpc-api", @@ -14147,7 +13330,7 @@ version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0d8fe06b03b8a291c09507c42f92a2c2c10dd3d62975d02c7f64a92d87bfe09b" dependencies = [ - "hyper 0.14.28", + "hyper", "log", "prometheus", "thiserror", @@ -14161,7 +13344,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0aa04291d8b0e96b475c2abc26fe96f59478e23af38307c294a6f6c3d2a06fc8" dependencies = [ "async-trait", - "jsonrpsee 0.22.2", + "jsonrpsee", "log", "sc-rpc-api", "serde", @@ -14174,7 +13357,7 @@ version = "29.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a62395e13acaff44193068733ca986dd5b5be54055cabcee9cdad075b3a5f496" dependencies = [ - "jsonrpsee 0.22.2", + "jsonrpsee", "parity-scale-codec", "sc-client-api", "sc-rpc-api", @@ -14193,7 +13376,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d182ae093d473b5947e32c392b10fb12125318c4470ff8adf32b0cbf2e9e6611" dependencies = [ "build-helper", - "cargo_metadata 0.15.4", + "cargo_metadata", "console", "filetime", "parity-wasm", @@ -14224,130 +13407,6 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "734676eb262c623cec13c3155096e08d1f8f29adce39ba17948b18dad1e54142" -[[package]] -name = "subxt" -version = "0.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3323d5c27898b139d043dc1ee971f602f937b99354ee33ee933bd90e0009fbd" -dependencies = [ - "async-trait", - "base58", - "blake2 0.10.6", - "derivative", - "either", - "frame-metadata 16.0.0", - "futures", - "hex", - "impl-serde", - "instant", - "jsonrpsee 0.21.0", - "parity-scale-codec", - "primitive-types", - "scale-bits", - "scale-decode", - "scale-encode", - "scale-info", - "scale-value", - "serde", - "serde_json", - "sp-core-hashing", - "subxt-lightclient", - "subxt-macro", - "subxt-metadata", - "thiserror", - "tokio-util", - "tracing", - "url", -] - -[[package]] -name = "subxt-codegen" -version = "0.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d0e58c3f88651cff26aa52bae0a0a85f806a2e923a20eb438c16474990743ea" -dependencies = [ - "frame-metadata 16.0.0", - "heck", - "hex", - "jsonrpsee 0.21.0", - "parity-scale-codec", - "proc-macro2", - "quote", - "scale-info", - "scale-typegen", - "subxt-metadata", - "syn 2.0.52", - "thiserror", - "tokio", -] - -[[package]] -name = "subxt-lightclient" -version = "0.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecec7066ba7bc0c3608fcd1d0c7d9584390990cd06095b6ae4f114f74c4b8550" -dependencies = [ - "futures", - "futures-util", - "serde", - "serde_json", - "smoldot-light 0.14.0", - "thiserror", - "tokio", - "tokio-stream", - "tracing", -] - -[[package]] -name = "subxt-macro" -version = "0.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "365251668613323064803427af8c7c7bc366cd8b28e33639640757669dafebd5" -dependencies = [ - "darling 0.20.8", - "parity-scale-codec", - "proc-macro-error", - "quote", - "scale-typegen", - "subxt-codegen", - "syn 2.0.52", -] - -[[package]] -name = "subxt-metadata" -version = "0.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c02aca8d39a1f6c55fff3a8fd81557d30a610fedc1cef03f889a81bc0f8f0b52" -dependencies = [ - "frame-metadata 16.0.0", - "parity-scale-codec", - "scale-info", - "sp-core-hashing", - "thiserror", -] - -[[package]] -name = "subxt-signer" -version = "0.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f88a76a5d114bfae2f6f9cc1491c46173ecc3fb2b9e53948eb3c8d43d4b43ab5" -dependencies = [ - "bip39", - "hex", - "hmac 0.12.1", - "parity-scale-codec", - "pbkdf2 0.12.2", - "regex", - "schnorrkel 0.11.4", - "secp256k1", - "secrecy", - "sha2 0.10.8", - "sp-core-hashing", - "subxt", - "thiserror", - "zeroize", -] - [[package]] name = "syn" version = "1.0.109" @@ -14438,16 +13497,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "term_size" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e4129646ca0ed8f45d09b929036bafad5377103edd06e50bf574b353d2b08d9" -dependencies = [ - "libc", - "winapi", -] - [[package]] name = "termcolor" version = "1.4.1" @@ -14802,7 +13851,6 @@ dependencies = [ "futures-util", "pin-project", "pin-project-lite 0.2.13", - "tokio", "tower-layer", "tower-service", "tracing", @@ -14818,8 +13866,8 @@ dependencies = [ "bytes", "futures-core", "futures-util", - "http 0.2.12", - "http-body 0.4.6", + "http", + "http-body", "http-range-header", "pin-project-lite 0.2.13", "tower-layer", @@ -14917,17 +13965,6 @@ dependencies = [ "tracing-core", ] -[[package]] -name = "tracing-log" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" -dependencies = [ - "log", - "once_cell", - "tracing-core", -] - [[package]] name = "tracing-serde" version = "0.1.3" @@ -14947,7 +13984,7 @@ dependencies = [ "ansi_term", "chrono", "lazy_static", - "matchers 0.0.1", + "matchers", "parking_lot 0.11.2", "regex", "serde", @@ -14957,28 +13994,10 @@ dependencies = [ "thread_local", "tracing", "tracing-core", - "tracing-log 0.1.4", + "tracing-log", "tracing-serde", ] -[[package]] -name = "tracing-subscriber" -version = "0.3.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" -dependencies = [ - "matchers 0.1.0", - "nu-ansi-term", - "once_cell", - "regex", - "sharded-slab", - "smallvec", - "thread_local", - "tracing", - "tracing-core", - "tracing-log 0.2.0", -] - [[package]] name = "trie-db" version = "0.28.0" @@ -15217,7 +14236,6 @@ dependencies = [ "form_urlencoded", "idna 0.5.0", "percent-encoding", - "serde", ] [[package]] @@ -15226,16 +14244,6 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" -[[package]] -name = "uzers" -version = "0.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76d283dc7e8c901e79e32d077866eaf599156cbf427fffa8289aecc52c5c3f63" -dependencies = [ - "libc", - "log", -] - [[package]] name = "valuable" version = "0.1.0" @@ -15952,19 +14960,6 @@ dependencies = [ "rustix 0.38.31", ] -[[package]] -name = "which" -version = "6.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fa5e0c10bf77f44aac573e498d1a82d5fbd5e91f6fc0a99e7be4b38e85e101c" -dependencies = [ - "either", - "home", - "once_cell", - "rustix 0.38.31", - "windows-sys 0.52.0", -] - [[package]] name = "wide" version = "0.7.15" @@ -16363,12 +15358,6 @@ dependencies = [ "static_assertions", ] -[[package]] -name = "yap" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff4524214bc4629eba08d78ceb1d6507070cc0bcbbed23af74e19e6e924a24cf" - [[package]] name = "yasna" version = "0.5.2" @@ -16418,17 +15407,6 @@ dependencies = [ "syn 2.0.52", ] -[[package]] -name = "zip" -version = "0.6.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "760394e246e4c28189f19d488c058bf16f564016aefac5d32bb1f3b51d5e9261" -dependencies = [ - "byteorder", - "crc32fast", - "crossbeam-utils", -] - [[package]] name = "zstd" version = "0.11.2+zstd.1.5.2" diff --git a/Cargo.toml b/Cargo.toml index f97a1d1..a169c42 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,6 +12,7 @@ members = [ "node", "runtime", "parachain-runtime", + "pallets/contract-caller", ] [profile.release] diff --git a/pallets/contract-caller/Cargo.toml b/pallets/contract-caller/Cargo.toml index a5191a0..2429ee1 100644 --- a/pallets/contract-caller/Cargo.toml +++ b/pallets/contract-caller/Cargo.toml @@ -22,7 +22,8 @@ frame-system = { workspace = true, default-features = false } sp-std = { workspace = true, default-features = false } pallet-contracts = { workspace = true, default-features = false } -flipper = { path = "contracts/flipper", default-features = false, features = ["ink-as-dependency"] } +flipper-traits = { path = "contracts/flipper/traits", default-features = false } +ink = { path = "/home/andrew/code/ink/crates/ink", default-features = false } [dev-dependencies] sp-core = { workspace = true } @@ -41,7 +42,7 @@ std = [ "sp-runtime/std", "sp-std/std", "pallet-contracts/std", - "flipper/std" + "flipper-traits/std" ] try-runtime = [ "frame-support/try-runtime", diff --git a/pallets/contract-caller/contracts/.gitignore b/pallets/contract-caller/contracts/.gitignore new file mode 100755 index 0000000..4531c3e --- /dev/null +++ b/pallets/contract-caller/contracts/.gitignore @@ -0,0 +1,2 @@ +**/target/ +Cargo.lock diff --git a/pallets/contract-caller/contracts/flipper/Cargo.toml b/pallets/contract-caller/contracts/flipper/Cargo.toml index 2515e43..79653b0 100755 --- a/pallets/contract-caller/contracts/flipper/Cargo.toml +++ b/pallets/contract-caller/contracts/flipper/Cargo.toml @@ -1,3 +1,8 @@ +[workspace] +members = [ + "traits", +] + [package] name = "flipper" version = "0.1.0" @@ -6,11 +11,11 @@ edition = "2021" [dependencies] ink = { path = "/home/andrew/code/ink/crates/ink", default-features = false } -contract-traits = { path = "../traits", default-features = false } +flipper-traits = { path = "traits", default-features = false } [dev-dependencies] ink_e2e = { path = "/home/andrew/code/ink/crates/e2e" } -frame-support = { workspace = true } +frame-support = { version = "30.0.0", default-features = false } scale-value = "0.13.0" [lib] @@ -20,7 +25,7 @@ path = "lib.rs" default = ["std"] std = [ "ink/std", - "contract-traits/std", + "flipper-traits/std", ] ink-as-dependency = [] e2e-tests = [] diff --git a/pallets/contract-caller/contracts/flipper/lib.rs b/pallets/contract-caller/contracts/flipper/lib.rs index 4ea4d65..307ae9e 100755 --- a/pallets/contract-caller/contracts/flipper/lib.rs +++ b/pallets/contract-caller/contracts/flipper/lib.rs @@ -2,7 +2,7 @@ #[ink::contract] mod flipper { - use contract_traits::Flip; + use flipper_traits::Flip; /// Defines the storage of your contract. /// Add new fields to the below struct in order diff --git a/pallets/contract-caller/contracts/traits/Cargo.toml b/pallets/contract-caller/contracts/flipper/traits/Cargo.toml similarity index 91% rename from pallets/contract-caller/contracts/traits/Cargo.toml rename to pallets/contract-caller/contracts/flipper/traits/Cargo.toml index f92836a..5586465 100644 --- a/pallets/contract-caller/contracts/traits/Cargo.toml +++ b/pallets/contract-caller/contracts/flipper/traits/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "contract-traits" +name = "flipper-traits" version = "5.0.0" authors = ["Parity Technologies "] edition = "2021" diff --git a/pallets/contract-caller/contracts/traits/lib.rs b/pallets/contract-caller/contracts/flipper/traits/lib.rs similarity index 100% rename from pallets/contract-caller/contracts/traits/lib.rs rename to pallets/contract-caller/contracts/flipper/traits/lib.rs diff --git a/pallets/contract-caller/src/lib.rs b/pallets/contract-caller/src/lib.rs index e6f13e3..7f63fd5 100644 --- a/pallets/contract-caller/src/lib.rs +++ b/pallets/contract-caller/src/lib.rs @@ -9,8 +9,10 @@ pub use pallet::*; #[frame_support::pallet] pub mod pallet { use super::*; - use frame_support::pallet_prelude::*; + use flipper_traits::Flip; + use frame_support::{pallet_prelude::*, traits::fungible::Inspect}; use frame_system::pallet_prelude::*; + use ink::codegen::TraitCallBuilder; type AccountIdOf = ::AccountId; @@ -24,7 +26,6 @@ pub mod pallet { } #[pallet::event] - #[pallet::generate_deposit(pub(super) fn deposit_event)] pub enum Event {} #[pallet::error] @@ -33,7 +34,13 @@ pub mod pallet { } #[pallet::call] - impl Pallet { + impl Pallet + where + [u8; 32]: From<::AccountId>, + <::Currency as Inspect< + ::AccountId, + >>::Balance: From, + { /// Call the flip method on the contract at the given `contract` account. #[pallet::call_index(0)] #[pallet::weight(::call().saturating_add(*gas_limit))] @@ -44,7 +51,36 @@ pub mod pallet { ) -> DispatchResult { let who = ensure_signed(origin)?; - // todo: call the contract.. + let ink_account_id = + ink::primitives::AccountId::from(<[u8; 32]>::from(contract.clone())); + let mut flipper: ink::contract_ref!(Flip, ink::env::DefaultEnvironment) = + ink_account_id.into(); + let call_builder = flipper.call_mut(); + + let params = call_builder + .flip() + .ref_time_limit(gas_limit.ref_time()) + .proof_size_limit(gas_limit.proof_size()) + .params(); + + // Next step is to explore ways to encapsulate the following into the call builder. + let value = *params.transferred_value(); + let data = params.exec_input().encode(); + let weight = Weight::from_parts(params.ref_time_limit(), params.proof_size_limit()); + let storage_deposit_limit = params.storage_deposit_limit().map(|limit| (*limit).into()); + + pallet_contracts::Pallet::::bare_call( + who, + contract, + value.into(), + weight, + storage_deposit_limit, + data, + pallet_contracts::DebugInfo::Skip, + pallet_contracts::CollectEvents::Skip, + pallet_contracts::Determinism::Enforced, + ) + .result?; Ok(()) } From 5bc7e8a3c1382517b7447210de092dd30e0498b9 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Fri, 15 Mar 2024 12:22:47 +0000 Subject: [PATCH 18/30] Use released ink from contract --- pallets/contract-caller/contracts/flipper/Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pallets/contract-caller/contracts/flipper/Cargo.toml b/pallets/contract-caller/contracts/flipper/Cargo.toml index 79653b0..e66371d 100755 --- a/pallets/contract-caller/contracts/flipper/Cargo.toml +++ b/pallets/contract-caller/contracts/flipper/Cargo.toml @@ -10,11 +10,11 @@ authors = ["[your_name] <[your_email]>"] edition = "2021" [dependencies] -ink = { path = "/home/andrew/code/ink/crates/ink", default-features = false } +ink = { version = "5.0.0", default-features = false } flipper-traits = { path = "traits", default-features = false } [dev-dependencies] -ink_e2e = { path = "/home/andrew/code/ink/crates/e2e" } +ink_e2e = "5.0.0" frame-support = { version = "30.0.0", default-features = false } scale-value = "0.13.0" From 9d4ef8f114d6ca69681cbd22a38691b2522748f1 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Fri, 15 Mar 2024 12:25:59 +0000 Subject: [PATCH 19/30] ink 5.0 --- Cargo.lock | 24 +++++++++++++++++++ pallets/contract-caller/Cargo.toml | 5 ++-- .../contracts/flipper/traits/Cargo.toml | 2 +- 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9160637..4c82807 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4330,6 +4330,8 @@ dependencies = [ [[package]] name = "ink" version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d4a862aedbfda93175ddf75c9aaa2ae4c4b39ee5cee06c16d50bccce05bf5c7" dependencies = [ "derive_more", "ink_env", @@ -4346,6 +4348,8 @@ dependencies = [ [[package]] name = "ink_allocator" version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cee56055bac6d928d425e944c5f3b69baa33c9635822fd1c00cd4afc70fde3e" dependencies = [ "cfg-if", ] @@ -4353,6 +4357,8 @@ dependencies = [ [[package]] name = "ink_codegen" version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70a1f8473fa09e0f9b6f3cb3f8d18c07c14ebf9ea1f7cdfee270f009d45ee8e9" dependencies = [ "blake2 0.10.6", "derive_more", @@ -4373,6 +4379,8 @@ dependencies = [ [[package]] name = "ink_engine" version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f357e2e867f4e222ffc4015a6e61d1073548de89f70a4e36a8b0385562777fa" dependencies = [ "blake2 0.10.6", "derive_more", @@ -4387,6 +4395,8 @@ dependencies = [ [[package]] name = "ink_env" version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42cec50b7e4f8406aab25801b015d3802a52d76cfbe48ce11cfb4200fa88e296" dependencies = [ "blake2 0.10.6", "cfg-if", @@ -4415,6 +4425,8 @@ dependencies = [ [[package]] name = "ink_ir" version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b1ad2975551c4ed800af971289ed6d2c68ac41ffc03a42010b3e01d7360dfb2" dependencies = [ "blake2 0.10.6", "either", @@ -4429,6 +4441,8 @@ dependencies = [ [[package]] name = "ink_macro" version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aee1a546f37eae3b3cd223832d31702033c5369dcfa3405899587c110a7908d3" dependencies = [ "ink_codegen", "ink_ir", @@ -4443,6 +4457,8 @@ dependencies = [ [[package]] name = "ink_metadata" version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a98fcc0ff9292ff68c7ee7b84c93533c9ff13859ec3b148faa822e2da9954fe6" dependencies = [ "derive_more", "impl-serde", @@ -4458,6 +4474,8 @@ dependencies = [ [[package]] name = "ink_prelude" version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea1734d058c80aa72e59c8ae75624fd8a51791efba21469f273156c0f4cad5c9" dependencies = [ "cfg-if", ] @@ -4465,6 +4483,8 @@ dependencies = [ [[package]] name = "ink_primitives" version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11ec35ef7f45e67a53b6142d7e7f18e6d9292d76c3a2a1da14cf8423e481813d" dependencies = [ "derive_more", "ink_prelude", @@ -4478,6 +4498,8 @@ dependencies = [ [[package]] name = "ink_storage" version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbdb04cad74df858c05bc9cb6f30bbf12da33c3e2cb7ca211749c001fa761aa9" dependencies = [ "array-init", "cfg-if", @@ -4495,6 +4517,8 @@ dependencies = [ [[package]] name = "ink_storage_traits" version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83ce49e3d2935fc1ec3e73117119712b187d3123339f6a31624e92f75fa2293d" dependencies = [ "ink_metadata", "ink_prelude", diff --git a/pallets/contract-caller/Cargo.toml b/pallets/contract-caller/Cargo.toml index 2429ee1..80a1fc6 100644 --- a/pallets/contract-caller/Cargo.toml +++ b/pallets/contract-caller/Cargo.toml @@ -23,7 +23,7 @@ sp-std = { workspace = true, default-features = false } pallet-contracts = { workspace = true, default-features = false } flipper-traits = { path = "contracts/flipper/traits", default-features = false } -ink = { path = "/home/andrew/code/ink/crates/ink", default-features = false } +ink = { version = "5.0.0", default-features = false } [dev-dependencies] sp-core = { workspace = true } @@ -42,7 +42,8 @@ std = [ "sp-runtime/std", "sp-std/std", "pallet-contracts/std", - "flipper-traits/std" + "flipper-traits/std", + "ink/std" ] try-runtime = [ "frame-support/try-runtime", diff --git a/pallets/contract-caller/contracts/flipper/traits/Cargo.toml b/pallets/contract-caller/contracts/flipper/traits/Cargo.toml index 5586465..243663b 100644 --- a/pallets/contract-caller/contracts/flipper/traits/Cargo.toml +++ b/pallets/contract-caller/contracts/flipper/traits/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" publish = false [dependencies] -ink = { path = "/home/andrew/code/ink/crates/ink", default-features = false } +ink = { version = "5.0.0", default-features = false } [lib] path = "lib.rs" From e2eaf03022ecafd1032dd415f611b2139c0c4408 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Fri, 15 Mar 2024 12:38:04 +0000 Subject: [PATCH 20/30] Failing e2e test --- .../contracts/flipper/e2e_tests.rs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/pallets/contract-caller/contracts/flipper/e2e_tests.rs b/pallets/contract-caller/contracts/flipper/e2e_tests.rs index 5852243..d420097 100644 --- a/pallets/contract-caller/contracts/flipper/e2e_tests.rs +++ b/pallets/contract-caller/contracts/flipper/e2e_tests.rs @@ -1,11 +1,13 @@ use super::flipper::*; +use flipper_traits::Flip; use ink_e2e::{ChainBackend, ContractsBackend}; type E2EResult = Result>; #[ink_e2e::test] async fn instantiate_and_get(mut client: Client) -> E2EResult<()> { - let mut constructor = FlipperRef::new(false); + let initial_value = false; + let mut constructor = FlipperRef::new(initial_value); let contract = client .instantiate("flipper", &ink_e2e::alice(), &mut constructor) @@ -21,15 +23,21 @@ async fn instantiate_and_get(mut client: Client) -> E2EResul "contract_call_flip", vec![ scale_value::Value::from_bytes(contract.account_id), - scale_value::serde::to_value( - frame_support::weights::Weight::from_parts(1_000_000_000, 0), - ).unwrap(), + scale_value::serde::to_value(frame_support::weights::Weight::from_parts( + 1_000_000_000, + 0, + )) + .unwrap(), ], ) .await .expect("runtime call failed"); - println!("contract: {:?}", contract.account_id); + // now check that the flip was executed via the pallet + let get_message = contract.call_builder::().get(); + let get_result = client.call(&ink_e2e::alice(), &get_message).dry_run().await?; + + assert_eq!(get_result.return_value(), !initial_value); Ok(()) } From 72c09b20bbf51038a0c228fe62ee24642cd622f8 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Fri, 15 Mar 2024 17:00:45 +0000 Subject: [PATCH 21/30] Use gas estimate, tidy up pallet --- .../contract-caller/contracts/flipper/e2e_tests.rs | 11 +++++++---- pallets/contract-caller/src/lib.rs | 14 +++++++------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/pallets/contract-caller/contracts/flipper/e2e_tests.rs b/pallets/contract-caller/contracts/flipper/e2e_tests.rs index d420097..62d302a 100644 --- a/pallets/contract-caller/contracts/flipper/e2e_tests.rs +++ b/pallets/contract-caller/contracts/flipper/e2e_tests.rs @@ -15,6 +15,10 @@ async fn instantiate_and_get(mut client: Client) -> E2EResul .await .expect("instantiate failed"); + let mut call_builder = contract.call_builder::(); + let flip_dry_run = client.call(&ink_e2e::bob(), &call_builder.flip()).dry_run().await?; + let gas_required = flip_dry_run.exec_result.gas_required; + // call pallet dispatchable client .runtime_call( @@ -24,8 +28,8 @@ async fn instantiate_and_get(mut client: Client) -> E2EResul vec![ scale_value::Value::from_bytes(contract.account_id), scale_value::serde::to_value(frame_support::weights::Weight::from_parts( - 1_000_000_000, - 0, + gas_required.ref_time(), + gas_required.proof_size(), )) .unwrap(), ], @@ -34,8 +38,7 @@ async fn instantiate_and_get(mut client: Client) -> E2EResul .expect("runtime call failed"); // now check that the flip was executed via the pallet - let get_message = contract.call_builder::().get(); - let get_result = client.call(&ink_e2e::alice(), &get_message).dry_run().await?; + let get_result = client.call(&ink_e2e::alice(), &call_builder.get()).dry_run().await?; assert_eq!(get_result.return_value(), !initial_value); diff --git a/pallets/contract-caller/src/lib.rs b/pallets/contract-caller/src/lib.rs index 7f63fd5..b253d81 100644 --- a/pallets/contract-caller/src/lib.rs +++ b/pallets/contract-caller/src/lib.rs @@ -1,6 +1,6 @@ //! # Contract Caller //! -//! todo: [AJ] docs +//! Demonstrates calling into an `ink!` contract from a pallet. #![cfg_attr(not(feature = "std"), no_std)] @@ -29,9 +29,7 @@ pub mod pallet { pub enum Event {} #[pallet::error] - pub enum Error { - NoOp, // ContractCallError(pallet_contracts::Error), - } + pub enum Error { } #[pallet::call] impl Pallet @@ -69,9 +67,9 @@ pub mod pallet { let weight = Weight::from_parts(params.ref_time_limit(), params.proof_size_limit()); let storage_deposit_limit = params.storage_deposit_limit().map(|limit| (*limit).into()); - pallet_contracts::Pallet::::bare_call( - who, - contract, + let result = pallet_contracts::Pallet::::bare_call( + who.clone(), + contract.clone(), value.into(), weight, storage_deposit_limit, @@ -82,6 +80,8 @@ pub mod pallet { ) .result?; + assert!(!result.did_revert()); + Ok(()) } } From 346b08336b6e663248034b12c2a92e8060411641 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Fri, 15 Mar 2024 17:07:01 +0000 Subject: [PATCH 22/30] Add CI test --- .gitlab-ci.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2bfc1ef..c4cb853 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -80,6 +80,18 @@ build-linux: - mkdir -p ./artifacts/substrate-contracts-node-linux/ - cp target/release/substrate-contracts-node ./artifacts/substrate-contracts-node-linux/substrate-contracts-node +### stage: test-contract-caller-linux + +test-contract-caller-linux: + stage: test-contract-caller-linux + <<: *docker-env + <<: *collect-artifacts + <<: *build-refs + variables: + CONTRACTS_NODE: ./artifacts/substrate-contracts-node-linux/substrate-contracts-node + script: + - cargo test --manifest-path ./pallets/contract-caller/contracts/flipper/Cargo.toml --features e2e-tests + ### stage: build-mac build-mac: From f820b6cc1a71eb62c9c7c1f4049c2c11caed47c7 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Fri, 15 Mar 2024 17:46:58 +0000 Subject: [PATCH 23/30] Revert "Add CI test" This reverts commit 346b08336b6e663248034b12c2a92e8060411641. --- .gitlab-ci.yml | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c4cb853..2bfc1ef 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -80,18 +80,6 @@ build-linux: - mkdir -p ./artifacts/substrate-contracts-node-linux/ - cp target/release/substrate-contracts-node ./artifacts/substrate-contracts-node-linux/substrate-contracts-node -### stage: test-contract-caller-linux - -test-contract-caller-linux: - stage: test-contract-caller-linux - <<: *docker-env - <<: *collect-artifacts - <<: *build-refs - variables: - CONTRACTS_NODE: ./artifacts/substrate-contracts-node-linux/substrate-contracts-node - script: - - cargo test --manifest-path ./pallets/contract-caller/contracts/flipper/Cargo.toml --features e2e-tests - ### stage: build-mac build-mac: From 5cc26e0d8cf159d11b6bbfd91c5f2d7d78ab626c Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Fri, 15 Mar 2024 17:07:01 +0000 Subject: [PATCH 24/30] Add CI test --- .gitlab-ci.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2bfc1ef..c4cb853 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -80,6 +80,18 @@ build-linux: - mkdir -p ./artifacts/substrate-contracts-node-linux/ - cp target/release/substrate-contracts-node ./artifacts/substrate-contracts-node-linux/substrate-contracts-node +### stage: test-contract-caller-linux + +test-contract-caller-linux: + stage: test-contract-caller-linux + <<: *docker-env + <<: *collect-artifacts + <<: *build-refs + variables: + CONTRACTS_NODE: ./artifacts/substrate-contracts-node-linux/substrate-contracts-node + script: + - cargo test --manifest-path ./pallets/contract-caller/contracts/flipper/Cargo.toml --features e2e-tests + ### stage: build-mac build-mac: From eefa41f55ee385990f0b3d642b3157519ac1a161 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Fri, 15 Mar 2024 17:53:50 +0000 Subject: [PATCH 25/30] Add stage --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c4cb853..fce9534 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -16,6 +16,7 @@ default: stages: - fmt - build-linux + - test-contract-caller-linux - build-mac - publish From f522ba3538c605b06ee8746a1f3effea0da4a451 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Fri, 15 Mar 2024 17:55:52 +0000 Subject: [PATCH 26/30] Fmt --- pallets/contract-caller/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pallets/contract-caller/src/lib.rs b/pallets/contract-caller/src/lib.rs index b253d81..b47ae56 100644 --- a/pallets/contract-caller/src/lib.rs +++ b/pallets/contract-caller/src/lib.rs @@ -29,7 +29,7 @@ pub mod pallet { pub enum Event {} #[pallet::error] - pub enum Error { } + pub enum Error {} #[pallet::call] impl Pallet From 53be75992a7a31860f91f1959bb4b3cd62f79a64 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Mon, 18 Mar 2024 09:43:33 +0000 Subject: [PATCH 27/30] Remove empty event definition --- pallets/contract-caller/src/lib.rs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/pallets/contract-caller/src/lib.rs b/pallets/contract-caller/src/lib.rs index b47ae56..29b25a7 100644 --- a/pallets/contract-caller/src/lib.rs +++ b/pallets/contract-caller/src/lib.rs @@ -20,13 +20,7 @@ pub mod pallet { pub struct Pallet(_); #[pallet::config] - pub trait Config: frame_system::Config + pallet_contracts::Config { - /// The overarching runtime event type. - type RuntimeEvent: From> + IsType<::RuntimeEvent>; - } - - #[pallet::event] - pub enum Event {} + pub trait Config: frame_system::Config + pallet_contracts::Config {} #[pallet::error] pub enum Error {} From ef2dbcb9910de833bb1ac7768d1da666b4e16b38 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Mon, 18 Mar 2024 09:53:46 +0000 Subject: [PATCH 28/30] remove event impl --- runtime/src/lib.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 1568af4..bad9e01 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -266,9 +266,7 @@ impl pallet_utility::Config for Runtime { type WeightInfo = pallet_utility::weights::SubstrateWeight; } -impl pallet_contract_caller::Config for Runtime { - type RuntimeEvent = RuntimeEvent; -} +impl pallet_contract_caller::Config for Runtime {} // Create the runtime by composing the FRAME pallets that were previously configured. construct_runtime!( From ef680afec88d892e756eed3aa9a1eb1aad2bfa6a Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Mon, 18 Mar 2024 11:28:17 +0000 Subject: [PATCH 29/30] Use ink `no-panic-handler` branch --- Cargo.lock | 36 +++++++------------ pallets/contract-caller/Cargo.toml | 3 +- .../contracts/flipper/Cargo.toml | 4 +-- .../contracts/flipper/traits/Cargo.toml | 2 +- 4 files changed, 16 insertions(+), 29 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4c82807..ed81018 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4330,8 +4330,7 @@ dependencies = [ [[package]] name = "ink" version = "5.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d4a862aedbfda93175ddf75c9aaa2ae4c4b39ee5cee06c16d50bccce05bf5c7" +source = "git+https://github.com/paritytech/ink/?branch=aj/no-panic-handler#f93dfe6c70c00c95d2156b240678d86a4580632f" dependencies = [ "derive_more", "ink_env", @@ -4348,8 +4347,7 @@ dependencies = [ [[package]] name = "ink_allocator" version = "5.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cee56055bac6d928d425e944c5f3b69baa33c9635822fd1c00cd4afc70fde3e" +source = "git+https://github.com/paritytech/ink/?branch=aj/no-panic-handler#f93dfe6c70c00c95d2156b240678d86a4580632f" dependencies = [ "cfg-if", ] @@ -4357,8 +4355,7 @@ dependencies = [ [[package]] name = "ink_codegen" version = "5.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70a1f8473fa09e0f9b6f3cb3f8d18c07c14ebf9ea1f7cdfee270f009d45ee8e9" +source = "git+https://github.com/paritytech/ink/?branch=aj/no-panic-handler#f93dfe6c70c00c95d2156b240678d86a4580632f" dependencies = [ "blake2 0.10.6", "derive_more", @@ -4379,8 +4376,7 @@ dependencies = [ [[package]] name = "ink_engine" version = "5.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f357e2e867f4e222ffc4015a6e61d1073548de89f70a4e36a8b0385562777fa" +source = "git+https://github.com/paritytech/ink/?branch=aj/no-panic-handler#f93dfe6c70c00c95d2156b240678d86a4580632f" dependencies = [ "blake2 0.10.6", "derive_more", @@ -4395,8 +4391,7 @@ dependencies = [ [[package]] name = "ink_env" version = "5.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42cec50b7e4f8406aab25801b015d3802a52d76cfbe48ce11cfb4200fa88e296" +source = "git+https://github.com/paritytech/ink/?branch=aj/no-panic-handler#f93dfe6c70c00c95d2156b240678d86a4580632f" dependencies = [ "blake2 0.10.6", "cfg-if", @@ -4425,8 +4420,7 @@ dependencies = [ [[package]] name = "ink_ir" version = "5.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b1ad2975551c4ed800af971289ed6d2c68ac41ffc03a42010b3e01d7360dfb2" +source = "git+https://github.com/paritytech/ink/?branch=aj/no-panic-handler#f93dfe6c70c00c95d2156b240678d86a4580632f" dependencies = [ "blake2 0.10.6", "either", @@ -4441,8 +4435,7 @@ dependencies = [ [[package]] name = "ink_macro" version = "5.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aee1a546f37eae3b3cd223832d31702033c5369dcfa3405899587c110a7908d3" +source = "git+https://github.com/paritytech/ink/?branch=aj/no-panic-handler#f93dfe6c70c00c95d2156b240678d86a4580632f" dependencies = [ "ink_codegen", "ink_ir", @@ -4457,8 +4450,7 @@ dependencies = [ [[package]] name = "ink_metadata" version = "5.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a98fcc0ff9292ff68c7ee7b84c93533c9ff13859ec3b148faa822e2da9954fe6" +source = "git+https://github.com/paritytech/ink/?branch=aj/no-panic-handler#f93dfe6c70c00c95d2156b240678d86a4580632f" dependencies = [ "derive_more", "impl-serde", @@ -4474,8 +4466,7 @@ dependencies = [ [[package]] name = "ink_prelude" version = "5.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea1734d058c80aa72e59c8ae75624fd8a51791efba21469f273156c0f4cad5c9" +source = "git+https://github.com/paritytech/ink/?branch=aj/no-panic-handler#f93dfe6c70c00c95d2156b240678d86a4580632f" dependencies = [ "cfg-if", ] @@ -4483,8 +4474,7 @@ dependencies = [ [[package]] name = "ink_primitives" version = "5.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11ec35ef7f45e67a53b6142d7e7f18e6d9292d76c3a2a1da14cf8423e481813d" +source = "git+https://github.com/paritytech/ink/?branch=aj/no-panic-handler#f93dfe6c70c00c95d2156b240678d86a4580632f" dependencies = [ "derive_more", "ink_prelude", @@ -4498,8 +4488,7 @@ dependencies = [ [[package]] name = "ink_storage" version = "5.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbdb04cad74df858c05bc9cb6f30bbf12da33c3e2cb7ca211749c001fa761aa9" +source = "git+https://github.com/paritytech/ink/?branch=aj/no-panic-handler#f93dfe6c70c00c95d2156b240678d86a4580632f" dependencies = [ "array-init", "cfg-if", @@ -4517,8 +4506,7 @@ dependencies = [ [[package]] name = "ink_storage_traits" version = "5.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83ce49e3d2935fc1ec3e73117119712b187d3123339f6a31624e92f75fa2293d" +source = "git+https://github.com/paritytech/ink/?branch=aj/no-panic-handler#f93dfe6c70c00c95d2156b240678d86a4580632f" dependencies = [ "ink_metadata", "ink_prelude", diff --git a/pallets/contract-caller/Cargo.toml b/pallets/contract-caller/Cargo.toml index 80a1fc6..5103552 100644 --- a/pallets/contract-caller/Cargo.toml +++ b/pallets/contract-caller/Cargo.toml @@ -23,7 +23,7 @@ sp-std = { workspace = true, default-features = false } pallet-contracts = { workspace = true, default-features = false } flipper-traits = { path = "contracts/flipper/traits", default-features = false } -ink = { version = "5.0.0", default-features = false } +ink = { git = "https://github.com/paritytech/ink/", branch = "aj/no-panic-handler", default-features = false, features = ["no-panic-handler", "no-allocator"] } [dev-dependencies] sp-core = { workspace = true } @@ -42,7 +42,6 @@ std = [ "sp-runtime/std", "sp-std/std", "pallet-contracts/std", - "flipper-traits/std", "ink/std" ] try-runtime = [ diff --git a/pallets/contract-caller/contracts/flipper/Cargo.toml b/pallets/contract-caller/contracts/flipper/Cargo.toml index e66371d..f4b71c2 100755 --- a/pallets/contract-caller/contracts/flipper/Cargo.toml +++ b/pallets/contract-caller/contracts/flipper/Cargo.toml @@ -10,11 +10,11 @@ authors = ["[your_name] <[your_email]>"] edition = "2021" [dependencies] -ink = { version = "5.0.0", default-features = false } +ink = { git = "https://github.com/paritytech/ink/", branch = "aj/no-panic-handler", default-features = false, features = ["no-panic-handler", "no-allocator"] } flipper-traits = { path = "traits", default-features = false } [dev-dependencies] -ink_e2e = "5.0.0" +ink_e2e = { git = "https://github.com/paritytech/ink/", package = "ink_e2e", branch = "aj/no-panic-handler" } frame-support = { version = "30.0.0", default-features = false } scale-value = "0.13.0" diff --git a/pallets/contract-caller/contracts/flipper/traits/Cargo.toml b/pallets/contract-caller/contracts/flipper/traits/Cargo.toml index 243663b..3f2edb3 100644 --- a/pallets/contract-caller/contracts/flipper/traits/Cargo.toml +++ b/pallets/contract-caller/contracts/flipper/traits/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" publish = false [dependencies] -ink = { version = "5.0.0", default-features = false } +ink = { git = "https://github.com/paritytech/ink/", branch = "aj/no-panic-handler", default-features = false, features = ["no-panic-handler", "no-allocator"] } [lib] path = "lib.rs" From 5c217b9d0b4215a03f4fa26c0af7d1cc4cedc2a9 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Mon, 18 Mar 2024 14:38:59 +0000 Subject: [PATCH 30/30] ink master --- Cargo.lock | 24 +++++++++---------- pallets/contract-caller/Cargo.toml | 2 +- .../contracts/flipper/Cargo.toml | 4 ++-- .../contracts/flipper/traits/Cargo.toml | 2 +- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ed81018..8361325 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4330,7 +4330,7 @@ dependencies = [ [[package]] name = "ink" version = "5.0.0" -source = "git+https://github.com/paritytech/ink/?branch=aj/no-panic-handler#f93dfe6c70c00c95d2156b240678d86a4580632f" +source = "git+https://github.com/paritytech/ink/?branch=master#72a671cd4d736b0c6c3f58e5a28a7c178b94e49a" dependencies = [ "derive_more", "ink_env", @@ -4347,7 +4347,7 @@ dependencies = [ [[package]] name = "ink_allocator" version = "5.0.0" -source = "git+https://github.com/paritytech/ink/?branch=aj/no-panic-handler#f93dfe6c70c00c95d2156b240678d86a4580632f" +source = "git+https://github.com/paritytech/ink/?branch=master#72a671cd4d736b0c6c3f58e5a28a7c178b94e49a" dependencies = [ "cfg-if", ] @@ -4355,7 +4355,7 @@ dependencies = [ [[package]] name = "ink_codegen" version = "5.0.0" -source = "git+https://github.com/paritytech/ink/?branch=aj/no-panic-handler#f93dfe6c70c00c95d2156b240678d86a4580632f" +source = "git+https://github.com/paritytech/ink/?branch=master#72a671cd4d736b0c6c3f58e5a28a7c178b94e49a" dependencies = [ "blake2 0.10.6", "derive_more", @@ -4376,7 +4376,7 @@ dependencies = [ [[package]] name = "ink_engine" version = "5.0.0" -source = "git+https://github.com/paritytech/ink/?branch=aj/no-panic-handler#f93dfe6c70c00c95d2156b240678d86a4580632f" +source = "git+https://github.com/paritytech/ink/?branch=master#72a671cd4d736b0c6c3f58e5a28a7c178b94e49a" dependencies = [ "blake2 0.10.6", "derive_more", @@ -4391,7 +4391,7 @@ dependencies = [ [[package]] name = "ink_env" version = "5.0.0" -source = "git+https://github.com/paritytech/ink/?branch=aj/no-panic-handler#f93dfe6c70c00c95d2156b240678d86a4580632f" +source = "git+https://github.com/paritytech/ink/?branch=master#72a671cd4d736b0c6c3f58e5a28a7c178b94e49a" dependencies = [ "blake2 0.10.6", "cfg-if", @@ -4420,7 +4420,7 @@ dependencies = [ [[package]] name = "ink_ir" version = "5.0.0" -source = "git+https://github.com/paritytech/ink/?branch=aj/no-panic-handler#f93dfe6c70c00c95d2156b240678d86a4580632f" +source = "git+https://github.com/paritytech/ink/?branch=master#72a671cd4d736b0c6c3f58e5a28a7c178b94e49a" dependencies = [ "blake2 0.10.6", "either", @@ -4435,7 +4435,7 @@ dependencies = [ [[package]] name = "ink_macro" version = "5.0.0" -source = "git+https://github.com/paritytech/ink/?branch=aj/no-panic-handler#f93dfe6c70c00c95d2156b240678d86a4580632f" +source = "git+https://github.com/paritytech/ink/?branch=master#72a671cd4d736b0c6c3f58e5a28a7c178b94e49a" dependencies = [ "ink_codegen", "ink_ir", @@ -4450,7 +4450,7 @@ dependencies = [ [[package]] name = "ink_metadata" version = "5.0.0" -source = "git+https://github.com/paritytech/ink/?branch=aj/no-panic-handler#f93dfe6c70c00c95d2156b240678d86a4580632f" +source = "git+https://github.com/paritytech/ink/?branch=master#72a671cd4d736b0c6c3f58e5a28a7c178b94e49a" dependencies = [ "derive_more", "impl-serde", @@ -4466,7 +4466,7 @@ dependencies = [ [[package]] name = "ink_prelude" version = "5.0.0" -source = "git+https://github.com/paritytech/ink/?branch=aj/no-panic-handler#f93dfe6c70c00c95d2156b240678d86a4580632f" +source = "git+https://github.com/paritytech/ink/?branch=master#72a671cd4d736b0c6c3f58e5a28a7c178b94e49a" dependencies = [ "cfg-if", ] @@ -4474,7 +4474,7 @@ dependencies = [ [[package]] name = "ink_primitives" version = "5.0.0" -source = "git+https://github.com/paritytech/ink/?branch=aj/no-panic-handler#f93dfe6c70c00c95d2156b240678d86a4580632f" +source = "git+https://github.com/paritytech/ink/?branch=master#72a671cd4d736b0c6c3f58e5a28a7c178b94e49a" dependencies = [ "derive_more", "ink_prelude", @@ -4488,7 +4488,7 @@ dependencies = [ [[package]] name = "ink_storage" version = "5.0.0" -source = "git+https://github.com/paritytech/ink/?branch=aj/no-panic-handler#f93dfe6c70c00c95d2156b240678d86a4580632f" +source = "git+https://github.com/paritytech/ink/?branch=master#72a671cd4d736b0c6c3f58e5a28a7c178b94e49a" dependencies = [ "array-init", "cfg-if", @@ -4506,7 +4506,7 @@ dependencies = [ [[package]] name = "ink_storage_traits" version = "5.0.0" -source = "git+https://github.com/paritytech/ink/?branch=aj/no-panic-handler#f93dfe6c70c00c95d2156b240678d86a4580632f" +source = "git+https://github.com/paritytech/ink/?branch=master#72a671cd4d736b0c6c3f58e5a28a7c178b94e49a" dependencies = [ "ink_metadata", "ink_prelude", diff --git a/pallets/contract-caller/Cargo.toml b/pallets/contract-caller/Cargo.toml index 5103552..a7fedef 100644 --- a/pallets/contract-caller/Cargo.toml +++ b/pallets/contract-caller/Cargo.toml @@ -23,7 +23,7 @@ sp-std = { workspace = true, default-features = false } pallet-contracts = { workspace = true, default-features = false } flipper-traits = { path = "contracts/flipper/traits", default-features = false } -ink = { git = "https://github.com/paritytech/ink/", branch = "aj/no-panic-handler", default-features = false, features = ["no-panic-handler", "no-allocator"] } +ink = { git = "https://github.com/paritytech/ink/", branch = "master", default-features = false, features = ["no-panic-handler", "no-allocator"] } [dev-dependencies] sp-core = { workspace = true } diff --git a/pallets/contract-caller/contracts/flipper/Cargo.toml b/pallets/contract-caller/contracts/flipper/Cargo.toml index f4b71c2..cd347e0 100755 --- a/pallets/contract-caller/contracts/flipper/Cargo.toml +++ b/pallets/contract-caller/contracts/flipper/Cargo.toml @@ -10,11 +10,11 @@ authors = ["[your_name] <[your_email]>"] edition = "2021" [dependencies] -ink = { git = "https://github.com/paritytech/ink/", branch = "aj/no-panic-handler", default-features = false, features = ["no-panic-handler", "no-allocator"] } +ink = { git = "https://github.com/paritytech/ink/", branch = "master", default-features = false, features = ["no-panic-handler", "no-allocator"] } flipper-traits = { path = "traits", default-features = false } [dev-dependencies] -ink_e2e = { git = "https://github.com/paritytech/ink/", package = "ink_e2e", branch = "aj/no-panic-handler" } +ink_e2e = { git = "https://github.com/paritytech/ink/", package = "ink_e2e", branch = "master" } frame-support = { version = "30.0.0", default-features = false } scale-value = "0.13.0" diff --git a/pallets/contract-caller/contracts/flipper/traits/Cargo.toml b/pallets/contract-caller/contracts/flipper/traits/Cargo.toml index 3f2edb3..55c20f5 100644 --- a/pallets/contract-caller/contracts/flipper/traits/Cargo.toml +++ b/pallets/contract-caller/contracts/flipper/traits/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" publish = false [dependencies] -ink = { git = "https://github.com/paritytech/ink/", branch = "aj/no-panic-handler", default-features = false, features = ["no-panic-handler", "no-allocator"] } +ink = { git = "https://github.com/paritytech/ink/", branch = "master", default-features = false, features = ["no-panic-handler", "no-allocator"] } [lib] path = "lib.rs"