From b40a8c7a72a694df28e7d8ddb02712baee27d953 Mon Sep 17 00:00:00 2001 From: Alessandro Siniscalchi Date: Wed, 19 Jul 2023 16:05:46 +0200 Subject: [PATCH 1/5] copied the pallet --- pallets/precompile/sha3fips/Cargo.toml | 20 ++++ pallets/precompile/sha3fips/src/lib.rs | 148 +++++++++++++++++++++++++ runtime/Cargo.toml | 2 +- 3 files changed, 169 insertions(+), 1 deletion(-) create mode 100644 pallets/precompile/sha3fips/Cargo.toml create mode 100644 pallets/precompile/sha3fips/src/lib.rs diff --git a/pallets/precompile/sha3fips/Cargo.toml b/pallets/precompile/sha3fips/Cargo.toml new file mode 100644 index 00000000..241e1fc7 --- /dev/null +++ b/pallets/precompile/sha3fips/Cargo.toml @@ -0,0 +1,20 @@ +[package] +name = "pallet-evm-precompile-sha3fips" +version = "2.0.0-dev" +authors = ["Parity Technologies ", "Drew Stone "] +license = "Apache-2.0" +description = "SHA3 FIPS202 precompile for EVM pallet." +edition = { workspace = true } +repository = { workspace = true } + +[dependencies] +tiny-keccak = { version = "2.0", features = ["fips202"] } +# Frontier +fp-evm = { workspace = true } + +[features] +default = ["std"] +std = [ + # Frontier + "fp-evm/std", +] diff --git a/pallets/precompile/sha3fips/src/lib.rs b/pallets/precompile/sha3fips/src/lib.rs new file mode 100644 index 00000000..6f951d35 --- /dev/null +++ b/pallets/precompile/sha3fips/src/lib.rs @@ -0,0 +1,148 @@ +// SPDX-License-Identifier: Apache-2.0 +// This file is part of Frontier. +// +// Copyright (c) 2020-2022 Parity Technologies (UK) Ltd. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#![cfg_attr(not(feature = "std"), no_std)] +#![deny(unused_crate_dependencies)] + +extern crate alloc; + +use alloc::vec::Vec; + +use fp_evm::{ExitSucceed, LinearCostPrecompile, PrecompileFailure}; + +pub struct Sha3FIPS256; + +impl LinearCostPrecompile for Sha3FIPS256 { + const BASE: u64 = 60; + const WORD: u64 = 12; + + fn execute(input: &[u8], _: u64) -> Result<(ExitSucceed, Vec), PrecompileFailure> { + use tiny_keccak::Hasher; + let mut output = [0; 32]; + let mut sha3 = tiny_keccak::Sha3::v256(); + sha3.update(input); + sha3.finalize(&mut output); + Ok((ExitSucceed::Returned, output.to_vec())) + } +} + +pub struct Sha3FIPS512; + +impl LinearCostPrecompile for Sha3FIPS512 { + const BASE: u64 = 60; + const WORD: u64 = 12; + + fn execute(input: &[u8], _: u64) -> Result<(ExitSucceed, Vec), PrecompileFailure> { + use tiny_keccak::Hasher; + let mut output = [0; 64]; + let mut sha3 = tiny_keccak::Sha3::v512(); + sha3.update(input); + sha3.finalize(&mut output); + Ok((ExitSucceed::Returned, output.to_vec())) + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_empty_input() -> Result<(), PrecompileFailure> { + let input: [u8; 0] = []; + let expected = b"\ + \xa7\xff\xc6\xf8\xbf\x1e\xd7\x66\x51\xc1\x47\x56\xa0\x61\xd6\x62\ + \xf5\x80\xff\x4d\xe4\x3b\x49\xfa\x82\xd8\x0a\x4b\x80\xf8\x43\x4a\ + "; + + let cost: u64 = 1; + + match Sha3FIPS256::execute(&input, cost) { + Ok((_, out)) => { + assert_eq!(out, expected); + Ok(()) + } + Err(e) => { + panic!("Test not expected to fail: {:?}", e); + } + } + } + + #[test] + fn hello_sha3_256() -> Result<(), PrecompileFailure> { + let input = b"hello"; + let expected = b"\ + \x33\x38\xbe\x69\x4f\x50\xc5\xf3\x38\x81\x49\x86\xcd\xf0\x68\x64\ + \x53\xa8\x88\xb8\x4f\x42\x4d\x79\x2a\xf4\xb9\x20\x23\x98\xf3\x92\ + "; + + let cost: u64 = 1; + + match Sha3FIPS256::execute(input, cost) { + Ok((_, out)) => { + assert_eq!(out, expected); + Ok(()) + } + Err(e) => { + panic!("Test not expected to fail: {:?}", e); + } + } + } + + #[test] + fn long_string_sha3_256() -> Result<(), PrecompileFailure> { + let input = b"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."; + let expected = b"\ + \xbd\xe3\xf2\x69\x17\x5e\x1d\xcd\xa1\x38\x48\x27\x8a\xa6\x04\x6b\ + \xd6\x43\xce\xa8\x5b\x84\xc8\xb8\xbb\x80\x95\x2e\x70\xb6\xea\xe0\ + "; + + let cost: u64 = 1; + + match Sha3FIPS256::execute(input, cost) { + Ok((_, out)) => { + assert_eq!(out, expected); + Ok(()) + } + Err(e) => { + panic!("Test not expected to fail: {:?}", e); + } + } + } + + #[test] + fn long_string_sha3_512() -> Result<(), PrecompileFailure> { + let input = b"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."; + let expected = b"\ + \xf3\x2a\x94\x23\x55\x13\x51\xdf\x0a\x07\xc0\xb8\xc2\x0e\xb9\x72\ + \x36\x7c\x39\x8d\x61\x06\x60\x38\xe1\x69\x86\x44\x8e\xbf\xbc\x3d\ + \x15\xed\xe0\xed\x36\x93\xe3\x90\x5e\x9a\x8c\x60\x1d\x9d\x00\x2a\ + \x06\x85\x3b\x97\x97\xef\x9a\xb1\x0c\xbd\xe1\x00\x9c\x7d\x0f\x09\ + "; + + let cost: u64 = 1; + + match Sha3FIPS512::execute(input, cost) { + Ok((_, out)) => { + assert_eq!(out, expected); + Ok(()) + } + Err(e) => { + panic!("Test not expected to fail: {:?}", e); + } + } + } +} diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index 7c6a2f06..86bab2db 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -50,6 +50,7 @@ sp-transaction-pool = { git = "https://github.com/paritytech/substrate", default sp-version = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" } pallet-living-assets-ownership = { version = "0.0.1", default-features = false, path = "../pallets/livingassets-ownership" } +pallet-evm-precompile-sha3fips = { default-features = false, path = "../pallets/evm-precompile-sha3fips" } # Polkadot pallet-xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.43" } @@ -84,7 +85,6 @@ pallet-evm = { git = "https://github.com/paritytech/frontier.git", branch = "pol pallet-ethereum = { git = "https://github.com/paritytech/frontier.git", branch = "polkadot-v0.9.43", default-features = false } pallet-evm-chain-id = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.43", default-features = false } pallet-evm-precompile-modexp = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.43", default-features = false } -pallet-evm-precompile-sha3fips = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.43", default-features = false } pallet-evm-precompile-simple = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.43", default-features = false } [features] From 426a1a4ee32d145da57dba3c6911e5a3a8c659be Mon Sep 17 00:00:00 2001 From: Alessandro Siniscalchi Date: Wed, 19 Jul 2023 16:17:55 +0200 Subject: [PATCH 2/5] precompiled compile --- Cargo.lock | 54 +++++++++++++++----------- Cargo.toml | 1 + pallets/precompile/sha3fips/Cargo.toml | 6 +-- runtime/Cargo.toml | 2 +- 4 files changed, 36 insertions(+), 27 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7ff4ddaa..dd9bbb12 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2800,7 +2800,7 @@ dependencies = [ [[package]] name = "fc-cli" version = "1.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" +source = "git+https://github.com/paritytech/frontier.git?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" dependencies = [ "clap", "ethereum-types", @@ -2818,7 +2818,7 @@ dependencies = [ [[package]] name = "fc-consensus" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" +source = "git+https://github.com/paritytech/frontier.git?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" dependencies = [ "async-trait", "fp-consensus", @@ -2834,7 +2834,7 @@ dependencies = [ [[package]] name = "fc-db" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" +source = "git+https://github.com/paritytech/frontier.git?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" dependencies = [ "async-trait", "fp-storage", @@ -2854,7 +2854,7 @@ dependencies = [ [[package]] name = "fc-mapping-sync" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" +source = "git+https://github.com/paritytech/frontier.git?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" dependencies = [ "fc-db", "fc-storage", @@ -2875,7 +2875,7 @@ dependencies = [ [[package]] name = "fc-rpc" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" +source = "git+https://github.com/paritytech/frontier.git?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" dependencies = [ "ethereum", "ethereum-types", @@ -2925,7 +2925,7 @@ dependencies = [ [[package]] name = "fc-rpc-core" version = "1.1.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" +source = "git+https://github.com/paritytech/frontier.git?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" dependencies = [ "ethereum", "ethereum-types", @@ -2938,7 +2938,7 @@ dependencies = [ [[package]] name = "fc-storage" version = "1.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" +source = "git+https://github.com/paritytech/frontier.git?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" dependencies = [ "ethereum", "ethereum-types", @@ -3090,7 +3090,7 @@ dependencies = [ [[package]] name = "fp-account" version = "1.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" +source = "git+https://github.com/paritytech/frontier.git?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" dependencies = [ "hex", "impl-serde", @@ -3109,7 +3109,7 @@ dependencies = [ [[package]] name = "fp-consensus" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" +source = "git+https://github.com/paritytech/frontier.git?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" dependencies = [ "ethereum", "parity-scale-codec", @@ -3121,7 +3121,7 @@ dependencies = [ [[package]] name = "fp-dynamic-fee" version = "1.0.0" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" +source = "git+https://github.com/paritytech/frontier.git?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" dependencies = [ "async-trait", "sp-core", @@ -3131,7 +3131,7 @@ dependencies = [ [[package]] name = "fp-ethereum" version = "1.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" +source = "git+https://github.com/paritytech/frontier.git?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" dependencies = [ "ethereum", "ethereum-types", @@ -3145,7 +3145,7 @@ dependencies = [ [[package]] name = "fp-evm" version = "3.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" +source = "git+https://github.com/paritytech/frontier.git?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" dependencies = [ "evm", "frame-support", @@ -3160,7 +3160,7 @@ dependencies = [ [[package]] name = "fp-rpc" version = "3.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" +source = "git+https://github.com/paritytech/frontier.git?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" dependencies = [ "ethereum", "ethereum-types", @@ -3177,7 +3177,7 @@ dependencies = [ [[package]] name = "fp-self-contained" version = "1.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" +source = "git+https://github.com/paritytech/frontier.git?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" dependencies = [ "frame-support", "parity-scale-codec", @@ -3189,7 +3189,7 @@ dependencies = [ [[package]] name = "fp-storage" version = "2.0.0" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" +source = "git+https://github.com/paritytech/frontier.git?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" dependencies = [ "parity-scale-codec", "serde", @@ -6146,7 +6146,7 @@ dependencies = [ [[package]] name = "pallet-base-fee" version = "1.0.0" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" +source = "git+https://github.com/paritytech/frontier.git?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" dependencies = [ "fp-evm", "frame-support", @@ -6365,7 +6365,7 @@ dependencies = [ [[package]] name = "pallet-ethereum" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" +source = "git+https://github.com/paritytech/frontier.git?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" dependencies = [ "ethereum", "ethereum-types", @@ -6388,7 +6388,7 @@ dependencies = [ [[package]] name = "pallet-evm" version = "6.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" +source = "git+https://github.com/paritytech/frontier.git?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" dependencies = [ "environmental", "evm", @@ -6413,7 +6413,7 @@ dependencies = [ [[package]] name = "pallet-evm-chain-id" version = "1.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" +source = "git+https://github.com/paritytech/frontier.git?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" dependencies = [ "frame-support", "frame-system", @@ -6424,7 +6424,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-modexp" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" +source = "git+https://github.com/paritytech/frontier.git?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" dependencies = [ "fp-evm", "num", @@ -6433,7 +6433,15 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-sha3fips" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" +dependencies = [ + "fp-evm", + "tiny-keccak", +] + +[[package]] +name = "pallet-evm-precompile-sha3fips" +version = "2.0.0-dev" +source = "git+https://github.com/paritytech/frontier.git?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" dependencies = [ "fp-evm", "tiny-keccak", @@ -6442,7 +6450,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-simple" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" +source = "git+https://github.com/paritytech/frontier.git?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" dependencies = [ "fp-evm", "ripemd", @@ -7264,7 +7272,7 @@ dependencies = [ "pallet-evm", "pallet-evm-chain-id", "pallet-evm-precompile-modexp", - "pallet-evm-precompile-sha3fips", + "pallet-evm-precompile-sha3fips 2.0.0-dev (git+https://github.com/paritytech/frontier.git?branch=polkadot-v0.9.43)", "pallet-evm-precompile-simple", "pallet-living-assets-ownership", "pallet-session", diff --git a/Cargo.toml b/Cargo.toml index 0f833e57..406861dd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,4 +5,5 @@ panic = "unwind" members = [ "node", "runtime", + "pallets/precompile/sha3fips" ] diff --git a/pallets/precompile/sha3fips/Cargo.toml b/pallets/precompile/sha3fips/Cargo.toml index 241e1fc7..8b0e9457 100644 --- a/pallets/precompile/sha3fips/Cargo.toml +++ b/pallets/precompile/sha3fips/Cargo.toml @@ -4,13 +4,13 @@ version = "2.0.0-dev" authors = ["Parity Technologies ", "Drew Stone "] license = "Apache-2.0" description = "SHA3 FIPS202 precompile for EVM pallet." -edition = { workspace = true } -repository = { workspace = true } +repository = "https://github.com/freeverseio/pallet-livingassets-ownership" +edition = "2021" [dependencies] tiny-keccak = { version = "2.0", features = ["fips202"] } # Frontier -fp-evm = { workspace = true } +fp-evm = { git = "https://github.com/paritytech/frontier.git", branch = "polkadot-v0.9.43", default-features = false } [features] default = ["std"] diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index 86bab2db..7c6a2f06 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -50,7 +50,6 @@ sp-transaction-pool = { git = "https://github.com/paritytech/substrate", default sp-version = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" } pallet-living-assets-ownership = { version = "0.0.1", default-features = false, path = "../pallets/livingassets-ownership" } -pallet-evm-precompile-sha3fips = { default-features = false, path = "../pallets/evm-precompile-sha3fips" } # Polkadot pallet-xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.43" } @@ -85,6 +84,7 @@ pallet-evm = { git = "https://github.com/paritytech/frontier.git", branch = "pol pallet-ethereum = { git = "https://github.com/paritytech/frontier.git", branch = "polkadot-v0.9.43", default-features = false } pallet-evm-chain-id = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.43", default-features = false } pallet-evm-precompile-modexp = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.43", default-features = false } +pallet-evm-precompile-sha3fips = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.43", default-features = false } pallet-evm-precompile-simple = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.43", default-features = false } [features] From 35fda97d075766bd3032df51d0e7f7def8eb4560 Mon Sep 17 00:00:00 2001 From: Alessandro Siniscalchi Date: Wed, 19 Jul 2023 16:22:33 +0200 Subject: [PATCH 3/5] compiling --- Cargo.lock | 53 +++++++++++++++++++--------------------------- runtime/Cargo.toml | 2 +- 2 files changed, 23 insertions(+), 32 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index dd9bbb12..369da7a9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2800,7 +2800,7 @@ dependencies = [ [[package]] name = "fc-cli" version = "1.0.0-dev" -source = "git+https://github.com/paritytech/frontier.git?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" dependencies = [ "clap", "ethereum-types", @@ -2818,7 +2818,7 @@ dependencies = [ [[package]] name = "fc-consensus" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/frontier.git?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" dependencies = [ "async-trait", "fp-consensus", @@ -2834,7 +2834,7 @@ dependencies = [ [[package]] name = "fc-db" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/frontier.git?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" dependencies = [ "async-trait", "fp-storage", @@ -2854,7 +2854,7 @@ dependencies = [ [[package]] name = "fc-mapping-sync" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/frontier.git?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" dependencies = [ "fc-db", "fc-storage", @@ -2875,7 +2875,7 @@ dependencies = [ [[package]] name = "fc-rpc" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/frontier.git?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" dependencies = [ "ethereum", "ethereum-types", @@ -2925,7 +2925,7 @@ dependencies = [ [[package]] name = "fc-rpc-core" version = "1.1.0-dev" -source = "git+https://github.com/paritytech/frontier.git?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" dependencies = [ "ethereum", "ethereum-types", @@ -2938,7 +2938,7 @@ dependencies = [ [[package]] name = "fc-storage" version = "1.0.0-dev" -source = "git+https://github.com/paritytech/frontier.git?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" dependencies = [ "ethereum", "ethereum-types", @@ -3090,7 +3090,7 @@ dependencies = [ [[package]] name = "fp-account" version = "1.0.0-dev" -source = "git+https://github.com/paritytech/frontier.git?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" dependencies = [ "hex", "impl-serde", @@ -3109,7 +3109,7 @@ dependencies = [ [[package]] name = "fp-consensus" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/frontier.git?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" dependencies = [ "ethereum", "parity-scale-codec", @@ -3121,7 +3121,7 @@ dependencies = [ [[package]] name = "fp-dynamic-fee" version = "1.0.0" -source = "git+https://github.com/paritytech/frontier.git?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" dependencies = [ "async-trait", "sp-core", @@ -3131,7 +3131,7 @@ dependencies = [ [[package]] name = "fp-ethereum" version = "1.0.0-dev" -source = "git+https://github.com/paritytech/frontier.git?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" dependencies = [ "ethereum", "ethereum-types", @@ -3145,7 +3145,7 @@ dependencies = [ [[package]] name = "fp-evm" version = "3.0.0-dev" -source = "git+https://github.com/paritytech/frontier.git?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" dependencies = [ "evm", "frame-support", @@ -3160,7 +3160,7 @@ dependencies = [ [[package]] name = "fp-rpc" version = "3.0.0-dev" -source = "git+https://github.com/paritytech/frontier.git?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" dependencies = [ "ethereum", "ethereum-types", @@ -3177,7 +3177,7 @@ dependencies = [ [[package]] name = "fp-self-contained" version = "1.0.0-dev" -source = "git+https://github.com/paritytech/frontier.git?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" dependencies = [ "frame-support", "parity-scale-codec", @@ -3189,7 +3189,7 @@ dependencies = [ [[package]] name = "fp-storage" version = "2.0.0" -source = "git+https://github.com/paritytech/frontier.git?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" dependencies = [ "parity-scale-codec", "serde", @@ -6146,7 +6146,7 @@ dependencies = [ [[package]] name = "pallet-base-fee" version = "1.0.0" -source = "git+https://github.com/paritytech/frontier.git?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" dependencies = [ "fp-evm", "frame-support", @@ -6365,7 +6365,7 @@ dependencies = [ [[package]] name = "pallet-ethereum" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/frontier.git?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" dependencies = [ "ethereum", "ethereum-types", @@ -6388,7 +6388,7 @@ dependencies = [ [[package]] name = "pallet-evm" version = "6.0.0-dev" -source = "git+https://github.com/paritytech/frontier.git?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" dependencies = [ "environmental", "evm", @@ -6413,7 +6413,7 @@ dependencies = [ [[package]] name = "pallet-evm-chain-id" version = "1.0.0-dev" -source = "git+https://github.com/paritytech/frontier.git?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" dependencies = [ "frame-support", "frame-system", @@ -6424,7 +6424,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-modexp" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/frontier.git?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" dependencies = [ "fp-evm", "num", @@ -6438,19 +6438,10 @@ dependencies = [ "tiny-keccak", ] -[[package]] -name = "pallet-evm-precompile-sha3fips" -version = "2.0.0-dev" -source = "git+https://github.com/paritytech/frontier.git?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" -dependencies = [ - "fp-evm", - "tiny-keccak", -] - [[package]] name = "pallet-evm-precompile-simple" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/frontier.git?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" dependencies = [ "fp-evm", "ripemd", @@ -7272,7 +7263,7 @@ dependencies = [ "pallet-evm", "pallet-evm-chain-id", "pallet-evm-precompile-modexp", - "pallet-evm-precompile-sha3fips 2.0.0-dev (git+https://github.com/paritytech/frontier.git?branch=polkadot-v0.9.43)", + "pallet-evm-precompile-sha3fips", "pallet-evm-precompile-simple", "pallet-living-assets-ownership", "pallet-session", diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index 7c6a2f06..e0b93822 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -50,6 +50,7 @@ sp-transaction-pool = { git = "https://github.com/paritytech/substrate", default sp-version = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" } pallet-living-assets-ownership = { version = "0.0.1", default-features = false, path = "../pallets/livingassets-ownership" } +pallet-evm-precompile-sha3fips = { default-features = false, path = "../pallets/precompile/sha3fips" } # Polkadot pallet-xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.43" } @@ -84,7 +85,6 @@ pallet-evm = { git = "https://github.com/paritytech/frontier.git", branch = "pol pallet-ethereum = { git = "https://github.com/paritytech/frontier.git", branch = "polkadot-v0.9.43", default-features = false } pallet-evm-chain-id = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.43", default-features = false } pallet-evm-precompile-modexp = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.43", default-features = false } -pallet-evm-precompile-sha3fips = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.43", default-features = false } pallet-evm-precompile-simple = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.43", default-features = false } [features] From cd30c0d2f122fc20fe8e08b4391aa6b075b24ff5 Mon Sep 17 00:00:00 2001 From: Dastan Samatov Date: Thu, 20 Jul 2023 12:49:59 +0600 Subject: [PATCH 4/5] Compiling stuff --- Cargo.lock | 47 +++++- Cargo.toml | 3 +- .../Cargo.lock | 0 .../Cargo.toml | 0 .../src/functions.rs | 0 .../src/lib.rs | 0 .../src/mock.rs | 0 .../src/tests.rs | 0 pallets/precompile/sha3fips/Cargo.toml | 20 --- pallets/precompile/sha3fips/src/lib.rs | 148 ------------------ precompile/living-assets/Cargo.toml | 48 ++++++ precompile/living-assets/src/lib.rs | 91 +++++++++++ runtime/Cargo.toml | 9 +- runtime/src/lib.rs | 5 +- runtime/src/precompiles.rs | 27 +++- 15 files changed, 208 insertions(+), 190 deletions(-) rename pallets/{livingassets-ownership => living-assets-ownership}/Cargo.lock (100%) rename pallets/{livingassets-ownership => living-assets-ownership}/Cargo.toml (100%) rename pallets/{livingassets-ownership => living-assets-ownership}/src/functions.rs (100%) rename pallets/{livingassets-ownership => living-assets-ownership}/src/lib.rs (100%) rename pallets/{livingassets-ownership => living-assets-ownership}/src/mock.rs (100%) rename pallets/{livingassets-ownership => living-assets-ownership}/src/tests.rs (100%) delete mode 100644 pallets/precompile/sha3fips/Cargo.toml delete mode 100644 pallets/precompile/sha3fips/src/lib.rs create mode 100644 precompile/living-assets/Cargo.toml create mode 100644 precompile/living-assets/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index 369da7a9..bf08bd8b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3137,7 +3137,7 @@ dependencies = [ "ethereum-types", "fp-evm", "frame-support", - "num_enum", + "num_enum 0.6.1", "parity-scale-codec", "sp-std", ] @@ -5842,13 +5842,34 @@ dependencies = [ "libc", ] +[[package]] +name = "num_enum" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f646caf906c20226733ed5b1374287eb97e3c2a5c227ce668c1f2ce20ae57c9" +dependencies = [ + "num_enum_derive 0.5.11", +] + [[package]] name = "num_enum" version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a015b430d3c108a207fd776d2e2196aaf8b1cf8cf93253e3a097ff3085076a1" dependencies = [ - "num_enum_derive", + "num_enum_derive 0.6.1", +] + +[[package]] +name = "num_enum_derive" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcbff9bc912032c62bf65ef1d5aea88983b420f4f839db1e9b0c281a25c9c799" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 1.0.109", ] [[package]] @@ -6422,20 +6443,30 @@ dependencies = [ ] [[package]] -name = "pallet-evm-precompile-modexp" +name = "pallet-evm-living-assets-ownership" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" dependencies = [ + "evm", "fp-evm", - "num", + "frame-support", + "num_enum 0.5.11", + "pallet-evm", + "pallet-living-assets-ownership", + "parity-scale-codec", + "scale-info", + "sp-arithmetic", + "sp-core", + "sp-runtime", + "sp-std", ] [[package]] -name = "pallet-evm-precompile-sha3fips" +name = "pallet-evm-precompile-modexp" version = "2.0.0-dev" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" dependencies = [ "fp-evm", - "tiny-keccak", + "num", ] [[package]] @@ -7262,8 +7293,8 @@ dependencies = [ "pallet-ethereum", "pallet-evm", "pallet-evm-chain-id", + "pallet-evm-living-assets-ownership", "pallet-evm-precompile-modexp", - "pallet-evm-precompile-sha3fips", "pallet-evm-precompile-simple", "pallet-living-assets-ownership", "pallet-session", diff --git a/Cargo.toml b/Cargo.toml index 406861dd..4869eb07 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,5 +5,6 @@ panic = "unwind" members = [ "node", "runtime", - "pallets/precompile/sha3fips" + "precompile/*", + "pallets/*" ] diff --git a/pallets/livingassets-ownership/Cargo.lock b/pallets/living-assets-ownership/Cargo.lock similarity index 100% rename from pallets/livingassets-ownership/Cargo.lock rename to pallets/living-assets-ownership/Cargo.lock diff --git a/pallets/livingassets-ownership/Cargo.toml b/pallets/living-assets-ownership/Cargo.toml similarity index 100% rename from pallets/livingassets-ownership/Cargo.toml rename to pallets/living-assets-ownership/Cargo.toml diff --git a/pallets/livingassets-ownership/src/functions.rs b/pallets/living-assets-ownership/src/functions.rs similarity index 100% rename from pallets/livingassets-ownership/src/functions.rs rename to pallets/living-assets-ownership/src/functions.rs diff --git a/pallets/livingassets-ownership/src/lib.rs b/pallets/living-assets-ownership/src/lib.rs similarity index 100% rename from pallets/livingassets-ownership/src/lib.rs rename to pallets/living-assets-ownership/src/lib.rs diff --git a/pallets/livingassets-ownership/src/mock.rs b/pallets/living-assets-ownership/src/mock.rs similarity index 100% rename from pallets/livingassets-ownership/src/mock.rs rename to pallets/living-assets-ownership/src/mock.rs diff --git a/pallets/livingassets-ownership/src/tests.rs b/pallets/living-assets-ownership/src/tests.rs similarity index 100% rename from pallets/livingassets-ownership/src/tests.rs rename to pallets/living-assets-ownership/src/tests.rs diff --git a/pallets/precompile/sha3fips/Cargo.toml b/pallets/precompile/sha3fips/Cargo.toml deleted file mode 100644 index 8b0e9457..00000000 --- a/pallets/precompile/sha3fips/Cargo.toml +++ /dev/null @@ -1,20 +0,0 @@ -[package] -name = "pallet-evm-precompile-sha3fips" -version = "2.0.0-dev" -authors = ["Parity Technologies ", "Drew Stone "] -license = "Apache-2.0" -description = "SHA3 FIPS202 precompile for EVM pallet." -repository = "https://github.com/freeverseio/pallet-livingassets-ownership" -edition = "2021" - -[dependencies] -tiny-keccak = { version = "2.0", features = ["fips202"] } -# Frontier -fp-evm = { git = "https://github.com/paritytech/frontier.git", branch = "polkadot-v0.9.43", default-features = false } - -[features] -default = ["std"] -std = [ - # Frontier - "fp-evm/std", -] diff --git a/pallets/precompile/sha3fips/src/lib.rs b/pallets/precompile/sha3fips/src/lib.rs deleted file mode 100644 index 6f951d35..00000000 --- a/pallets/precompile/sha3fips/src/lib.rs +++ /dev/null @@ -1,148 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// This file is part of Frontier. -// -// Copyright (c) 2020-2022 Parity Technologies (UK) Ltd. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#![cfg_attr(not(feature = "std"), no_std)] -#![deny(unused_crate_dependencies)] - -extern crate alloc; - -use alloc::vec::Vec; - -use fp_evm::{ExitSucceed, LinearCostPrecompile, PrecompileFailure}; - -pub struct Sha3FIPS256; - -impl LinearCostPrecompile for Sha3FIPS256 { - const BASE: u64 = 60; - const WORD: u64 = 12; - - fn execute(input: &[u8], _: u64) -> Result<(ExitSucceed, Vec), PrecompileFailure> { - use tiny_keccak::Hasher; - let mut output = [0; 32]; - let mut sha3 = tiny_keccak::Sha3::v256(); - sha3.update(input); - sha3.finalize(&mut output); - Ok((ExitSucceed::Returned, output.to_vec())) - } -} - -pub struct Sha3FIPS512; - -impl LinearCostPrecompile for Sha3FIPS512 { - const BASE: u64 = 60; - const WORD: u64 = 12; - - fn execute(input: &[u8], _: u64) -> Result<(ExitSucceed, Vec), PrecompileFailure> { - use tiny_keccak::Hasher; - let mut output = [0; 64]; - let mut sha3 = tiny_keccak::Sha3::v512(); - sha3.update(input); - sha3.finalize(&mut output); - Ok((ExitSucceed::Returned, output.to_vec())) - } -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn test_empty_input() -> Result<(), PrecompileFailure> { - let input: [u8; 0] = []; - let expected = b"\ - \xa7\xff\xc6\xf8\xbf\x1e\xd7\x66\x51\xc1\x47\x56\xa0\x61\xd6\x62\ - \xf5\x80\xff\x4d\xe4\x3b\x49\xfa\x82\xd8\x0a\x4b\x80\xf8\x43\x4a\ - "; - - let cost: u64 = 1; - - match Sha3FIPS256::execute(&input, cost) { - Ok((_, out)) => { - assert_eq!(out, expected); - Ok(()) - } - Err(e) => { - panic!("Test not expected to fail: {:?}", e); - } - } - } - - #[test] - fn hello_sha3_256() -> Result<(), PrecompileFailure> { - let input = b"hello"; - let expected = b"\ - \x33\x38\xbe\x69\x4f\x50\xc5\xf3\x38\x81\x49\x86\xcd\xf0\x68\x64\ - \x53\xa8\x88\xb8\x4f\x42\x4d\x79\x2a\xf4\xb9\x20\x23\x98\xf3\x92\ - "; - - let cost: u64 = 1; - - match Sha3FIPS256::execute(input, cost) { - Ok((_, out)) => { - assert_eq!(out, expected); - Ok(()) - } - Err(e) => { - panic!("Test not expected to fail: {:?}", e); - } - } - } - - #[test] - fn long_string_sha3_256() -> Result<(), PrecompileFailure> { - let input = b"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."; - let expected = b"\ - \xbd\xe3\xf2\x69\x17\x5e\x1d\xcd\xa1\x38\x48\x27\x8a\xa6\x04\x6b\ - \xd6\x43\xce\xa8\x5b\x84\xc8\xb8\xbb\x80\x95\x2e\x70\xb6\xea\xe0\ - "; - - let cost: u64 = 1; - - match Sha3FIPS256::execute(input, cost) { - Ok((_, out)) => { - assert_eq!(out, expected); - Ok(()) - } - Err(e) => { - panic!("Test not expected to fail: {:?}", e); - } - } - } - - #[test] - fn long_string_sha3_512() -> Result<(), PrecompileFailure> { - let input = b"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."; - let expected = b"\ - \xf3\x2a\x94\x23\x55\x13\x51\xdf\x0a\x07\xc0\xb8\xc2\x0e\xb9\x72\ - \x36\x7c\x39\x8d\x61\x06\x60\x38\xe1\x69\x86\x44\x8e\xbf\xbc\x3d\ - \x15\xed\xe0\xed\x36\x93\xe3\x90\x5e\x9a\x8c\x60\x1d\x9d\x00\x2a\ - \x06\x85\x3b\x97\x97\xef\x9a\xb1\x0c\xbd\xe1\x00\x9c\x7d\x0f\x09\ - "; - - let cost: u64 = 1; - - match Sha3FIPS512::execute(input, cost) { - Ok((_, out)) => { - assert_eq!(out, expected); - Ok(()) - } - Err(e) => { - panic!("Test not expected to fail: {:?}", e); - } - } - } -} diff --git a/precompile/living-assets/Cargo.toml b/precompile/living-assets/Cargo.toml new file mode 100644 index 00000000..1b0ad3b5 --- /dev/null +++ b/precompile/living-assets/Cargo.toml @@ -0,0 +1,48 @@ +[package] +name = "pallet-evm-living-assets-ownership" +version = "2.0.0-dev" +authors = ["Parity Technologies ", "Drew Stone "] +license = "Apache-2.0" +description = "Living assets ownership precompile" +repository = "https://github.com/freeverseio/pallet-livingassets-ownership" +edition = "2021" + +[dependencies] +evm = { git = "https://github.com/rust-blockchain/evm", rev = "b7b82c7e1fc57b7449d6dfa6826600de37cc1e65", default-features = false } +parity-scale-codec = { version = "3.2.2", default-features = false, features = [ + "derive", +] } +scale-info = { version = "2.0", default-features = false, features = [ + "derive", +] } + +# Frontier +fp-evm = { git = "https://github.com/paritytech/frontier.git", branch = "polkadot-v0.9.43", default-features = false } +pallet-evm = { git = "https://github.com/paritytech/frontier.git", branch = "polkadot-v0.9.43", default-features = false } + +# Substrate +frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" } +sp-arithmetic = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" } +sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" } +sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" } +sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" } + +# Local pallet +pallet-living-assets-ownership = { path = "../../pallets/living-assets-ownership", default-features = false } + +num_enum = { version = "0.5.3", default-features = false } + +[features] +default = ["std"] +std = [ + # Frontier + "fp-evm/std", + "pallet-evm/std", + "sp-core/std", + "sp-runtime/std", + "sp-std/std", + "pallet-living-assets-ownership/std", + "num_enum/std", + "frame-support/std", + "sp-arithmetic/std", +] diff --git a/precompile/living-assets/src/lib.rs b/precompile/living-assets/src/lib.rs new file mode 100644 index 00000000..d1375332 --- /dev/null +++ b/precompile/living-assets/src/lib.rs @@ -0,0 +1,91 @@ +// SPDX-License-Identifier: Apache-2.0 +// This file is part of Frontier. +// +// Copyright (c) 2020-2022 Parity Technologies (UK) Ltd. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Living Assets precompile module. + +#![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr(test, feature(assert_matches))] + +use fp_evm::{ + ExitError, ExitSucceed, PrecompileFailure, PrecompileHandle, PrecompileOutput, PrecompileResult, +}; +use frame_support::log; +use pallet_living_assets_ownership::LivingAssetsOwnership; +use sp_arithmetic::traits::BaseArithmetic; +// use precompile_utils::{Address, EvmResult, FunctionModifier, PrecompileHandleExt}; +use sp_runtime::SaturatedConversion; + +use sp_core::H160; +use sp_std::marker::PhantomData; + +/// Wrapper for the precompile function. +pub struct LivingAssetsOwnershipPrecompile( + PhantomData<(AddressMapping, AccountId, CollectionId, LivingAssets)>, +) +where + AddressMapping: pallet_evm::AddressMapping, + CollectionId: BaseArithmetic, + LivingAssets: LivingAssetsOwnership; + +impl + LivingAssetsOwnershipPrecompile +where + AddressMapping: pallet_evm::AddressMapping, + CollectionId: BaseArithmetic, + LivingAssets: LivingAssetsOwnership, +{ + pub fn new() -> Self { + Self(PhantomData) + } +} + +impl fp_evm::Precompile + for LivingAssetsOwnershipPrecompile +where + AddressMapping: pallet_evm::AddressMapping, + CollectionId: BaseArithmetic, + LivingAssets: LivingAssetsOwnership, +{ + fn execute(handle: &mut impl PrecompileHandle) -> PrecompileResult { + log::trace!(target: "ds-precompile", "Execute input = {:?}", handle.input()); + + let context = handle.context(); + let input = handle.input(); + + log::info!("Context: {:?}", context); + + // first read u64 from input + let mut buffer = [0u8; 8]; + buffer.copy_from_slice(&input[..8]); + let collection_id = u64::from_be_bytes(buffer).saturated_into(); + + // then read address from input + let mut buffer = [0u8; 20]; + buffer.copy_from_slice(&input[8..28]); + let owner = AddressMapping::into_account_id(H160::from_slice(&buffer)); + + if let Err(_) = LivingAssets::create_collection(collection_id, owner) { + return Err(PrecompileFailure::Error { + exit_status: ExitError::Other(sp_std::borrow::Cow::Borrowed( + "Could net create collection", + )), + }) + } + + Ok(PrecompileOutput { exit_status: ExitSucceed::Returned, output: sp_std::vec::Vec::new() }) + } +} diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index e0b93822..ea2667e9 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -49,8 +49,9 @@ sp-std = { git = "https://github.com/paritytech/substrate", default-features = f sp-transaction-pool = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" } sp-version = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" } -pallet-living-assets-ownership = { version = "0.0.1", default-features = false, path = "../pallets/livingassets-ownership" } -pallet-evm-precompile-sha3fips = { default-features = false, path = "../pallets/precompile/sha3fips" } +pallet-living-assets-ownership = { version = "0.0.1", default-features = false, path = "../pallets/living-assets-ownership" } +# pallet-evm-precompile-sha3fips = { default-features = false, path = "../pallets/precompile/sha3fips" } +pallet-evm-living-assets-ownership = { path = "../precompile/living-assets", default-features = false } # Polkadot pallet-xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.43" } @@ -147,12 +148,12 @@ std = [ "pallet-evm/std", "pallet-evm-chain-id/std", "pallet-evm-precompile-modexp/std", - "pallet-evm-precompile-sha3fips/std", "pallet-evm-precompile-simple/std", "cumulus-pallet-session-benchmarking/std", "frame-benchmarking", "frame-system-benchmarking", - "frame-try-runtime" + "frame-try-runtime", + "pallet-evm-living-assets-ownership/std", ] runtime-benchmarks = [ diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 3040029b..1e4198eb 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -98,6 +98,9 @@ pub type AccountId = <::Signer as IdentifyAccount>::Account /// Balance of an account. pub type Balance = u128; +/// Collection id +pub type CollectionId = u64; + /// Index of a transaction in the chain. pub type Index = u32; @@ -503,7 +506,7 @@ impl pallet_collator_selection::Config for Runtime { impl pallet_living_assets_ownership::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type CollectionId = u64; + type CollectionId = CollectionId; } impl pallet_sudo::Config for Runtime { diff --git a/runtime/src/precompiles.rs b/runtime/src/precompiles.rs index a199669c..8aaa6e01 100644 --- a/runtime/src/precompiles.rs +++ b/runtime/src/precompiles.rs @@ -3,30 +3,40 @@ use pallet_evm::{ IsPrecompileResult, Precompile, PrecompileHandle, PrecompileResult, PrecompileSet, }; +use polkadot_primitives::BlakeTwo256; use sp_core::H160; use sp_std::marker::PhantomData; +use pallet_evm_living_assets_ownership::LivingAssetsOwnershipPrecompile; use pallet_evm_precompile_modexp::Modexp; -use pallet_evm_precompile_sha3fips::Sha3FIPS256; use pallet_evm_precompile_simple::{ECRecover, ECRecoverPublicKey, Identity, Ripemd160, Sha256}; -pub struct FrontierPrecompiles(PhantomData); +use crate::{AccountId, CollectionId}; -impl FrontierPrecompiles +pub struct FrontierPrecompiles(PhantomData); + +impl FrontierPrecompiles where - R: pallet_evm::Config, + Runtime: pallet_evm::Config, { pub fn new() -> Self { Self(Default::default()) } pub fn used_addresses() -> [H160; 7] { - [hash(1), hash(2), hash(3), hash(4), hash(5), hash(1024), hash(1025)] + [hash(1), hash(2), hash(3), hash(4), hash(5), hash(1025), hash(1026)] } } -impl PrecompileSet for FrontierPrecompiles +type LivingAssetsPrecompile = LivingAssetsOwnershipPrecompile< + pallet_evm::HashedAddressMapping, + AccountId, + CollectionId, + pallet_living_assets_ownership::Pallet, +>; + +impl PrecompileSet for FrontierPrecompiles where - R: pallet_evm::Config, + Runtime: pallet_evm::Config + pallet_living_assets_ownership::Config, { fn execute(&self, handle: &mut impl PrecompileHandle) -> Option { match handle.code_address() { @@ -37,8 +47,9 @@ where a if a == hash(4) => Some(Identity::execute(handle)), a if a == hash(5) => Some(Modexp::execute(handle)), // Non-Frontier specific nor Ethereum precompiles : - a if a == hash(1024) => Some(Sha3FIPS256::execute(handle)), + // a if a == hash(1024) => Some(Sha3FIPS256::execute(handle)), a if a == hash(1025) => Some(ECRecoverPublicKey::execute(handle)), + a if a == hash(1026) => Some(LivingAssetsPrecompile::execute(handle)), _ => None, } } From 863e25f0fb178d4965ce913d4d43fd98e9ad52ed Mon Sep 17 00:00:00 2001 From: Dastan Samatov Date: Thu, 20 Jul 2023 15:35:01 +0600 Subject: [PATCH 5/5] Add new precompiled contract --- Cargo.lock | 442 +-- node/Cargo.toml | 2 +- pallets/living-assets-ownership/Cargo.lock | 3485 -------------------- pallets/living-assets-ownership/Cargo.toml | 2 +- precompile/living-assets/Cargo.toml | 8 +- precompile/living-assets/src/lib.rs | 103 +- precompile/utils/Cargo.toml | 53 + precompile/utils/macro/Cargo.toml | 20 + precompile/utils/macro/src/lib.rs | 139 + precompile/utils/macro/tests/tests.rs | 49 + precompile/utils/src/data.rs | 588 ++++ precompile/utils/src/lib.rs | 354 ++ precompile/utils/src/testing.rs | 410 +++ precompile/utils/src/tests.rs | 731 ++++ runtime/Cargo.toml | 2 +- 15 files changed, 2670 insertions(+), 3718 deletions(-) delete mode 100644 pallets/living-assets-ownership/Cargo.lock create mode 100644 precompile/utils/Cargo.toml create mode 100644 precompile/utils/macro/Cargo.toml create mode 100644 precompile/utils/macro/src/lib.rs create mode 100644 precompile/utils/macro/tests/tests.rs create mode 100644 precompile/utils/src/data.rs create mode 100644 precompile/utils/src/lib.rs create mode 100644 precompile/utils/src/testing.rs create mode 100644 precompile/utils/src/tests.rs diff --git a/Cargo.lock b/Cargo.lock index bf08bd8b..24f7f3b3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -170,15 +170,6 @@ dependencies = [ "version_check", ] -[[package]] -name = "aho-corasick" -version = "0.7.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" -dependencies = [ - "memchr", -] - [[package]] name = "aho-corasick" version = "1.0.2" @@ -269,9 +260,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.71" +version = "1.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8" +checksum = "3b13c32d80ecc7ab747b80c3784bce54ee8a7a0cc4fbda9bf4cda2cf6fe90854" [[package]] name = "approx" @@ -439,7 +430,7 @@ checksum = "0e97ce7de6cf12de5d7226c73f5ba9811622f4db3a5b91b55c53e987e5f91cba" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.26", ] [[package]] @@ -450,7 +441,7 @@ checksum = "a564d521dd56509c4c47480d00b80ee55f7e385ae48db5744c67ad50c92d2ebf" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.26", ] [[package]] @@ -597,7 +588,7 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.25", + "syn 2.0.26", ] [[package]] @@ -751,6 +742,17 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" +[[package]] +name = "bstr" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba3569f383e8f1598449f1a423e72e99569137b47740b1da11ef19af3d5c3223" +dependencies = [ + "lazy_static", + "memchr", + "regex-automata 0.1.10", +] + [[package]] name = "bstr" version = "1.6.0" @@ -819,18 +821,18 @@ dependencies = [ [[package]] name = "camino" -version = "1.1.4" +version = "1.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c530edf18f37068ac2d977409ed5cd50d53d73bc653c7647b48eb78976ac9ae2" +checksum = "c59e92b5a388f549b863a7bea62612c09f24c8393560709a54558a9abdfb3b9c" dependencies = [ "serde", ] [[package]] name = "cargo-platform" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbdb825da8a5df079a43676dbe042702f1707b1109f713a01420fbb4cc71fa27" +checksum = "2cfa25e60aea747ec7e1124f238816749faa93759c6ff5b31f1ccdda137f4479" dependencies = [ "serde", ] @@ -843,7 +845,7 @@ checksum = "eee4243f1f26fc7a42710e7439c149e2b10b05472f88090acce52632f231a73a" dependencies = [ "camino", "cargo-platform", - "semver 1.0.17", + "semver 1.0.18", "serde", "serde_json", "thiserror", @@ -1002,9 +1004,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.3.11" +version = "4.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1640e5cc7fb47dbb8338fd471b105e7ed6c3cb2aeb00c2e067127ffd3764a05d" +checksum = "5b0827b011f6f8ab38590295339817b0d26f344aa4932c3ced71b45b0c54b4a9" dependencies = [ "clap_builder", "clap_derive", @@ -1013,9 +1015,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.3.11" +version = "4.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98c59138d527eeaf9b53f35a77fcc1fad9d883116070c63d5de1c7dc7b00c72b" +checksum = "9441b403be87be858db6a23edb493e7f694761acdc3343d5a0fcaafd304cbc9e" dependencies = [ "anstream", "anstyle", @@ -1025,14 +1027,14 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.3.2" +version = "4.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8cd2b2a819ad6eec39e8f1d6b53001af1e5469f8c177579cdaeb313115b825f" +checksum = "54a9bb5758fc5dfe728d1019941681eccaf0cf8a4189b692a0ee2f2ecf90a050" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.26", ] [[package]] @@ -1723,7 +1725,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.26", ] [[package]] @@ -2014,9 +2016,9 @@ dependencies = [ [[package]] name = "cxx" -version = "1.0.100" +version = "1.0.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e928d50d5858b744d1ea920b790641129c347a770d1530c3a85b77705a5ee031" +checksum = "5032837c1384de3708043de9d4e97bb91290faca6c16529a28aa340592a78166" dependencies = [ "cc", "cxxbridge-flags", @@ -2026,9 +2028,9 @@ dependencies = [ [[package]] name = "cxx-build" -version = "1.0.100" +version = "1.0.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8332ba63f8a8040ca479de693150129067304a3496674477fff6d0c372cc34ae" +checksum = "51368b3d0dbf356e10fcbfd455a038503a105ee556f7ee79b6bb8c53a7247456" dependencies = [ "cc", "codespan-reporting", @@ -2036,24 +2038,24 @@ dependencies = [ "proc-macro2", "quote", "scratch", - "syn 2.0.25", + "syn 2.0.26", ] [[package]] name = "cxxbridge-flags" -version = "1.0.100" +version = "1.0.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5966a5a87b6e9bb342f5fab7170a93c77096efe199872afffc4b477cfeb86957" +checksum = "0d9062157072e4aafc8e56ceaf8325ce850c5ae37578c852a0d4de2cecdded13" [[package]] name = "cxxbridge-macro" -version = "1.0.100" +version = "1.0.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81b2dab6991c7ab1572fea8cb049db819b1aeea1e2dac74c0869f244d9f21a7c" +checksum = "cf01e8a540f5a4e0f284595834f81cf88572f244b768f051724537afa99a2545" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.26", ] [[package]] @@ -2317,7 +2319,7 @@ checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.26", ] [[package]] @@ -2334,9 +2336,9 @@ checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" [[package]] name = "dtoa" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "519b83cd10f5f6e969625a409f735182bea5558cd8b64c655806ceaae36f1999" +checksum = "dcbb2bf8e87535c23f7a8a321e364ce21462d0ff10cb6407820e8e96dfff6653" [[package]] name = "dyn-clonable" @@ -2361,9 +2363,9 @@ dependencies = [ [[package]] name = "dyn-clone" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b0cf012f1230e43cd00ebb729c6bb58707ecfa8ad08b52ef3a4ccd2697fc30" +checksum = "304e6508efa593091e97a9abbc10f90aa7ca635b6d2784feff3c89d41dd12272" [[package]] name = "ecdsa" @@ -2470,7 +2472,7 @@ dependencies = [ "group 0.13.0", "pkcs8 0.10.2", "rand_core 0.6.4", - "sec1 0.7.2", + "sec1 0.7.3", "subtle", "zeroize", ] @@ -2510,7 +2512,7 @@ checksum = "5e9a1f9f7d83e59740248a6e14ecf93929ade55027844dfcea78beafccc15745" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.26", ] [[package]] @@ -2521,7 +2523,7 @@ checksum = "c9838a970f5de399d3070ae1739e131986b2f5dcc223c7423ca0927e3a878522" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.26", ] [[package]] @@ -2748,7 +2750,7 @@ dependencies = [ "fs-err", "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.26", ] [[package]] @@ -2800,7 +2802,7 @@ dependencies = [ [[package]] name = "fc-cli" version = "1.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#c2605558ad7e23362be1f16c7d2ec3e7d2e658ab" dependencies = [ "clap", "ethereum-types", @@ -2818,7 +2820,7 @@ dependencies = [ [[package]] name = "fc-consensus" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#c2605558ad7e23362be1f16c7d2ec3e7d2e658ab" dependencies = [ "async-trait", "fp-consensus", @@ -2834,7 +2836,7 @@ dependencies = [ [[package]] name = "fc-db" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#c2605558ad7e23362be1f16c7d2ec3e7d2e658ab" dependencies = [ "async-trait", "fp-storage", @@ -2854,7 +2856,7 @@ dependencies = [ [[package]] name = "fc-mapping-sync" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#c2605558ad7e23362be1f16c7d2ec3e7d2e658ab" dependencies = [ "fc-db", "fc-storage", @@ -2875,7 +2877,7 @@ dependencies = [ [[package]] name = "fc-rpc" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#c2605558ad7e23362be1f16c7d2ec3e7d2e658ab" dependencies = [ "ethereum", "ethereum-types", @@ -2925,7 +2927,7 @@ dependencies = [ [[package]] name = "fc-rpc-core" version = "1.1.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#c2605558ad7e23362be1f16c7d2ec3e7d2e658ab" dependencies = [ "ethereum", "ethereum-types", @@ -2938,7 +2940,7 @@ dependencies = [ [[package]] name = "fc-storage" version = "1.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#c2605558ad7e23362be1f16c7d2ec3e7d2e658ab" dependencies = [ "ethereum", "ethereum-types", @@ -3090,7 +3092,7 @@ dependencies = [ [[package]] name = "fp-account" version = "1.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#c2605558ad7e23362be1f16c7d2ec3e7d2e658ab" dependencies = [ "hex", "impl-serde", @@ -3109,7 +3111,7 @@ dependencies = [ [[package]] name = "fp-consensus" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#c2605558ad7e23362be1f16c7d2ec3e7d2e658ab" dependencies = [ "ethereum", "parity-scale-codec", @@ -3121,7 +3123,7 @@ dependencies = [ [[package]] name = "fp-dynamic-fee" version = "1.0.0" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#c2605558ad7e23362be1f16c7d2ec3e7d2e658ab" dependencies = [ "async-trait", "sp-core", @@ -3131,7 +3133,7 @@ dependencies = [ [[package]] name = "fp-ethereum" version = "1.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#c2605558ad7e23362be1f16c7d2ec3e7d2e658ab" dependencies = [ "ethereum", "ethereum-types", @@ -3145,7 +3147,7 @@ dependencies = [ [[package]] name = "fp-evm" version = "3.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#c2605558ad7e23362be1f16c7d2ec3e7d2e658ab" dependencies = [ "evm", "frame-support", @@ -3160,7 +3162,7 @@ dependencies = [ [[package]] name = "fp-rpc" version = "3.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#c2605558ad7e23362be1f16c7d2ec3e7d2e658ab" dependencies = [ "ethereum", "ethereum-types", @@ -3177,7 +3179,7 @@ dependencies = [ [[package]] name = "fp-self-contained" version = "1.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#c2605558ad7e23362be1f16c7d2ec3e7d2e658ab" dependencies = [ "frame-support", "parity-scale-codec", @@ -3189,7 +3191,7 @@ dependencies = [ [[package]] name = "fp-storage" version = "2.0.0" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#c2605558ad7e23362be1f16c7d2ec3e7d2e658ab" dependencies = [ "parity-scale-codec", "serde", @@ -3281,7 +3283,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.26", ] [[package]] @@ -3398,7 +3400,7 @@ dependencies = [ "proc-macro-warning", "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.26", ] [[package]] @@ -3410,7 +3412,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.26", ] [[package]] @@ -3420,7 +3422,7 @@ source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.43#5e dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.26", ] [[package]] @@ -3500,7 +3502,7 @@ version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2eeb4ed9e12f43b7fa0baae3f9cdda28352770132ef2e09a23760c29cae8bd47" dependencies = [ - "rustix 0.38.3", + "rustix 0.38.4", "windows-sys 0.48.0", ] @@ -3582,7 +3584,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.26", ] [[package]] @@ -3732,12 +3734,12 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "globset" -version = "0.4.10" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "029d74589adefde59de1a0c4f4732695c32805624aec7b68d91503d4dba79afc" +checksum = "1391ab1f92ffcc08911957149833e682aa3fe252b9f45f966d2ef972274c97df" dependencies = [ - "aho-corasick 0.7.20", - "bstr", + "aho-corasick", + "bstr 1.6.0", "fnv", "log", "regex", @@ -3870,6 +3872,12 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +[[package]] +name = "hex-literal" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" + [[package]] name = "hex-literal" version = "0.4.1" @@ -4267,7 +4275,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" dependencies = [ "hermit-abi 0.3.2", - "rustix 0.38.3", + "rustix 0.38.4", "windows-sys 0.48.0", ] @@ -4282,9 +4290,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b02a5381cc465bd3041d84623d0fa3b66738b52b8e2fc3bab8ad63ab032f4a" +checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" [[package]] name = "jobserver" @@ -4484,7 +4492,7 @@ dependencies = [ "frame-system-benchmarking", "frame-system-rpc-runtime-api", "frame-try-runtime", - "hex-literal", + "hex-literal 0.4.1", "kusama-runtime-constants", "log", "pallet-authority-discovery", @@ -5748,9 +5756,9 @@ checksum = "61807f77802ff30975e01f4f071c8ba10c022052f98b3294119f3e615d13e5be" [[package]] name = "num" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43db66d1170d347f9a065114077f7dccb00c1b9478c89384490a3425279a4606" +checksum = "b05180d69e3da0e530ba2a1dae5110317e49e3b7f3d41be227dc5f92e49ee7af" dependencies = [ "num-bigint", "num-complex", @@ -5881,7 +5889,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.26", ] [[package]] @@ -6167,7 +6175,7 @@ dependencies = [ [[package]] name = "pallet-base-fee" version = "1.0.0" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#c2605558ad7e23362be1f16c7d2ec3e7d2e658ab" dependencies = [ "fp-evm", "frame-support", @@ -6386,7 +6394,7 @@ dependencies = [ [[package]] name = "pallet-ethereum" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#c2605558ad7e23362be1f16c7d2ec3e7d2e658ab" dependencies = [ "ethereum", "ethereum-types", @@ -6409,7 +6417,7 @@ dependencies = [ [[package]] name = "pallet-evm" version = "6.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#c2605558ad7e23362be1f16c7d2ec3e7d2e658ab" dependencies = [ "environmental", "evm", @@ -6419,7 +6427,7 @@ dependencies = [ "frame-support", "frame-system", "hex", - "hex-literal", + "hex-literal 0.4.1", "impl-trait-for-tuples", "log", "parity-scale-codec", @@ -6434,7 +6442,7 @@ dependencies = [ [[package]] name = "pallet-evm-chain-id" version = "1.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#c2605558ad7e23362be1f16c7d2ec3e7d2e658ab" dependencies = [ "frame-support", "frame-system", @@ -6446,13 +6454,14 @@ dependencies = [ name = "pallet-evm-living-assets-ownership" version = "2.0.0-dev" dependencies = [ - "evm", "fp-evm", "frame-support", "num_enum 0.5.11", "pallet-evm", "pallet-living-assets-ownership", "parity-scale-codec", + "precompile-utils", + "precompile-utils-macro", "scale-info", "sp-arithmetic", "sp-core", @@ -6463,7 +6472,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-modexp" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#c2605558ad7e23362be1f16c7d2ec3e7d2e658ab" dependencies = [ "fp-evm", "num", @@ -6472,7 +6481,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-simple" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#adf7117f373b68d4128385ad08c28a9f7c597cd0" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.43#c2605558ad7e23362be1f16c7d2ec3e7d2e658ab" dependencies = [ "fp-evm", "ripemd", @@ -6945,7 +6954,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.26", ] [[package]] @@ -7220,7 +7229,7 @@ dependencies = [ "frame-benchmarking", "frame-benchmarking-cli", "futures", - "hex-literal", + "hex-literal 0.4.1", "jsonrpsee", "log", "pallet-transaction-payment-rpc", @@ -7283,7 +7292,7 @@ dependencies = [ "frame-system-benchmarking", "frame-system-rpc-runtime-api", "frame-try-runtime", - "hex-literal", + "hex-literal 0.4.1", "log", "pallet-aura", "pallet-authorship", @@ -7377,9 +7386,9 @@ dependencies = [ [[package]] name = "parity-scale-codec" -version = "3.6.3" +version = "3.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "756d439303e94fae44f288ba881ad29670c65b0c4b0e05674ca81061bb65f2c5" +checksum = "dd8e946cc0cc711189c0b0249fb8b599cbeeab9784d83c415719368bb8d4ac64" dependencies = [ "arrayvec 0.7.4", "bitvec", @@ -7392,9 +7401,9 @@ dependencies = [ [[package]] name = "parity-scale-codec-derive" -version = "3.6.3" +version = "3.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d884d78fcf214d70b1e239fcd1c6e5e95aa3be1881918da2e488cc946c7a476" +checksum = "2a296c3079b5fefbc499e1de58dc26c09b1b9a5952d26694ee89f04a43ebbb3e" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -7476,9 +7485,9 @@ checksum = "7924d1d0ad836f665c9065e26d016c673ece3993f30d340068b16f282afc1156" [[package]] name = "paste" -version = "1.0.13" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4b27ab7be369122c218afc2079489cdcb4b517c0a3fc386ff11e1fedfcc2b35" +checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" [[package]] name = "pbkdf2" @@ -7530,9 +7539,9 @@ checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" [[package]] name = "pest" -version = "2.7.0" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f73935e4d55e2abf7f130186537b19e7a4abc886a0252380b59248af473a3fc9" +checksum = "0d2d1d55045829d65aad9d389139882ad623b33b904e7c9f1b10c5b8927298e5" dependencies = [ "thiserror", "ucd-trie", @@ -7540,9 +7549,9 @@ dependencies = [ [[package]] name = "pest_derive" -version = "2.7.0" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aef623c9bbfa0eedf5a0efba11a5ee83209c326653ca31ff019bec3a95bfff2b" +checksum = "5f94bca7e7a599d89dea5dfa309e217e7906c3c007fb9c3299c40b10d6a315d3" dependencies = [ "pest", "pest_generator", @@ -7550,22 +7559,22 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.7.0" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3e8cba4ec22bada7fc55ffe51e2deb6a0e0db2d0b7ab0b103acc80d2510c190" +checksum = "99d490fe7e8556575ff6911e45567ab95e71617f43781e5c05490dc8d75c965c" dependencies = [ "pest", "pest_meta", "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.26", ] [[package]] name = "pest_meta" -version = "2.7.0" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a01f71cb40bd8bb94232df14b946909e14660e33fc05db3e50ae2a82d7ea0ca0" +checksum = "2674c66ebb4b4d9036012091b537aae5878970d6999f81a265034d85b136b341" dependencies = [ "once_cell", "pest", @@ -7599,7 +7608,7 @@ checksum = "ec2e072ecce94ec471b13398d5402c188e76ac03cf74dd1a975161b23a3f6d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.26", ] [[package]] @@ -8427,7 +8436,7 @@ version = "0.9.43" source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.43#ba42b9ce51d25bdaf52d2c61e0763a6e3da50d25" dependencies = [ "bitvec", - "hex-literal", + "hex-literal 0.4.1", "parity-scale-codec", "polkadot-core-primitives", "polkadot-parachain", @@ -8493,7 +8502,7 @@ dependencies = [ "frame-system-benchmarking", "frame-system-rpc-runtime-api", "frame-try-runtime", - "hex-literal", + "hex-literal 0.4.1", "log", "pallet-authority-discovery", "pallet-authorship", @@ -8701,7 +8710,7 @@ dependencies = [ "frame-support", "frame-system-rpc-runtime-api", "futures", - "hex-literal", + "hex-literal 0.4.1", "kusama-runtime", "kvdb", "kvdb-rocksdb", @@ -8885,9 +8894,9 @@ dependencies = [ [[package]] name = "portable-atomic" -version = "1.3.3" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "767eb9f07d4a5ebcb39bbf2d452058a93c011373abf6832e24194a1c3f004794" +checksum = "edc55135a600d700580e406b4de0d59cb9ad25e344a3a091a97ded2622ec4ec6" [[package]] name = "ppv-lite86" @@ -8895,6 +8904,41 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +[[package]] +name = "precompile-utils" +version = "0.4.3" +dependencies = [ + "assert_matches", + "evm", + "fp-evm", + "frame-support", + "frame-system", + "hex-literal 0.3.4", + "impl-trait-for-tuples", + "num_enum 0.5.11", + "pallet-evm", + "parity-scale-codec", + "precompile-utils-macro", + "sha3", + "similar-asserts", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", + "xcm", +] + +[[package]] +name = "precompile-utils-macro" +version = "0.1.0" +dependencies = [ + "num_enum 0.5.11", + "proc-macro2", + "quote", + "sha3", + "syn 1.0.109", +] + [[package]] name = "predicates" version = "2.1.5" @@ -8942,7 +8986,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "92139198957b410250d43fad93e630d956499a625c527eda65175c8680f83387" dependencies = [ "proc-macro2", - "syn 2.0.25", + "syn 2.0.26", ] [[package]] @@ -9017,14 +9061,14 @@ checksum = "0e99670bafb56b9a106419397343bdbc8b8742c3cc449fec6345f86173f47cd4" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.26", ] [[package]] name = "proc-macro2" -version = "1.0.64" +version = "1.0.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78803b62cbf1f46fde80d7c0e803111524b9877184cfe7c3033659490ac7a7da" +checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" dependencies = [ "unicode-ident", ] @@ -9188,9 +9232,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.29" +version = "1.0.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "573015e8ab27661678357f27dc26460738fd2b6c86e46f386fde94cb5d913105" +checksum = "5fe8a65d69dd0808184ebb5f836ab526bb259db23c657efa38711b1072ee47f0" dependencies = [ "proc-macro2", ] @@ -9393,7 +9437,7 @@ checksum = "68bf53dad9b6086826722cdc99140793afd9f62faa14a1ad07eb4f955e7a7216" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.26", ] [[package]] @@ -9414,9 +9458,9 @@ version = "1.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b2eae68fc220f7cf2532e4494aded17545fce192d59cd996e0fe7887f4ceb575" dependencies = [ - "aho-corasick 1.0.2", + "aho-corasick", "memchr", - "regex-automata 0.3.2", + "regex-automata 0.3.3", "regex-syntax 0.7.4", ] @@ -9431,11 +9475,11 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83d3daa6976cffb758ec878f108ba0e062a45b2d6ca3a2cca965338855476caf" +checksum = "39354c10dd07468c2e73926b23bb9c2caca74c5501e38a35da70406f1d923310" dependencies = [ - "aho-corasick 1.0.2", + "aho-corasick", "memchr", "regex-syntax 0.7.4", ] @@ -9552,7 +9596,7 @@ dependencies = [ "frame-system-benchmarking", "frame-system-rpc-runtime-api", "frame-try-runtime", - "hex-literal", + "hex-literal 0.4.1", "log", "pallet-authority-discovery", "pallet-authorship", @@ -9725,7 +9769,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ - "semver 1.0.17", + "semver 1.0.18", ] [[package]] @@ -9767,9 +9811,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.3" +version = "0.38.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac5ffa1efe7548069688cd7028f32591853cd7b5b756d41bcffd2353e4fc75b4" +checksum = "0a962918ea88d644592894bc6dc55acc6c0956488adcebbfb6e273506b7fd6e5" dependencies = [ "bitflags 2.3.3", "errno", @@ -9826,9 +9870,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.13" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc31bd9b61a32c31f9650d18add92aa83a49ba979c143eefd27fe7177b05bd5f" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" [[package]] name = "rw-stream-sink" @@ -9843,15 +9887,15 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.14" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe232bdf6be8c8de797b22184ee71118d63780ea42ac85b61d1baa6d3b782ae9" +checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" [[package]] name = "safe_arch" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62a7484307bd40f8f7ccbacccac730108f2cae119a3b11c74485b48aa9ea650f" +checksum = "f398075ce1e6a179b46f51bd88d0598b92b00d3551f1a2d4ac49e771b56ac354" dependencies = [ "bytemuck", ] @@ -9970,7 +10014,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.26", ] [[package]] @@ -10938,7 +10982,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.26", ] [[package]] @@ -11063,15 +11107,15 @@ dependencies = [ [[package]] name = "scopeguard" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "scratch" -version = "1.0.6" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "764cad9e7e1ca5fe15b552859ff5d96a314e6ed2934f2260168cd5dfa5891409" +checksum = "a3cf7c11c38cb994f3d40e8a8cde3bbd1f72a435e4c49e85d6553d8312306152" [[package]] name = "sct" @@ -11121,9 +11165,9 @@ dependencies = [ [[package]] name = "sec1" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0aec48e813d6b90b15f0b8948af3c63483992dee44c03e9930b3eebdabe046e" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" dependencies = [ "base16ct 0.2.0", "der 0.7.7", @@ -11194,9 +11238,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.17" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed" +checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" dependencies = [ "serde", ] @@ -11209,29 +11253,29 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.171" +version = "1.0.173" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30e27d1e4fd7659406c492fd6cfaf2066ba8773de45ca75e855590f856dc34a9" +checksum = "e91f70896d6720bc714a4a57d22fc91f1db634680e65c8efe13323f1fa38d53f" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.171" +version = "1.0.173" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "389894603bd18c46fa56231694f8d827779c0951a667087194cf9de94ed24682" +checksum = "a6250dde8342e0232232be9ca3db7aa40aceb5a3e5dd9bddbc00d99a007cde49" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.26", ] [[package]] name = "serde_json" -version = "1.0.100" +version = "1.0.103" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f1e14e89be7aa4c4b78bdbdc9eb5bf8517829a600ae8eaa39a6e1d960b5185c" +checksum = "d03b412469450d4404fe8499a268edd7f8b79fecb074b0d812ad64ca21f4031b" dependencies = [ "itoa", "ryu", @@ -11374,6 +11418,26 @@ dependencies = [ "wide", ] +[[package]] +name = "similar" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "420acb44afdae038210c99e69aae24109f32f15500aa708e81d46c9f29d55fcf" +dependencies = [ + "bstr 0.2.17", + "unicode-segmentation", +] + +[[package]] +name = "similar-asserts" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbf644ad016b75129f01a34a355dcb8d66a5bc803e417c7a77cc5d5ee9fa0f18" +dependencies = [ + "console", + "similar", +] + [[package]] name = "siphasher" version = "0.3.10" @@ -11513,7 +11577,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.26", ] [[package]] @@ -11755,7 +11819,7 @@ dependencies = [ "proc-macro2", "quote", "sp-core-hashing", - "syn 2.0.25", + "syn 2.0.26", ] [[package]] @@ -11774,7 +11838,7 @@ source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.43#5e dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.26", ] [[package]] @@ -11860,7 +11924,7 @@ version = "4.1.0-dev" source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.43#5e49f6e44820affccaf517fd22af564f4b495d40" dependencies = [ "thiserror", - "zstd 0.12.3+zstd.1.5.2", + "zstd 0.12.4", ] [[package]] @@ -11985,7 +12049,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.26", ] [[package]] @@ -12171,7 +12235,7 @@ dependencies = [ "parity-scale-codec", "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.26", ] [[package]] @@ -12496,9 +12560,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.25" +version = "2.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15e3fc8c0c74267e2df136e5e5fb656a464158aa57624053375eb9c8c6e25ae2" +checksum = "45c3457aacde3c65315de5031ec191ce46604304d2446e803d71ade03308d970" dependencies = [ "proc-macro2", "quote", @@ -12546,9 +12610,9 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "target-lexicon" -version = "0.12.8" +version = "0.12.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b1c7f239eb94671427157bd93b3694320f3668d4e1eff08c7285366fd777fac" +checksum = "1d2faeef5759ab89935255b1a4cd98e0baf99d1085e37d36599c625dac49ae8e" [[package]] name = "tempfile" @@ -12596,7 +12660,7 @@ checksum = "463fe12d7993d3b327787537ce8dd4dfa058de32fc2b195ef3cde03dc4771e8f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.26", ] [[package]] @@ -12777,7 +12841,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.26", ] [[package]] @@ -12861,9 +12925,9 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.19.12" +version = "0.19.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c500344a19072298cd05a7224b3c0c629348b78692bf48466c5238656e315a78" +checksum = "f8123f27e969974a3dfba720fdb560be359f57b44302d280ba72e76a74480e8a" dependencies = [ "indexmap 2.0.0", "serde", @@ -12885,9 +12949,9 @@ dependencies = [ [[package]] name = "tower-http" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8bd22a874a2d0b70452d5597b12c537331d49060824a95f49f108994f94aa4c" +checksum = "7ac8060a61f8758a61562f6fb53ba3cbe1ca906f001df2e53cccddcdbee91e7c" dependencies = [ "bitflags 2.3.3", "bytes", @@ -12934,7 +12998,7 @@ checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.26", ] [[package]] @@ -12977,7 +13041,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.26", ] [[package]] @@ -13142,7 +13206,7 @@ dependencies = [ "sp-version", "sp-weights", "substrate-rpc-client", - "zstd 0.12.3+zstd.1.5.2", + "zstd 0.12.4", ] [[package]] @@ -13214,9 +13278,9 @@ checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" [[package]] name = "unicode-ident" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22049a19f4a68748a168c0fc439f9516686aa045927ff767eca0a85101fb6e73" +checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" [[package]] name = "unicode-normalization" @@ -13227,6 +13291,12 @@ dependencies = [ "tinyvec", ] +[[package]] +name = "unicode-segmentation" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" + [[package]] name = "unicode-width" version = "0.1.10" @@ -13296,9 +13366,9 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" [[package]] name = "uuid" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d023da39d1fde5a8a3fe1f3e01ca9632ada0a63e9797de55a879d6e2236277be" +checksum = "79daa5ed5740825c40b389c5e50312b9c86df53fccd33f281df655642b43869d" dependencies = [ "getrandom 0.2.10", ] @@ -13400,7 +13470,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.26", "wasm-bindgen-shared", ] @@ -13434,7 +13504,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.26", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -14009,7 +14079,7 @@ dependencies = [ "frame-system-benchmarking", "frame-system-rpc-runtime-api", "frame-try-runtime", - "hex-literal", + "hex-literal 0.4.1", "log", "pallet-authority-discovery", "pallet-authorship", @@ -14115,9 +14185,9 @@ dependencies = [ [[package]] name = "wide" -version = "0.7.10" +version = "0.7.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40018623e2dba2602a9790faba8d33f2ebdebf4b86561b83928db735f8784728" +checksum = "aa469ffa65ef7e0ba0f164183697b89b854253fd31aeb92358b7b6155177d62f" dependencies = [ "bytemuck", "safe_arch", @@ -14346,9 +14416,9 @@ checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" [[package]] name = "winnow" -version = "0.4.9" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81a2094c43cc94775293eaa0e499fbc30048a6d824ac82c0351a8c0bf9112529" +checksum = "81fac9742fd1ad1bd9643b991319f72dd031016d44b77039a26977eb667141e7" dependencies = [ "memchr", ] @@ -14497,7 +14567,7 @@ dependencies = [ "Inflector", "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.26", ] [[package]] @@ -14540,7 +14610,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.26", ] [[package]] @@ -14554,11 +14624,11 @@ dependencies = [ [[package]] name = "zstd" -version = "0.12.3+zstd.1.5.2" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76eea132fb024e0e13fd9c2f5d5d595d8a967aa72382ac2f9d39fcc95afd0806" +checksum = "1a27595e173641171fc74a1232b7b1c7a7cb6e18222c11e9dfb9888fa424c53c" dependencies = [ - "zstd-safe 6.0.5+zstd.1.5.4", + "zstd-safe 6.0.6", ] [[package]] @@ -14573,9 +14643,9 @@ dependencies = [ [[package]] name = "zstd-safe" -version = "6.0.5+zstd.1.5.4" +version = "6.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d56d9e60b4b1758206c238a10165fbcae3ca37b01744e394c463463f6529d23b" +checksum = "ee98ffd0b48ee95e6c5168188e44a54550b1564d9d530ee21d5f0eaed1069581" dependencies = [ "libc", "zstd-sys", diff --git a/node/Cargo.toml b/node/Cargo.toml index e7b305c3..63672d37 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -13,7 +13,7 @@ build = "build.rs" clap = { version = "4.2.7", features = ["derive"] } futures = "0.3.25" log = "0.4.17" -codec = { package = "parity-scale-codec", version = "3.0.0" } +codec = { package = "parity-scale-codec", version = "3.2.2" } serde = { version = "1.0.163", features = ["derive"] } jsonrpsee = { version = "0.16.2", features = ["server"] } hex-literal = { version = "0.4.1" } diff --git a/pallets/living-assets-ownership/Cargo.lock b/pallets/living-assets-ownership/Cargo.lock deleted file mode 100644 index 04fcd99a..00000000 --- a/pallets/living-assets-ownership/Cargo.lock +++ /dev/null @@ -1,3485 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "Inflector" -version = "0.11.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" -dependencies = [ - "lazy_static", - "regex", -] - -[[package]] -name = "addr2line" -version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b" -dependencies = [ - "gimli 0.26.2", -] - -[[package]] -name = "addr2line" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97" -dependencies = [ - "gimli 0.27.2", -] - -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - -[[package]] -name = "ahash" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" -dependencies = [ - "getrandom 0.2.9", - "once_cell", - "version_check", -] - -[[package]] -name = "ahash" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" -dependencies = [ - "cfg-if", - "getrandom 0.2.9", - "once_cell", - "version_check", -] - -[[package]] -name = "aho-corasick" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41" -dependencies = [ - "memchr", -] - -[[package]] -name = "android-tzdata" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" - -[[package]] -name = "android_system_properties" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" -dependencies = [ - "libc", -] - -[[package]] -name = "ansi_term" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" -dependencies = [ - "winapi", -] - -[[package]] -name = "anyhow" -version = "1.0.71" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8" - -[[package]] -name = "approx" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cab112f0a86d568ea0e627cc1d6be74a1e9cd55214684db5561995f6dad897c6" -dependencies = [ - "num-traits", -] - -[[package]] -name = "array-bytes" -version = "4.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f52f63c5c1316a16a4b35eaac8b76a98248961a533f061684cb2a7cb0eafb6c6" - -[[package]] -name = "arrayref" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" - -[[package]] -name = "arrayvec" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" - -[[package]] -name = "arrayvec" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" - -[[package]] -name = "async-trait" -version = "0.1.68" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.18", -] - -[[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - -[[package]] -name = "backtrace" -version = "0.3.67" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "233d376d6d185f2a3093e58f283f60f880315b6c60075b01f36b3b85154564ca" -dependencies = [ - "addr2line 0.19.0", - "cc", - "cfg-if", - "libc", - "miniz_oxide", - "object 0.30.3", - "rustc-demangle", -] - -[[package]] -name = "base16ct" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" - -[[package]] -name = "base64" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" - -[[package]] -name = "base64ct" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" - -[[package]] -name = "bincode" -version = "1.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" -dependencies = [ - "serde", -] - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "bitvec" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" -dependencies = [ - "funty", - "radium", - "tap", - "wyz", -] - -[[package]] -name = "blake2" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" -dependencies = [ - "digest 0.10.7", -] - -[[package]] -name = "blake2b_simd" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c2f0dc9a68c6317d884f97cc36cf5a3d20ba14ce404227df55e1af708ab04bc" -dependencies = [ - "arrayref", - "arrayvec 0.7.2", - "constant_time_eq", -] - -[[package]] -name = "block-buffer" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" -dependencies = [ - "block-padding", - "byte-tools", - "byteorder", - "generic-array 0.12.4", -] - -[[package]] -name = "block-buffer" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" -dependencies = [ - "generic-array 0.14.7", -] - -[[package]] -name = "block-buffer" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" -dependencies = [ - "generic-array 0.14.7", -] - -[[package]] -name = "block-padding" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" -dependencies = [ - "byte-tools", -] - -[[package]] -name = "bounded-collections" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07fbd1d11282a1eb134d3c3b7cf8ce213b5161c6e5f73fb1b98618482c606b64" -dependencies = [ - "log", - "parity-scale-codec", - "scale-info", - "serde", -] - -[[package]] -name = "bs58" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" - -[[package]] -name = "bumpalo" -version = "3.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" - -[[package]] -name = "byte-slice-cast" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" - -[[package]] -name = "byte-tools" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" - -[[package]] -name = "bytemuck" -version = "1.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17febce684fd15d89027105661fec94afb475cb995fbc59d2865198446ba2eea" - -[[package]] -name = "byteorder" -version = "1.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" - -[[package]] -name = "bytes" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" - -[[package]] -name = "cc" -version = "1.0.79" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" - -[[package]] -name = "cfg-expr" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0aacacf4d96c24b2ad6eb8ee6df040e4f27b0d0b39a5710c30091baa830485db" -dependencies = [ - "smallvec", -] - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "chrono" -version = "0.4.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5" -dependencies = [ - "android-tzdata", - "iana-time-zone", - "num-traits", - "winapi", -] - -[[package]] -name = "const-oid" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "520fbf3c07483f94e3e3ca9d0cfd913d7718ef2483d2cfd91c0d9e91474ab913" - -[[package]] -name = "constant_time_eq" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13418e745008f7349ec7e449155f419a61b92b58a99cc3616942b926825ec76b" - -[[package]] -name = "core-foundation-sys" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" - -[[package]] -name = "cpp_demangle" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eeaa953eaad386a53111e47172c2fedba671e5684c8dd601a5f474f4f118710f" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "cpufeatures" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e4c1eaa2012c47becbbad2ab175484c2a84d1185b566fb2cc5b8707343dfe58" -dependencies = [ - "libc", -] - -[[package]] -name = "cranelift-entity" -version = "0.93.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f42ea692c7b450ad18b8c9889661505d51c09ec4380cf1c2d278dbb2da22cae1" -dependencies = [ - "serde", -] - -[[package]] -name = "crc32fast" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "crunchy" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" - -[[package]] -name = "crypto-bigint" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4c2f4e1afd912bc40bfd6fed5d9dc1f288e0ba01bfcc835cc5bc3eb13efe15" -dependencies = [ - "generic-array 0.14.7", - "rand_core 0.6.4", - "subtle", - "zeroize", -] - -[[package]] -name = "crypto-common" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" -dependencies = [ - "generic-array 0.14.7", - "typenum", -] - -[[package]] -name = "crypto-mac" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" -dependencies = [ - "generic-array 0.14.7", - "subtle", -] - -[[package]] -name = "crypto-mac" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1d1a86f49236c215f271d40892d5fc950490551400b02ef360692c29815c714" -dependencies = [ - "generic-array 0.14.7", - "subtle", -] - -[[package]] -name = "curve25519-dalek" -version = "2.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a9b85542f99a2dfa2a1b8e192662741c9859a846b296bef1c92ef9b58b5a216" -dependencies = [ - "byteorder", - "digest 0.8.1", - "rand_core 0.5.1", - "subtle", - "zeroize", -] - -[[package]] -name = "curve25519-dalek" -version = "3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b9fdf9972b2bd6af2d913799d9ebc165ea4d2e65878e329d9c6b372c4491b61" -dependencies = [ - "byteorder", - "digest 0.9.0", - "rand_core 0.5.1", - "subtle", - "zeroize", -] - -[[package]] -name = "der" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56acb310e15652100da43d130af8d97b509e95af61aab1c5a7939ef24337ee17" -dependencies = [ - "const-oid", - "zeroize", -] - -[[package]] -name = "derive-syn-parse" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e79116f119dd1dba1abf1f3405f03b9b0e79a27a3883864bfebded8a3dc768cd" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "derive_more" -version = "0.99.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "digest" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" -dependencies = [ - "generic-array 0.12.4", -] - -[[package]] -name = "digest" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" -dependencies = [ - "generic-array 0.14.7", -] - -[[package]] -name = "digest" -version = "0.10.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" -dependencies = [ - "block-buffer 0.10.4", - "const-oid", - "crypto-common", - "subtle", -] - -[[package]] -name = "downcast-rs" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" - -[[package]] -name = "dyn-clonable" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e9232f0e607a262ceb9bd5141a3dfb3e4db6994b31989bbfd845878cba59fd4" -dependencies = [ - "dyn-clonable-impl", - "dyn-clone", -] - -[[package]] -name = "dyn-clonable-impl" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "558e40ea573c374cf53507fd240b7ee2f5477df7cfebdb97323ec61c719399c5" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "dyn-clone" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b0cf012f1230e43cd00ebb729c6bb58707ecfa8ad08b52ef3a4ccd2697fc30" - -[[package]] -name = "ecdsa" -version = "0.16.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0997c976637b606099b9985693efa3581e84e41f5c11ba5255f88711058ad428" -dependencies = [ - "der", - "digest 0.10.7", - "elliptic-curve", - "rfc6979", - "signature 2.1.0", - "spki", -] - -[[package]] -name = "ed25519" -version = "1.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91cff35c70bba8a626e3185d8cd48cc11b5437e1a5bcd15b9b5fa3c64b6dfee7" -dependencies = [ - "signature 1.6.4", -] - -[[package]] -name = "ed25519-dalek" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" -dependencies = [ - "curve25519-dalek 3.2.0", - "ed25519", - "sha2 0.9.9", - "zeroize", -] - -[[package]] -name = "ed25519-zebra" -version = "3.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c24f403d068ad0b359e577a77f92392118be3f3c927538f2bb544a5ecd828c6" -dependencies = [ - "curve25519-dalek 3.2.0", - "hashbrown 0.12.3", - "hex", - "rand_core 0.6.4", - "sha2 0.9.9", - "zeroize", -] - -[[package]] -name = "either" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" - -[[package]] -name = "elliptic-curve" -version = "0.13.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "968405c8fdc9b3bf4df0a6638858cc0b52462836ab6b1c87377785dd09cf1c0b" -dependencies = [ - "base16ct", - "crypto-bigint", - "digest 0.10.7", - "ff", - "generic-array 0.14.7", - "group", - "pkcs8", - "rand_core 0.6.4", - "sec1", - "subtle", - "zeroize", -] - -[[package]] -name = "environmental" -version = "1.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e48c92028aaa870e83d51c64e5d4e0b6981b360c522198c23959f219a4e1b15b" - -[[package]] -name = "errno" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" -dependencies = [ - "errno-dragonfly", - "libc", - "windows-sys 0.48.0", -] - -[[package]] -name = "errno-dragonfly" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" -dependencies = [ - "cc", - "libc", -] - -[[package]] -name = "expander" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f360349150728553f92e4c997a16af8915f418d3a0f21b440d34c5632f16ed84" -dependencies = [ - "blake2", - "fs-err", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "fake-simd" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" - -[[package]] -name = "fallible-iterator" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" - -[[package]] -name = "ff" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" -dependencies = [ - "rand_core 0.6.4", - "subtle", -] - -[[package]] -name = "fixed-hash" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534" -dependencies = [ - "byteorder", - "rand 0.8.5", - "rustc-hex", - "static_assertions", -] - -[[package]] -name = "form_urlencoded" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" -dependencies = [ - "percent-encoding", -] - -[[package]] -name = "frame-benchmarking" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#569aae5341ea0c1d10426fa1ec13a36c0b64393b" -dependencies = [ - "frame-support", - "frame-support-procedural", - "frame-system", - "linregress", - "log", - "parity-scale-codec", - "paste", - "scale-info", - "serde", - "sp-api", - "sp-application-crypto", - "sp-core", - "sp-io", - "sp-runtime", - "sp-runtime-interface", - "sp-std", - "sp-storage", - "static_assertions", -] - -[[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", - "serde", -] - -[[package]] -name = "frame-support" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#569aae5341ea0c1d10426fa1ec13a36c0b64393b" -dependencies = [ - "bitflags", - "environmental", - "frame-metadata", - "frame-support-procedural", - "impl-trait-for-tuples", - "k256", - "log", - "once_cell", - "parity-scale-codec", - "paste", - "scale-info", - "serde", - "smallvec", - "sp-api", - "sp-arithmetic", - "sp-core", - "sp-core-hashing-proc-macro", - "sp-inherents", - "sp-io", - "sp-runtime", - "sp-staking", - "sp-state-machine", - "sp-std", - "sp-tracing", - "sp-weights", - "tt-call", -] - -[[package]] -name = "frame-support-procedural" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#569aae5341ea0c1d10426fa1ec13a36c0b64393b" -dependencies = [ - "Inflector", - "cfg-expr", - "derive-syn-parse", - "frame-support-procedural-tools", - "itertools", - "proc-macro-warning", - "proc-macro2", - "quote", - "syn 2.0.18", -] - -[[package]] -name = "frame-support-procedural-tools" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#569aae5341ea0c1d10426fa1ec13a36c0b64393b" -dependencies = [ - "frame-support-procedural-tools-derive", - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 2.0.18", -] - -[[package]] -name = "frame-support-procedural-tools-derive" -version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#569aae5341ea0c1d10426fa1ec13a36c0b64393b" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.18", -] - -[[package]] -name = "frame-system" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#569aae5341ea0c1d10426fa1ec13a36c0b64393b" -dependencies = [ - "frame-support", - "log", - "parity-scale-codec", - "scale-info", - "serde", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", - "sp-version", - "sp-weights", -] - -[[package]] -name = "fs-err" -version = "2.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0845fa252299212f0389d64ba26f34fa32cfe41588355f21ed507c59a0f64541" - -[[package]] -name = "funty" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" - -[[package]] -name = "futures" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40" -dependencies = [ - "futures-channel", - "futures-core", - "futures-executor", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-channel" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" -dependencies = [ - "futures-core", - "futures-sink", -] - -[[package]] -name = "futures-core" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" - -[[package]] -name = "futures-executor" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0" -dependencies = [ - "futures-core", - "futures-task", - "futures-util", - "num_cpus", -] - -[[package]] -name = "futures-io" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" - -[[package]] -name = "futures-macro" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.18", -] - -[[package]] -name = "futures-sink" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" - -[[package]] -name = "futures-task" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" - -[[package]] -name = "futures-util" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" -dependencies = [ - "futures-channel", - "futures-core", - "futures-io", - "futures-macro", - "futures-sink", - "futures-task", - "memchr", - "pin-project-lite", - "pin-utils", - "slab", -] - -[[package]] -name = "generic-array" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd" -dependencies = [ - "typenum", -] - -[[package]] -name = "generic-array" -version = "0.14.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" -dependencies = [ - "typenum", - "version_check", - "zeroize", -] - -[[package]] -name = "getrandom" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" -dependencies = [ - "cfg-if", - "libc", - "wasi 0.9.0+wasi-snapshot-preview1", -] - -[[package]] -name = "getrandom" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c85e1d9ab2eadba7e5040d4e09cbd6d072b76a557ad64e797c2cb9d4da21d7e4" -dependencies = [ - "cfg-if", - "libc", - "wasi 0.11.0+wasi-snapshot-preview1", -] - -[[package]] -name = "gimli" -version = "0.26.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d" -dependencies = [ - "fallible-iterator", - "stable_deref_trait", -] - -[[package]] -name = "gimli" -version = "0.27.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0a93d233ebf96623465aad4046a8d3aa4da22d4f4beba5388838c8a434bbb4" - -[[package]] -name = "group" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" -dependencies = [ - "ff", - "rand_core 0.6.4", - "subtle", -] - -[[package]] -name = "hash-db" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e7d7786361d7425ae2fe4f9e407eb0efaa0840f5212d109cc018c40c35c6ab4" - -[[package]] -name = "hash256-std-hasher" -version = "0.15.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92c171d55b98633f4ed3860808f004099b36c1cc29c42cfc53aa8591b21efcf2" -dependencies = [ - "crunchy", -] - -[[package]] -name = "hashbrown" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" -dependencies = [ - "ahash 0.7.6", -] - -[[package]] -name = "hashbrown" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" -dependencies = [ - "ahash 0.8.3", -] - -[[package]] -name = "hermit-abi" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" -dependencies = [ - "libc", -] - -[[package]] -name = "hermit-abi" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" - -[[package]] -name = "hex" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" - -[[package]] -name = "hmac" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "126888268dcc288495a26bf004b38c5fdbb31682f992c84ceb046a1f0fe38840" -dependencies = [ - "crypto-mac 0.8.0", - "digest 0.9.0", -] - -[[package]] -name = "hmac" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a2a2320eb7ec0ebe8da8f744d7812d9fc4cb4d09344ac01898dbcb6a20ae69b" -dependencies = [ - "crypto-mac 0.11.1", - "digest 0.9.0", -] - -[[package]] -name = "hmac" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" -dependencies = [ - "digest 0.10.7", -] - -[[package]] -name = "hmac-drbg" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17ea0a1394df5b6574da6e0c1ade9e78868c9fb0a4e5ef4428e32da4676b85b1" -dependencies = [ - "digest 0.9.0", - "generic-array 0.14.7", - "hmac 0.8.1", -] - -[[package]] -name = "iana-time-zone" -version = "0.1.56" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0722cd7114b7de04316e7ea5456a0bbb20e4adb46fd27a3697adb812cff0f37c" -dependencies = [ - "android_system_properties", - "core-foundation-sys", - "iana-time-zone-haiku", - "js-sys", - "wasm-bindgen", - "windows", -] - -[[package]] -name = "iana-time-zone-haiku" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" -dependencies = [ - "cc", -] - -[[package]] -name = "idna" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" -dependencies = [ - "unicode-bidi", - "unicode-normalization", -] - -[[package]] -name = "impl-codec" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba6a270039626615617f3f36d15fc827041df3b78c439da2cadfa47455a77f2f" -dependencies = [ - "parity-scale-codec", -] - -[[package]] -name = "impl-serde" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebc88fc67028ae3db0c853baa36269d398d5f45b6982f95549ff5def78c935cd" -dependencies = [ - "serde", -] - -[[package]] -name = "impl-trait-for-tuples" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11d7a9f6330b71fea57921c9b61c47ee6e84f72d394754eff6163ae67e7395eb" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "indexmap" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" -dependencies = [ - "autocfg", - "hashbrown 0.12.3", - "serde", -] - -[[package]] -name = "integer-sqrt" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "276ec31bcb4a9ee45f58bec6f9ec700ae4cf4f4f8f2fa7e06cb406bd5ffdd770" -dependencies = [ - "num-traits", -] - -[[package]] -name = "io-lifetimes" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" -dependencies = [ - "hermit-abi 0.3.1", - "libc", - "windows-sys 0.48.0", -] - -[[package]] -name = "itertools" -version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" -dependencies = [ - "either", -] - -[[package]] -name = "itoa" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" - -[[package]] -name = "js-sys" -version = "0.3.63" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f37a4a5928311ac501dee68b3c7613a1037d0edb30c8e5427bd832d55d1b790" -dependencies = [ - "wasm-bindgen", -] - -[[package]] -name = "k256" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cadb76004ed8e97623117f3df85b17aaa6626ab0b0831e6573f104df16cd1bcc" -dependencies = [ - "cfg-if", - "ecdsa", - "elliptic-curve", - "once_cell", - "sha2 0.10.6", -] - -[[package]] -name = "keccak" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f6d5ed8676d904364de097082f4e7d240b571b67989ced0240f08b7f966f940" -dependencies = [ - "cpufeatures", -] - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - -[[package]] -name = "libc" -version = "0.2.145" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc86cde3ff845662b8f4ef6cb50ea0e20c524eb3d29ae048287e06a1b3fa6a81" - -[[package]] -name = "libm" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7012b1bbb0719e1097c47611d3898568c546d597c2e74d66f6087edd5233ff4" - -[[package]] -name = "libsecp256k1" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95b09eff1b35ed3b33b877ced3a691fc7a481919c7e29c53c906226fcf55e2a1" -dependencies = [ - "arrayref", - "base64", - "digest 0.9.0", - "hmac-drbg", - "libsecp256k1-core", - "libsecp256k1-gen-ecmult", - "libsecp256k1-gen-genmult", - "rand 0.8.5", - "serde", - "sha2 0.9.9", - "typenum", -] - -[[package]] -name = "libsecp256k1-core" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5be9b9bb642d8522a44d533eab56c16c738301965504753b03ad1de3425d5451" -dependencies = [ - "crunchy", - "digest 0.9.0", - "subtle", -] - -[[package]] -name = "libsecp256k1-gen-ecmult" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3038c808c55c87e8a172643a7d87187fc6c4174468159cb3090659d55bcb4809" -dependencies = [ - "libsecp256k1-core", -] - -[[package]] -name = "libsecp256k1-gen-genmult" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3db8d6ba2cec9eacc40e6e8ccc98931840301f1006e95647ceb2dd5c3aa06f7c" -dependencies = [ - "libsecp256k1-core", -] - -[[package]] -name = "linregress" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "475015a7f8f017edb28d2e69813be23500ad4b32cfe3421c4148efc97324ee52" -dependencies = [ - "nalgebra", -] - -[[package]] -name = "linux-raw-sys" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" - -[[package]] -name = "linux-raw-sys" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" - -[[package]] -name = "lock_api" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" -dependencies = [ - "autocfg", - "scopeguard", -] - -[[package]] -name = "log" -version = "0.4.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "518ef76f2f87365916b142844c16d8fefd85039bc5699050210a7778ee1cd1de" - -[[package]] -name = "mach" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa" -dependencies = [ - "libc", -] - -[[package]] -name = "matchers" -version = "0.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f099785f7595cc4b4553a174ce30dd7589ef93391ff414dbb67f62392b9e0ce1" -dependencies = [ - "regex-automata", -] - -[[package]] -name = "matrixmultiply" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "090126dc04f95dc0d1c1c91f61bdd474b3930ca064c1edc8a849da2c6cbe1e77" -dependencies = [ - "autocfg", - "rawpointer", -] - -[[package]] -name = "memchr" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" - -[[package]] -name = "memfd" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffc89ccdc6e10d6907450f753537ebc5c5d3460d2e4e62ea74bd571db62c0f9e" -dependencies = [ - "rustix 0.37.19", -] - -[[package]] -name = "memoffset" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" -dependencies = [ - "autocfg", -] - -[[package]] -name = "memory-db" -version = "0.32.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "808b50db46293432a45e63bc15ea51e0ab4c0a1647b8eb114e31a3e698dd6fbe" -dependencies = [ - "hash-db", -] - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - -[[package]] -name = "merlin" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e261cf0f8b3c42ded9f7d2bb59dea03aa52bc8a1cbc7482f9fc3fd1229d3b42" -dependencies = [ - "byteorder", - "keccak", - "rand_core 0.5.1", - "zeroize", -] - -[[package]] -name = "miniz_oxide" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa" -dependencies = [ - "adler", -] - -[[package]] -name = "nalgebra" -version = "0.32.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d68d47bba83f9e2006d117a9a33af1524e655516b8919caac694427a6fb1e511" -dependencies = [ - "approx", - "matrixmultiply", - "nalgebra-macros", - "num-complex", - "num-rational", - "num-traits", - "simba", - "typenum", -] - -[[package]] -name = "nalgebra-macros" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d232c68884c0c99810a5a4d333ef7e47689cfd0edc85efc9e54e1e6bf5212766" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "nohash-hasher" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" - -[[package]] -name = "num-bigint" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-complex" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02e0d21255c828d6f128a1e41534206671e8c3ea0c62f32291e808dc82cff17d" -dependencies = [ - "num-traits", -] - -[[package]] -name = "num-format" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a652d9771a63711fd3c3deb670acfbe5c30a4072e664d7a3bf5a9e1056ac72c3" -dependencies = [ - "arrayvec 0.7.2", - "itoa", -] - -[[package]] -name = "num-integer" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" -dependencies = [ - "autocfg", - "num-traits", -] - -[[package]] -name = "num-rational" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" -dependencies = [ - "autocfg", - "num-bigint", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-traits" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" -dependencies = [ - "autocfg", -] - -[[package]] -name = "num_cpus" -version = "1.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" -dependencies = [ - "hermit-abi 0.2.6", - "libc", -] - -[[package]] -name = "object" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21158b2c33aa6d4561f1c0a6ea283ca92bc54802a93b263e910746d679a7eb53" -dependencies = [ - "crc32fast", - "hashbrown 0.12.3", - "indexmap", - "memchr", -] - -[[package]] -name = "object" -version = "0.30.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea86265d3d3dcb6a27fc51bd29a4bf387fae9d2986b823079d4986af253eb439" -dependencies = [ - "memchr", -] - -[[package]] -name = "once_cell" -version = "1.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" - -[[package]] -name = "opaque-debug" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" - -[[package]] -name = "opaque-debug" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" - -[[package]] -name = "pallet-livingassets-ownership" -version = "0.0.1" -dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "parity-scale-codec", - "scale-info", - "serde", - "sp-core", - "sp-io", - "sp-runtime", -] - -[[package]] -name = "parity-scale-codec" -version = "3.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ddb756ca205bd108aee3c62c6d3c994e1df84a59b9d6d4a5ea42ee1fd5a9a28" -dependencies = [ - "arrayvec 0.7.2", - "bitvec", - "byte-slice-cast", - "bytes", - "impl-trait-for-tuples", - "parity-scale-codec-derive", - "serde", -] - -[[package]] -name = "parity-scale-codec-derive" -version = "3.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b26a931f824dd4eca30b3e43bb4f31cd5f0d3a403c5f5ff27106b805bfde7b" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "parity-wasm" -version = "0.45.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1ad0aff30c1da14b1254fcb2af73e1fa9a28670e584a626f53a369d0e157304" - -[[package]] -name = "parking_lot" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" -dependencies = [ - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.9.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall", - "smallvec", - "windows-sys 0.45.0", -] - -[[package]] -name = "paste" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f746c4065a8fa3fe23974dd82f15431cc8d40779821001404d10d2e79ca7d79" - -[[package]] -name = "pbkdf2" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d95f5254224e617595d2cc3cc73ff0a5eaf2637519e25f03388154e9378b6ffa" -dependencies = [ - "crypto-mac 0.11.1", -] - -[[package]] -name = "pbkdf2" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" -dependencies = [ - "digest 0.10.7", -] - -[[package]] -name = "percent-encoding" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" - -[[package]] -name = "pin-project-lite" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" - -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - -[[package]] -name = "pkcs8" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" -dependencies = [ - "der", - "spki", -] - -[[package]] -name = "ppv-lite86" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" - -[[package]] -name = "primitive-types" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f3486ccba82358b11a77516035647c34ba167dfa53312630de83b12bd4f3d66" -dependencies = [ - "fixed-hash", - "impl-codec", - "impl-serde", - "scale-info", - "uint", -] - -[[package]] -name = "proc-macro-crate" -version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" -dependencies = [ - "once_cell", - "toml_edit", -] - -[[package]] -name = "proc-macro-warning" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e99670bafb56b9a106419397343bdbc8b8742c3cc449fec6345f86173f47cd4" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.18", -] - -[[package]] -name = "proc-macro2" -version = "1.0.59" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6aeca18b86b413c660b781aa319e4e2648a3e6f9eadc9b47e9038e6fe9f3451b" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "psm" -version = "0.1.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5787f7cda34e3033a72192c018bc5883100330f362ef279a8cbccfce8bb4e874" -dependencies = [ - "cc", -] - -[[package]] -name = "quote" -version = "1.0.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "radium" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" - -[[package]] -name = "rand" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" -dependencies = [ - "getrandom 0.1.16", - "libc", - "rand_chacha 0.2.2", - "rand_core 0.5.1", - "rand_hc", -] - -[[package]] -name = "rand" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" -dependencies = [ - "libc", - "rand_chacha 0.3.1", - "rand_core 0.6.4", -] - -[[package]] -name = "rand_chacha" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" -dependencies = [ - "ppv-lite86", - "rand_core 0.5.1", -] - -[[package]] -name = "rand_chacha" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", - "rand_core 0.6.4", -] - -[[package]] -name = "rand_core" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" -dependencies = [ - "getrandom 0.1.16", -] - -[[package]] -name = "rand_core" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom 0.2.9", -] - -[[package]] -name = "rand_hc" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" -dependencies = [ - "rand_core 0.5.1", -] - -[[package]] -name = "rawpointer" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" - -[[package]] -name = "redox_syscall" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" -dependencies = [ - "bitflags", -] - -[[package]] -name = "ref-cast" -version = "1.0.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f43faa91b1c8b36841ee70e97188a869d37ae21759da6846d4be66de5bf7b12c" -dependencies = [ - "ref-cast-impl", -] - -[[package]] -name = "ref-cast-impl" -version = "1.0.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d2275aab483050ab2a7364c1a46604865ee7d6906684e08db0f090acf74f9e7" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.18", -] - -[[package]] -name = "regex" -version = "1.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81ca098a9821bd52d6b24fd8b10bd081f47d39c22778cafaa75a2857a62c6390" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax 0.7.2", -] - -[[package]] -name = "regex-automata" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" -dependencies = [ - "regex-syntax 0.6.29", -] - -[[package]] -name = "regex-syntax" -version = "0.6.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" - -[[package]] -name = "regex-syntax" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "436b050e76ed2903236f032a59761c1eb99e1b0aead2c257922771dab1fc8c78" - -[[package]] -name = "rfc6979" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" -dependencies = [ - "hmac 0.12.1", - "subtle", -] - -[[package]] -name = "rustc-demangle" -version = "0.1.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" - -[[package]] -name = "rustc-hash" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" - -[[package]] -name = "rustc-hex" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" - -[[package]] -name = "rustix" -version = "0.36.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14e4d67015953998ad0eb82887a0eb0129e18a7e2f3b7b0f6c422fddcd503d62" -dependencies = [ - "bitflags", - "errno", - "io-lifetimes", - "libc", - "linux-raw-sys 0.1.4", - "windows-sys 0.45.0", -] - -[[package]] -name = "rustix" -version = "0.37.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acf8729d8542766f1b2cf77eb034d52f40d375bb8b615d0b147089946e16613d" -dependencies = [ - "bitflags", - "errno", - "io-lifetimes", - "libc", - "linux-raw-sys 0.3.8", - "windows-sys 0.48.0", -] - -[[package]] -name = "rustversion" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f3208ce4d8448b3f3e7d168a73f5e0c43a61e32930de3bceeccedb388b6bf06" - -[[package]] -name = "ryu" -version = "1.0.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" - -[[package]] -name = "safe_arch" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "794821e4ccb0d9f979512f9c1973480123f9bd62a90d74ab0f9426fcf8f4a529" -dependencies = [ - "bytemuck", -] - -[[package]] -name = "scale-info" -version = "2.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b569c32c806ec3abdf3b5869fb8bf1e0d275a7c1c9b0b05603d9464632649edf" -dependencies = [ - "bitvec", - "cfg-if", - "derive_more", - "parity-scale-codec", - "scale-info-derive", - "serde", -] - -[[package]] -name = "scale-info-derive" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53012eae69e5aa5c14671942a5dd47de59d4cdcff8532a6dd0e081faf1119482" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "schnellru" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "772575a524feeb803e5b0fcbc6dd9f367e579488197c94c6e4023aad2305774d" -dependencies = [ - "ahash 0.8.3", - "cfg-if", - "hashbrown 0.13.2", -] - -[[package]] -name = "schnorrkel" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "021b403afe70d81eea68f6ea12f6b3c9588e5d536a94c3bf80f15e7faa267862" -dependencies = [ - "arrayref", - "arrayvec 0.5.2", - "curve25519-dalek 2.1.3", - "getrandom 0.1.16", - "merlin", - "rand 0.7.3", - "rand_core 0.5.1", - "sha2 0.8.2", - "subtle", - "zeroize", -] - -[[package]] -name = "scopeguard" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" - -[[package]] -name = "sec1" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0aec48e813d6b90b15f0b8948af3c63483992dee44c03e9930b3eebdabe046e" -dependencies = [ - "base16ct", - "der", - "generic-array 0.14.7", - "pkcs8", - "subtle", - "zeroize", -] - -[[package]] -name = "secp256k1" -version = "0.24.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b1629c9c557ef9b293568b338dddfc8208c98a18c59d722a9d53f859d9c9b62" -dependencies = [ - "secp256k1-sys", -] - -[[package]] -name = "secp256k1-sys" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83080e2c2fc1006e625be82e5d1eb6a43b7fd9578b617fcc55814daf286bba4b" -dependencies = [ - "cc", -] - -[[package]] -name = "secrecy" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bd1c54ea06cfd2f6b63219704de0b9b4f72dcc2b8fdef820be6cd799780e91e" -dependencies = [ - "zeroize", -] - -[[package]] -name = "serde" -version = "1.0.163" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2113ab51b87a539ae008b5c6c02dc020ffa39afd2d83cffcb3f4eb2722cebec2" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.163" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c805777e3930c8883389c602315a24224bcc738b63905ef87cd1420353ea93e" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.18", -] - -[[package]] -name = "serde_json" -version = "1.0.96" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "057d394a50403bcac12672b2b18fb387ab6d289d957dab67dd201875391e52f1" -dependencies = [ - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "sha2" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a256f46ea78a0c0d9ff00077504903ac881a1dafdc20da66545699e7776b3e69" -dependencies = [ - "block-buffer 0.7.3", - "digest 0.8.1", - "fake-simd", - "opaque-debug 0.2.3", -] - -[[package]] -name = "sha2" -version = "0.9.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" -dependencies = [ - "block-buffer 0.9.0", - "cfg-if", - "cpufeatures", - "digest 0.9.0", - "opaque-debug 0.3.0", -] - -[[package]] -name = "sha2" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest 0.10.7", -] - -[[package]] -name = "sha3" -version = "0.10.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" -dependencies = [ - "digest 0.10.7", - "keccak", -] - -[[package]] -name = "sharded-slab" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31" -dependencies = [ - "lazy_static", -] - -[[package]] -name = "signature" -version = "1.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" - -[[package]] -name = "signature" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e1788eed21689f9cf370582dfc467ef36ed9c707f073528ddafa8d83e3b8500" -dependencies = [ - "digest 0.10.7", - "rand_core 0.6.4", -] - -[[package]] -name = "simba" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "061507c94fc6ab4ba1c9a0305018408e312e17c041eb63bef8aa726fa33aceae" -dependencies = [ - "approx", - "num-complex", - "num-traits", - "paste", - "wide", -] - -[[package]] -name = "slab" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" -dependencies = [ - "autocfg", -] - -[[package]] -name = "smallvec" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" - -[[package]] -name = "sp-api" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#569aae5341ea0c1d10426fa1ec13a36c0b64393b" -dependencies = [ - "hash-db", - "log", - "parity-scale-codec", - "scale-info", - "sp-api-proc-macro", - "sp-core", - "sp-metadata-ir", - "sp-runtime", - "sp-state-machine", - "sp-std", - "sp-trie", - "sp-version", - "thiserror", -] - -[[package]] -name = "sp-api-proc-macro" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#569aae5341ea0c1d10426fa1ec13a36c0b64393b" -dependencies = [ - "Inflector", - "blake2", - "expander", - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 2.0.18", -] - -[[package]] -name = "sp-application-crypto" -version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#569aae5341ea0c1d10426fa1ec13a36c0b64393b" -dependencies = [ - "parity-scale-codec", - "scale-info", - "serde", - "sp-core", - "sp-io", - "sp-std", -] - -[[package]] -name = "sp-arithmetic" -version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#569aae5341ea0c1d10426fa1ec13a36c0b64393b" -dependencies = [ - "integer-sqrt", - "num-traits", - "parity-scale-codec", - "scale-info", - "serde", - "sp-std", - "static_assertions", -] - -[[package]] -name = "sp-core" -version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#569aae5341ea0c1d10426fa1ec13a36c0b64393b" -dependencies = [ - "array-bytes", - "bitflags", - "blake2", - "bounded-collections", - "bs58", - "dyn-clonable", - "ed25519-zebra", - "futures", - "hash-db", - "hash256-std-hasher", - "impl-serde", - "lazy_static", - "libsecp256k1", - "log", - "merlin", - "parity-scale-codec", - "parking_lot", - "paste", - "primitive-types", - "rand 0.8.5", - "regex", - "scale-info", - "schnorrkel", - "secp256k1", - "secrecy", - "serde", - "sp-core-hashing", - "sp-debug-derive", - "sp-externalities", - "sp-runtime-interface", - "sp-std", - "sp-storage", - "ss58-registry", - "substrate-bip39", - "thiserror", - "tiny-bip39", - "zeroize", -] - -[[package]] -name = "sp-core-hashing" -version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#569aae5341ea0c1d10426fa1ec13a36c0b64393b" -dependencies = [ - "blake2b_simd", - "byteorder", - "digest 0.10.7", - "sha2 0.10.6", - "sha3", - "sp-std", - "twox-hash", -] - -[[package]] -name = "sp-core-hashing-proc-macro" -version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#569aae5341ea0c1d10426fa1ec13a36c0b64393b" -dependencies = [ - "proc-macro2", - "quote", - "sp-core-hashing", - "syn 2.0.18", -] - -[[package]] -name = "sp-debug-derive" -version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#569aae5341ea0c1d10426fa1ec13a36c0b64393b" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.18", -] - -[[package]] -name = "sp-externalities" -version = "0.13.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#569aae5341ea0c1d10426fa1ec13a36c0b64393b" -dependencies = [ - "environmental", - "parity-scale-codec", - "sp-std", - "sp-storage", -] - -[[package]] -name = "sp-inherents" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#569aae5341ea0c1d10426fa1ec13a36c0b64393b" -dependencies = [ - "async-trait", - "impl-trait-for-tuples", - "parity-scale-codec", - "scale-info", - "sp-core", - "sp-runtime", - "sp-std", - "thiserror", -] - -[[package]] -name = "sp-io" -version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#569aae5341ea0c1d10426fa1ec13a36c0b64393b" -dependencies = [ - "bytes", - "ed25519", - "ed25519-dalek", - "futures", - "libsecp256k1", - "log", - "parity-scale-codec", - "rustversion", - "secp256k1", - "sp-core", - "sp-externalities", - "sp-keystore", - "sp-runtime-interface", - "sp-state-machine", - "sp-std", - "sp-tracing", - "sp-trie", - "tracing", - "tracing-core", -] - -[[package]] -name = "sp-keystore" -version = "0.13.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#569aae5341ea0c1d10426fa1ec13a36c0b64393b" -dependencies = [ - "futures", - "parity-scale-codec", - "parking_lot", - "sp-core", - "sp-externalities", - "thiserror", -] - -[[package]] -name = "sp-metadata-ir" -version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#569aae5341ea0c1d10426fa1ec13a36c0b64393b" -dependencies = [ - "frame-metadata", - "parity-scale-codec", - "scale-info", - "sp-std", -] - -[[package]] -name = "sp-panic-handler" -version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#569aae5341ea0c1d10426fa1ec13a36c0b64393b" -dependencies = [ - "backtrace", - "lazy_static", - "regex", -] - -[[package]] -name = "sp-runtime" -version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#569aae5341ea0c1d10426fa1ec13a36c0b64393b" -dependencies = [ - "either", - "hash256-std-hasher", - "impl-trait-for-tuples", - "log", - "parity-scale-codec", - "paste", - "rand 0.8.5", - "scale-info", - "serde", - "sp-application-crypto", - "sp-arithmetic", - "sp-core", - "sp-io", - "sp-std", - "sp-weights", -] - -[[package]] -name = "sp-runtime-interface" -version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#569aae5341ea0c1d10426fa1ec13a36c0b64393b" -dependencies = [ - "bytes", - "impl-trait-for-tuples", - "parity-scale-codec", - "primitive-types", - "sp-externalities", - "sp-runtime-interface-proc-macro", - "sp-std", - "sp-storage", - "sp-tracing", - "sp-wasm-interface", - "static_assertions", -] - -[[package]] -name = "sp-runtime-interface-proc-macro" -version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#569aae5341ea0c1d10426fa1ec13a36c0b64393b" -dependencies = [ - "Inflector", - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 2.0.18", -] - -[[package]] -name = "sp-staking" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#569aae5341ea0c1d10426fa1ec13a36c0b64393b" -dependencies = [ - "parity-scale-codec", - "scale-info", - "serde", - "sp-core", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "sp-state-machine" -version = "0.13.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#569aae5341ea0c1d10426fa1ec13a36c0b64393b" -dependencies = [ - "hash-db", - "log", - "parity-scale-codec", - "parking_lot", - "rand 0.8.5", - "smallvec", - "sp-core", - "sp-externalities", - "sp-panic-handler", - "sp-std", - "sp-trie", - "thiserror", - "tracing", -] - -[[package]] -name = "sp-std" -version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#569aae5341ea0c1d10426fa1ec13a36c0b64393b" - -[[package]] -name = "sp-storage" -version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#569aae5341ea0c1d10426fa1ec13a36c0b64393b" -dependencies = [ - "impl-serde", - "parity-scale-codec", - "ref-cast", - "serde", - "sp-debug-derive", - "sp-std", -] - -[[package]] -name = "sp-tracing" -version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#569aae5341ea0c1d10426fa1ec13a36c0b64393b" -dependencies = [ - "parity-scale-codec", - "sp-std", - "tracing", - "tracing-core", - "tracing-subscriber", -] - -[[package]] -name = "sp-trie" -version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#569aae5341ea0c1d10426fa1ec13a36c0b64393b" -dependencies = [ - "ahash 0.8.3", - "hash-db", - "hashbrown 0.13.2", - "lazy_static", - "memory-db", - "nohash-hasher", - "parity-scale-codec", - "parking_lot", - "scale-info", - "schnellru", - "sp-core", - "sp-std", - "thiserror", - "tracing", - "trie-db", - "trie-root", -] - -[[package]] -name = "sp-version" -version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#569aae5341ea0c1d10426fa1ec13a36c0b64393b" -dependencies = [ - "impl-serde", - "parity-scale-codec", - "parity-wasm", - "scale-info", - "serde", - "sp-core-hashing-proc-macro", - "sp-runtime", - "sp-std", - "sp-version-proc-macro", - "thiserror", -] - -[[package]] -name = "sp-version-proc-macro" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#569aae5341ea0c1d10426fa1ec13a36c0b64393b" -dependencies = [ - "parity-scale-codec", - "proc-macro2", - "quote", - "syn 2.0.18", -] - -[[package]] -name = "sp-wasm-interface" -version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#569aae5341ea0c1d10426fa1ec13a36c0b64393b" -dependencies = [ - "anyhow", - "impl-trait-for-tuples", - "log", - "parity-scale-codec", - "sp-std", - "wasmi", - "wasmtime", -] - -[[package]] -name = "sp-weights" -version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#569aae5341ea0c1d10426fa1ec13a36c0b64393b" -dependencies = [ - "parity-scale-codec", - "scale-info", - "serde", - "smallvec", - "sp-arithmetic", - "sp-core", - "sp-debug-derive", - "sp-std", -] - -[[package]] -name = "spki" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d1e996ef02c474957d681f1b05213dfb0abab947b446a62d37770b23500184a" -dependencies = [ - "base64ct", - "der", -] - -[[package]] -name = "ss58-registry" -version = "1.40.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb47a8ad42e5fc72d5b1eb104a5546937eaf39843499948bb666d6e93c62423b" -dependencies = [ - "Inflector", - "num-format", - "proc-macro2", - "quote", - "serde", - "serde_json", - "unicode-xid", -] - -[[package]] -name = "stable_deref_trait" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" - -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - -[[package]] -name = "substrate-bip39" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49eee6965196b32f882dd2ee85a92b1dbead41b04e53907f269de3b0dc04733c" -dependencies = [ - "hmac 0.11.0", - "pbkdf2 0.8.0", - "schnorrkel", - "sha2 0.9.9", - "zeroize", -] - -[[package]] -name = "subtle" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" - -[[package]] -name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "syn" -version = "2.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32d41677bcbe24c20c52e7c70b0d8db04134c5d1066bf98662e2871ad200ea3e" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "tap" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" - -[[package]] -name = "target-lexicon" -version = "0.12.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd1ba337640d60c3e96bc6f0638a939b9c9a7f2c316a1598c279828b3d1dc8c5" - -[[package]] -name = "thiserror" -version = "1.0.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.18", -] - -[[package]] -name = "thread_local" -version = "1.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" -dependencies = [ - "cfg-if", - "once_cell", -] - -[[package]] -name = "tiny-bip39" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62cc94d358b5a1e84a5cb9109f559aa3c4d634d2b1b4de3d0fa4adc7c78e2861" -dependencies = [ - "anyhow", - "hmac 0.12.1", - "once_cell", - "pbkdf2 0.11.0", - "rand 0.8.5", - "rustc-hash", - "sha2 0.10.6", - "thiserror", - "unicode-normalization", - "wasm-bindgen", - "zeroize", -] - -[[package]] -name = "tinyvec" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" -dependencies = [ - "tinyvec_macros", -] - -[[package]] -name = "tinyvec_macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" - -[[package]] -name = "toml_datetime" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a76a9312f5ba4c2dec6b9161fdf25d87ad8a09256ccea5a556fef03c706a10f" - -[[package]] -name = "toml_edit" -version = "0.19.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2380d56e8670370eee6566b0bfd4265f65b3f432e8c6d85623f728d4fa31f739" -dependencies = [ - "indexmap", - "toml_datetime", - "winnow", -] - -[[package]] -name = "tracing" -version = "0.1.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" -dependencies = [ - "cfg-if", - "pin-project-lite", - "tracing-attributes", - "tracing-core", -] - -[[package]] -name = "tracing-attributes" -version = "0.1.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f57e3ca2a01450b1a921183a9c9cbfda207fd822cef4ccb00a65402cbba7a74" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.18", -] - -[[package]] -name = "tracing-core" -version = "0.1.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" -dependencies = [ - "once_cell", - "valuable", -] - -[[package]] -name = "tracing-log" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922" -dependencies = [ - "lazy_static", - "log", - "tracing-core", -] - -[[package]] -name = "tracing-serde" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc6b213177105856957181934e4920de57730fc69bf42c37ee5bb664d406d9e1" -dependencies = [ - "serde", - "tracing-core", -] - -[[package]] -name = "tracing-subscriber" -version = "0.2.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e0d2eaa99c3c2e41547cfa109e910a68ea03823cccad4a0525dcbc9b01e8c71" -dependencies = [ - "ansi_term", - "chrono", - "lazy_static", - "matchers", - "regex", - "serde", - "serde_json", - "sharded-slab", - "smallvec", - "thread_local", - "tracing", - "tracing-core", - "tracing-log", - "tracing-serde", -] - -[[package]] -name = "trie-db" -version = "0.27.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "767abe6ffed88a1889671a102c2861ae742726f52e0a5a425b92c9fbfa7e9c85" -dependencies = [ - "hash-db", - "hashbrown 0.13.2", - "log", - "rustc-hex", - "smallvec", -] - -[[package]] -name = "trie-root" -version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4ed310ef5ab98f5fa467900ed906cb9232dd5376597e00fd4cba2a449d06c0b" -dependencies = [ - "hash-db", -] - -[[package]] -name = "tt-call" -version = "1.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4f195fd851901624eee5a58c4bb2b4f06399148fcd0ed336e6f1cb60a9881df" - -[[package]] -name = "twox-hash" -version = "1.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" -dependencies = [ - "cfg-if", - "digest 0.10.7", - "rand 0.8.5", - "static_assertions", -] - -[[package]] -name = "typenum" -version = "1.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" - -[[package]] -name = "uint" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" -dependencies = [ - "byteorder", - "crunchy", - "hex", - "static_assertions", -] - -[[package]] -name = "unicode-bidi" -version = "0.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" - -[[package]] -name = "unicode-ident" -version = "1.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" - -[[package]] -name = "unicode-normalization" -version = "0.1.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" -dependencies = [ - "tinyvec", -] - -[[package]] -name = "unicode-xid" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" - -[[package]] -name = "url" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" -dependencies = [ - "form_urlencoded", - "idna", - "percent-encoding", -] - -[[package]] -name = "valuable" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" - -[[package]] -name = "version_check" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wasi" -version = "0.9.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" - -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - -[[package]] -name = "wasm-bindgen" -version = "0.2.86" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bba0e8cb82ba49ff4e229459ff22a191bbe9a1cb3a341610c9c33efc27ddf73" -dependencies = [ - "cfg-if", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.86" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19b04bc93f9d6bdee709f6bd2118f57dd6679cf1176a1af464fca3ab0d66d8fb" -dependencies = [ - "bumpalo", - "log", - "once_cell", - "proc-macro2", - "quote", - "syn 2.0.18", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.86" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14d6b024f1a526bb0234f52840389927257beb670610081360e5a03c5df9c258" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.86" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e128beba882dd1eb6200e1dc92ae6c5dbaa4311aa7bb211ca035779e5efc39f8" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.18", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.86" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed9d5b4305409d1fc9482fee2d7f9bcbf24b3972bf59817ef757e23982242a93" - -[[package]] -name = "wasmi" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06c326c93fbf86419608361a2c925a31754cf109da1b8b55737070b4d6669422" -dependencies = [ - "parity-wasm", - "wasmi-validation", - "wasmi_core", -] - -[[package]] -name = "wasmi-validation" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ff416ad1ff0c42e5a926ed5d5fab74c0f098749aa0ad8b2a34b982ce0e867b" -dependencies = [ - "parity-wasm", -] - -[[package]] -name = "wasmi_core" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57d20cb3c59b788653d99541c646c561c9dd26506f25c0cebfe810659c54c6d7" -dependencies = [ - "downcast-rs", - "libm", - "memory_units", - "num-rational", - "num-traits", -] - -[[package]] -name = "wasmparser" -version = "0.100.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64b20236ab624147dfbb62cf12a19aaf66af0e41b8398838b66e997d07d269d4" -dependencies = [ - "indexmap", - "url", -] - -[[package]] -name = "wasmtime" -version = "6.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76a222f5fa1e14b2cefc286f1b68494d7a965f4bf57ec04c59bb62673d639af6" -dependencies = [ - "anyhow", - "bincode", - "cfg-if", - "indexmap", - "libc", - "log", - "object 0.29.0", - "once_cell", - "paste", - "psm", - "serde", - "target-lexicon", - "wasmparser", - "wasmtime-environ", - "wasmtime-jit", - "wasmtime-runtime", - "windows-sys 0.42.0", -] - -[[package]] -name = "wasmtime-asm-macros" -version = "6.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4407a7246e7d2f3d8fb1cf0c72fda8dbafdb6dd34d555ae8bea0e5ae031089cc" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "wasmtime-environ" -version = "6.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47b8b50962eae38ee319f7b24900b7cf371f03eebdc17400c1dc8575fc10c9a7" -dependencies = [ - "anyhow", - "cranelift-entity", - "gimli 0.26.2", - "indexmap", - "log", - "object 0.29.0", - "serde", - "target-lexicon", - "thiserror", - "wasmparser", - "wasmtime-types", -] - -[[package]] -name = "wasmtime-jit" -version = "6.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffaed4f9a234ba5225d8e64eac7b4a5d13b994aeb37353cde2cbeb3febda9eaa" -dependencies = [ - "addr2line 0.17.0", - "anyhow", - "bincode", - "cfg-if", - "cpp_demangle", - "gimli 0.26.2", - "log", - "object 0.29.0", - "rustc-demangle", - "serde", - "target-lexicon", - "wasmtime-environ", - "wasmtime-jit-icache-coherence", - "wasmtime-runtime", - "windows-sys 0.42.0", -] - -[[package]] -name = "wasmtime-jit-debug" -version = "6.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eed41cbcbf74ce3ff6f1d07d1b707888166dc408d1a880f651268f4f7c9194b2" -dependencies = [ - "once_cell", -] - -[[package]] -name = "wasmtime-jit-icache-coherence" -version = "6.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a28ae1e648461bfdbb79db3efdaee1bca5b940872e4175390f465593a2e54c" -dependencies = [ - "cfg-if", - "libc", - "windows-sys 0.42.0", -] - -[[package]] -name = "wasmtime-runtime" -version = "6.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e704b126e4252788ccfc3526d4d4511d4b23c521bf123e447ac726c14545217b" -dependencies = [ - "anyhow", - "cc", - "cfg-if", - "indexmap", - "libc", - "log", - "mach", - "memfd", - "memoffset", - "paste", - "rand 0.8.5", - "rustix 0.36.14", - "wasmtime-asm-macros", - "wasmtime-environ", - "wasmtime-jit-debug", - "windows-sys 0.42.0", -] - -[[package]] -name = "wasmtime-types" -version = "6.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83e5572c5727c1ee7e8f28717aaa8400e4d22dcbd714ea5457d85b5005206568" -dependencies = [ - "cranelift-entity", - "serde", - "thiserror", - "wasmparser", -] - -[[package]] -name = "wide" -version = "0.7.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cd0496a71f3cc6bc4bf0ed91346426a5099e93d89807e663162dc5a1069ff65" -dependencies = [ - "bytemuck", - "safe_arch", -] - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "windows" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" -dependencies = [ - "windows-targets 0.48.0", -] - -[[package]] -name = "windows-sys" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" -dependencies = [ - "windows_aarch64_gnullvm 0.42.2", - "windows_aarch64_msvc 0.42.2", - "windows_i686_gnu 0.42.2", - "windows_i686_msvc 0.42.2", - "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm 0.42.2", - "windows_x86_64_msvc 0.42.2", -] - -[[package]] -name = "windows-sys" -version = "0.45.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" -dependencies = [ - "windows-targets 0.42.2", -] - -[[package]] -name = "windows-sys" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" -dependencies = [ - "windows-targets 0.48.0", -] - -[[package]] -name = "windows-targets" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" -dependencies = [ - "windows_aarch64_gnullvm 0.42.2", - "windows_aarch64_msvc 0.42.2", - "windows_i686_gnu 0.42.2", - "windows_i686_msvc 0.42.2", - "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm 0.42.2", - "windows_x86_64_msvc 0.42.2", -] - -[[package]] -name = "windows-targets" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" -dependencies = [ - "windows_aarch64_gnullvm 0.48.0", - "windows_aarch64_msvc 0.48.0", - "windows_i686_gnu 0.48.0", - "windows_i686_msvc 0.48.0", - "windows_x86_64_gnu 0.48.0", - "windows_x86_64_gnullvm 0.48.0", - "windows_x86_64_msvc 0.48.0", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" - -[[package]] -name = "windows_i686_gnu" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" - -[[package]] -name = "windows_i686_gnu" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" - -[[package]] -name = "windows_i686_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" - -[[package]] -name = "windows_i686_msvc" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" - -[[package]] -name = "winnow" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61de7bac303dc551fe038e2b3cef0f571087a47571ea6e79a87692ac99b99699" -dependencies = [ - "memchr", -] - -[[package]] -name = "wyz" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" -dependencies = [ - "tap", -] - -[[package]] -name = "zeroize" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a0956f1ba7c7909bfb66c2e9e4124ab6f6482560f6628b5aaeba39207c9aad9" -dependencies = [ - "zeroize_derive", -] - -[[package]] -name = "zeroize_derive" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.18", -] diff --git a/pallets/living-assets-ownership/Cargo.toml b/pallets/living-assets-ownership/Cargo.toml index 1e1730c6..44f8793f 100644 --- a/pallets/living-assets-ownership/Cargo.toml +++ b/pallets/living-assets-ownership/Cargo.toml @@ -12,7 +12,7 @@ edition = "2021" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -codec = { package = "parity-scale-codec", version = "3.0.0", features = ["derive"], default-features = false } +codec = { package = "parity-scale-codec", version = "3.2.2", features = ["derive"], default-features = false } scale-info = { version = "2.2.0", default-features = false, features = ["derive"] } # Substrate diff --git a/precompile/living-assets/Cargo.toml b/precompile/living-assets/Cargo.toml index 1b0ad3b5..936286ad 100644 --- a/precompile/living-assets/Cargo.toml +++ b/precompile/living-assets/Cargo.toml @@ -8,7 +8,6 @@ repository = "https://github.com/freeverseio/pallet-livingassets-ownership" edition = "2021" [dependencies] -evm = { git = "https://github.com/rust-blockchain/evm", rev = "b7b82c7e1fc57b7449d6dfa6826600de37cc1e65", default-features = false } parity-scale-codec = { version = "3.2.2", default-features = false, features = [ "derive", ] } @@ -30,6 +29,10 @@ sp-std = { git = "https://github.com/paritytech/substrate", default-features = f # Local pallet pallet-living-assets-ownership = { path = "../../pallets/living-assets-ownership", default-features = false } +# Utils +precompile-utils = { path = "../utils", default-features = false } +precompile-utils-macro = { path = "../utils/macro", default-features = false } + num_enum = { version = "0.5.3", default-features = false } [features] @@ -45,4 +48,7 @@ std = [ "num_enum/std", "frame-support/std", "sp-arithmetic/std", + "precompile-utils/std", + "parity-scale-codec/std", + "scale-info/std", ] diff --git a/precompile/living-assets/src/lib.rs b/precompile/living-assets/src/lib.rs index d1375332..65f927e8 100644 --- a/precompile/living-assets/src/lib.rs +++ b/precompile/living-assets/src/lib.rs @@ -1,43 +1,33 @@ -// SPDX-License-Identifier: Apache-2.0 -// This file is part of Frontier. -// -// Copyright (c) 2020-2022 Parity Technologies (UK) Ltd. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - //! Living Assets precompile module. #![cfg_attr(not(feature = "std"), no_std)] #![cfg_attr(test, feature(assert_matches))] - -use fp_evm::{ - ExitError, ExitSucceed, PrecompileFailure, PrecompileHandle, PrecompileOutput, PrecompileResult, -}; +use fp_evm::{ExitError, ExitSucceed, PrecompileFailure, PrecompileHandle, PrecompileOutput}; use frame_support::log; use pallet_living_assets_ownership::LivingAssetsOwnership; +use parity_scale_codec::Encode; +use precompile_utils::{Address, EvmResult, FunctionModifier, PrecompileHandleExt}; use sp_arithmetic::traits::BaseArithmetic; -// use precompile_utils::{Address, EvmResult, FunctionModifier, PrecompileHandleExt}; use sp_runtime::SaturatedConversion; -use sp_core::H160; use sp_std::marker::PhantomData; +#[precompile_utils_macro::generate_function_selector] +#[derive(Debug, PartialEq)] +pub enum Action { + /// Create a new collection + CreateCollection = "createCollection(uint64,address)", + /// Get owner of the collection + OwnerOfCollection = "owner_of_collection(uint64)", +} + /// Wrapper for the precompile function. pub struct LivingAssetsOwnershipPrecompile( PhantomData<(AddressMapping, AccountId, CollectionId, LivingAssets)>, ) where AddressMapping: pallet_evm::AddressMapping, + AccountId: Encode, CollectionId: BaseArithmetic, LivingAssets: LivingAssetsOwnership; @@ -45,9 +35,11 @@ impl LivingAssetsOwnershipPrecompile where AddressMapping: pallet_evm::AddressMapping, + AccountId: Encode, CollectionId: BaseArithmetic, LivingAssets: LivingAssetsOwnership, { + #[allow(clippy::new_without_default)] pub fn new() -> Self { Self(PhantomData) } @@ -57,35 +49,60 @@ impl fp_evm::Precompile for LivingAssetsOwnershipPrecompile where AddressMapping: pallet_evm::AddressMapping, + AccountId: Encode, CollectionId: BaseArithmetic, LivingAssets: LivingAssetsOwnership, { - fn execute(handle: &mut impl PrecompileHandle) -> PrecompileResult { + fn execute(handle: &mut impl PrecompileHandle) -> EvmResult { log::trace!(target: "ds-precompile", "Execute input = {:?}", handle.input()); + let selector = handle.read_selector()?; - let context = handle.context(); - let input = handle.input(); + handle.check_function_modifier(match selector { + Action::OwnerOfCollection => FunctionModifier::View, + _ => FunctionModifier::NonPayable, + })?; - log::info!("Context: {:?}", context); + match selector { + // read storage + Action::OwnerOfCollection => { + let mut input = handle.read_input()?; + input.expect_arguments(1)?; - // first read u64 from input - let mut buffer = [0u8; 8]; - buffer.copy_from_slice(&input[..8]); - let collection_id = u64::from_be_bytes(buffer).saturated_into(); + if let Some(owner) = + LivingAssets::owner_of_collection(input.read::()?.saturated_into()) + { + Ok(PrecompileOutput { + exit_status: ExitSucceed::Returned, + output: owner.encode(), + }) + } else { + Ok(PrecompileOutput { + exit_status: ExitSucceed::Stopped, + output: sp_std::vec::Vec::new(), + }) + } + }, + // write storage + Action::CreateCollection => { + let mut input = handle.read_input()?; + input.expect_arguments(2)?; - // then read address from input - let mut buffer = [0u8; 20]; - buffer.copy_from_slice(&input[8..28]); - let owner = AddressMapping::into_account_id(H160::from_slice(&buffer)); + let collection_id = input.read::()?.saturated_into(); + let owner = AddressMapping::into_account_id(input.read::
()?.0); - if let Err(_) = LivingAssets::create_collection(collection_id, owner) { - return Err(PrecompileFailure::Error { - exit_status: ExitError::Other(sp_std::borrow::Cow::Borrowed( - "Could net create collection", - )), - }) - } + if LivingAssets::create_collection(collection_id, owner).is_err() { + return Err(PrecompileFailure::Error { + exit_status: ExitError::Other(sp_std::borrow::Cow::Borrowed( + "Could net create collection", + )), + }) + } - Ok(PrecompileOutput { exit_status: ExitSucceed::Returned, output: sp_std::vec::Vec::new() }) + Ok(PrecompileOutput { + exit_status: ExitSucceed::Returned, + output: sp_std::vec::Vec::new(), + }) + }, + } } } diff --git a/precompile/utils/Cargo.toml b/precompile/utils/Cargo.toml new file mode 100644 index 00000000..6e7da0c0 --- /dev/null +++ b/precompile/utils/Cargo.toml @@ -0,0 +1,53 @@ +[package] +name = "precompile-utils" +authors = ["StakeTechnologies", "PureStake"] +description = "Utils to write EVM precompiles." +version = "0.4.3" +edition = "2021" + +[dependencies] +# There's a problem with --all-features when this is moved under dev-deps +evm = { git = "https://github.com/rust-blockchain/evm", rev = "b7b82c7e1fc57b7449d6dfa6826600de37cc1e65", features = ["std"], optional = true, default-features = false } +impl-trait-for-tuples = "0.2.1" +num_enum = { version = "0.5.3", default-features = false } +sha3 = { version = "0.10.1", default-features = false } +similar-asserts = { version = "1.1.0", optional = true } +assert_matches = "1.3.0" + +precompile-utils-macro = { path = "./macro", default-features = false } + +# Substrate +frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" } +frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" } +parity-scale-codec = { version = "3.2.2", default-features = false } +sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" } +sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" } +sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" } +sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" } + +# Frontier +fp-evm = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.43", default-features = false } +pallet-evm = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.43", default-features = false } + +# Polkadot / XCM +xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.43" } + +[dev-dependencies] +hex-literal = "0.3.4" + +[features] +default = ["std"] +std = [ + "evm/std", + "parity-scale-codec/std", + "fp-evm/std", + "frame-support/std", + "frame-system/std", + "pallet-evm/std", + "sp-core/std", + "sp-io/std", + "sp-std/std", + "sp-runtime/std", + "xcm/std", +] +testing = ["similar-asserts", "std"] diff --git a/precompile/utils/macro/Cargo.toml b/precompile/utils/macro/Cargo.toml new file mode 100644 index 00000000..aa8f0f9c --- /dev/null +++ b/precompile/utils/macro/Cargo.toml @@ -0,0 +1,20 @@ +[package] +name = "precompile-utils-macro" +authors = ["StakeTechnologies", "PureStake"] +description = "" +version = "0.1.0" +edition = "2021" + +[lib] +proc-macro = true + +[[test]] +name = "tests" +path = "tests/tests.rs" + +[dependencies] +num_enum = { version = "0.5.3", default-features = false } +proc-macro2 = "1.0" +quote = "1.0" +sha3 = { version = "0.10.1", default-features = false } +syn = { version = "1.0", features = ["extra-traits", "fold", "full", "visit"] } diff --git a/precompile/utils/macro/src/lib.rs b/precompile/utils/macro/src/lib.rs new file mode 100644 index 00000000..1682a14b --- /dev/null +++ b/precompile/utils/macro/src/lib.rs @@ -0,0 +1,139 @@ +// This file is part of Astar. + +// Copyright 2019-2022 PureStake Inc. +// Copyright (C) 2022-2023 Stake Technologies Pte.Ltd. +// SPDX-License-Identifier: GPL-3.0-or-later +// +// This file is part of Utils package, originally developed by Purestake Inc. +// Utils package used in Astar Network in terms of GPLv3. +// +// Utils is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Utils is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Utils. If not, see . + +#![crate_type = "proc-macro"] +#![allow(clippy::all)] + +extern crate proc_macro; + +use proc_macro::TokenStream; +use proc_macro2::Literal; +use quote::{quote, quote_spanned}; +use sha3::{Digest, Keccak256}; +use syn::{parse_macro_input, spanned::Spanned, Expr, ExprLit, Ident, ItemEnum, Lit, LitStr}; + +struct Bytes(Vec); + +impl ::std::fmt::Debug for Bytes { + #[inline] + fn fmt(&self, f: &mut std::fmt::Formatter) -> ::std::fmt::Result { + let data = &self.0; + write!(f, "[")?; + if !data.is_empty() { + write!(f, "{:#04x}u8", data[0])?; + for unit in data.iter().skip(1) { + write!(f, ", {:#04x}", unit)?; + } + } + write!(f, "]") + } +} + +#[proc_macro] +pub fn keccak256(input: TokenStream) -> TokenStream { + let lit_str = parse_macro_input!(input as LitStr); + + let hash = Keccak256::digest(lit_str.value().as_bytes()); + + let bytes = Bytes(hash.to_vec()); + let eval_str = format!("{:?}", bytes); + let eval_ts: proc_macro2::TokenStream = eval_str.parse().unwrap_or_else(|_| { + panic!("Failed to parse the string \"{}\" to TokenStream.", eval_str); + }); + quote!(#eval_ts).into() +} + +/// This macro allows to associate to each variant of an enumeration a discriminant (of type u32 +/// whose value corresponds to the first 4 bytes of the Hash Keccak256 of the character string +///indicated by the user of this macro. +/// +/// Usage: +/// +/// ```ignore +/// #[generate_function_selector] +/// enum Action { +/// Toto = "toto()", +/// Tata = "tata()", +/// } +/// ``` +/// +/// Extanded to: +/// +/// ```rust +/// #[repr(u32)] +/// enum Action { +/// Toto = 119097542u32, +/// Tata = 1414311903u32, +/// } +/// ``` +/// +#[proc_macro_attribute] +pub fn generate_function_selector(_: TokenStream, input: TokenStream) -> TokenStream { + let item = parse_macro_input!(input as ItemEnum); + + let ItemEnum { attrs, vis, enum_token, ident, variants, .. } = item; + + let mut ident_expressions: Vec = vec![]; + let mut variant_expressions: Vec = vec![]; + for variant in variants { + match variant.discriminant { + Some((_, Expr::Lit(ExprLit { lit, .. }))) => + if let Lit::Str(lit_str) = lit { + let digest = Keccak256::digest(lit_str.value().as_bytes()); + let selector = u32::from_be_bytes([digest[0], digest[1], digest[2], digest[3]]); + + ident_expressions.push(variant.ident); + variant_expressions.push(Expr::Lit(ExprLit { + lit: Lit::Verbatim(Literal::u32_suffixed(selector)), + attrs: Default::default(), + })); + } else { + return quote_spanned! { + lit.span() => compile_error("Expected literal string"); + } + .into() + }, + Some((_eg, expr)) => + return quote_spanned! { + expr.span() => compile_error("Expected literal"); + } + .into(), + None => + return quote_spanned! { + variant.span() => compile_error("Each variant must have a discriminant"); + } + .into(), + } + } + + (quote! { + #(#attrs)* + #[derive(num_enum::TryFromPrimitive, num_enum::IntoPrimitive)] + #[repr(u32)] + #vis #enum_token #ident { + #( + #ident_expressions = #variant_expressions, + )* + } + }) + .into() +} diff --git a/precompile/utils/macro/tests/tests.rs b/precompile/utils/macro/tests/tests.rs new file mode 100644 index 00000000..1064b8f9 --- /dev/null +++ b/precompile/utils/macro/tests/tests.rs @@ -0,0 +1,49 @@ +// This file is part of Astar. + +// Copyright 2019-2022 PureStake Inc. +// Copyright (C) 2022-2023 Stake Technologies Pte.Ltd. +// SPDX-License-Identifier: GPL-3.0-or-later +// +// This file is part of Utils package, originally developed by Purestake Inc. +// Utils package used in Astar Network in terms of GPLv3. +// +// Utils is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Utils is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Utils. If not, see . + +use sha3::{Digest, Keccak256}; + +#[precompile_utils_macro::generate_function_selector] +pub enum Action { + Toto = "toto()", + Tata = "tata()", +} + +#[test] +fn test_keccak256() { + assert_eq!(&precompile_utils_macro::keccak256!(""), Keccak256::digest(b"").as_slice(),); + assert_eq!( + &precompile_utils_macro::keccak256!("toto()"), + Keccak256::digest(b"toto()").as_slice(), + ); + assert_ne!( + &precompile_utils_macro::keccak256!("toto()"), + Keccak256::digest(b"tata()").as_slice(), + ); +} + +#[test] +fn test_generate_function_selector() { + assert_eq!(&(Action::Toto as u32).to_be_bytes()[..], &Keccak256::digest(b"toto()")[0..4],); + assert_eq!(&(Action::Tata as u32).to_be_bytes()[..], &Keccak256::digest(b"tata()")[0..4],); + assert_ne!(Action::Toto as u32, Action::Tata as u32); +} diff --git a/precompile/utils/src/data.rs b/precompile/utils/src/data.rs new file mode 100644 index 00000000..251af1c6 --- /dev/null +++ b/precompile/utils/src/data.rs @@ -0,0 +1,588 @@ +// This file is part of Astar. + +// Copyright 2019-2022 PureStake Inc. +// Copyright (C) 2022-2023 Stake Technologies Pte.Ltd. +// SPDX-License-Identifier: GPL-3.0-or-later +// +// This file is part of Utils package, originally developed by Purestake Inc. +// Utils package used in Astar Network in terms of GPLv3. +// +// Utils is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Utils is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Utils. If not, see . + +use crate::{revert, EvmResult}; + +use alloc::borrow::ToOwned; +use core::{any::type_name, ops::Range}; +use impl_trait_for_tuples::impl_for_tuples; +use sp_core::{H160, H256, U256}; +use sp_std::{convert::TryInto, vec, vec::Vec}; + +/// The `address` type of Solidity. +/// H160 could represent 2 types of data (bytes20 and address) that are not encoded the same way. +/// To avoid issues writing H160 is thus not supported. +#[derive(Clone, Copy, Debug, Eq, PartialEq)] +pub struct Address(pub H160); + +impl From for Address { + fn from(a: H160) -> Address { + Address(a) + } +} + +impl From
for H160 { + fn from(a: Address) -> H160 { + a.0 + } +} + +/// The `bytes`/`string` type of Solidity. +/// It is different from `Vec` which will be serialized with padding for each `u8` element +/// of the array, while `Bytes` is tightly packed. +#[derive(Clone, Debug, Eq, PartialEq)] +pub struct Bytes(pub Vec); + +impl Bytes { + /// Interpret as `bytes`. + pub fn as_bytes(&self) -> &[u8] { + &self.0 + } + + /// Interpret as `string`. + /// Can fail if the string is not valid UTF8. + pub fn as_str(&self) -> Result<&str, sp_std::str::Utf8Error> { + sp_std::str::from_utf8(&self.0) + } +} + +impl From<&[u8]> for Bytes { + fn from(a: &[u8]) -> Self { + Self(a.to_owned()) + } +} + +impl From<&str> for Bytes { + fn from(a: &str) -> Self { + a.as_bytes().into() + } +} + +impl From for Vec { + fn from(b: Bytes) -> Vec { + b.0 + } +} + +/// Wrapper around an EVM input slice, helping to parse it. +/// Provide functions to parse common types. +#[derive(Clone, Copy, Debug)] +pub struct EvmDataReader<'a> { + input: &'a [u8], + cursor: usize, +} + +impl<'a> EvmDataReader<'a> { + /// Create a new input parser. + pub fn new(input: &'a [u8]) -> Self { + Self { input, cursor: 0 } + } + + /// Create a new input parser from a selector-initial input. + pub fn read_selector(input: &'a [u8]) -> EvmResult + where + T: num_enum::TryFromPrimitive, + { + if input.len() < 4 { + return Err(revert("tried to parse selector out of bounds")) + } + + let mut buffer = [0u8; 4]; + buffer.copy_from_slice(&input[0..4]); + let selector = T::try_from_primitive(u32::from_be_bytes(buffer)).map_err(|_| { + frame_support::log::trace!( + target: "precompile-utils", + "Failed to match function selector for {}", + type_name::() + ); + revert("unknown selector") + })?; + + Ok(selector) + } + + /// Create a new input parser from a selector-initial input. + pub fn new_skip_selector(input: &'a [u8]) -> EvmResult { + if input.len() < 4 { + return Err(revert("input is too short")) + } + + Ok(Self::new(&input[4..])) + } + + /// Check the input has at least the correct amount of arguments before the end (32 bytes values). + pub fn expect_arguments(&self, args: usize) -> EvmResult { + if self.input.len() >= self.cursor + args * 32 { + Ok(()) + } else { + Err(revert("input doesn't match expected length")) + } + } + + /// Read data from the input. + pub fn read(&mut self) -> EvmResult { + T::read(self) + } + + /// Read raw bytes from the input. + /// Doesn't handle any alignment checks, prefer using `read` instead of possible. + /// Returns an error if trying to parse out of bounds. + pub fn read_raw_bytes(&mut self, len: usize) -> EvmResult<&[u8]> { + let range = self.move_cursor(len)?; + + let data = self + .input + .get(range) + .ok_or_else(|| revert("tried to parse raw bytes out of bounds"))?; + + Ok(data) + } + + /// Reads a pointer, returning a reader targetting the pointed location. + pub fn read_pointer(&mut self) -> EvmResult { + let offset: usize = self + .read::() + .map_err(|_| revert("tried to parse array offset out of bounds"))? + .try_into() + .map_err(|_| revert("array offset is too large"))?; + + if offset >= self.input.len() { + return Err(revert("pointer points out of bounds")) + } + + Ok(Self { input: &self.input[offset..], cursor: 0 }) + } + + /// Read remaining bytes + pub fn read_till_end(&mut self) -> EvmResult<&[u8]> { + let range = self.move_cursor(self.input.len() - self.cursor)?; + + let data = self + .input + .get(range) + .ok_or_else(|| revert("tried to parse raw bytes out of bounds"))?; + + Ok(data) + } + + /// Move the reading cursor with provided length, and return a range from the previous cursor + /// location to the new one. + /// Checks cursor overflows. + fn move_cursor(&mut self, len: usize) -> EvmResult> { + let start = self.cursor; + let end = self + .cursor + .checked_add(len) + .ok_or_else(|| revert("data reading cursor overflow"))?; + + self.cursor = end; + + Ok(start..end) + } +} + +/// Help build an EVM input/output data. +/// +/// Functions takes `self` to allow chaining all calls like +/// `EvmDataWriter::new().write(...).write(...).build()`. +/// While it could be more ergonomic to take &mut self, this would +/// prevent to have a `build` function that don't clone the output. +#[derive(Clone, Debug)] +pub struct EvmDataWriter { + pub(crate) data: Vec, + offset_data: Vec, + selector: Option, +} + +#[derive(Clone, Debug)] +struct OffsetDatum { + // Offset location in the container data. + offset_position: usize, + // Data pointed by the offset that must be inserted at the end of container data. + data: Vec, + // Inside of arrays, the offset is not from the start of array data (length), but from the start + // of the item. This shift allow to correct this. + offset_shift: usize, +} + +impl EvmDataWriter { + /// Creates a new empty output builder (without selector). + pub fn new() -> Self { + Self { data: vec![], offset_data: vec![], selector: None } + } + + /// Creates a new empty output builder with provided selector. + /// Selector will only be appended before the data when calling + /// `build` to not mess with the offsets. + pub fn new_with_selector(selector: impl Into) -> Self { + Self { data: vec![], offset_data: vec![], selector: Some(selector.into()) } + } + + /// Return the built data. + pub fn build(mut self) -> Vec { + Self::bake_offsets(&mut self.data, self.offset_data); + + if let Some(selector) = self.selector { + let mut output = selector.to_be_bytes().to_vec(); + output.append(&mut self.data); + output + } else { + self.data + } + } + + /// Add offseted data at the end of this writer's data, updating the offsets. + fn bake_offsets(output: &mut Vec, offsets: Vec) { + for mut offset_datum in offsets { + let offset_position = offset_datum.offset_position; + let offset_position_end = offset_position + 32; + + // The offset is the distance between the start of the data and the + // start of the pointed data (start of a struct, length of an array). + // Offsets in inner data are relative to the start of their respective "container". + // However in arrays the "container" is actually the item itself instead of the whole + // array, which is corrected by `offset_shift`. + let free_space_offset = output.len() - offset_datum.offset_shift; + + // Override dummy offset to the offset it will be in the final output. + U256::from(free_space_offset) + .to_big_endian(&mut output[offset_position..offset_position_end]); + + // Append this data at the end of the current output. + output.append(&mut offset_datum.data); + } + } + + /// Write arbitrary bytes. + /// Doesn't handle any alignement checks, prefer using `write` instead if possible. + fn write_raw_bytes(mut self, value: &[u8]) -> Self { + self.data.extend_from_slice(value); + self + } + + /// Write data of requested type. + pub fn write(mut self, value: T) -> Self { + T::write(&mut self, value); + self + } + + /// Writes a pointer to given data. + /// The data will be appended when calling `build`. + /// Initially write a dummy value as offset in this writer's data, which will be replaced by + /// the correct offset once the pointed data is appended. + /// + /// Takes `&mut self` since its goal is to be used inside `EvmData` impl and not in chains. + pub fn write_pointer(&mut self, data: Vec) { + let offset_position = self.data.len(); + H256::write(self, H256::repeat_byte(0xff)); + + self.offset_data.push(OffsetDatum { offset_position, data, offset_shift: 0 }); + } +} + +impl Default for EvmDataWriter { + fn default() -> Self { + Self::new() + } +} + +/// Data that can be converted from and to EVM data types. +pub trait EvmData: Sized { + fn read(reader: &mut EvmDataReader) -> EvmResult; + fn write(writer: &mut EvmDataWriter, value: Self); + fn has_static_size() -> bool; +} + +#[impl_for_tuples(1, 18)] +impl EvmData for Tuple { + fn has_static_size() -> bool { + for_tuples!(#( Tuple::has_static_size() )&*) + } + + fn read(reader: &mut EvmDataReader) -> EvmResult { + if !Self::has_static_size() { + let reader = &mut reader.read_pointer()?; + Ok(for_tuples!( ( #( reader.read::()? ),* ) )) + } else { + Ok(for_tuples!( ( #( reader.read::()? ),* ) )) + } + } + + fn write(writer: &mut EvmDataWriter, value: Self) { + if !Self::has_static_size() { + let mut inner_writer = EvmDataWriter::new(); + for_tuples!( #( Tuple::write(&mut inner_writer, value.Tuple); )* ); + writer.write_pointer(inner_writer.build()); + } else { + for_tuples!( #( Tuple::write(writer, value.Tuple); )* ); + } + } +} + +impl EvmData for H256 { + fn read(reader: &mut EvmDataReader) -> EvmResult { + let range = reader.move_cursor(32)?; + + let data = reader + .input + .get(range) + .ok_or_else(|| revert("tried to parse H256 out of bounds"))?; + + Ok(H256::from_slice(data)) + } + + fn write(writer: &mut EvmDataWriter, value: Self) { + writer.data.extend_from_slice(value.as_bytes()); + } + + fn has_static_size() -> bool { + true + } +} + +impl EvmData for Address { + fn read(reader: &mut EvmDataReader) -> EvmResult { + let range = reader.move_cursor(32)?; + + let data = reader + .input + .get(range) + .ok_or_else(|| revert("tried to parse H160 out of bounds"))?; + + Ok(H160::from_slice(&data[12..32]).into()) + } + + fn write(writer: &mut EvmDataWriter, value: Self) { + H256::write(writer, value.0.into()); + } + + fn has_static_size() -> bool { + true + } +} + +impl EvmData for U256 { + fn read(reader: &mut EvmDataReader) -> EvmResult { + let range = reader.move_cursor(32)?; + + let data = reader + .input + .get(range) + .ok_or_else(|| revert("tried to parse U256 out of bounds"))?; + + Ok(U256::from_big_endian(data)) + } + + fn write(writer: &mut EvmDataWriter, value: Self) { + let mut buffer = [0u8; 32]; + value.to_big_endian(&mut buffer); + writer.data.extend_from_slice(&buffer); + } + + fn has_static_size() -> bool { + true + } +} + +macro_rules! impl_evmdata_for_uints { + ($($uint:ty, )*) => { + $( + impl EvmData for $uint { + fn read(reader: &mut EvmDataReader) -> EvmResult { + let range = reader.move_cursor(32)?; + + let data = reader + .input + .get(range) + .ok_or_else(|| revert(alloc::format!( + "tried to parse {} out of bounds", core::any::type_name::() + )))?; + + let mut buffer = [0u8; core::mem::size_of::()]; + buffer.copy_from_slice(&data[32 - core::mem::size_of::()..]); + Ok(Self::from_be_bytes(buffer)) + } + + fn write(writer: &mut EvmDataWriter, value: Self) { + let mut buffer = [0u8; 32]; + buffer[32 - core::mem::size_of::()..].copy_from_slice(&value.to_be_bytes()); + writer.data.extend_from_slice(&buffer); + } + + fn has_static_size() -> bool { + true + } + } + )* + }; +} + +impl_evmdata_for_uints!(u16, u32, u64, u128,); + +// The implementation for u8 is specific, for performance reasons. +impl EvmData for u8 { + fn read(reader: &mut EvmDataReader) -> EvmResult { + let range = reader.move_cursor(32)?; + + let data = reader + .input + .get(range) + .ok_or_else(|| revert("tried to parse u64 out of bounds"))?; + + Ok(data[31]) + } + + fn write(writer: &mut EvmDataWriter, value: Self) { + let mut buffer = [0u8; 32]; + buffer[31] = value; + + writer.data.extend_from_slice(&buffer); + } + + fn has_static_size() -> bool { + true + } +} + +impl EvmData for bool { + fn read(reader: &mut EvmDataReader) -> EvmResult { + let h256 = H256::read(reader).map_err(|_| revert("tried to parse bool out of bounds"))?; + + Ok(!h256.is_zero()) + } + + fn write(writer: &mut EvmDataWriter, value: Self) { + let mut buffer = [0u8; 32]; + if value { + buffer[31] = 1; + } + + writer.data.extend_from_slice(&buffer); + } + + fn has_static_size() -> bool { + true + } +} + +impl EvmData for Vec { + fn read(reader: &mut EvmDataReader) -> EvmResult { + let mut inner_reader = reader.read_pointer()?; + + let array_size: usize = inner_reader + .read::() + .map_err(|_| revert("tried to parse array length out of bounds"))? + .try_into() + .map_err(|_| revert("array length is too large"))?; + + let mut array = vec![]; + + let mut item_reader = EvmDataReader { + input: inner_reader + .input + .get(32..) + .ok_or_else(|| revert("try to read array items out of bound"))?, + cursor: 0, + }; + + for _ in 0..array_size { + array.push(item_reader.read()?); + } + + Ok(array) + } + + fn write(writer: &mut EvmDataWriter, value: Self) { + let mut inner_writer = EvmDataWriter::new().write(U256::from(value.len())); + + for inner in value { + // Any offset in items are relative to the start of the item instead of the + // start of the array. However if there is offseted data it must but appended after + // all items (offsets) are written. We thus need to rely on `compute_offsets` to do + // that, and must store a "shift" to correct the offsets. + let shift = inner_writer.data.len(); + let item_writer = EvmDataWriter::new().write(inner); + + inner_writer = inner_writer.write_raw_bytes(&item_writer.data); + for mut offset_datum in item_writer.offset_data { + offset_datum.offset_shift += 32; + offset_datum.offset_position += shift; + inner_writer.offset_data.push(offset_datum); + } + } + + writer.write_pointer(inner_writer.build()); + } + + fn has_static_size() -> bool { + false + } +} + +impl EvmData for Bytes { + fn read(reader: &mut EvmDataReader) -> EvmResult { + let mut inner_reader = reader.read_pointer()?; + + // Read bytes/string size. + let array_size: usize = inner_reader + .read::() + .map_err(|_| revert("tried to parse bytes/string length out of bounds"))? + .try_into() + .map_err(|_| revert("bytes/string length is too large"))?; + + // Get valid range over the bytes data. + let range = inner_reader.move_cursor(array_size)?; + + let data = inner_reader + .input + .get(range) + .ok_or_else(|| revert("tried to parse bytes/string out of bounds"))?; + + let bytes = Self(data.to_owned()); + + Ok(bytes) + } + + fn write(writer: &mut EvmDataWriter, value: Self) { + let length = value.0.len(); + + // Pad the data. + // Leave it as is if a multiple of 32, otherwise pad to next + // multiple or 32. + let chunks = length / 32; + let padded_size = match length % 32 { + 0 => chunks * 32, + _ => (chunks + 1) * 32, + }; + + let mut value = value.0.to_vec(); + value.resize(padded_size, 0); + + writer.write_pointer( + EvmDataWriter::new().write(U256::from(length)).write_raw_bytes(&value).build(), + ); + } + + fn has_static_size() -> bool { + false + } +} diff --git a/precompile/utils/src/lib.rs b/precompile/utils/src/lib.rs new file mode 100644 index 00000000..d073d087 --- /dev/null +++ b/precompile/utils/src/lib.rs @@ -0,0 +1,354 @@ +// This file is part of Astar. + +// Copyright 2019-2022 PureStake Inc. +// Copyright (C) 2022-2023 Stake Technologies Pte.Ltd. +// SPDX-License-Identifier: GPL-3.0-or-later +// +// This file is part of Utils package, originally developed by Purestake Inc. +// Utils package used in Astar Network in terms of GPLv3. +// +// Utils is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Utils is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Utils. If not, see . + +#![cfg_attr(not(feature = "std"), no_std)] +#![allow(clippy::all)] + +extern crate alloc; + +use crate::alloc::borrow::ToOwned; +use fp_evm::{ + Context, ExitError, ExitRevert, ExitSucceed, PrecompileFailure, PrecompileHandle, + PrecompileOutput, +}; +use frame_support::{ + dispatch::{Dispatchable, GetDispatchInfo, PostDispatchInfo}, + traits::Get, +}; +use pallet_evm::{GasWeightMapping, Log}; +use sp_core::{H160, H256, U256}; +use sp_std::{marker::PhantomData, vec, vec::Vec}; + +mod data; + +pub use data::{Address, Bytes, EvmData, EvmDataReader, EvmDataWriter}; +pub use precompile_utils_macro::{generate_function_selector, keccak256}; + +#[cfg(feature = "testing")] +pub mod testing; +#[cfg(test)] +mod tests; + +/// Alias for Result returning an EVM precompile error. +pub type EvmResult = Result; + +/// Return an error with provided (static) text. +/// Using the `revert` function of `Gasometer` is preferred as erroring +/// consumed all the gas limit and the error message is not easily +/// retrievable. +pub fn error>>(text: T) -> PrecompileFailure { + PrecompileFailure::Error { exit_status: ExitError::Other(text.into()) } +} + +/// Builder for PrecompileOutput. +#[derive(Clone, Debug)] +pub struct LogsBuilder { + address: H160, +} + +impl LogsBuilder { + /// Create a new builder with no logs. + /// Takes the address of the precompile (usually `context.address`). + pub fn new(address: H160) -> Self { + Self { address } + } + + /// Create a 0-topic log. + #[must_use] + pub fn log0(&self, data: impl Into>) -> Log { + Log { address: self.address, topics: vec![], data: data.into() } + } + + /// Create a 1-topic log. + #[must_use] + pub fn log1(&self, topic0: impl Into, data: impl Into>) -> Log { + Log { address: self.address, topics: vec![topic0.into()], data: data.into() } + } + + /// Create a 2-topics log. + #[must_use] + pub fn log2( + &self, + topic0: impl Into, + topic1: impl Into, + data: impl Into>, + ) -> Log { + Log { address: self.address, topics: vec![topic0.into(), topic1.into()], data: data.into() } + } + + /// Create a 3-topics log. + #[must_use] + pub fn log3( + &self, + topic0: impl Into, + topic1: impl Into, + topic2: impl Into, + data: impl Into>, + ) -> Log { + Log { + address: self.address, + topics: vec![topic0.into(), topic1.into(), topic2.into()], + data: data.into(), + } + } + + /// Create a 4-topics log. + #[must_use] + pub fn log4( + &self, + topic0: impl Into, + topic1: impl Into, + topic2: impl Into, + topic3: impl Into, + data: impl Into>, + ) -> Log { + Log { + address: self.address, + topics: vec![topic0.into(), topic1.into(), topic2.into(), topic3.into()], + data: data.into(), + } + } +} + +/// Extension trait allowing to record logs into a PrecompileHandle. +pub trait LogExt { + fn record(self, handle: &mut impl PrecompileHandle) -> EvmResult; + + fn compute_cost(&self) -> EvmResult; +} + +impl LogExt for Log { + fn record(self, handle: &mut impl PrecompileHandle) -> EvmResult { + handle.log(self.address, self.topics, self.data)?; + Ok(()) + } + + fn compute_cost(&self) -> EvmResult { + log_costs(self.topics.len(), self.data.len()) + } +} + +/// Helper functions requiring a Runtime. +/// This runtime must of course implement `pallet_evm::Config`. +#[derive(Clone, Copy, Debug)] +pub struct RuntimeHelper(PhantomData); + +impl RuntimeHelper +where + Runtime: pallet_evm::Config, + Runtime::RuntimeCall: Dispatchable + GetDispatchInfo, +{ + /// Try to dispatch a Substrate call. + /// Return an error if there are not enough gas, or if the call fails. + /// If successful returns the used gas using the Runtime GasWeightMapping. + pub fn try_dispatch( + handle: &mut impl PrecompileHandleExt, + origin: ::RuntimeOrigin, + call: Call, + ) -> EvmResult<()> + where + Runtime::RuntimeCall: From, + { + let call = Runtime::RuntimeCall::from(call); + let dispatch_info = call.get_dispatch_info(); + + // Make sure there is enough gas. + let remaining_gas = handle.remaining_gas(); + let required_gas = Runtime::GasWeightMapping::weight_to_gas(dispatch_info.weight); + if required_gas > remaining_gas { + return Err(PrecompileFailure::Error { exit_status: ExitError::OutOfGas }) + } + + // Dispatch call. + // It may be possible to not record gas cost if the call returns Pays::No. + // However while Substrate handle checking weight while not making the sender pay for it, + // the EVM doesn't. It seems this safer to always record the costs to avoid unmetered + // computations. + let result = call + .dispatch(origin) + .map_err(|e| revert(alloc::format!("Dispatched call failed with error: {:?}", e)))?; + + let used_weight = result.actual_weight; + + let used_gas = + Runtime::GasWeightMapping::weight_to_gas(used_weight.unwrap_or(dispatch_info.weight)); + + handle.record_cost(used_gas)?; + + Ok(()) + } +} + +impl RuntimeHelper +where + Runtime: pallet_evm::Config, +{ + /// Cost of a Substrate DB write in gas. + pub fn db_write_gas_cost() -> u64 { + ::GasWeightMapping::weight_to_gas( + ::DbWeight::get().writes(1), + ) + } + + /// Cost of a Substrate DB read in gas. + pub fn db_read_gas_cost() -> u64 { + ::GasWeightMapping::weight_to_gas( + ::DbWeight::get().reads(1), + ) + } +} + +/// Represents modifiers a Solidity function can be annotated with. +#[derive(Copy, Clone, PartialEq, Eq)] +pub enum FunctionModifier { + /// Function that doesn't modify the state. + View, + /// Function that modifies the state but refuse receiving funds. + /// Correspond to a Solidity function with no modifiers. + NonPayable, + /// Function that modifies the state and accept funds. + Payable, +} + +pub trait PrecompileHandleExt: PrecompileHandle { + #[must_use] + /// Record cost of a log manually. + /// This can be useful to record log costs early when their content have static size. + fn record_log_costs_manual(&mut self, topics: usize, data_len: usize) -> EvmResult; + + #[must_use] + /// Record cost of logs. + fn record_log_costs(&mut self, logs: &[&Log]) -> EvmResult; + + #[must_use] + /// Check that a function call is compatible with the context it is + /// called into. + fn check_function_modifier(&self, modifier: FunctionModifier) -> EvmResult; + + #[must_use] + /// Read the selector from the input data. + fn read_selector(&self) -> EvmResult + where + T: num_enum::TryFromPrimitive; + + #[must_use] + /// Returns a reader of the input, skipping the selector. + fn read_input(&self) -> EvmResult; +} + +pub fn log_costs(topics: usize, data_len: usize) -> EvmResult { + // Cost calculation is copied from EVM code that is not publicly exposed by the crates. + // https://github.com/rust-blockchain/evm/blob/master/gasometer/src/costs.rs#L148 + + const G_LOG: u64 = 375; + const G_LOGDATA: u64 = 8; + const G_LOGTOPIC: u64 = 375; + + let topic_cost = G_LOGTOPIC + .checked_mul(topics as u64) + .ok_or(PrecompileFailure::Error { exit_status: ExitError::OutOfGas })?; + + let data_cost = G_LOGDATA + .checked_mul(data_len as u64) + .ok_or(PrecompileFailure::Error { exit_status: ExitError::OutOfGas })?; + + G_LOG + .checked_add(topic_cost) + .ok_or(PrecompileFailure::Error { exit_status: ExitError::OutOfGas })? + .checked_add(data_cost) + .ok_or(PrecompileFailure::Error { exit_status: ExitError::OutOfGas }) +} + +impl PrecompileHandleExt for T { + #[must_use] + /// Record cost of a log manualy. + /// This can be useful to record log costs early when their content have static size. + fn record_log_costs_manual(&mut self, topics: usize, data_len: usize) -> EvmResult { + self.record_cost(log_costs(topics, data_len)?)?; + + Ok(()) + } + + #[must_use] + /// Record cost of logs. + fn record_log_costs(&mut self, logs: &[&Log]) -> EvmResult { + for log in logs { + self.record_log_costs_manual(log.topics.len(), log.data.len())?; + } + + Ok(()) + } + + #[must_use] + /// Check that a function call is compatible with the context it is + /// called into. + fn check_function_modifier(&self, modifier: FunctionModifier) -> EvmResult { + check_function_modifier(self.context(), self.is_static(), modifier) + } + + #[must_use] + /// Read the selector from the input data. + fn read_selector(&self) -> EvmResult + where + S: num_enum::TryFromPrimitive, + { + EvmDataReader::read_selector(self.input()) + } + + #[must_use] + /// Returns a reader of the input, skipping the selector. + fn read_input(&self) -> EvmResult { + EvmDataReader::new_skip_selector(self.input()) + } +} + +#[must_use] +pub fn revert(output: impl AsRef<[u8]>) -> PrecompileFailure { + PrecompileFailure::Revert { + exit_status: ExitRevert::Reverted, + output: output.as_ref().to_owned(), + } +} + +#[must_use] +pub fn succeed(output: impl AsRef<[u8]>) -> PrecompileOutput { + PrecompileOutput { exit_status: ExitSucceed::Returned, output: output.as_ref().to_owned() } +} + +#[must_use] +/// Check that a function call is compatible with the context it is +/// called into. +fn check_function_modifier( + context: &Context, + is_static: bool, + modifier: FunctionModifier, +) -> EvmResult { + if is_static && modifier != FunctionModifier::View { + return Err(revert("can't call non-static function in static context")) + } + + if modifier != FunctionModifier::Payable && context.apparent_value > U256::zero() { + return Err(revert("function is not payable")) + } + + Ok(()) +} diff --git a/precompile/utils/src/testing.rs b/precompile/utils/src/testing.rs new file mode 100644 index 00000000..1dbfeab3 --- /dev/null +++ b/precompile/utils/src/testing.rs @@ -0,0 +1,410 @@ +// This file is part of Astar. + +// Copyright 2019-2022 PureStake Inc. +// Copyright (C) 2022-2023 Stake Technologies Pte.Ltd. +// SPDX-License-Identifier: GPL-3.0-or-later +// +// This file is part of Utils package, originally developed by Purestake Inc. +// Utils package used in Astar Network in terms of GPLv3. +// +// Utils is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Utils is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Utils. If not, see . +use super::*; +use assert_matches::assert_matches; +use fp_evm::{ + ExitReason, ExitSucceed, PrecompileOutput, PrecompileResult, PrecompileSet, Transfer, +}; +use sp_std::boxed::Box; + +pub struct Subcall { + pub address: H160, + pub transfer: Option, + pub input: Vec, + pub target_gas: Option, + pub is_static: bool, + pub context: Context, +} + +pub struct SubcallOutput { + pub reason: ExitReason, + pub output: Vec, + pub cost: u64, + pub logs: Vec, +} + +pub trait SubcallTrait: FnMut(Subcall) -> SubcallOutput + 'static {} + +impl SubcallOutput + 'static> SubcallTrait for T {} + +pub type SubcallHandle = Box; + +/// Mock handle to write tests for precompiles. +pub struct MockHandle { + pub gas_limit: u64, + pub gas_used: u64, + pub logs: Vec, + pub subcall_handle: Option, + pub code_address: H160, + pub input: Vec, + pub context: Context, + pub is_static: bool, +} + +impl MockHandle { + pub fn new(code_address: H160, context: Context) -> Self { + Self { + gas_limit: u64::MAX, + gas_used: 0, + logs: vec![], + subcall_handle: None, + code_address, + input: Vec::new(), + context, + is_static: false, + } + } +} + +// Compute the cost of doing a subcall. +// Some parameters cannot be known in advance, so we estimate the worst possible cost. +pub fn call_cost(value: U256, config: &evm::Config) -> u64 { + // Copied from EVM code since not public. + pub const G_CALLVALUE: u64 = 9000; + pub const G_NEWACCOUNT: u64 = 25000; + + fn address_access_cost(is_cold: bool, regular_value: u64, config: &evm::Config) -> u64 { + if config.increase_state_access_gas { + if is_cold { + config.gas_account_access_cold + } else { + config.gas_storage_read_warm + } + } else { + regular_value + } + } + + fn xfer_cost(is_call_or_callcode: bool, transfers_value: bool) -> u64 { + if is_call_or_callcode && transfers_value { + G_CALLVALUE + } else { + 0 + } + } + + fn new_cost( + is_call_or_staticcall: bool, + new_account: bool, + transfers_value: bool, + config: &evm::Config, + ) -> u64 { + let eip161 = !config.empty_considered_exists; + if is_call_or_staticcall { + if eip161 { + if transfers_value && new_account { + G_NEWACCOUNT + } else { + 0 + } + } else if new_account { + G_NEWACCOUNT + } else { + 0 + } + } else { + 0 + } + } + + let transfers_value = value != U256::default(); + let is_cold = true; + let is_call_or_callcode = true; + let is_call_or_staticcall = true; + let new_account = true; + + address_access_cost(is_cold, config.gas_call, config) + + xfer_cost(is_call_or_callcode, transfers_value) + + new_cost(is_call_or_staticcall, new_account, transfers_value, config) +} + +impl PrecompileHandle for MockHandle { + /// Perform subcall in provided context. + /// Precompile specifies in which context the subcall is executed. + fn call( + &mut self, + address: H160, + transfer: Option, + input: Vec, + target_gas: Option, + is_static: bool, + context: &Context, + ) -> (ExitReason, Vec) { + if self + .record_cost(call_cost(context.apparent_value, &evm::Config::london())) + .is_err() + { + return (ExitReason::Error(ExitError::OutOfGas), vec![]) + } + + match &mut self.subcall_handle { + Some(handle) => { + let SubcallOutput { reason, output, cost, logs } = handle(Subcall { + address, + transfer, + input, + target_gas, + is_static, + context: context.clone(), + }); + + if self.record_cost(cost).is_err() { + return (ExitReason::Error(ExitError::OutOfGas), vec![]) + } + + for log in logs { + self.log(log.address, log.topics, log.data).expect("cannot fail"); + } + + (reason, output) + }, + None => panic!("no subcall handle registered"), + } + } + + fn record_cost(&mut self, cost: u64) -> Result<(), ExitError> { + self.gas_used += cost; + + if self.gas_used > self.gas_limit { + Err(ExitError::OutOfGas) + } else { + Ok(()) + } + } + + fn remaining_gas(&self) -> u64 { + self.gas_limit - self.gas_used + } + + fn log(&mut self, address: H160, topics: Vec, data: Vec) -> Result<(), ExitError> { + self.logs.push(PrettyLog(Log { address, topics, data })); + Ok(()) + } + + /// Retreive the code address (what is the address of the precompile being called). + fn code_address(&self) -> H160 { + self.code_address + } + + /// Retreive the input data the precompile is called with. + fn input(&self) -> &[u8] { + &self.input + } + + /// Retreive the context in which the precompile is executed. + fn context(&self) -> &Context { + &self.context + } + + /// Is the precompile call is done statically. + fn is_static(&self) -> bool { + self.is_static + } + + /// Retreive the gas limit of this call. + fn gas_limit(&self) -> Option { + Some(self.gas_limit) + } +} + +pub struct PrecompilesTester<'p, P> { + precompiles: &'p P, + handle: MockHandle, + + target_gas: Option, + subcall_handle: Option, + + expected_cost: Option, + expected_logs: Option>, +} + +impl<'p, P: PrecompileSet> PrecompilesTester<'p, P> { + pub fn new( + precompiles: &'p P, + from: impl Into, + to: impl Into, + data: Vec, + ) -> Self { + let to = to.into(); + let mut handle = MockHandle::new( + to, + Context { address: to, caller: from.into(), apparent_value: U256::zero() }, + ); + + handle.input = data; + + Self { + precompiles, + handle, + + target_gas: None, + subcall_handle: None, + + expected_cost: None, + expected_logs: None, + } + } + + pub fn with_value(mut self, value: impl Into) -> Self { + self.handle.context.apparent_value = value.into(); + self + } + + pub fn with_subcall_handle(mut self, subcall_handle: impl SubcallTrait) -> Self { + self.subcall_handle = Some(Box::new(subcall_handle)); + self + } + + pub fn with_target_gas(mut self, target_gas: Option) -> Self { + self.target_gas = target_gas; + self + } + + pub fn expect_cost(mut self, cost: u64) -> Self { + self.expected_cost = Some(cost); + self + } + + pub fn expect_no_logs(mut self) -> Self { + self.expected_logs = Some(vec![]); + self + } + + pub fn expect_log(mut self, log: Log) -> Self { + self.expected_logs = Some({ + let mut logs = self.expected_logs.unwrap_or_default(); + logs.push(PrettyLog(log)); + logs + }); + self + } + + fn assert_optionals(&self) { + if let Some(cost) = &self.expected_cost { + assert_eq!(&self.handle.gas_used, cost); + } + + if let Some(logs) = &self.expected_logs { + similar_asserts::assert_eq!(&self.handle.logs, logs); + } + } + + fn execute(&mut self) -> Option { + let handle = &mut self.handle; + handle.subcall_handle = self.subcall_handle.take(); + + if let Some(gas_limit) = self.target_gas { + handle.gas_limit = gas_limit; + } + + let res = self.precompiles.execute(handle); + + self.subcall_handle = handle.subcall_handle.take(); + + res + } + + /// Execute the precompile set and expect some precompile to have been executed, regardless of the + /// result. + pub fn execute_some(mut self) { + let res = self.execute(); + assert!(res.is_some()); + self.assert_optionals(); + } + + /// Execute the precompile set and expect no precompile to have been executed. + pub fn execute_none(mut self) { + let res = self.execute(); + assert!(res.is_none()); + self.assert_optionals(); + } + + /// Execute the precompile set and check it returns provided output. + pub fn execute_returns(mut self, output: Vec) { + let res = self.execute(); + assert_eq!(res, Some(Ok(PrecompileOutput { exit_status: ExitSucceed::Returned, output }))); + self.assert_optionals(); + } + + /// Execute the precompile set and check if it reverts. + /// Take a closure allowing to perform custom matching on the output. + pub fn execute_reverts(mut self, check: impl Fn(&[u8]) -> bool) { + let res = self.execute(); + assert_matches!( + res, + Some(Err(PrecompileFailure::Revert { output, ..})) + if check(&output) + ); + self.assert_optionals(); + } + + /// Execute the precompile set and check it returns provided output. + pub fn execute_error(mut self, error: ExitError) { + let res = self.execute(); + assert_eq!(res, Some(Err(PrecompileFailure::Error { exit_status: error }))); + self.assert_optionals(); + } +} + +pub trait PrecompileTesterExt: PrecompileSet + Sized { + fn prepare_test( + &self, + from: impl Into, + to: impl Into, + data: Vec, + ) -> PrecompilesTester; +} + +impl PrecompileTesterExt for T { + fn prepare_test( + &self, + from: impl Into, + to: impl Into, + data: Vec, + ) -> PrecompilesTester { + PrecompilesTester::new(self, from, to, data) + } +} + +#[derive(Clone, PartialEq, Eq)] +pub struct PrettyLog(Log); + +impl core::fmt::Debug for PrettyLog { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> Result<(), core::fmt::Error> { + let bytes = self + .0 + .data + .iter() + .map(|b| format!("{:02X}", b)) + .collect::>() + .join(""); + + let message = String::from_utf8(self.0.data.clone()).ok(); + + f.debug_struct("Log") + .field("address", &self.0.address) + .field("topics", &self.0.topics) + .field("data", &bytes) + .field("data_utf8", &message) + .finish() + } +} diff --git a/precompile/utils/src/tests.rs b/precompile/utils/src/tests.rs new file mode 100644 index 00000000..560631a2 --- /dev/null +++ b/precompile/utils/src/tests.rs @@ -0,0 +1,731 @@ +// This file is part of Astar. + +// Copyright 2019-2022 PureStake Inc. +// Copyright (C) 2022-2023 Stake Technologies Pte.Ltd. +// SPDX-License-Identifier: GPL-3.0-or-later +// +// This file is part of Utils package, originally developed by Purestake Inc. +// Utils package used in Astar Network in terms of GPLv3. +// +// Utils is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Utils is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Utils. If not, see . + +use super::*; +use hex_literal::hex; +use sp_core::{H256, U256}; + +fn u256_repeat_byte(byte: u8) -> U256 { + let value = H256::repeat_byte(byte); + + U256::from_big_endian(value.as_bytes()) +} + +// When debugging it is useful to display data in chunks of 32 bytes. +#[allow(dead_code)] +fn display_bytes(bytes: &[u8]) { + bytes + .chunks_exact(32) + .map(|chunk| H256::from_slice(chunk)) + .for_each(|hash| println!("{:?}", hash)); +} + +#[test] +fn write_bool() { + let value = true; + + let writer_output = EvmDataWriter::new().write(value).build(); + + let mut expected_output = [0u8; 32]; + expected_output[31] = 1; + + assert_eq!(writer_output, expected_output); +} + +#[test] +fn read_bool() { + let value = true; + + let writer_output = EvmDataWriter::new().write(value).build(); + + let mut reader = EvmDataReader::new(&writer_output); + let parsed: bool = reader.read().expect("to correctly parse bool"); + + assert_eq!(value, parsed); +} + +#[test] +fn write_u64() { + let value = 42u64; + + let writer_output = EvmDataWriter::new().write(value).build(); + + let mut expected_output = [0u8; 32]; + expected_output[24..].copy_from_slice(&value.to_be_bytes()); + + assert_eq!(writer_output, expected_output); +} + +#[test] +fn read_u64() { + let value = 42u64; + let writer_output = EvmDataWriter::new().write(value).build(); + + let mut reader = EvmDataReader::new(&writer_output); + let parsed: u64 = reader.read().expect("to correctly parse u64"); + + assert_eq!(value, parsed); +} + +#[test] +fn write_u128() { + let value = 42u128; + + let writer_output = EvmDataWriter::new().write(value).build(); + + let mut expected_output = [0u8; 32]; + expected_output[16..].copy_from_slice(&value.to_be_bytes()); + + assert_eq!(writer_output, expected_output); +} + +#[test] +fn read_u128() { + let value = 42u128; + let writer_output = EvmDataWriter::new().write(value).build(); + + let mut reader = EvmDataReader::new(&writer_output); + let parsed: u128 = reader.read().expect("to correctly parse u128"); + + assert_eq!(value, parsed); +} + +#[test] +fn write_u256() { + let value = U256::from(42); + + let writer_output = EvmDataWriter::new().write(value).build(); + + let mut expected_output = [0u8; 32]; + value.to_big_endian(&mut expected_output); + + assert_eq!(writer_output, expected_output); +} + +#[test] +fn read_u256() { + let value = U256::from(42); + let writer_output = EvmDataWriter::new().write(value).build(); + + let mut reader = EvmDataReader::new(&writer_output); + let parsed: U256 = reader.read().expect("to correctly parse U256"); + + assert_eq!(value, parsed); +} + +#[test] +fn read_selector() { + use sha3::{Digest, Keccak256}; + + #[precompile_utils_macro::generate_function_selector] + #[derive(Debug, PartialEq)] + enum FakeAction { + Action1 = "action1()", + } + + let selector = &Keccak256::digest(b"action1()")[0..4]; + + let parsed_selector = + EvmDataReader::read_selector::(selector).expect("there is a selector"); + EvmDataReader::new_skip_selector(selector).expect("there is a selector"); + + assert_eq!(parsed_selector, FakeAction::Action1) +} + +#[test] +#[should_panic(expected = "to correctly parse U256")] +fn read_u256_too_short() { + let value = U256::from(42); + let writer_output = EvmDataWriter::new().write(value).build(); + + let mut reader = EvmDataReader::new(&writer_output[0..31]); + let _: U256 = reader.read().expect("to correctly parse U256"); +} + +#[test] +fn write_h256() { + let mut raw = [0u8; 32]; + raw[0] = 42; + raw[12] = 43; + raw[31] = 44; + + let value = H256::from(raw); + + let output = EvmDataWriter::new().write(value).build(); + + assert_eq!(&output, &raw); +} + +#[test] +fn tmp() { + let u = U256::from(1_000_000_000); + println!("U256={:?}", u.0); +} + +#[test] +fn read_h256() { + let mut raw = [0u8; 32]; + raw[0] = 42; + raw[12] = 43; + raw[31] = 44; + let value = H256::from(raw); + let writer_output = EvmDataWriter::new().write(value).build(); + + let mut reader = EvmDataReader::new(&writer_output); + let parsed: H256 = reader.read().expect("to correctly parse H256"); + + assert_eq!(value, parsed); +} + +#[test] +#[should_panic(expected = "to correctly parse H256")] +fn read_h256_too_short() { + let mut raw = [0u8; 32]; + raw[0] = 42; + raw[12] = 43; + raw[31] = 44; + let value = H256::from(raw); + let writer_output = EvmDataWriter::new().write(value).build(); + + let mut reader = EvmDataReader::new(&writer_output[0..31]); + let _: H256 = reader.read().expect("to correctly parse H256"); +} + +#[test] +fn write_address() { + let value = H160::repeat_byte(0xAA); + + let output = EvmDataWriter::new().write(Address(value)).build(); + + assert_eq!(output.len(), 32); + assert_eq!(&output[12..32], value.as_bytes()); +} + +#[test] +fn read_address() { + let value = H160::repeat_byte(0xAA); + let writer_output = EvmDataWriter::new().write(Address(value)).build(); + + let mut reader = EvmDataReader::new(&writer_output); + let parsed: Address = reader.read().expect("to correctly parse Address"); + + assert_eq!(value, parsed.0); +} + +#[test] +fn write_h256_array() { + let array = vec![ + H256::repeat_byte(0x11), + H256::repeat_byte(0x22), + H256::repeat_byte(0x33), + H256::repeat_byte(0x44), + H256::repeat_byte(0x55), + ]; + let writer_output = EvmDataWriter::new().write(array.clone()).build(); + assert_eq!(writer_output.len(), 0xE0); + + // We can read this "manualy" using simpler functions since arrays are 32-byte aligned. + let mut reader = EvmDataReader::new(&writer_output); + + assert_eq!(reader.read::().expect("read offset"), 32.into()); + assert_eq!(reader.read::().expect("read size"), 5.into()); + assert_eq!(reader.read::().expect("read 1st"), array[0]); + assert_eq!(reader.read::().expect("read 2nd"), array[1]); + assert_eq!(reader.read::().expect("read 3rd"), array[2]); + assert_eq!(reader.read::().expect("read 4th"), array[3]); + assert_eq!(reader.read::().expect("read 5th"), array[4]); +} + +#[test] +fn read_h256_array() { + let array = vec![ + H256::repeat_byte(0x11), + H256::repeat_byte(0x22), + H256::repeat_byte(0x33), + H256::repeat_byte(0x44), + H256::repeat_byte(0x55), + ]; + let writer_output = EvmDataWriter::new().write(array.clone()).build(); + + let mut reader = EvmDataReader::new(&writer_output); + let parsed: Vec = reader.read().expect("to correctly parse Vec"); + + assert_eq!(array, parsed); +} + +#[test] +fn write_u256_array() { + let array = vec![ + u256_repeat_byte(0x11), + u256_repeat_byte(0x22), + u256_repeat_byte(0x33), + u256_repeat_byte(0x44), + u256_repeat_byte(0x55), + ]; + let writer_output = EvmDataWriter::new().write(array.clone()).build(); + assert_eq!(writer_output.len(), 0xE0); + + // We can read this "manualy" using simpler functions since arrays are 32-byte aligned. + let mut reader = EvmDataReader::new(&writer_output); + + assert_eq!(reader.read::().expect("read offset"), 32.into()); + assert_eq!(reader.read::().expect("read size"), 5.into()); + assert_eq!(reader.read::().expect("read 1st"), array[0]); + assert_eq!(reader.read::().expect("read 2nd"), array[1]); + assert_eq!(reader.read::().expect("read 3rd"), array[2]); + assert_eq!(reader.read::().expect("read 4th"), array[3]); + assert_eq!(reader.read::().expect("read 5th"), array[4]); +} + +#[test] +fn read_u256_array() { + let array = vec![ + u256_repeat_byte(0x11), + u256_repeat_byte(0x22), + u256_repeat_byte(0x33), + u256_repeat_byte(0x44), + u256_repeat_byte(0x55), + ]; + let writer_output = EvmDataWriter::new().write(array.clone()).build(); + + let mut reader = EvmDataReader::new(&writer_output); + let parsed: Vec = reader.read().expect("to correctly parse Vec"); + + assert_eq!(array, parsed); +} + +#[test] +fn write_address_array() { + let array = vec![ + Address(H160::repeat_byte(0x11)), + Address(H160::repeat_byte(0x22)), + Address(H160::repeat_byte(0x33)), + Address(H160::repeat_byte(0x44)), + Address(H160::repeat_byte(0x55)), + ]; + let writer_output = EvmDataWriter::new().write(array.clone()).build(); + + // We can read this "manualy" using simpler functions since arrays are 32-byte aligned. + let mut reader = EvmDataReader::new(&writer_output); + + assert_eq!(reader.read::().expect("read offset"), 32.into()); + assert_eq!(reader.read::().expect("read size"), 5.into()); + assert_eq!(reader.read::
().expect("read 1st"), array[0]); + assert_eq!(reader.read::
().expect("read 2nd"), array[1]); + assert_eq!(reader.read::
().expect("read 3rd"), array[2]); + assert_eq!(reader.read::
().expect("read 4th"), array[3]); + assert_eq!(reader.read::
().expect("read 5th"), array[4]); +} + +#[test] +fn read_address_array() { + let array = vec![ + Address(H160::repeat_byte(0x11)), + Address(H160::repeat_byte(0x22)), + Address(H160::repeat_byte(0x33)), + Address(H160::repeat_byte(0x44)), + Address(H160::repeat_byte(0x55)), + ]; + let writer_output = EvmDataWriter::new().write(array.clone()).build(); + + let mut reader = EvmDataReader::new(&writer_output); + let parsed: Vec
= reader.read().expect("to correctly parse Vec"); + + assert_eq!(array, parsed); +} + +#[test] +fn read_address_array_size_too_big() { + let array = vec![ + Address(H160::repeat_byte(0x11)), + Address(H160::repeat_byte(0x22)), + Address(H160::repeat_byte(0x33)), + Address(H160::repeat_byte(0x44)), + Address(H160::repeat_byte(0x55)), + ]; + let mut writer_output = EvmDataWriter::new().write(array).build(); + + U256::from(6u32).to_big_endian(&mut writer_output[0x20..0x40]); + + let mut reader = EvmDataReader::new(&writer_output); + + match reader.read::>() { + Ok(_) => panic!("should not parse correctly"), + Err(PrecompileFailure::Revert { output: err, .. }) => { + assert_eq!(err, b"tried to parse H160 out of bounds") + }, + Err(_) => panic!("unexpected error"), + } +} + +#[test] +fn write_address_nested_array() { + let array = vec![ + vec![ + Address(H160::repeat_byte(0x11)), + Address(H160::repeat_byte(0x22)), + Address(H160::repeat_byte(0x33)), + ], + vec![Address(H160::repeat_byte(0x44)), Address(H160::repeat_byte(0x55))], + ]; + let writer_output = EvmDataWriter::new().write(array.clone()).build(); + assert_eq!(writer_output.len(), 0x160); + + // We can read this "manualy" using simpler functions since arrays are 32-byte aligned. + let mut reader = EvmDataReader::new(&writer_output); + + assert_eq!(reader.read::().expect("read offset"), 0x20.into()); // 0x00 + assert_eq!(reader.read::().expect("read size"), 2.into()); // 0x20 + assert_eq!(reader.read::().expect("read 1st offset"), 0x40.into()); // 0x40 + assert_eq!(reader.read::().expect("read 2st offset"), 0xc0.into()); // 0x60 + assert_eq!(reader.read::().expect("read 1st size"), 3.into()); // 0x80 + assert_eq!(reader.read::
().expect("read 1-1"), array[0][0]); // 0xA0 + assert_eq!(reader.read::
().expect("read 1-2"), array[0][1]); // 0xC0 + assert_eq!(reader.read::
().expect("read 1-3"), array[0][2]); // 0xE0 + assert_eq!(reader.read::().expect("read 2nd size"), 2.into()); // 0x100 + assert_eq!(reader.read::
().expect("read 2-1"), array[1][0]); // 0x120 + assert_eq!(reader.read::
().expect("read 2-2"), array[1][1]); // 0x140 +} + +#[test] +fn read_address_nested_array() { + let array = vec![ + vec![ + Address(H160::repeat_byte(0x11)), + Address(H160::repeat_byte(0x22)), + Address(H160::repeat_byte(0x33)), + ], + vec![Address(H160::repeat_byte(0x44)), Address(H160::repeat_byte(0x55))], + ]; + let writer_output = EvmDataWriter::new().write(array.clone()).build(); + + let mut reader = EvmDataReader::new(&writer_output); + let parsed: Vec> = reader.read().expect("to correctly parse Vec>"); + + assert_eq!(array, parsed); +} + +#[test] + +fn write_multiple_arrays() { + let array1 = vec![ + Address(H160::repeat_byte(0x11)), + Address(H160::repeat_byte(0x22)), + Address(H160::repeat_byte(0x33)), + ]; + + let array2 = vec![H256::repeat_byte(0x44), H256::repeat_byte(0x55)]; + + let writer_output = EvmDataWriter::new().write(array1.clone()).write(array2.clone()).build(); + + assert_eq!(writer_output.len(), 0x120); + + // We can read this "manualy" using simpler functions since arrays are 32-byte aligned. + let mut reader = EvmDataReader::new(&writer_output); + + assert_eq!(reader.read::().expect("read 1st offset"), 0x40.into()); // 0x00 + assert_eq!(reader.read::().expect("read 2nd offset"), 0xc0.into()); // 0x20 + assert_eq!(reader.read::().expect("read 1st size"), 3.into()); // 0x40 + assert_eq!(reader.read::
().expect("read 1-1"), array1[0]); // 0x60 + assert_eq!(reader.read::
().expect("read 1-2"), array1[1]); // 0x80 + assert_eq!(reader.read::
().expect("read 1-3"), array1[2]); // 0xA0 + assert_eq!(reader.read::().expect("read 2nd size"), 2.into()); // 0xC0 + assert_eq!(reader.read::().expect("read 2-1"), array2[0]); // 0xE0 + assert_eq!(reader.read::().expect("read 2-2"), array2[1]); // 0x100 +} + +#[test] +fn read_multiple_arrays() { + let array1 = vec![ + Address(H160::repeat_byte(0x11)), + Address(H160::repeat_byte(0x22)), + Address(H160::repeat_byte(0x33)), + ]; + + let array2 = vec![H256::repeat_byte(0x44), H256::repeat_byte(0x55)]; + + let writer_output = EvmDataWriter::new().write(array1.clone()).write(array2.clone()).build(); + + // offset 0x20 + // offset 0x40 + // size 0x60 + // 3 addresses 0xC0 + // size 0xE0 + // 2 H256 0x120 + assert_eq!(writer_output.len(), 0x120); + + let mut reader = EvmDataReader::new(&writer_output); + + let parsed: Vec
= reader.read().expect("to correctly parse Vec
"); + assert_eq!(array1, parsed); + + let parsed: Vec = reader.read().expect("to correctly parse Vec"); + assert_eq!(array2, parsed); +} + +#[test] +fn read_bytes() { + let data = b"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod\ + tempor incididunt ut labore et dolore magna aliqua."; + let writer_output = EvmDataWriter::new().write(Bytes::from(&data[..])).build(); + + let mut reader = EvmDataReader::new(&writer_output); + let parsed: Bytes = reader.read().expect("to correctly parse Bytes"); + + assert_eq!(data, parsed.as_bytes()); +} + +#[test] +fn write_bytes() { + let data = b"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod\ + tempor incididunt ut labore et dolore magna aliqua."; + + let writer_output = EvmDataWriter::new().write(Bytes::from(&data[..])).build(); + + // We can read this "manualy" using simpler functions. + let mut reader = EvmDataReader::new(&writer_output); + + // We pad data to a multiple of 32 bytes. + let mut padded = data.to_vec(); + assert!(data.len() < 0x80); + padded.resize(0x80, 0); + + assert_eq!(reader.read::().expect("read offset"), 32.into()); + assert_eq!(reader.read::().expect("read size"), data.len().into()); + let mut read = |e| reader.read::().expect(e); // shorthand + assert_eq!(read("read part 1"), H256::from_slice(&padded[0x00..0x20])); + assert_eq!(read("read part 2"), H256::from_slice(&padded[0x20..0x40])); + assert_eq!(read("read part 3"), H256::from_slice(&padded[0x40..0x60])); + assert_eq!(read("read part 4"), H256::from_slice(&padded[0x60..0x80])); +} + +#[test] +fn read_string() { + let data = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod\ + tempor incididunt ut labore et dolore magna aliqua."; + let writer_output = EvmDataWriter::new().write(Bytes::from(data)).build(); + + let mut reader = EvmDataReader::new(&writer_output); + let parsed: Bytes = reader.read().expect("to correctly parse Bytes"); + + assert_eq!(data, parsed.as_str().expect("valid utf8")); +} + +#[test] +fn write_string() { + let data = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod\ + tempor incididunt ut labore et dolore magna aliqua."; + + let writer_output = EvmDataWriter::new().write(Bytes::from(data)).build(); + + // We can read this "manualy" using simpler functions. + let mut reader = EvmDataReader::new(&writer_output); + + // We pad data to next multiple of 32 bytes. + let mut padded = data.as_bytes().to_vec(); + assert!(data.len() < 0x80); + padded.resize(0x80, 0); + + assert_eq!(reader.read::().expect("read offset"), 32.into()); + assert_eq!(reader.read::().expect("read size"), data.len().into()); + let mut read = |e| reader.read::().expect(e); // shorthand + assert_eq!(read("read part 1"), H256::from_slice(&padded[0x00..0x20])); + assert_eq!(read("read part 2"), H256::from_slice(&padded[0x20..0x40])); + assert_eq!(read("read part 3"), H256::from_slice(&padded[0x40..0x60])); + assert_eq!(read("read part 4"), H256::from_slice(&padded[0x60..0x80])); +} + +#[test] +fn write_vec_bytes() { + let data = b"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod\ + tempor incididunt ut labore et dolore magna aliqua."; + + let writer_output = EvmDataWriter::new() + .write(vec![Bytes::from(&data[..]), Bytes::from(&data[..])]) + .build(); + + writer_output + .chunks_exact(32) + .map(|chunk| H256::from_slice(chunk)) + .for_each(|hash| println!("{:?}", hash)); + + // We pad data to a multiple of 32 bytes. + let mut padded = data.to_vec(); + assert!(data.len() < 0x80); + padded.resize(0x80, 0); + + let mut reader = EvmDataReader::new(&writer_output); + + // Offset of vec + assert_eq!(reader.read::().expect("read offset"), 32.into()); + + // Length of vec + assert_eq!(reader.read::().expect("read offset"), 2.into()); + + // Relative offset of first bytgmes object + assert_eq!(reader.read::().expect("read offset"), 0x40.into()); + // Relative offset of second bytes object + assert_eq!(reader.read::().expect("read offset"), 0xe0.into()); + + // Length of first bytes object + assert_eq!(reader.read::().expect("read size"), data.len().into()); + + // First byte objects data + let mut read = |e| reader.read::().expect(e); // shorthand + assert_eq!(read("read part 1"), H256::from_slice(&padded[0x00..0x20])); + assert_eq!(read("read part 2"), H256::from_slice(&padded[0x20..0x40])); + assert_eq!(read("read part 3"), H256::from_slice(&padded[0x40..0x60])); + assert_eq!(read("read part 4"), H256::from_slice(&padded[0x60..0x80])); + + // Length of second bytes object + assert_eq!(reader.read::().expect("read size"), data.len().into()); + + // Second byte objects data + let mut read = |e| reader.read::().expect(e); // shorthand + assert_eq!(read("read part 1"), H256::from_slice(&padded[0x00..0x20])); + assert_eq!(read("read part 2"), H256::from_slice(&padded[0x20..0x40])); + assert_eq!(read("read part 3"), H256::from_slice(&padded[0x40..0x60])); + assert_eq!(read("read part 4"), H256::from_slice(&padded[0x60..0x80])); +} + +#[test] +fn read_vec_of_bytes() { + let data = b"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod\ + tempor incididunt ut labore et dolore magna aliqua."; + + let writer_output = EvmDataWriter::new() + .write(vec![Bytes::from(&data[..]), Bytes::from(&data[..])]) + .build(); + + writer_output + .chunks_exact(32) + .map(|chunk| H256::from_slice(chunk)) + .for_each(|hash| println!("{:?}", hash)); + + let mut reader = EvmDataReader::new(&writer_output); + let parsed: Vec = reader.read().expect("to correctly parse Vec"); + + assert_eq!(vec![Bytes::from(&data[..]), Bytes::from(&data[..])], parsed); +} + +// The following test parses input data generated by web3 from a Solidity contract. +// This is important to test on external data since all the above tests can only test consistency +// between `EvmDataReader` and `EvmDataWriter`. +// +// It also provides an example on how to impl `EvmData` for Solidity structs. +// +// struct MultiLocation { +// uint8 parents; +// bytes [] interior; +// } +// +// function transfer( +// address currency_address, +// uint256 amount, +// MultiLocation memory destination, +// uint64 weight +// ) external; + +#[derive(Clone, Debug, Eq, PartialEq)] +struct MultiLocation { + parents: u8, + interior: Vec, +} + +impl EvmData for MultiLocation { + fn read(reader: &mut EvmDataReader) -> EvmResult { + let (parents, interior) = reader.read()?; + Ok(MultiLocation { parents, interior }) + } + + fn write(writer: &mut EvmDataWriter, value: Self) { + EvmData::write(writer, (value.parents, value.interior)); + } + + fn has_static_size() -> bool { + <(u8, Vec)>::has_static_size() + } +} + +#[crate::generate_function_selector] +#[derive(Debug, PartialEq)] +pub enum Action { + TransferMultiAsset = "transfer_multiasset((uint8,bytes[]),uint256,(uint8,bytes[]),uint64)", +} + +#[test] +fn read_complex_solidity_function() { + // Function call data generated by web3. + let data = hex!( + "b38c60fa + 0000000000000000000000000000000000000000000000000000000000000080 + 0000000000000000000000000000000000000000000000000000000000000064 + 00000000000000000000000000000000000000000000000000000000000001a0 + 0000000000000000000000000000000000000000000000000000000000000064 + 0000000000000000000000000000000000000000000000000000000000000001 + 0000000000000000000000000000000000000000000000000000000000000040 + 0000000000000000000000000000000000000000000000000000000000000002 + 0000000000000000000000000000000000000000000000000000000000000040 + 0000000000000000000000000000000000000000000000000000000000000080 + 0000000000000000000000000000000000000000000000000000000000000005 + 00000003e8000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000002 + 0403000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000001 + 0000000000000000000000000000000000000000000000000000000000000040 + 0000000000000000000000000000000000000000000000000000000000000001 + 0000000000000000000000000000000000000000000000000000000000000020 + 0000000000000000000000000000000000000000000000000000000000000022 + 0101010101010101010101010101010101010101010101010101010101010101 + 0100000000000000000000000000000000000000000000000000000000000000" + ); + + let selector = EvmDataReader::read_selector::(&data).expect("to read selector"); + let mut reader = EvmDataReader::new_skip_selector(&data).expect("to read selector"); + + assert_eq!(selector, Action::TransferMultiAsset); + // asset + assert_eq!( + reader.read::().unwrap(), + MultiLocation { + parents: 1, + interior: vec![Bytes::from(&hex!("00000003e8")[..]), Bytes::from(&hex!("0403")[..]),], + } + ); + + // amount + assert_eq!(reader.read::().unwrap(), 100u32.into()); + + // destination + assert_eq!( + reader.read::().unwrap(), + MultiLocation { + parents: 1, + interior: vec![Bytes::from( + &hex!("01010101010101010101010101010101010101010101010101010101010101010100")[..] + )], + } + ); + + // weight + assert_eq!(reader.read::().unwrap(), 100u32.into()); +} diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index ea2667e9..204023bf 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", optional = true , branch = "polkadot-v0.9.43" } [dependencies] -codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive"] } hex-literal = { version = "0.4.1", optional = true } log = { version = "0.4.17", default-features = false } scale-info = { version = "2.7.0", default-features = false, features = ["derive"] }