diff --git a/Cargo.lock b/Cargo.lock index ba10c93..4352e35 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -180,7 +180,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62945a2f7e6de02a31fe400aa489f0e0f5b2502e69f95f853adb82a96c7a6b60" dependencies = [ "quote", - "syn 2.0.82", + "syn 2.0.89", ] [[package]] @@ -193,7 +193,7 @@ dependencies = [ "num-traits", "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.89", ] [[package]] @@ -232,7 +232,7 @@ checksum = "213888f660fddcca0d257e88e54ac05bca01885f258ccdf695bafd77031bb69d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.89", ] [[package]] @@ -411,7 +411,7 @@ checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.89", ] [[package]] @@ -428,7 +428,7 @@ checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.89", ] [[package]] @@ -518,6 +518,12 @@ dependencies = [ "windows-targets", ] +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + [[package]] name = "base58" version = "0.2.0" @@ -542,6 +548,12 @@ version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" +[[package]] +name = "base64ct" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" + [[package]] name = "beef" version = "0.5.2" @@ -747,7 +759,7 @@ checksum = "bcfcc3cd946cb52f0bbfdbbcfa2f4e24f75ebb6c0e1002f7c25904fada18b9ec" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.89", ] [[package]] @@ -851,7 +863,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.89", ] [[package]] @@ -904,6 +916,12 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + [[package]] name = "constant_time_eq" version = "0.1.5" @@ -974,6 +992,18 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" +[[package]] +name = "crypto-bigint" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" +dependencies = [ + "generic-array", + "rand_core", + "subtle", + "zeroize", +] + [[package]] name = "crypto-common" version = "0.1.6" @@ -1021,7 +1051,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.89", ] [[package]] @@ -1069,7 +1099,7 @@ dependencies = [ "proc-macro2", "quote", "strsim 0.11.1", - "syn 2.0.82", + "syn 2.0.89", ] [[package]] @@ -1091,7 +1121,17 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core 0.20.10", "quote", - "syn 2.0.82", + "syn 2.0.89", +] + +[[package]] +name = "der" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" +dependencies = [ + "const-oid", + "zeroize", ] [[package]] @@ -1102,7 +1142,7 @@ checksum = "62d671cc41a825ebabc75757b62d3d168c577f9149b2d49ece1dad1f72119d25" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.89", ] [[package]] @@ -1115,7 +1155,7 @@ dependencies = [ "proc-macro2", "quote", "rustc_version", - "syn 2.0.82", + "syn 2.0.89", ] [[package]] @@ -1135,7 +1175,7 @@ checksum = "cb7330aeadfbe296029522e6c40f315320aba36fc43a5b3632f3795348f3bd22" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.89", ] [[package]] @@ -1154,6 +1194,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer 0.10.4", + "const-oid", "crypto-common", "subtle", ] @@ -1170,6 +1211,20 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" +[[package]] +name = "ecdsa" +version = "0.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" +dependencies = [ + "der", + "digest 0.10.7", + "elliptic-curve", + "rfc6979", + "signature", + "spki", +] + [[package]] name = "ed25519" version = "2.2.3" @@ -1203,7 +1258,7 @@ dependencies = [ "enum-ordinalize", "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.89", ] [[package]] @@ -1212,6 +1267,25 @@ version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest 0.10.7", + "ff", + "generic-array", + "group", + "pkcs8", + "rand_core", + "sec1", + "subtle", + "zeroize", +] + [[package]] name = "embedded-io" version = "0.4.0" @@ -1265,7 +1339,7 @@ checksum = "0d28318a75d4aead5c4db25382e8ef717932d0346600cacae6357eb5941bc5ff" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.89", ] [[package]] @@ -1277,7 +1351,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.89", ] [[package]] @@ -1356,6 +1430,16 @@ version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" +[[package]] +name = "ff" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" +dependencies = [ + "rand_core", + "subtle", +] + [[package]] name = "fiat-crypto" version = "0.2.9" @@ -1537,7 +1621,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.89", ] [[package]] @@ -1588,6 +1672,7 @@ checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", + "zeroize", ] [[package]] @@ -1664,6 +1749,17 @@ dependencies = [ "web-sys", ] +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core", + "subtle", +] + [[package]] name = "h2" version = "0.3.26" @@ -2383,6 +2479,20 @@ dependencies = [ "url", ] +[[package]] +name = "k256" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6e3919bbaa2945715f0bb6d3934a173d1e9a59ac23767fbaaef277265a7411b" +dependencies = [ + "cfg-if", + "ecdsa", + "elliptic-curve", + "once_cell", + "sha2 0.10.8", + "signature", +] + [[package]] name = "keccak" version = "0.1.5" @@ -2739,7 +2849,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.89", ] [[package]] @@ -2879,7 +2989,7 @@ checksum = "3c0f5fad0874fc7abcd4d750e76917eaebbecaa2c20bde22e1dbeeba8beb758c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.89", ] [[package]] @@ -2905,6 +3015,16 @@ dependencies = [ "futures-io", ] +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + [[package]] name = "pkg-config" version = "0.3.31" @@ -2978,7 +3098,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "64d1ec885c64d0457d564db4ec299b2dae3f9c02808b8ad9c3a089c591b18033" dependencies = [ "proc-macro2", - "syn 2.0.82", + "syn 2.0.89", ] [[package]] @@ -3039,9 +3159,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.89" +version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" +checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" dependencies = [ "unicode-ident", ] @@ -3132,7 +3252,7 @@ dependencies = [ "prost", "prost-types", "regex", - "syn 2.0.82", + "syn 2.0.89", "tempfile", ] @@ -3146,7 +3266,7 @@ dependencies = [ "itertools 0.12.1", "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.89", ] [[package]] @@ -3301,6 +3421,16 @@ dependencies = [ "windows-registry", ] +[[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 = "ring" version = "0.17.8" @@ -3590,7 +3720,7 @@ dependencies = [ "proc-macro-crate 3.2.0", "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.89", ] [[package]] @@ -3616,7 +3746,7 @@ dependencies = [ "proc-macro-crate 3.2.0", "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.89", ] [[package]] @@ -3638,7 +3768,7 @@ dependencies = [ "proc-macro2", "quote", "scale-info", - "syn 2.0.82", + "syn 2.0.89", "thiserror", ] @@ -3707,6 +3837,20 @@ dependencies = [ "untrusted", ] +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "pkcs8", + "subtle", + "zeroize", +] + [[package]] name = "security-framework" version = "2.11.1" @@ -3775,7 +3919,7 @@ checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.89", ] [[package]] @@ -3880,6 +4024,10 @@ name = "signature" version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest 0.10.7", + "rand_core", +] [[package]] name = "siphasher" @@ -4034,7 +4182,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.89", ] [[package]] @@ -4100,6 +4248,16 @@ dependencies = [ "lock_api", ] +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] + [[package]] name = "sqlparser" version = "0.45.0" @@ -4206,7 +4364,7 @@ dependencies = [ "scale-info", "scale-typegen", "subxt-metadata", - "syn 2.0.82", + "syn 2.0.89", "thiserror", "tokio", ] @@ -4277,7 +4435,7 @@ dependencies = [ "quote", "scale-typegen", "subxt-codegen", - "syn 2.0.82", + "syn 2.0.89", ] [[package]] @@ -4302,12 +4460,14 @@ dependencies = [ "env_logger", "futures", "indexmap 2.6.0", + "itertools 0.13.0", "log", "postcard", "proof-of-sql", "proof-of-sql-parser", "reqwest", "serde_json", + "snafu", "subxt", "sxt-proof-of-sql-sdk-local", "tokio", @@ -4319,10 +4479,12 @@ name = "sxt-proof-of-sql-sdk-local" version = "0.1.0" dependencies = [ "flexbuffers", + "k256", "proof-of-sql", "proof-of-sql-parser", "prost", "serde", + "sha3", "snafu", "subxt", "tonic", @@ -4361,9 +4523,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.82" +version = "2.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83540f837a8afc019423a8edb95b52a8effe46957ee402287f4292fae35be021" +checksum = "44d46482f1c1c87acd84dea20c1bf5ebff4c757009ed6bf19cfd36fb10e92c4e" dependencies = [ "proc-macro2", "quote", @@ -4452,7 +4614,7 @@ checksum = "ae71770322cbd277e69d762a16c444af02aa0575ac0d174f0b9562d3b37f8602" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.89", ] [[package]] @@ -4513,7 +4675,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.89", ] [[package]] @@ -4652,7 +4814,7 @@ dependencies = [ "proc-macro2", "prost-build", "quote", - "syn 2.0.82", + "syn 2.0.89", ] [[package]] @@ -4707,7 +4869,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.89", ] [[package]] @@ -4768,9 +4930,9 @@ checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unicode-normalization" -version = "0.1.24" +version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" +checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" dependencies = [ "tinyvec", ] @@ -4885,7 +5047,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.89", "wasm-bindgen-shared", ] @@ -4919,7 +5081,7 @@ checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.89", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -5205,7 +5367,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.89", ] [[package]] @@ -5225,5 +5387,5 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.89", ] diff --git a/Cargo.toml b/Cargo.toml index 3228074..f5fec5f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -40,3 +40,7 @@ tokio = { version = "1.0", features = ["rt-multi-thread", "macros"] } tonic = { version = "0.11", default-features = false } tonic-build = { version = "0.11" } wasm-bindgen = { version = "0.2.95" } +k256 = { version = "0.13.4" } +sha3 = { version = "0.10.8" } +sp-core = "34.0.0" +itertools = "0.13.0" \ No newline at end of file diff --git a/crates/proof-of-sql-sdk-local/Cargo.toml b/crates/proof-of-sql-sdk-local/Cargo.toml index d8117e5..f451a7d 100644 --- a/crates/proof-of-sql-sdk-local/Cargo.toml +++ b/crates/proof-of-sql-sdk-local/Cargo.toml @@ -14,6 +14,8 @@ tonic = { workspace = true, features = ["codegen", "prost"] } serde = { workspace = true } snafu = { workspace = true } subxt = { workspace = true } +k256 = { workspace = true } +sha3 = { workspace = true } [build-dependencies] tonic-build = { workspace = true } diff --git a/crates/proof-of-sql-sdk-local/src/attestation.rs b/crates/proof-of-sql-sdk-local/src/attestation.rs new file mode 100644 index 0000000..45c1c47 --- /dev/null +++ b/crates/proof-of-sql-sdk-local/src/attestation.rs @@ -0,0 +1,257 @@ +use crate::sxt_chain_runtime as runtime; +use k256::ecdsa::{RecoveryId, Signature, SigningKey, VerifyingKey}; +use sha3::{digest::core_api::CoreWrapper, Digest, Keccak256, Keccak256Core}; +use snafu::{ResultExt, Snafu}; + +/// Represents an Ethereum-style ECDSA signature, broken into its components. +/// +/// Wrapper around the [`k256::ecdsa::Signature`] type. +#[derive(Clone, Copy, Eq, PartialEq)] +pub struct EthereumSignature { + /// The `r` component of the signature. + pub r: [u8; 32], + /// The `s` component of the signature. + pub s: [u8; 32], + /// The recovery ID, usually 27 or 28 for Ethereum. + pub v: u8, +} + +impl EthereumSignature { + /// Creates a new `EthereumSignature`. + /// + /// If the recovery ID (`v`) is not provided, it defaults to `28`. + pub fn new(r: [u8; 32], s: [u8; 32], v: Option) -> Self { + Self { + r, + s, + v: v.unwrap_or(28), + } + } +} + +/// Top-level error type for the attestation module. +#[derive(Debug, Snafu)] +pub enum AttestationError { + /// Error during verification. + #[snafu(display("Verification error: {:?}", source))] + VerificationError { + /// Source of the error. + source: AttestationVerificationError, + }, + /// Error related to signing or verifying signatures. + #[snafu(display("Signature error: {:?}", source))] + SignatureError { + /// Source of the error. + source: SignatureError, + }, + /// Error parsing the public key. + #[snafu(display("Public key parsing error"))] + PublicKeyError, +} + +/// Specialized `Result` type for the attestation module. +type Result = core::result::Result; + +/// Errors that can occur during verification. +#[derive(Debug, Snafu)] +pub enum AttestationVerificationError { + /// The recovery ID does not match the Ethereum specification. + #[snafu(display("Invalid recovery ID: {:?}", recovery_id))] + InvalidRecoveryIdError { + /// The recovery id that caused the error + recovery_id: u8, + }, + /// The public key could not be recovered. + #[snafu(display("Key recovery error"))] + KeyRecoveryError, + /// The public key could not be parsed. + #[snafu(display("Public key parsing error"))] + PublicKeyParsingError, + /// The signature could not be recovered. + #[snafu(display("Signature recovery error"))] + SignatureRecoveryError, + + /// Invalid public key recovered + #[snafu(display("The signature recovery resulted in an incorrect public key"))] + InvalidPublicKeyRecovered, +} + +/// Errors related to signature generation and validation. +#[derive(Debug, Snafu)] +pub enum SignatureError { + /// Error parsing the private key into the correct format. + #[snafu(display("Error creating signing key from private key"))] + CreateSigningKeyError, +} + +/// Verifies an Ethereum ECDSA signature against a given message and public key. +/// +/// This function performs the following steps: +/// 1. Parses the `EthereumSignature` into its `r`, `s`, and `v` components. +/// 2. Attempts to recover the public key from the message digest and signature. +/// 3. Compares the recovered public key with the provided public key to determine validity. +/// +/// # Arguments +/// +/// * `msg` - The message that was signed, represented as a slice of bytes. +/// * `scalars` - The Ethereum signature, containing the `r`, `s`, and `v` components. +/// * `pub_key` - The public key to verify the signature against, as a byte slice. +/// +/// # Returns +/// +/// Returns `Ok(())` if the signature is valid. Otherwise, returns an error describing the failure. +/// +/// # Errors +/// +/// * `VerificationError::SignatureRecoveryError` - If the signature could not be parsed. +/// * `VerificationError::InvalidRecoveryIdError` - If the recovery ID (`v`) is invalid. +/// * `VerificationError::KeyRecoveryError` - If the public key cannot be recovered. +/// * `VerificationError::PublicKeyParsingError` - If the provided public key is invalid. +/// * `VerificationError::InvalidPublicKeyRecovered` - If the recovered public key does not match the provided key. +/// +/// # Examples +/// +/// ```rust +/// let msg = b"Example message"; +/// let signature = EthereumSignature { r: ..., s: ..., v: ... }; +/// let pub_key = [0x04, ...]; // Compressed or uncompressed public key bytes. +/// +/// match verify_eth_signature(msg, &signature, &pub_key) { +/// Ok(_) => println!("Signature is valid."), +/// Err(e) => println!("Signature verification failed: {:?}", e), +/// } +/// ``` +pub fn verify_eth_signature(msg: &[u8], scalars: &EthereumSignature, pub_key: &[u8]) -> Result<()> { + let signature = Signature::from_scalars(scalars.r, scalars.s) + .map_err(|_| AttestationVerificationError::SignatureRecoveryError) + .context(VerificationSnafu)?; + + let recovery_id = RecoveryId::try_from(scalars.v) + .map_err(|_| AttestationVerificationError::InvalidRecoveryIdError { + recovery_id: scalars.v, + }) + .context(VerificationSnafu)?; + + let digest = hash_eth_msg(msg); + + let recovered_pub_key = VerifyingKey::recover_from_digest(digest, &signature, recovery_id) + .map_err(|_| AttestationVerificationError::KeyRecoveryError) + .context(VerificationSnafu)?; + + let expected_key = VerifyingKey::from_sec1_bytes(pub_key) + .map_err(|_| AttestationVerificationError::PublicKeyParsingError) + .context(VerificationSnafu)?; + + match recovered_pub_key == expected_key { + true => Ok(()), + false => Err(AttestationError::VerificationError { + source: AttestationVerificationError::InvalidPublicKeyRecovered, + }), + } +} + +/// Hashes a message with the Ethereum-specific prefix. +/// +/// # Arguments +/// * `message` - The message to hash. +/// +/// Returns the hashed message. +fn hash_eth_msg(message: &[u8]) -> CoreWrapper { + let prefix = format!("\x19Ethereum Signed Message:\n{}", message.len()); + let mut hasher = Keccak256::new(); + hasher.update(prefix.as_bytes()); + hasher.update(message); + hasher +} + +/// Signs a message with a private Ethereum key. +/// +/// # Arguments +/// * `private_key` - The private key as a byte slice. +/// * `message` - The message to sign. +/// +/// Returns the signature if successful. +pub fn sign_eth_message(private_key: &[u8], message: &[u8]) -> Result { + let signing_key = SigningKey::from_bytes(private_key.into()) + .map_err(|_| SignatureError::CreateSigningKeyError) + .context(SignatureSnafu)?; + + let digest = hash_eth_msg(message); + + // Gross coercion of types below + let (signature, recovery_id) = signing_key.sign_digest_recoverable(digest).unwrap(); + let r = slice_to_scalar(&signature.r().to_bytes()) + .expect("r should work from sign_digest_recoverable"); + let s = slice_to_scalar(&signature.s().to_bytes()) + .expect("s should work from sign_digest_recoverable"); + + Ok(EthereumSignature::new(r, s, Some(recovery_id.into()))) +} + +/// Converts a slice into a fixed-size array. +/// +/// Returns `None` if the slice is not of the expected length. +fn slice_to_scalar(slice: &[u8]) -> Option<[u8; 32]> { + slice.try_into().ok() +} + +/// Create a message from a state root and block number +pub fn create_attestation_message(state_root: impl AsRef<[u8]>, block_number: u32) -> Vec { + let mut msg = Vec::with_capacity(state_root.as_ref().len() + std::mem::size_of::()); + msg.extend_from_slice(state_root.as_ref()); + msg.extend_from_slice(&block_number.to_le_bytes()); + msg +} + +/// Verifies the signature of an attestation. +/// +/// This function checks whether an Ethereum-style signature is valid for the provided message +/// and public key. It is typically used to validate attestations in a blockchain context. +/// +/// # Arguments +/// +/// * `msg` - The message that was signed, as a byte slice. +/// * `signature` - The Ethereum signature to verify, containing `r`, `s`, and `v` components. +/// * `proposed_pub_key` - The public key proposed for validation, as a 33-byte array. +/// * `block_number` - The block number associated with the attestation, used for error context. +/// +/// # Returns +/// +/// Returns `Ok(())` if the signature is valid. Otherwise, returns an error indicating why the +/// validation failed. +/// +/// # Errors +/// +/// * `AttestationError::InvalidSignature` - If the signature validation fails. +/// * `AttestationError::VerificationError` - If a lower-level signature verification error occurs. +/// +/// # Examples +/// +/// ```rust +/// let msg = b"Example attestation message"; +/// let signature = EthereumSignature { r: ..., s: ..., v: ... }; +/// let proposed_pub_key = [0x02, ...]; // Compressed public key bytes. +/// let block_number = 42; +/// +/// match verify_signature(msg, &signature, &proposed_pub_key, block_number) { +/// Ok(_) => println!("Attestation signature is valid."), +/// Err(e) => println!("Attestation signature verification failed: {:?}", e), +/// } +/// ``` +pub fn verify_signature( + msg: &[u8], + signature: &runtime::api::runtime_types::sxt_core::attestation::EthereumSignature, + proposed_pub_key: &[u8; 33], +) -> Result<(), AttestationError> { + let runtime::api::runtime_types::sxt_core::attestation::EthereumSignature { r, s, v } = + signature; + let signature = EthereumSignature { + r: *r, + s: *s, + v: *v, + }; + + verify_eth_signature(msg, &signature, proposed_pub_key)?; + + Ok(()) +} diff --git a/crates/proof-of-sql-sdk-local/src/lib.rs b/crates/proof-of-sql-sdk-local/src/lib.rs index 822fe59..f29efd5 100644 --- a/crates/proof-of-sql-sdk-local/src/lib.rs +++ b/crates/proof-of-sql-sdk-local/src/lib.rs @@ -16,3 +16,6 @@ pub use verify::{verify_prover_response, VerifyProverResponseError}; pub mod prover { tonic::include_proto!("sxt.core"); } + +/// types for verifying attestations +pub mod attestation; diff --git a/crates/proof-of-sql-sdk-local/src/sxt_chain_runtime.rs b/crates/proof-of-sql-sdk-local/src/sxt_chain_runtime.rs index f1f6f88..5610cec 100644 --- a/crates/proof-of-sql-sdk-local/src/sxt_chain_runtime.rs +++ b/crates/proof-of-sql-sdk-local/src/sxt_chain_runtime.rs @@ -1,4 +1,4 @@ -#[allow(dead_code, unused_imports, non_camel_case_types, unreachable_patterns)] +#[allow(dead_code, unused_imports, non_camel_case_types)] #[allow(clippy::all)] #[allow(rustdoc::broken_intra_doc_links)] pub mod api { @@ -6,19 +6,21 @@ pub mod api { mod root_mod { pub use super::*; } - pub static PALLETS: [&str; 12usize] = [ + pub static PALLETS: [&str; 14usize] = [ "System", "Timestamp", + "Session", + "Validators", "Aura", "Grandpa", "Balances", "TransactionPayment", "Sudo", - "TemplateModule", "Permissions", "Tables", "Indexing", "Commitments", + "Attestations", ]; pub static RUNTIME_APIS: [&str; 12usize] = [ "Core", @@ -34,13 +36,13 @@ pub mod api { "TransactionPaymentCallApi", "GenesisBuilder", ]; - #[doc = r" The error type that is returned when there is a runtime issue."] + #[doc = r" The error type returned when there is a runtime issue."] pub type DispatchError = runtime_types::sp_runtime::DispatchError; #[doc = r" The outer event enum."] pub type Event = runtime_types::sxt_runtime::RuntimeEvent; #[doc = r" The outer extrinsic enum."] pub type Call = runtime_types::sxt_runtime::RuntimeCall; - #[doc = r" The outer error enum represents the DispatchError's Module variant."] + #[doc = r" The outer error enum representing the DispatchError's Module variant."] pub type Error = runtime_types::sxt_runtime::RuntimeError; pub fn constants() -> ConstantsApi { ConstantsApi @@ -182,7 +184,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -206,7 +207,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -233,7 +233,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -330,7 +329,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -355,7 +353,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -381,7 +378,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -496,7 +492,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -523,7 +518,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -547,7 +541,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -574,7 +567,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -647,7 +639,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -705,7 +696,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -779,7 +769,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -804,7 +793,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -888,7 +876,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -920,7 +907,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -1071,7 +1057,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -1100,7 +1085,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -1131,7 +1115,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -1157,7 +1140,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -1211,7 +1193,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -1327,7 +1308,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -1358,7 +1338,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -1385,7 +1364,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -1411,7 +1389,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -1441,10 +1418,9 @@ pub mod api { "query_call_info", types::QueryCallInfo { call, len }, [ - 31u8, 193u8, 192u8, 150u8, 123u8, 94u8, 210u8, 18u8, 148u8, 65u8, - 233u8, 133u8, 77u8, 48u8, 101u8, 212u8, 236u8, 16u8, 219u8, 42u8, - 221u8, 179u8, 217u8, 229u8, 180u8, 79u8, 133u8, 23u8, 125u8, 142u8, - 61u8, 26u8, + 144u8, 76u8, 44u8, 254u8, 64u8, 0u8, 143u8, 167u8, 153u8, 252u8, 105u8, + 165u8, 111u8, 11u8, 52u8, 178u8, 96u8, 230u8, 19u8, 47u8, 58u8, 172u8, + 110u8, 212u8, 131u8, 32u8, 26u8, 168u8, 252u8, 245u8, 20u8, 195u8, ], ) } @@ -1462,10 +1438,10 @@ pub mod api { "query_call_fee_details", types::QueryCallFeeDetails { call, len }, [ - 124u8, 177u8, 227u8, 241u8, 25u8, 191u8, 100u8, 185u8, 83u8, 214u8, - 174u8, 75u8, 35u8, 175u8, 46u8, 255u8, 81u8, 65u8, 90u8, 206u8, 100u8, - 231u8, 110u8, 210u8, 119u8, 34u8, 148u8, 218u8, 244u8, 154u8, 12u8, - 211u8, + 128u8, 58u8, 72u8, 110u8, 150u8, 138u8, 237u8, 99u8, 138u8, 167u8, + 14u8, 74u8, 238u8, 159u8, 249u8, 97u8, 99u8, 109u8, 88u8, 162u8, 123u8, + 18u8, 26u8, 183u8, 244u8, 189u8, 154u8, 158u8, 231u8, 130u8, 193u8, + 69u8, ], ) } @@ -1531,7 +1507,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -1562,7 +1537,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -1589,7 +1563,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -1615,7 +1588,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -1668,7 +1640,7 @@ pub mod api { #[doc = ""] #[doc = " Otherwise function returns a JSON representation of the built-in, named"] #[doc = " `RuntimeGenesisConfig` preset identified by `id`, or `None` if such preset does not"] - #[doc = " exists. Returned `Vec` contains bytes of JSON blob (patch) which comprises a list of"] + #[doc = " exist. Returned `Vec` contains bytes of JSON blob (patch) which comprises a list of"] #[doc = " (potentially nested) key-value pairs that are intended for customizing the default"] #[doc = " runtime genesis config. The patch shall be merged (rfc7386) with the JSON representation"] #[doc = " of the default `RuntimeGenesisConfig` to create a comprehensive genesis config that can"] @@ -1737,7 +1709,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -1766,7 +1737,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -1793,7 +1763,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -1838,6 +1807,12 @@ pub mod api { pub fn timestamp(&self) -> timestamp::storage::StorageApi { timestamp::storage::StorageApi } + pub fn session(&self) -> session::storage::StorageApi { + session::storage::StorageApi + } + pub fn validators(&self) -> validators::storage::StorageApi { + validators::storage::StorageApi + } pub fn aura(&self) -> aura::storage::StorageApi { aura::storage::StorageApi } @@ -1853,9 +1828,6 @@ pub mod api { pub fn sudo(&self) -> sudo::storage::StorageApi { sudo::storage::StorageApi } - pub fn template_module(&self) -> template_module::storage::StorageApi { - template_module::storage::StorageApi - } pub fn permissions(&self) -> permissions::storage::StorageApi { permissions::storage::StorageApi } @@ -1868,6 +1840,9 @@ pub mod api { pub fn commitments(&self) -> commitments::storage::StorageApi { commitments::storage::StorageApi } + pub fn attestations(&self) -> attestations::storage::StorageApi { + attestations::storage::StorageApi + } } pub struct TransactionApi; impl TransactionApi { @@ -1877,6 +1852,12 @@ pub mod api { pub fn timestamp(&self) -> timestamp::calls::TransactionApi { timestamp::calls::TransactionApi } + pub fn session(&self) -> session::calls::TransactionApi { + session::calls::TransactionApi + } + pub fn validators(&self) -> validators::calls::TransactionApi { + validators::calls::TransactionApi + } pub fn grandpa(&self) -> grandpa::calls::TransactionApi { grandpa::calls::TransactionApi } @@ -1886,9 +1867,6 @@ pub mod api { pub fn sudo(&self) -> sudo::calls::TransactionApi { sudo::calls::TransactionApi } - pub fn template_module(&self) -> template_module::calls::TransactionApi { - template_module::calls::TransactionApi - } pub fn permissions(&self) -> permissions::calls::TransactionApi { permissions::calls::TransactionApi } @@ -1898,6 +1876,9 @@ pub mod api { pub fn indexing(&self) -> indexing::calls::TransactionApi { indexing::calls::TransactionApi } + pub fn attestations(&self) -> attestations::calls::TransactionApi { + attestations::calls::TransactionApi + } } #[doc = r" check whether the metadata provided is aligned with this statically generated code."] pub fn is_codegen_valid_for(metadata: &::subxt::ext::subxt_core::Metadata) -> bool { @@ -1908,9 +1889,9 @@ pub mod api { .hash(); runtime_metadata_hash == [ - 107u8, 158u8, 146u8, 35u8, 208u8, 129u8, 35u8, 224u8, 13u8, 192u8, 225u8, 67u8, - 122u8, 189u8, 128u8, 58u8, 191u8, 243u8, 64u8, 57u8, 147u8, 111u8, 7u8, 172u8, - 109u8, 218u8, 91u8, 0u8, 95u8, 139u8, 152u8, 156u8, + 53u8, 129u8, 58u8, 80u8, 206u8, 16u8, 16u8, 174u8, 40u8, 220u8, 39u8, 54u8, 251u8, + 156u8, 62u8, 164u8, 173u8, 27u8, 212u8, 17u8, 101u8, 75u8, 240u8, 191u8, 8u8, + 117u8, 25u8, 64u8, 75u8, 159u8, 128u8, 50u8, ] } pub mod system { @@ -1932,7 +1913,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -1962,7 +1942,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -1989,7 +1968,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -2017,7 +1995,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -2048,7 +2025,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -2078,7 +2054,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -2107,7 +2082,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -2140,7 +2114,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -2168,7 +2141,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -2198,7 +2170,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -2232,7 +2203,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -2501,7 +2471,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "An extrinsic completed successfully."] @@ -2524,7 +2493,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "An extrinsic failed."] @@ -2549,7 +2517,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "`:code` was updated."] @@ -2566,7 +2533,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "A new account was created."] @@ -2589,7 +2555,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "An account was reaped."] @@ -2612,7 +2577,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "On on-chain remark happened."] @@ -2637,7 +2601,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "An upgrade was authorized."] @@ -3067,9 +3030,9 @@ pub mod api { "Events", (), [ - 179u8, 124u8, 24u8, 183u8, 126u8, 25u8, 165u8, 146u8, 72u8, 120u8, - 71u8, 188u8, 73u8, 89u8, 23u8, 209u8, 152u8, 128u8, 21u8, 94u8, 16u8, - 108u8, 21u8, 39u8, 129u8, 2u8, 9u8, 67u8, 219u8, 244u8, 115u8, 58u8, + 12u8, 177u8, 221u8, 43u8, 135u8, 65u8, 120u8, 166u8, 136u8, 51u8, 30u8, + 179u8, 152u8, 64u8, 148u8, 248u8, 131u8, 6u8, 43u8, 95u8, 183u8, 208u8, + 232u8, 167u8, 103u8, 172u8, 55u8, 224u8, 119u8, 34u8, 0u8, 96u8, ], ) } @@ -3396,7 +3359,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -3566,107 +3528,12 @@ pub mod api { } } } - pub mod aura { - use super::{root_mod, runtime_types}; - pub mod storage { - use super::runtime_types; - pub mod types { - use super::runtime_types; - pub mod authorities { - use super::runtime_types; - pub type Authorities = - runtime_types::bounded_collections::bounded_vec::BoundedVec< - runtime_types::sp_consensus_aura::sr25519::app_sr25519::Public, - >; - } - pub mod current_slot { - use super::runtime_types; - pub type CurrentSlot = runtime_types::sp_consensus_slots::Slot; - } - } - pub struct StorageApi; - impl StorageApi { - #[doc = " The current authority set."] - pub fn authorities( - &self, - ) -> ::subxt::ext::subxt_core::storage::address::StaticAddress< - (), - types::authorities::Authorities, - ::subxt::ext::subxt_core::utils::Yes, - ::subxt::ext::subxt_core::utils::Yes, - (), - > { - ::subxt::ext::subxt_core::storage::address::StaticAddress::new_static( - "Aura", - "Authorities", - (), - [ - 95u8, 52u8, 203u8, 53u8, 254u8, 107u8, 134u8, 122u8, 95u8, 253u8, 51u8, - 137u8, 142u8, 106u8, 237u8, 248u8, 159u8, 80u8, 41u8, 233u8, 137u8, - 133u8, 13u8, 217u8, 176u8, 88u8, 132u8, 199u8, 241u8, 47u8, 125u8, - 27u8, - ], - ) - } - #[doc = " The current slot of this block."] - #[doc = ""] - #[doc = " This will be set in `on_initialize`."] - pub fn current_slot( - &self, - ) -> ::subxt::ext::subxt_core::storage::address::StaticAddress< - (), - types::current_slot::CurrentSlot, - ::subxt::ext::subxt_core::utils::Yes, - ::subxt::ext::subxt_core::utils::Yes, - (), - > { - ::subxt::ext::subxt_core::storage::address::StaticAddress::new_static( - "Aura", - "CurrentSlot", - (), - [ - 112u8, 199u8, 115u8, 248u8, 217u8, 242u8, 45u8, 231u8, 178u8, 53u8, - 236u8, 167u8, 219u8, 238u8, 81u8, 243u8, 39u8, 140u8, 68u8, 19u8, - 201u8, 169u8, 211u8, 133u8, 135u8, 213u8, 150u8, 105u8, 60u8, 252u8, - 43u8, 57u8, - ], - ) - } - } - } - pub mod constants { - use super::runtime_types; - pub struct ConstantsApi; - impl ConstantsApi { - #[doc = " The slot duration Aura should run with, expressed in milliseconds."] - #[doc = " The effective value of this type should not change while the chain is running."] - #[doc = ""] - #[doc = " For backwards compatibility either use [`MinimumPeriodTimesTwo`] or a const."] - pub fn slot_duration( - &self, - ) -> ::subxt::ext::subxt_core::constants::address::StaticAddress< - ::core::primitive::u64, - > { - ::subxt::ext::subxt_core::constants::address::StaticAddress::new_static( - "Aura", - "SlotDuration", - [ - 128u8, 214u8, 205u8, 242u8, 181u8, 142u8, 124u8, 231u8, 190u8, 146u8, - 59u8, 226u8, 157u8, 101u8, 103u8, 117u8, 249u8, 65u8, 18u8, 191u8, - 103u8, 119u8, 53u8, 85u8, 81u8, 96u8, 220u8, 42u8, 184u8, 239u8, 42u8, - 246u8, - ], - ) - } - } - } - } - pub mod grandpa { + pub mod session { use super::{root_mod, runtime_types}; - #[doc = "The `Error` enum of this pallet."] - pub type Error = runtime_types::pallet_grandpa::pallet::Error; + #[doc = "Error for the session pallet."] + pub type Error = runtime_types::pallet_session::pallet::Error; #[doc = "Contains a variant per dispatchable extrinsic that this pallet has."] - pub type Call = runtime_types::pallet_grandpa::pallet::Call; + pub type Call = runtime_types::pallet_session::pallet::Call; pub mod calls { use super::{root_mod, runtime_types}; type DispatchError = runtime_types::sp_runtime::DispatchError; @@ -3680,78 +3547,34 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] - #[decode_as_type( - crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" - )] - #[encode_as_type( - crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode" - )] - #[doc = "Report voter equivocation/misbehavior. This method will verify the"] - #[doc = "equivocation proof and validate the given key ownership proof"] - #[doc = "against the extracted offender. If both are valid, the offence"] - #[doc = "will be reported."] - pub struct ReportEquivocation { - pub equivocation_proof: ::subxt::ext::subxt_core::alloc::boxed::Box< - report_equivocation::EquivocationProof, - >, - pub key_owner_proof: report_equivocation::KeyOwnerProof, - } - pub mod report_equivocation { - use super::runtime_types; - pub type EquivocationProof = - runtime_types::sp_consensus_grandpa::EquivocationProof< - ::subxt::ext::subxt_core::utils::H256, - ::core::primitive::u32, - >; - pub type KeyOwnerProof = runtime_types::sp_core::Void; - } - impl ::subxt::ext::subxt_core::blocks::StaticExtrinsic for ReportEquivocation { - const PALLET: &'static str = "Grandpa"; - const CALL: &'static str = "report_equivocation"; - } - #[derive( - :: subxt :: ext :: subxt_core :: ext :: codec :: Decode, - :: subxt :: ext :: subxt_core :: ext :: codec :: Encode, - :: subxt :: ext :: subxt_core :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: subxt_core :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] #[encode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode" )] - #[doc = "Report voter equivocation/misbehavior. This method will verify the"] - #[doc = "equivocation proof and validate the given key ownership proof"] - #[doc = "against the extracted offender. If both are valid, the offence"] - #[doc = "will be reported."] + #[doc = "Sets the session key(s) of the function caller to `keys`."] + #[doc = "Allows an account to set its session key prior to becoming a validator."] + #[doc = "This doesn't take effect until the next session."] #[doc = ""] - #[doc = "This extrinsic must be called unsigned and it is expected that only"] - #[doc = "block authors will call it (validated in `ValidateUnsigned`), as such"] - #[doc = "if the block author is defined it will be defined as the equivocation"] - #[doc = "reporter."] - pub struct ReportEquivocationUnsigned { - pub equivocation_proof: ::subxt::ext::subxt_core::alloc::boxed::Box< - report_equivocation_unsigned::EquivocationProof, - >, - pub key_owner_proof: report_equivocation_unsigned::KeyOwnerProof, + #[doc = "The dispatch origin of this function must be signed."] + #[doc = ""] + #[doc = "## Complexity"] + #[doc = "- `O(1)`. Actual cost depends on the number of length of `T::Keys::key_ids()` which is"] + #[doc = " fixed."] + pub struct SetKeys { + pub keys: set_keys::Keys, + pub proof: set_keys::Proof, } - pub mod report_equivocation_unsigned { + pub mod set_keys { use super::runtime_types; - pub type EquivocationProof = - runtime_types::sp_consensus_grandpa::EquivocationProof< - ::subxt::ext::subxt_core::utils::H256, - ::core::primitive::u32, - >; - pub type KeyOwnerProof = runtime_types::sp_core::Void; + pub type Keys = runtime_types::sxt_runtime::opaque::SessionKeys; + pub type Proof = + ::subxt::ext::subxt_core::alloc::vec::Vec<::core::primitive::u8>; } - impl ::subxt::ext::subxt_core::blocks::StaticExtrinsic for ReportEquivocationUnsigned { - const PALLET: &'static str = "Grandpa"; - const CALL: &'static str = "report_equivocation_unsigned"; + impl ::subxt::ext::subxt_core::blocks::StaticExtrinsic for SetKeys { + const PALLET: &'static str = "Session"; + const CALL: &'static str = "set_keys"; } #[derive( :: subxt :: ext :: subxt_core :: ext :: codec :: Decode, @@ -3761,110 +3584,948 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] #[encode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode" )] - #[doc = "Note that the current authority set of the GRANDPA finality gadget has stalled."] + #[doc = "Removes any session key(s) of the function caller."] #[doc = ""] - #[doc = "This will trigger a forced authority set change at the beginning of the next session, to"] - #[doc = "be enacted `delay` blocks after that. The `delay` should be high enough to safely assume"] - #[doc = "that the block signalling the forced change will not be re-orged e.g. 1000 blocks."] - #[doc = "The block production rate (which may be slowed down because of finality lagging) should"] - #[doc = "be taken into account when choosing the `delay`. The GRANDPA voters based on the new"] - #[doc = "authority will start voting on top of `best_finalized_block_number` for new finalized"] - #[doc = "blocks. `best_finalized_block_number` should be the highest of the latest finalized"] - #[doc = "block of all validators of the new authority set."] + #[doc = "This doesn't take effect until the next session."] #[doc = ""] - #[doc = "Only callable by root."] - pub struct NoteStalled { - pub delay: note_stalled::Delay, - pub best_finalized_block_number: note_stalled::BestFinalizedBlockNumber, - } - pub mod note_stalled { - use super::runtime_types; - pub type Delay = ::core::primitive::u32; - pub type BestFinalizedBlockNumber = ::core::primitive::u32; - } - impl ::subxt::ext::subxt_core::blocks::StaticExtrinsic for NoteStalled { - const PALLET: &'static str = "Grandpa"; - const CALL: &'static str = "note_stalled"; + #[doc = "The dispatch origin of this function must be Signed and the account must be either be"] + #[doc = "convertible to a validator ID using the chain's typical addressing system (this usually"] + #[doc = "means being a controller account) or directly convertible into a validator ID (which"] + #[doc = "usually means being a stash account)."] + #[doc = ""] + #[doc = "## Complexity"] + #[doc = "- `O(1)` in number of key types. Actual cost depends on the number of length of"] + #[doc = " `T::Keys::key_ids()` which is fixed."] + pub struct PurgeKeys; + impl ::subxt::ext::subxt_core::blocks::StaticExtrinsic for PurgeKeys { + const PALLET: &'static str = "Session"; + const CALL: &'static str = "purge_keys"; } } pub struct TransactionApi; impl TransactionApi { - #[doc = "Report voter equivocation/misbehavior. This method will verify the"] - #[doc = "equivocation proof and validate the given key ownership proof"] - #[doc = "against the extracted offender. If both are valid, the offence"] - #[doc = "will be reported."] - pub fn report_equivocation( + #[doc = "Sets the session key(s) of the function caller to `keys`."] + #[doc = "Allows an account to set its session key prior to becoming a validator."] + #[doc = "This doesn't take effect until the next session."] + #[doc = ""] + #[doc = "The dispatch origin of this function must be signed."] + #[doc = ""] + #[doc = "## Complexity"] + #[doc = "- `O(1)`. Actual cost depends on the number of length of `T::Keys::key_ids()` which is"] + #[doc = " fixed."] + pub fn set_keys( &self, - equivocation_proof: types::report_equivocation::EquivocationProof, - key_owner_proof: types::report_equivocation::KeyOwnerProof, - ) -> ::subxt::ext::subxt_core::tx::payload::StaticPayload + keys: types::set_keys::Keys, + proof: types::set_keys::Proof, + ) -> ::subxt::ext::subxt_core::tx::payload::StaticPayload { ::subxt::ext::subxt_core::tx::payload::StaticPayload::new_static( - "Grandpa", - "report_equivocation", - types::ReportEquivocation { - equivocation_proof: ::subxt::ext::subxt_core::alloc::boxed::Box::new( - equivocation_proof, - ), - key_owner_proof, - }, + "Session", + "set_keys", + types::SetKeys { keys, proof }, [ - 187u8, 224u8, 115u8, 5u8, 236u8, 32u8, 180u8, 155u8, 218u8, 109u8, - 238u8, 253u8, 30u8, 225u8, 4u8, 225u8, 132u8, 232u8, 243u8, 54u8, 56u8, - 158u8, 94u8, 192u8, 94u8, 206u8, 189u8, 61u8, 14u8, 49u8, 48u8, 131u8, + 48u8, 188u8, 0u8, 161u8, 245u8, 138u8, 159u8, 146u8, 33u8, 52u8, 30u8, + 20u8, 17u8, 25u8, 176u8, 221u8, 45u8, 5u8, 84u8, 75u8, 108u8, 142u8, + 120u8, 102u8, 70u8, 9u8, 199u8, 158u8, 39u8, 155u8, 125u8, 28u8, ], ) } - #[doc = "Report voter equivocation/misbehavior. This method will verify the"] - #[doc = "equivocation proof and validate the given key ownership proof"] - #[doc = "against the extracted offender. If both are valid, the offence"] - #[doc = "will be reported."] + #[doc = "Removes any session key(s) of the function caller."] #[doc = ""] - #[doc = "This extrinsic must be called unsigned and it is expected that only"] - #[doc = "block authors will call it (validated in `ValidateUnsigned`), as such"] - #[doc = "if the block author is defined it will be defined as the equivocation"] - #[doc = "reporter."] - pub fn report_equivocation_unsigned( + #[doc = "This doesn't take effect until the next session."] + #[doc = ""] + #[doc = "The dispatch origin of this function must be Signed and the account must be either be"] + #[doc = "convertible to a validator ID using the chain's typical addressing system (this usually"] + #[doc = "means being a controller account) or directly convertible into a validator ID (which"] + #[doc = "usually means being a stash account)."] + #[doc = ""] + #[doc = "## Complexity"] + #[doc = "- `O(1)` in number of key types. Actual cost depends on the number of length of"] + #[doc = " `T::Keys::key_ids()` which is fixed."] + pub fn purge_keys( &self, - equivocation_proof: types::report_equivocation_unsigned::EquivocationProof, - key_owner_proof: types::report_equivocation_unsigned::KeyOwnerProof, - ) -> ::subxt::ext::subxt_core::tx::payload::StaticPayload< - types::ReportEquivocationUnsigned, - > { + ) -> ::subxt::ext::subxt_core::tx::payload::StaticPayload + { ::subxt::ext::subxt_core::tx::payload::StaticPayload::new_static( - "Grandpa", - "report_equivocation_unsigned", - types::ReportEquivocationUnsigned { - equivocation_proof: ::subxt::ext::subxt_core::alloc::boxed::Box::new( - equivocation_proof, - ), - key_owner_proof, - }, + "Session", + "purge_keys", + types::PurgeKeys {}, [ - 98u8, 103u8, 6u8, 54u8, 0u8, 200u8, 166u8, 163u8, 202u8, 45u8, 131u8, - 226u8, 114u8, 166u8, 237u8, 174u8, 207u8, 214u8, 2u8, 227u8, 32u8, - 166u8, 47u8, 83u8, 166u8, 239u8, 232u8, 72u8, 224u8, 242u8, 156u8, - 44u8, + 215u8, 204u8, 146u8, 236u8, 32u8, 78u8, 198u8, 79u8, 85u8, 214u8, 15u8, + 151u8, 158u8, 31u8, 146u8, 119u8, 119u8, 204u8, 151u8, 169u8, 226u8, + 67u8, 217u8, 39u8, 241u8, 245u8, 203u8, 240u8, 203u8, 172u8, 16u8, + 209u8, ], ) } - #[doc = "Note that the current authority set of the GRANDPA finality gadget has stalled."] - #[doc = ""] - #[doc = "This will trigger a forced authority set change at the beginning of the next session, to"] - #[doc = "be enacted `delay` blocks after that. The `delay` should be high enough to safely assume"] - #[doc = "that the block signalling the forced change will not be re-orged e.g. 1000 blocks."] - #[doc = "The block production rate (which may be slowed down because of finality lagging) should"] - #[doc = "be taken into account when choosing the `delay`. The GRANDPA voters based on the new"] - #[doc = "authority will start voting on top of `best_finalized_block_number` for new finalized"] - #[doc = "blocks. `best_finalized_block_number` should be the highest of the latest finalized"] - #[doc = "block of all validators of the new authority set."] + } + } + #[doc = "The `Event` enum of this pallet"] + pub type Event = runtime_types::pallet_session::pallet::Event; + pub mod events { + use super::runtime_types; + #[derive( + :: subxt :: ext :: subxt_core :: ext :: codec :: Decode, + :: subxt :: ext :: subxt_core :: ext :: codec :: Encode, + :: subxt :: ext :: subxt_core :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: subxt_core :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] + #[doc = "New session has happened. Note that the argument is the session index, not the"] + #[doc = "block number as the type might suggest."] + pub struct NewSession { + pub session_index: new_session::SessionIndex, + } + pub mod new_session { + use super::runtime_types; + pub type SessionIndex = ::core::primitive::u32; + } + impl ::subxt::ext::subxt_core::events::StaticEvent for NewSession { + const PALLET: &'static str = "Session"; + const EVENT: &'static str = "NewSession"; + } + } + pub mod storage { + use super::runtime_types; + pub mod types { + use super::runtime_types; + pub mod validators { + use super::runtime_types; + pub type Validators = ::subxt::ext::subxt_core::alloc::vec::Vec< + ::subxt::ext::subxt_core::utils::AccountId32, + >; + } + pub mod current_index { + use super::runtime_types; + pub type CurrentIndex = ::core::primitive::u32; + } + pub mod queued_changed { + use super::runtime_types; + pub type QueuedChanged = ::core::primitive::bool; + } + pub mod queued_keys { + use super::runtime_types; + pub type QueuedKeys = ::subxt::ext::subxt_core::alloc::vec::Vec<( + ::subxt::ext::subxt_core::utils::AccountId32, + runtime_types::sxt_runtime::opaque::SessionKeys, + )>; + } + pub mod disabled_validators { + use super::runtime_types; + pub type DisabledValidators = + ::subxt::ext::subxt_core::alloc::vec::Vec<::core::primitive::u32>; + } + pub mod next_keys { + use super::runtime_types; + pub type NextKeys = runtime_types::sxt_runtime::opaque::SessionKeys; + pub type Param0 = ::subxt::ext::subxt_core::utils::AccountId32; + } + pub mod key_owner { + use super::runtime_types; + pub type KeyOwner = ::subxt::ext::subxt_core::utils::AccountId32; + pub type Param0 = runtime_types::sp_core::crypto::KeyTypeId; + pub type Param1 = [::core::primitive::u8]; + } + } + pub struct StorageApi; + impl StorageApi { + #[doc = " The current set of validators."] + pub fn validators( + &self, + ) -> ::subxt::ext::subxt_core::storage::address::StaticAddress< + (), + types::validators::Validators, + ::subxt::ext::subxt_core::utils::Yes, + ::subxt::ext::subxt_core::utils::Yes, + (), + > { + ::subxt::ext::subxt_core::storage::address::StaticAddress::new_static( + "Session", + "Validators", + (), + [ + 50u8, 86u8, 154u8, 222u8, 249u8, 209u8, 156u8, 22u8, 155u8, 25u8, + 133u8, 194u8, 210u8, 50u8, 38u8, 28u8, 139u8, 201u8, 90u8, 139u8, + 115u8, 12u8, 12u8, 141u8, 4u8, 178u8, 201u8, 241u8, 223u8, 234u8, 6u8, + 86u8, + ], + ) + } + #[doc = " Current index of the session."] + pub fn current_index( + &self, + ) -> ::subxt::ext::subxt_core::storage::address::StaticAddress< + (), + types::current_index::CurrentIndex, + ::subxt::ext::subxt_core::utils::Yes, + ::subxt::ext::subxt_core::utils::Yes, + (), + > { + ::subxt::ext::subxt_core::storage::address::StaticAddress::new_static( + "Session", + "CurrentIndex", + (), + [ + 167u8, 151u8, 125u8, 150u8, 159u8, 21u8, 78u8, 217u8, 237u8, 183u8, + 135u8, 65u8, 187u8, 114u8, 188u8, 206u8, 16u8, 32u8, 69u8, 208u8, + 134u8, 159u8, 232u8, 224u8, 243u8, 27u8, 31u8, 166u8, 145u8, 44u8, + 221u8, 230u8, + ], + ) + } + #[doc = " True if the underlying economic identities or weighting behind the validators"] + #[doc = " has changed in the queued validator set."] + pub fn queued_changed( + &self, + ) -> ::subxt::ext::subxt_core::storage::address::StaticAddress< + (), + types::queued_changed::QueuedChanged, + ::subxt::ext::subxt_core::utils::Yes, + ::subxt::ext::subxt_core::utils::Yes, + (), + > { + ::subxt::ext::subxt_core::storage::address::StaticAddress::new_static( + "Session", + "QueuedChanged", + (), + [ + 184u8, 137u8, 224u8, 137u8, 31u8, 236u8, 95u8, 164u8, 102u8, 225u8, + 198u8, 227u8, 140u8, 37u8, 113u8, 57u8, 59u8, 4u8, 202u8, 102u8, 117u8, + 36u8, 226u8, 64u8, 113u8, 141u8, 199u8, 111u8, 99u8, 144u8, 198u8, + 153u8, + ], + ) + } + #[doc = " The queued keys for the next session. When the next session begins, these keys"] + #[doc = " will be used to determine the validator's session keys."] + pub fn queued_keys( + &self, + ) -> ::subxt::ext::subxt_core::storage::address::StaticAddress< + (), + types::queued_keys::QueuedKeys, + ::subxt::ext::subxt_core::utils::Yes, + ::subxt::ext::subxt_core::utils::Yes, + (), + > { + ::subxt::ext::subxt_core::storage::address::StaticAddress::new_static( + "Session", + "QueuedKeys", + (), + [ + 162u8, 181u8, 111u8, 231u8, 243u8, 120u8, 191u8, 220u8, 10u8, 186u8, + 5u8, 41u8, 158u8, 179u8, 194u8, 79u8, 23u8, 207u8, 237u8, 149u8, 110u8, + 217u8, 252u8, 98u8, 152u8, 64u8, 200u8, 133u8, 97u8, 236u8, 143u8, + 91u8, + ], + ) + } + #[doc = " Indices of disabled validators."] + #[doc = ""] + #[doc = " The vec is always kept sorted so that we can find whether a given validator is"] + #[doc = " disabled using binary search. It gets cleared when `on_session_ending` returns"] + #[doc = " a new set of identities."] + pub fn disabled_validators( + &self, + ) -> ::subxt::ext::subxt_core::storage::address::StaticAddress< + (), + types::disabled_validators::DisabledValidators, + ::subxt::ext::subxt_core::utils::Yes, + ::subxt::ext::subxt_core::utils::Yes, + (), + > { + ::subxt::ext::subxt_core::storage::address::StaticAddress::new_static( + "Session", + "DisabledValidators", + (), + [ + 213u8, 19u8, 168u8, 234u8, 187u8, 200u8, 180u8, 97u8, 234u8, 189u8, + 36u8, 233u8, 158u8, 184u8, 45u8, 35u8, 129u8, 213u8, 133u8, 8u8, 104u8, + 183u8, 46u8, 68u8, 154u8, 240u8, 132u8, 22u8, 247u8, 11u8, 54u8, 221u8, + ], + ) + } + #[doc = " The next session keys for a validator."] + pub fn next_keys_iter( + &self, + ) -> ::subxt::ext::subxt_core::storage::address::StaticAddress< + (), + types::next_keys::NextKeys, + (), + (), + ::subxt::ext::subxt_core::utils::Yes, + > { + ::subxt::ext::subxt_core::storage::address::StaticAddress::new_static( + "Session", + "NextKeys", + (), + [ + 165u8, 93u8, 209u8, 105u8, 147u8, 150u8, 218u8, 68u8, 116u8, 100u8, + 43u8, 135u8, 232u8, 100u8, 184u8, 210u8, 169u8, 240u8, 154u8, 169u8, + 28u8, 194u8, 180u8, 162u8, 148u8, 192u8, 113u8, 236u8, 62u8, 99u8, + 148u8, 187u8, + ], + ) + } + #[doc = " The next session keys for a validator."] + pub fn next_keys( + &self, + _0: impl ::core::borrow::Borrow, + ) -> ::subxt::ext::subxt_core::storage::address::StaticAddress< + ::subxt::ext::subxt_core::storage::address::StaticStorageKey< + types::next_keys::Param0, + >, + types::next_keys::NextKeys, + ::subxt::ext::subxt_core::utils::Yes, + (), + (), + > { + ::subxt::ext::subxt_core::storage::address::StaticAddress::new_static( + "Session", + "NextKeys", + ::subxt::ext::subxt_core::storage::address::StaticStorageKey::new( + _0.borrow(), + ), + [ + 165u8, 93u8, 209u8, 105u8, 147u8, 150u8, 218u8, 68u8, 116u8, 100u8, + 43u8, 135u8, 232u8, 100u8, 184u8, 210u8, 169u8, 240u8, 154u8, 169u8, + 28u8, 194u8, 180u8, 162u8, 148u8, 192u8, 113u8, 236u8, 62u8, 99u8, + 148u8, 187u8, + ], + ) + } + #[doc = " The owner of a key. The key is the `KeyTypeId` + the encoded key."] + pub fn key_owner_iter( + &self, + ) -> ::subxt::ext::subxt_core::storage::address::StaticAddress< + (), + types::key_owner::KeyOwner, + (), + (), + ::subxt::ext::subxt_core::utils::Yes, + > { + ::subxt::ext::subxt_core::storage::address::StaticAddress::new_static( + "Session", + "KeyOwner", + (), + [ + 217u8, 204u8, 21u8, 114u8, 247u8, 129u8, 32u8, 242u8, 93u8, 91u8, + 253u8, 253u8, 248u8, 90u8, 12u8, 202u8, 195u8, 25u8, 18u8, 100u8, + 253u8, 109u8, 88u8, 77u8, 217u8, 140u8, 51u8, 40u8, 118u8, 35u8, 107u8, + 206u8, + ], + ) + } + #[doc = " The owner of a key. The key is the `KeyTypeId` + the encoded key."] + pub fn key_owner_iter1( + &self, + _0: impl ::core::borrow::Borrow, + ) -> ::subxt::ext::subxt_core::storage::address::StaticAddress< + ::subxt::ext::subxt_core::storage::address::StaticStorageKey< + types::key_owner::Param0, + >, + types::key_owner::KeyOwner, + (), + (), + ::subxt::ext::subxt_core::utils::Yes, + > { + ::subxt::ext::subxt_core::storage::address::StaticAddress::new_static( + "Session", + "KeyOwner", + ::subxt::ext::subxt_core::storage::address::StaticStorageKey::new( + _0.borrow(), + ), + [ + 217u8, 204u8, 21u8, 114u8, 247u8, 129u8, 32u8, 242u8, 93u8, 91u8, + 253u8, 253u8, 248u8, 90u8, 12u8, 202u8, 195u8, 25u8, 18u8, 100u8, + 253u8, 109u8, 88u8, 77u8, 217u8, 140u8, 51u8, 40u8, 118u8, 35u8, 107u8, + 206u8, + ], + ) + } + #[doc = " The owner of a key. The key is the `KeyTypeId` + the encoded key."] + pub fn key_owner( + &self, + _0: impl ::core::borrow::Borrow, + _1: impl ::core::borrow::Borrow, + ) -> ::subxt::ext::subxt_core::storage::address::StaticAddress< + ( + ::subxt::ext::subxt_core::storage::address::StaticStorageKey< + types::key_owner::Param0, + >, + ::subxt::ext::subxt_core::storage::address::StaticStorageKey< + types::key_owner::Param1, + >, + ), + types::key_owner::KeyOwner, + ::subxt::ext::subxt_core::utils::Yes, + (), + (), + > { + ::subxt::ext::subxt_core::storage::address::StaticAddress::new_static( + "Session", + "KeyOwner", + ( + ::subxt::ext::subxt_core::storage::address::StaticStorageKey::new( + _0.borrow(), + ), + ::subxt::ext::subxt_core::storage::address::StaticStorageKey::new( + _1.borrow(), + ), + ), + [ + 217u8, 204u8, 21u8, 114u8, 247u8, 129u8, 32u8, 242u8, 93u8, 91u8, + 253u8, 253u8, 248u8, 90u8, 12u8, 202u8, 195u8, 25u8, 18u8, 100u8, + 253u8, 109u8, 88u8, 77u8, 217u8, 140u8, 51u8, 40u8, 118u8, 35u8, 107u8, + 206u8, + ], + ) + } + } + } + } + pub mod validators { + use super::{root_mod, runtime_types}; + #[doc = "Errors that can be returned by this pallet."] + pub type Error = runtime_types::pallet_validators::pallet::Error; + #[doc = "The pallet's dispatchable functions ([`Call`]s)."] + pub type Call = runtime_types::pallet_validators::pallet::Call; + pub mod calls { + use super::{root_mod, runtime_types}; + type DispatchError = runtime_types::sp_runtime::DispatchError; + pub mod types { + use super::runtime_types; + #[derive( + :: subxt :: ext :: subxt_core :: ext :: codec :: Decode, + :: subxt :: ext :: subxt_core :: ext :: codec :: Encode, + :: subxt :: ext :: subxt_core :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: subxt_core :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[decode_as_type( + crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" + )] + #[encode_as_type( + crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode" + )] + #[doc = "Add a new validator."] + pub struct AddValidator { + pub validator_id: add_validator::ValidatorId, + } + pub mod add_validator { + use super::runtime_types; + pub type ValidatorId = ::subxt::ext::subxt_core::utils::AccountId32; + } + impl ::subxt::ext::subxt_core::blocks::StaticExtrinsic for AddValidator { + const PALLET: &'static str = "Validators"; + const CALL: &'static str = "add_validator"; + } + #[derive( + :: subxt :: ext :: subxt_core :: ext :: codec :: Decode, + :: subxt :: ext :: subxt_core :: ext :: codec :: Encode, + :: subxt :: ext :: subxt_core :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: subxt_core :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[decode_as_type( + crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" + )] + #[encode_as_type( + crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode" + )] + #[doc = "Remove a validator."] + pub struct RemoveValidator { + pub validator_id: remove_validator::ValidatorId, + } + pub mod remove_validator { + use super::runtime_types; + pub type ValidatorId = ::subxt::ext::subxt_core::utils::AccountId32; + } + impl ::subxt::ext::subxt_core::blocks::StaticExtrinsic for RemoveValidator { + const PALLET: &'static str = "Validators"; + const CALL: &'static str = "remove_validator"; + } + } + pub struct TransactionApi; + impl TransactionApi { + #[doc = "Add a new validator."] + pub fn add_validator( + &self, + validator_id: types::add_validator::ValidatorId, + ) -> ::subxt::ext::subxt_core::tx::payload::StaticPayload + { + ::subxt::ext::subxt_core::tx::payload::StaticPayload::new_static( + "Validators", + "add_validator", + types::AddValidator { validator_id }, + [ + 126u8, 146u8, 187u8, 183u8, 159u8, 201u8, 223u8, 160u8, 19u8, 193u8, + 112u8, 251u8, 195u8, 206u8, 104u8, 98u8, 246u8, 104u8, 40u8, 122u8, + 86u8, 94u8, 97u8, 190u8, 47u8, 207u8, 221u8, 71u8, 119u8, 50u8, 79u8, + 68u8, + ], + ) + } + #[doc = "Remove a validator."] + pub fn remove_validator( + &self, + validator_id: types::remove_validator::ValidatorId, + ) -> ::subxt::ext::subxt_core::tx::payload::StaticPayload + { + ::subxt::ext::subxt_core::tx::payload::StaticPayload::new_static( + "Validators", + "remove_validator", + types::RemoveValidator { validator_id }, + [ + 83u8, 26u8, 215u8, 89u8, 19u8, 91u8, 208u8, 249u8, 201u8, 127u8, 230u8, + 207u8, 191u8, 215u8, 193u8, 206u8, 55u8, 139u8, 121u8, 133u8, 42u8, + 97u8, 68u8, 90u8, 210u8, 81u8, 74u8, 126u8, 60u8, 80u8, 242u8, 132u8, + ], + ) + } + } + } + #[doc = "The `Event` enum of this pallet"] + pub type Event = runtime_types::pallet_validators::pallet::Event; + pub mod events { + use super::runtime_types; + #[derive( + :: subxt :: ext :: subxt_core :: ext :: codec :: Decode, + :: subxt :: ext :: subxt_core :: ext :: codec :: Encode, + :: subxt :: ext :: subxt_core :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: subxt_core :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] + #[doc = "New validator addition initiated. Effective in ~2 sessions."] + pub struct ValidatorAdditionInitiated(pub validator_addition_initiated::Field0); + pub mod validator_addition_initiated { + use super::runtime_types; + pub type Field0 = ::subxt::ext::subxt_core::utils::AccountId32; + } + impl ::subxt::ext::subxt_core::events::StaticEvent for ValidatorAdditionInitiated { + const PALLET: &'static str = "Validators"; + const EVENT: &'static str = "ValidatorAdditionInitiated"; + } + #[derive( + :: subxt :: ext :: subxt_core :: ext :: codec :: Decode, + :: subxt :: ext :: subxt_core :: ext :: codec :: Encode, + :: subxt :: ext :: subxt_core :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: subxt_core :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] + #[doc = "Validator removal initiated. Effective in ~2 sessions."] + pub struct ValidatorRemovalInitiated(pub validator_removal_initiated::Field0); + pub mod validator_removal_initiated { + use super::runtime_types; + pub type Field0 = ::subxt::ext::subxt_core::utils::AccountId32; + } + impl ::subxt::ext::subxt_core::events::StaticEvent for ValidatorRemovalInitiated { + const PALLET: &'static str = "Validators"; + const EVENT: &'static str = "ValidatorRemovalInitiated"; + } + } + pub mod storage { + use super::runtime_types; + pub mod types { + use super::runtime_types; + pub mod something { + use super::runtime_types; + pub type Something = ::core::primitive::u32; + } + pub mod validators { + use super::runtime_types; + pub type Validators = + runtime_types::bounded_collections::bounded_vec::BoundedVec< + ::subxt::ext::subxt_core::utils::AccountId32, + >; + } + pub mod offline_validators { + use super::runtime_types; + pub type OfflineValidators = + runtime_types::bounded_collections::bounded_vec::BoundedVec< + ::subxt::ext::subxt_core::utils::AccountId32, + >; + } + } + pub struct StorageApi; + impl StorageApi { + pub fn something( + &self, + ) -> ::subxt::ext::subxt_core::storage::address::StaticAddress< + (), + types::something::Something, + ::subxt::ext::subxt_core::utils::Yes, + (), + (), + > { + ::subxt::ext::subxt_core::storage::address::StaticAddress::new_static( + "Validators", + "Something", + (), + [ + 6u8, 80u8, 50u8, 15u8, 9u8, 111u8, 229u8, 130u8, 206u8, 91u8, 123u8, + 1u8, 210u8, 243u8, 237u8, 67u8, 231u8, 115u8, 161u8, 63u8, 208u8, + 123u8, 139u8, 55u8, 186u8, 125u8, 167u8, 229u8, 229u8, 107u8, 235u8, + 56u8, + ], + ) + } + pub fn validators( + &self, + ) -> ::subxt::ext::subxt_core::storage::address::StaticAddress< + (), + types::validators::Validators, + ::subxt::ext::subxt_core::utils::Yes, + ::subxt::ext::subxt_core::utils::Yes, + (), + > { + ::subxt::ext::subxt_core::storage::address::StaticAddress::new_static( + "Validators", + "Validators", + (), + [ + 161u8, 172u8, 13u8, 250u8, 171u8, 85u8, 70u8, 135u8, 215u8, 32u8, + 156u8, 108u8, 145u8, 253u8, 40u8, 255u8, 190u8, 23u8, 7u8, 110u8, + 245u8, 25u8, 246u8, 18u8, 7u8, 143u8, 227u8, 73u8, 247u8, 255u8, 252u8, + 94u8, + ], + ) + } + pub fn offline_validators( + &self, + ) -> ::subxt::ext::subxt_core::storage::address::StaticAddress< + (), + types::offline_validators::OfflineValidators, + ::subxt::ext::subxt_core::utils::Yes, + ::subxt::ext::subxt_core::utils::Yes, + (), + > { + ::subxt::ext::subxt_core::storage::address::StaticAddress::new_static( + "Validators", + "OfflineValidators", + (), + [ + 244u8, 152u8, 193u8, 115u8, 100u8, 174u8, 85u8, 55u8, 56u8, 97u8, 89u8, + 80u8, 105u8, 160u8, 8u8, 34u8, 145u8, 38u8, 127u8, 198u8, 24u8, 85u8, + 49u8, 59u8, 173u8, 19u8, 90u8, 80u8, 233u8, 90u8, 95u8, 252u8, + ], + ) + } + } + } + } + pub mod aura { + use super::{root_mod, runtime_types}; + pub mod storage { + use super::runtime_types; + pub mod types { + use super::runtime_types; + pub mod authorities { + use super::runtime_types; + pub type Authorities = + runtime_types::bounded_collections::bounded_vec::BoundedVec< + runtime_types::sp_consensus_aura::sr25519::app_sr25519::Public, + >; + } + pub mod current_slot { + use super::runtime_types; + pub type CurrentSlot = runtime_types::sp_consensus_slots::Slot; + } + } + pub struct StorageApi; + impl StorageApi { + #[doc = " The current authority set."] + pub fn authorities( + &self, + ) -> ::subxt::ext::subxt_core::storage::address::StaticAddress< + (), + types::authorities::Authorities, + ::subxt::ext::subxt_core::utils::Yes, + ::subxt::ext::subxt_core::utils::Yes, + (), + > { + ::subxt::ext::subxt_core::storage::address::StaticAddress::new_static( + "Aura", + "Authorities", + (), + [ + 95u8, 52u8, 203u8, 53u8, 254u8, 107u8, 134u8, 122u8, 95u8, 253u8, 51u8, + 137u8, 142u8, 106u8, 237u8, 248u8, 159u8, 80u8, 41u8, 233u8, 137u8, + 133u8, 13u8, 217u8, 176u8, 88u8, 132u8, 199u8, 241u8, 47u8, 125u8, + 27u8, + ], + ) + } + #[doc = " The current slot of this block."] + #[doc = ""] + #[doc = " This will be set in `on_initialize`."] + pub fn current_slot( + &self, + ) -> ::subxt::ext::subxt_core::storage::address::StaticAddress< + (), + types::current_slot::CurrentSlot, + ::subxt::ext::subxt_core::utils::Yes, + ::subxt::ext::subxt_core::utils::Yes, + (), + > { + ::subxt::ext::subxt_core::storage::address::StaticAddress::new_static( + "Aura", + "CurrentSlot", + (), + [ + 112u8, 199u8, 115u8, 248u8, 217u8, 242u8, 45u8, 231u8, 178u8, 53u8, + 236u8, 167u8, 219u8, 238u8, 81u8, 243u8, 39u8, 140u8, 68u8, 19u8, + 201u8, 169u8, 211u8, 133u8, 135u8, 213u8, 150u8, 105u8, 60u8, 252u8, + 43u8, 57u8, + ], + ) + } + } + } + pub mod constants { + use super::runtime_types; + pub struct ConstantsApi; + impl ConstantsApi { + #[doc = " The slot duration Aura should run with, expressed in milliseconds."] + #[doc = " The effective value of this type should not change while the chain is running."] + #[doc = ""] + #[doc = " For backwards compatibility either use [`MinimumPeriodTimesTwo`] or a const."] + pub fn slot_duration( + &self, + ) -> ::subxt::ext::subxt_core::constants::address::StaticAddress< + ::core::primitive::u64, + > { + ::subxt::ext::subxt_core::constants::address::StaticAddress::new_static( + "Aura", + "SlotDuration", + [ + 128u8, 214u8, 205u8, 242u8, 181u8, 142u8, 124u8, 231u8, 190u8, 146u8, + 59u8, 226u8, 157u8, 101u8, 103u8, 117u8, 249u8, 65u8, 18u8, 191u8, + 103u8, 119u8, 53u8, 85u8, 81u8, 96u8, 220u8, 42u8, 184u8, 239u8, 42u8, + 246u8, + ], + ) + } + } + } + } + pub mod grandpa { + use super::{root_mod, runtime_types}; + #[doc = "The `Error` enum of this pallet."] + pub type Error = runtime_types::pallet_grandpa::pallet::Error; + #[doc = "Contains a variant per dispatchable extrinsic that this pallet has."] + pub type Call = runtime_types::pallet_grandpa::pallet::Call; + pub mod calls { + use super::{root_mod, runtime_types}; + type DispatchError = runtime_types::sp_runtime::DispatchError; + pub mod types { + use super::runtime_types; + #[derive( + :: subxt :: ext :: subxt_core :: ext :: codec :: Decode, + :: subxt :: ext :: subxt_core :: ext :: codec :: Encode, + :: subxt :: ext :: subxt_core :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: subxt_core :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[decode_as_type( + crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" + )] + #[encode_as_type( + crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode" + )] + #[doc = "Report voter equivocation/misbehavior. This method will verify the"] + #[doc = "equivocation proof and validate the given key ownership proof"] + #[doc = "against the extracted offender. If both are valid, the offence"] + #[doc = "will be reported."] + pub struct ReportEquivocation { + pub equivocation_proof: ::subxt::ext::subxt_core::alloc::boxed::Box< + report_equivocation::EquivocationProof, + >, + pub key_owner_proof: report_equivocation::KeyOwnerProof, + } + pub mod report_equivocation { + use super::runtime_types; + pub type EquivocationProof = + runtime_types::sp_consensus_grandpa::EquivocationProof< + ::subxt::ext::subxt_core::utils::H256, + ::core::primitive::u32, + >; + pub type KeyOwnerProof = runtime_types::sp_core::Void; + } + impl ::subxt::ext::subxt_core::blocks::StaticExtrinsic for ReportEquivocation { + const PALLET: &'static str = "Grandpa"; + const CALL: &'static str = "report_equivocation"; + } + #[derive( + :: subxt :: ext :: subxt_core :: ext :: codec :: Decode, + :: subxt :: ext :: subxt_core :: ext :: codec :: Encode, + :: subxt :: ext :: subxt_core :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: subxt_core :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[decode_as_type( + crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" + )] + #[encode_as_type( + crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode" + )] + #[doc = "Report voter equivocation/misbehavior. This method will verify the"] + #[doc = "equivocation proof and validate the given key ownership proof"] + #[doc = "against the extracted offender. If both are valid, the offence"] + #[doc = "will be reported."] + #[doc = ""] + #[doc = "This extrinsic must be called unsigned and it is expected that only"] + #[doc = "block authors will call it (validated in `ValidateUnsigned`), as such"] + #[doc = "if the block author is defined it will be defined as the equivocation"] + #[doc = "reporter."] + pub struct ReportEquivocationUnsigned { + pub equivocation_proof: ::subxt::ext::subxt_core::alloc::boxed::Box< + report_equivocation_unsigned::EquivocationProof, + >, + pub key_owner_proof: report_equivocation_unsigned::KeyOwnerProof, + } + pub mod report_equivocation_unsigned { + use super::runtime_types; + pub type EquivocationProof = + runtime_types::sp_consensus_grandpa::EquivocationProof< + ::subxt::ext::subxt_core::utils::H256, + ::core::primitive::u32, + >; + pub type KeyOwnerProof = runtime_types::sp_core::Void; + } + impl ::subxt::ext::subxt_core::blocks::StaticExtrinsic for ReportEquivocationUnsigned { + const PALLET: &'static str = "Grandpa"; + const CALL: &'static str = "report_equivocation_unsigned"; + } + #[derive( + :: subxt :: ext :: subxt_core :: ext :: codec :: Decode, + :: subxt :: ext :: subxt_core :: ext :: codec :: Encode, + :: subxt :: ext :: subxt_core :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: subxt_core :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[decode_as_type( + crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" + )] + #[encode_as_type( + crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode" + )] + #[doc = "Note that the current authority set of the GRANDPA finality gadget has stalled."] + #[doc = ""] + #[doc = "This will trigger a forced authority set change at the beginning of the next session, to"] + #[doc = "be enacted `delay` blocks after that. The `delay` should be high enough to safely assume"] + #[doc = "that the block signalling the forced change will not be re-orged e.g. 1000 blocks."] + #[doc = "The block production rate (which may be slowed down because of finality lagging) should"] + #[doc = "be taken into account when choosing the `delay`. The GRANDPA voters based on the new"] + #[doc = "authority will start voting on top of `best_finalized_block_number` for new finalized"] + #[doc = "blocks. `best_finalized_block_number` should be the highest of the latest finalized"] + #[doc = "block of all validators of the new authority set."] + #[doc = ""] + #[doc = "Only callable by root."] + pub struct NoteStalled { + pub delay: note_stalled::Delay, + pub best_finalized_block_number: note_stalled::BestFinalizedBlockNumber, + } + pub mod note_stalled { + use super::runtime_types; + pub type Delay = ::core::primitive::u32; + pub type BestFinalizedBlockNumber = ::core::primitive::u32; + } + impl ::subxt::ext::subxt_core::blocks::StaticExtrinsic for NoteStalled { + const PALLET: &'static str = "Grandpa"; + const CALL: &'static str = "note_stalled"; + } + } + pub struct TransactionApi; + impl TransactionApi { + #[doc = "Report voter equivocation/misbehavior. This method will verify the"] + #[doc = "equivocation proof and validate the given key ownership proof"] + #[doc = "against the extracted offender. If both are valid, the offence"] + #[doc = "will be reported."] + pub fn report_equivocation( + &self, + equivocation_proof: types::report_equivocation::EquivocationProof, + key_owner_proof: types::report_equivocation::KeyOwnerProof, + ) -> ::subxt::ext::subxt_core::tx::payload::StaticPayload + { + ::subxt::ext::subxt_core::tx::payload::StaticPayload::new_static( + "Grandpa", + "report_equivocation", + types::ReportEquivocation { + equivocation_proof: ::subxt::ext::subxt_core::alloc::boxed::Box::new( + equivocation_proof, + ), + key_owner_proof, + }, + [ + 187u8, 224u8, 115u8, 5u8, 236u8, 32u8, 180u8, 155u8, 218u8, 109u8, + 238u8, 253u8, 30u8, 225u8, 4u8, 225u8, 132u8, 232u8, 243u8, 54u8, 56u8, + 158u8, 94u8, 192u8, 94u8, 206u8, 189u8, 61u8, 14u8, 49u8, 48u8, 131u8, + ], + ) + } + #[doc = "Report voter equivocation/misbehavior. This method will verify the"] + #[doc = "equivocation proof and validate the given key ownership proof"] + #[doc = "against the extracted offender. If both are valid, the offence"] + #[doc = "will be reported."] + #[doc = ""] + #[doc = "This extrinsic must be called unsigned and it is expected that only"] + #[doc = "block authors will call it (validated in `ValidateUnsigned`), as such"] + #[doc = "if the block author is defined it will be defined as the equivocation"] + #[doc = "reporter."] + pub fn report_equivocation_unsigned( + &self, + equivocation_proof: types::report_equivocation_unsigned::EquivocationProof, + key_owner_proof: types::report_equivocation_unsigned::KeyOwnerProof, + ) -> ::subxt::ext::subxt_core::tx::payload::StaticPayload< + types::ReportEquivocationUnsigned, + > { + ::subxt::ext::subxt_core::tx::payload::StaticPayload::new_static( + "Grandpa", + "report_equivocation_unsigned", + types::ReportEquivocationUnsigned { + equivocation_proof: ::subxt::ext::subxt_core::alloc::boxed::Box::new( + equivocation_proof, + ), + key_owner_proof, + }, + [ + 98u8, 103u8, 6u8, 54u8, 0u8, 200u8, 166u8, 163u8, 202u8, 45u8, 131u8, + 226u8, 114u8, 166u8, 237u8, 174u8, 207u8, 214u8, 2u8, 227u8, 32u8, + 166u8, 47u8, 83u8, 166u8, 239u8, 232u8, 72u8, 224u8, 242u8, 156u8, + 44u8, + ], + ) + } + #[doc = "Note that the current authority set of the GRANDPA finality gadget has stalled."] + #[doc = ""] + #[doc = "This will trigger a forced authority set change at the beginning of the next session, to"] + #[doc = "be enacted `delay` blocks after that. The `delay` should be high enough to safely assume"] + #[doc = "that the block signalling the forced change will not be re-orged e.g. 1000 blocks."] + #[doc = "The block production rate (which may be slowed down because of finality lagging) should"] + #[doc = "be taken into account when choosing the `delay`. The GRANDPA voters based on the new"] + #[doc = "authority will start voting on top of `best_finalized_block_number` for new finalized"] + #[doc = "blocks. `best_finalized_block_number` should be the highest of the latest finalized"] + #[doc = "block of all validators of the new authority set."] #[doc = ""] #[doc = "Only callable by root."] pub fn note_stalled( @@ -3901,7 +4562,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "New authority set has been applied."] @@ -3927,7 +4587,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "Current authority set has been paused."] @@ -3944,7 +4603,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "Current authority set has been resumed."] @@ -4275,7 +4933,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -4314,7 +4971,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -4353,7 +5009,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -4391,7 +5046,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -4437,7 +5091,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -4471,7 +5124,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -4507,7 +5159,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -4542,7 +5193,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -4576,7 +5226,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -4838,7 +5487,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "An account was created with some free balance."] @@ -4863,7 +5511,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "An account was removed whose balance was non-zero but below ExistentialDeposit,"] @@ -4889,7 +5536,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "Transfer succeeded."] @@ -4916,7 +5562,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "A balance was set by root."] @@ -4941,7 +5586,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "Some balance was reserved (moved from free to reserved)."] @@ -4966,7 +5610,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "Some balance was unreserved (moved from reserved to free)."] @@ -4991,7 +5634,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "Some balance was moved from the reserve of the first account to the second account."] @@ -5022,7 +5664,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "Some amount was deposited (e.g. for transaction fees)."] @@ -5047,7 +5688,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "Some amount was withdrawn from the account (e.g. for transaction fees)."] @@ -5072,7 +5712,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "Some amount was removed from the account (e.g. for misbehavior)."] @@ -5097,7 +5736,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "Some amount was minted into an account."] @@ -5122,7 +5760,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "Some amount was burned from an account."] @@ -5147,7 +5784,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "Some amount was suspended from an account (it can be restored later)."] @@ -5172,7 +5808,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "Some amount was restored into an account."] @@ -5197,7 +5832,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "An account was upgraded."] @@ -5220,7 +5854,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "Total issuance was increased by `amount`, creating a credit to be balanced."] @@ -5243,7 +5876,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "Total issuance was decreased by `amount`, creating a debt to be balanced."] @@ -5266,7 +5898,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "Some balance was locked."] @@ -5291,7 +5922,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "Some balance was unlocked."] @@ -5316,7 +5946,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "Some balance was frozen."] @@ -5341,7 +5970,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "Some balance was thawed."] @@ -5366,7 +5994,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "The `TotalIssuance` was forcefully changed."] @@ -5881,7 +6508,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "A transaction fee `actual_fee`, of which `tip` was added to the minimum inclusion fee,"] @@ -6025,7 +6651,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -6052,7 +6677,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -6086,7 +6710,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -6117,7 +6740,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -6152,7 +6774,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -6183,10 +6804,9 @@ pub mod api { call: ::subxt::ext::subxt_core::alloc::boxed::Box::new(call), }, [ - 121u8, 108u8, 175u8, 85u8, 201u8, 197u8, 89u8, 129u8, 221u8, 240u8, - 29u8, 162u8, 174u8, 216u8, 24u8, 247u8, 110u8, 44u8, 93u8, 238u8, 88u8, - 238u8, 214u8, 120u8, 117u8, 130u8, 241u8, 100u8, 176u8, 188u8, 9u8, - 178u8, + 116u8, 53u8, 235u8, 94u8, 68u8, 135u8, 79u8, 23u8, 148u8, 132u8, 127u8, + 50u8, 235u8, 139u8, 218u8, 45u8, 142u8, 3u8, 153u8, 162u8, 72u8, 211u8, + 16u8, 170u8, 84u8, 172u8, 40u8, 168u8, 70u8, 22u8, 188u8, 238u8, ], ) } @@ -6209,10 +6829,9 @@ pub mod api { weight, }, [ - 28u8, 103u8, 180u8, 200u8, 98u8, 83u8, 110u8, 252u8, 126u8, 67u8, - 206u8, 121u8, 157u8, 176u8, 42u8, 217u8, 49u8, 136u8, 130u8, 152u8, - 189u8, 53u8, 206u8, 128u8, 19u8, 193u8, 59u8, 136u8, 97u8, 136u8, - 117u8, 166u8, + 92u8, 64u8, 70u8, 108u8, 98u8, 219u8, 68u8, 26u8, 226u8, 11u8, 43u8, + 21u8, 135u8, 224u8, 190u8, 249u8, 20u8, 82u8, 252u8, 112u8, 89u8, 38u8, + 55u8, 201u8, 145u8, 67u8, 29u8, 177u8, 223u8, 236u8, 91u8, 96u8, ], ) } @@ -6252,10 +6871,9 @@ pub mod api { call: ::subxt::ext::subxt_core::alloc::boxed::Box::new(call), }, [ - 172u8, 38u8, 215u8, 159u8, 53u8, 125u8, 226u8, 67u8, 122u8, 63u8, - 212u8, 168u8, 201u8, 233u8, 17u8, 167u8, 204u8, 229u8, 158u8, 132u8, - 234u8, 139u8, 241u8, 55u8, 23u8, 80u8, 172u8, 74u8, 131u8, 212u8, 62u8, - 81u8, + 108u8, 37u8, 145u8, 159u8, 232u8, 176u8, 12u8, 166u8, 94u8, 100u8, + 199u8, 224u8, 27u8, 77u8, 246u8, 8u8, 12u8, 114u8, 192u8, 214u8, 140u8, + 140u8, 89u8, 104u8, 92u8, 71u8, 107u8, 128u8, 114u8, 52u8, 153u8, 61u8, ], ) } @@ -6292,7 +6910,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "A sudo call just took place."] @@ -6316,7 +6933,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "The sudo key has been updated."] @@ -6326,250 +6942,29 @@ pub mod api { } pub mod key_changed { use super::runtime_types; - pub type Old = ::core::option::Option<::subxt::ext::subxt_core::utils::AccountId32>; - pub type New = ::subxt::ext::subxt_core::utils::AccountId32; - } - impl ::subxt::ext::subxt_core::events::StaticEvent for KeyChanged { - const PALLET: &'static str = "Sudo"; - const EVENT: &'static str = "KeyChanged"; - } - #[derive( - :: subxt :: ext :: subxt_core :: ext :: codec :: Decode, - :: subxt :: ext :: subxt_core :: ext :: codec :: Encode, - :: subxt :: ext :: subxt_core :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: subxt_core :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] - #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] - #[doc = "The key was permanently removed."] - pub struct KeyRemoved; - impl ::subxt::ext::subxt_core::events::StaticEvent for KeyRemoved { - const PALLET: &'static str = "Sudo"; - const EVENT: &'static str = "KeyRemoved"; - } - #[derive( - :: subxt :: ext :: subxt_core :: ext :: codec :: Decode, - :: subxt :: ext :: subxt_core :: ext :: codec :: Encode, - :: subxt :: ext :: subxt_core :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: subxt_core :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] - #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] - #[doc = "A [sudo_as](Pallet::sudo_as) call just took place."] - pub struct SudoAsDone { - pub sudo_result: sudo_as_done::SudoResult, - } - pub mod sudo_as_done { - use super::runtime_types; - pub type SudoResult = - ::core::result::Result<(), runtime_types::sp_runtime::DispatchError>; - } - impl ::subxt::ext::subxt_core::events::StaticEvent for SudoAsDone { - const PALLET: &'static str = "Sudo"; - const EVENT: &'static str = "SudoAsDone"; - } - } - pub mod storage { - use super::runtime_types; - pub mod types { - use super::runtime_types; - pub mod key { - use super::runtime_types; - pub type Key = ::subxt::ext::subxt_core::utils::AccountId32; - } - } - pub struct StorageApi; - impl StorageApi { - #[doc = " The `AccountId` of the sudo key."] - pub fn key( - &self, - ) -> ::subxt::ext::subxt_core::storage::address::StaticAddress< - (), - types::key::Key, - ::subxt::ext::subxt_core::utils::Yes, - (), - (), - > { - ::subxt::ext::subxt_core::storage::address::StaticAddress::new_static( - "Sudo", - "Key", - (), - [ - 72u8, 14u8, 225u8, 162u8, 205u8, 247u8, 227u8, 105u8, 116u8, 57u8, 4u8, - 31u8, 84u8, 137u8, 227u8, 228u8, 133u8, 245u8, 206u8, 227u8, 117u8, - 36u8, 252u8, 151u8, 107u8, 15u8, 180u8, 4u8, 4u8, 152u8, 195u8, 144u8, - ], - ) - } - } - } - } - pub mod template_module { - use super::{root_mod, runtime_types}; - #[doc = "Errors that can be returned by this pallet."] - #[doc = ""] - #[doc = "Errors tell users that something went wrong so it's important that their naming is"] - #[doc = "informative. Similar to events, error documentation is added to a node's metadata so it's"] - #[doc = "equally important that they have helpful documentation associated with them."] - #[doc = ""] - #[doc = "This type of runtime error can be up to 4 bytes in size should you want to return additional"] - #[doc = "information."] - pub type Error = runtime_types::pallet_template::pallet::Error; - #[doc = "The pallet's dispatchable functions ([`Call`]s)."] - #[doc = ""] - #[doc = "Dispatchable functions allows users to interact with the pallet and invoke state changes."] - #[doc = "These functions materialize as \"extrinsics\", which are often compared to transactions."] - #[doc = "They must always return a `DispatchResult` and be annotated with a weight and call index."] - #[doc = ""] - #[doc = "The [`call_index`] macro is used to explicitly"] - #[doc = "define an index for calls in the [`Call`] enum. This is useful for pallets that may"] - #[doc = "introduce new dispatchables over time. If the order of a dispatchable changes, its index"] - #[doc = "will also change which will break backwards compatibility."] - #[doc = ""] - #[doc = "The [`weight`] macro is used to assign a weight to each call."] - pub type Call = runtime_types::pallet_template::pallet::Call; - pub mod calls { - use super::{root_mod, runtime_types}; - type DispatchError = runtime_types::sp_runtime::DispatchError; - pub mod types { - use super::runtime_types; - #[derive( - :: subxt :: ext :: subxt_core :: ext :: codec :: Decode, - :: subxt :: ext :: subxt_core :: ext :: codec :: Encode, - :: subxt :: ext :: subxt_core :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: subxt_core :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] - #[decode_as_type( - crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" - )] - #[encode_as_type( - crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode" - )] - #[doc = "An example dispatchable that takes a single u32 value as a parameter, writes the value"] - #[doc = "to storage and emits an event."] - #[doc = ""] - #[doc = "It checks that the _origin_ for this call is _Signed_ and returns a dispatch"] - #[doc = "error if it isn't. Learn more about origins here: "] - pub struct DoSomething { - pub something: do_something::Something, - } - pub mod do_something { - use super::runtime_types; - pub type Something = ::core::primitive::u32; - } - impl ::subxt::ext::subxt_core::blocks::StaticExtrinsic for DoSomething { - const PALLET: &'static str = "TemplateModule"; - const CALL: &'static str = "do_something"; - } - #[derive( - :: subxt :: ext :: subxt_core :: ext :: codec :: Decode, - :: subxt :: ext :: subxt_core :: ext :: codec :: Encode, - :: subxt :: ext :: subxt_core :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: subxt_core :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] - #[decode_as_type( - crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" - )] - #[encode_as_type( - crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode" - )] - #[doc = "An example dispatchable that may throw a custom error."] - #[doc = ""] - #[doc = "It checks that the caller is a signed origin and reads the current value from the"] - #[doc = "`Something` storage item. If a current value exists, it is incremented by 1 and then"] - #[doc = "written back to storage."] - #[doc = ""] - #[doc = "## Errors"] - #[doc = ""] - #[doc = "The function will return an error under the following conditions:"] - #[doc = ""] - #[doc = "- If no value has been set ([`Error::NoneValue`])"] - #[doc = "- If incrementing the value in storage causes an arithmetic overflow"] - #[doc = " ([`Error::StorageOverflow`])"] - pub struct CauseError; - impl ::subxt::ext::subxt_core::blocks::StaticExtrinsic for CauseError { - const PALLET: &'static str = "TemplateModule"; - const CALL: &'static str = "cause_error"; - } + pub type Old = ::core::option::Option<::subxt::ext::subxt_core::utils::AccountId32>; + pub type New = ::subxt::ext::subxt_core::utils::AccountId32; } - pub struct TransactionApi; - impl TransactionApi { - #[doc = "An example dispatchable that takes a single u32 value as a parameter, writes the value"] - #[doc = "to storage and emits an event."] - #[doc = ""] - #[doc = "It checks that the _origin_ for this call is _Signed_ and returns a dispatch"] - #[doc = "error if it isn't. Learn more about origins here: "] - pub fn do_something( - &self, - something: types::do_something::Something, - ) -> ::subxt::ext::subxt_core::tx::payload::StaticPayload - { - ::subxt::ext::subxt_core::tx::payload::StaticPayload::new_static( - "TemplateModule", - "do_something", - types::DoSomething { something }, - [ - 236u8, 120u8, 161u8, 55u8, 61u8, 88u8, 224u8, 28u8, 174u8, 255u8, 69u8, - 156u8, 44u8, 11u8, 255u8, 87u8, 183u8, 239u8, 120u8, 48u8, 187u8, - 157u8, 151u8, 49u8, 105u8, 193u8, 12u8, 1u8, 183u8, 58u8, 73u8, 4u8, - ], - ) - } - #[doc = "An example dispatchable that may throw a custom error."] - #[doc = ""] - #[doc = "It checks that the caller is a signed origin and reads the current value from the"] - #[doc = "`Something` storage item. If a current value exists, it is incremented by 1 and then"] - #[doc = "written back to storage."] - #[doc = ""] - #[doc = "## Errors"] - #[doc = ""] - #[doc = "The function will return an error under the following conditions:"] - #[doc = ""] - #[doc = "- If no value has been set ([`Error::NoneValue`])"] - #[doc = "- If incrementing the value in storage causes an arithmetic overflow"] - #[doc = " ([`Error::StorageOverflow`])"] - pub fn cause_error( - &self, - ) -> ::subxt::ext::subxt_core::tx::payload::StaticPayload - { - ::subxt::ext::subxt_core::tx::payload::StaticPayload::new_static( - "TemplateModule", - "cause_error", - types::CauseError {}, - [ - 29u8, 131u8, 81u8, 134u8, 218u8, 173u8, 12u8, 104u8, 19u8, 10u8, 117u8, - 192u8, 155u8, 3u8, 171u8, 11u8, 177u8, 248u8, 43u8, 252u8, 4u8, 46u8, - 244u8, 69u8, 220u8, 51u8, 188u8, 75u8, 165u8, 41u8, 16u8, 188u8, - ], - ) - } + impl ::subxt::ext::subxt_core::events::StaticEvent for KeyChanged { + const PALLET: &'static str = "Sudo"; + const EVENT: &'static str = "KeyChanged"; + } + #[derive( + :: subxt :: ext :: subxt_core :: ext :: codec :: Decode, + :: subxt :: ext :: subxt_core :: ext :: codec :: Encode, + :: subxt :: ext :: subxt_core :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: subxt_core :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] + #[doc = "The key was permanently removed."] + pub struct KeyRemoved; + impl ::subxt::ext::subxt_core::events::StaticEvent for KeyRemoved { + const PALLET: &'static str = "Sudo"; + const EVENT: &'static str = "KeyRemoved"; } - } - #[doc = "Events that functions in this pallet can emit."] - #[doc = ""] - #[doc = "Events are a simple means of indicating to the outside world (such as dApps, chain explorers"] - #[doc = "or other users) that some notable update in the runtime has occurred. In a FRAME pallet, the"] - #[doc = "documentation for each event field and its parameters is added to a node's metadata so it"] - #[doc = "can be used by external interfaces or tools."] - #[doc = ""] - #[doc = "\tThe `generate_deposit` macro generates a function on `Pallet` called `deposit_event` which"] - #[doc = "will convert the event type of your pallet into `RuntimeEvent` (declared in the pallet's"] - #[doc = "[`Config`] trait) and deposit it using [`frame_system::Pallet::deposit_event`]."] - pub type Event = runtime_types::pallet_template::pallet::Event; - pub mod events { - use super::runtime_types; #[derive( :: subxt :: ext :: subxt_core :: ext :: codec :: Decode, :: subxt :: ext :: subxt_core :: ext :: codec :: Encode, @@ -6578,57 +6973,51 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] - #[doc = "A user has successfully set a new value."] - pub struct SomethingStored { - pub something: something_stored::Something, - pub who: something_stored::Who, + #[doc = "A [sudo_as](Pallet::sudo_as) call just took place."] + pub struct SudoAsDone { + pub sudo_result: sudo_as_done::SudoResult, } - pub mod something_stored { + pub mod sudo_as_done { use super::runtime_types; - pub type Something = ::core::primitive::u32; - pub type Who = ::subxt::ext::subxt_core::utils::AccountId32; + pub type SudoResult = + ::core::result::Result<(), runtime_types::sp_runtime::DispatchError>; } - impl ::subxt::ext::subxt_core::events::StaticEvent for SomethingStored { - const PALLET: &'static str = "TemplateModule"; - const EVENT: &'static str = "SomethingStored"; + impl ::subxt::ext::subxt_core::events::StaticEvent for SudoAsDone { + const PALLET: &'static str = "Sudo"; + const EVENT: &'static str = "SudoAsDone"; } } pub mod storage { use super::runtime_types; pub mod types { use super::runtime_types; - pub mod something { + pub mod key { use super::runtime_types; - pub type Something = ::core::primitive::u32; + pub type Key = ::subxt::ext::subxt_core::utils::AccountId32; } } pub struct StorageApi; impl StorageApi { - #[doc = " A storage item for this pallet."] - #[doc = ""] - #[doc = " In this template, we are declaring a storage item called `Something` that stores a single"] - #[doc = " `u32` value. Learn more about runtime storage here: "] - pub fn something( + #[doc = " The `AccountId` of the sudo key."] + pub fn key( &self, ) -> ::subxt::ext::subxt_core::storage::address::StaticAddress< (), - types::something::Something, + types::key::Key, ::subxt::ext::subxt_core::utils::Yes, (), (), > { ::subxt::ext::subxt_core::storage::address::StaticAddress::new_static( - "TemplateModule", - "Something", + "Sudo", + "Key", (), [ - 6u8, 80u8, 50u8, 15u8, 9u8, 111u8, 229u8, 130u8, 206u8, 91u8, 123u8, - 1u8, 210u8, 243u8, 237u8, 67u8, 231u8, 115u8, 161u8, 63u8, 208u8, - 123u8, 139u8, 55u8, 186u8, 125u8, 167u8, 229u8, 229u8, 107u8, 235u8, - 56u8, + 72u8, 14u8, 225u8, 162u8, 205u8, 247u8, 227u8, 105u8, 116u8, 57u8, 4u8, + 31u8, 84u8, 137u8, 227u8, 228u8, 133u8, 245u8, 206u8, 227u8, 117u8, + 36u8, 252u8, 151u8, 107u8, 15u8, 180u8, 4u8, 4u8, 152u8, 195u8, 144u8, ], ) } @@ -6654,7 +7043,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -6687,7 +7075,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -6761,7 +7148,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "The permissions for this account id were updated"] @@ -6864,7 +7250,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -6899,7 +7284,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -6928,7 +7312,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -6949,7 +7332,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -7059,7 +7441,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "The schema for a table has been updated"] @@ -7086,7 +7467,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "Tables have been created with known commitments"] @@ -7424,7 +7804,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -7493,7 +7872,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "This event is emitted every time data is submitted by an indexer."] @@ -7521,7 +7899,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "This event is emitted when a quorum is reached amongst submissions and the"] @@ -7779,69 +8156,307 @@ pub mod api { _0.borrow(), ), [ - 86u8, 192u8, 207u8, 246u8, 148u8, 237u8, 137u8, 43u8, 159u8, 125u8, - 100u8, 195u8, 104u8, 180u8, 108u8, 149u8, 183u8, 44u8, 161u8, 35u8, - 56u8, 246u8, 69u8, 210u8, 199u8, 139u8, 154u8, 235u8, 92u8, 148u8, - 138u8, 42u8, + 86u8, 192u8, 207u8, 246u8, 148u8, 237u8, 137u8, 43u8, 159u8, 125u8, + 100u8, 195u8, 104u8, 180u8, 108u8, 149u8, 183u8, 44u8, 161u8, 35u8, + 56u8, 246u8, 69u8, 210u8, 199u8, 139u8, 154u8, 235u8, 92u8, 148u8, + 138u8, 42u8, + ], + ) + } + #[doc = " Mapping of tables to their current commitments, stored on chain."] + pub fn commitment_storage_map( + &self, + _0: impl ::core::borrow::Borrow, + _1: impl ::core::borrow::Borrow, + ) -> ::subxt::ext::subxt_core::storage::address::StaticAddress< + ( + ::subxt::ext::subxt_core::storage::address::StaticStorageKey< + types::commitment_storage_map::Param0, + >, + ::subxt::ext::subxt_core::storage::address::StaticStorageKey< + types::commitment_storage_map::Param1, + >, + ), + types::commitment_storage_map::CommitmentStorageMap, + ::subxt::ext::subxt_core::utils::Yes, + (), + (), + > { + ::subxt::ext::subxt_core::storage::address::StaticAddress::new_static( + "Commitments", + "CommitmentStorageMap", + ( + ::subxt::ext::subxt_core::storage::address::StaticStorageKey::new( + _0.borrow(), + ), + ::subxt::ext::subxt_core::storage::address::StaticStorageKey::new( + _1.borrow(), + ), + ), + [ + 86u8, 192u8, 207u8, 246u8, 148u8, 237u8, 137u8, 43u8, 159u8, 125u8, + 100u8, 195u8, 104u8, 180u8, 108u8, 149u8, 183u8, 44u8, 161u8, 35u8, + 56u8, 246u8, 69u8, 210u8, 199u8, 139u8, 154u8, 235u8, 92u8, 148u8, + 138u8, 42u8, + ], + ) + } + #[doc = " Default schemes used when committing to new tables."] + pub fn default_commitment_schemes( + &self, + ) -> ::subxt::ext::subxt_core::storage::address::StaticAddress< + (), + types::default_commitment_schemes::DefaultCommitmentSchemes, + ::subxt::ext::subxt_core::utils::Yes, + (), + (), + > { + ::subxt::ext::subxt_core::storage::address::StaticAddress::new_static( + "Commitments", + "DefaultCommitmentSchemes", + (), + [ + 107u8, 56u8, 234u8, 43u8, 253u8, 96u8, 181u8, 8u8, 24u8, 137u8, 246u8, + 176u8, 162u8, 174u8, 107u8, 175u8, 41u8, 35u8, 58u8, 123u8, 206u8, + 16u8, 150u8, 210u8, 218u8, 70u8, 133u8, 29u8, 111u8, 56u8, 149u8, 67u8, + ], + ) + } + } + } + } + pub mod attestations { + use super::{root_mod, runtime_types}; + #[doc = "The `Error` enum of this pallet."] + pub type Error = runtime_types::pallet_attestation::pallet::Error; + #[doc = "Pallet call implementation"] + pub type Call = runtime_types::pallet_attestation::pallet::Call; + pub mod calls { + use super::{root_mod, runtime_types}; + type DispatchError = runtime_types::sp_runtime::DispatchError; + pub mod types { + use super::runtime_types; + #[derive( + :: subxt :: ext :: subxt_core :: ext :: codec :: Decode, + :: subxt :: ext :: subxt_core :: ext :: codec :: Encode, + :: subxt :: ext :: subxt_core :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: subxt_core :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[decode_as_type( + crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" + )] + #[encode_as_type( + crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode" + )] + #[doc = "Register an external attestation key"] + pub struct RegisterAttestationKey { + pub who: register_attestation_key::Who, + pub registration: register_attestation_key::Registration, + } + pub mod register_attestation_key { + use super::runtime_types; + pub type Who = ::subxt::ext::subxt_core::utils::AccountId32; + pub type Registration = + runtime_types::sxt_core::attestation::RegisterExternalAddress; + } + impl ::subxt::ext::subxt_core::blocks::StaticExtrinsic for RegisterAttestationKey { + const PALLET: &'static str = "Attestations"; + const CALL: &'static str = "register_attestation_key"; + } + #[derive( + :: subxt :: ext :: subxt_core :: ext :: codec :: Decode, + :: subxt :: ext :: subxt_core :: ext :: codec :: Encode, + :: subxt :: ext :: subxt_core :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: subxt_core :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[decode_as_type( + crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" + )] + #[encode_as_type( + crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode" + )] + #[doc = "TODO"] + pub struct AttestBlock { + pub block_number: attest_block::BlockNumber, + pub attestation: attest_block::Attestation, + } + pub mod attest_block { + use super::runtime_types; + pub type BlockNumber = ::core::primitive::u32; + pub type Attestation = runtime_types::sxt_core::attestation::Attestation; + } + impl ::subxt::ext::subxt_core::blocks::StaticExtrinsic for AttestBlock { + const PALLET: &'static str = "Attestations"; + const CALL: &'static str = "attest_block"; + } + } + pub struct TransactionApi; + impl TransactionApi { + #[doc = "Register an external attestation key"] + pub fn register_attestation_key( + &self, + who: types::register_attestation_key::Who, + registration: types::register_attestation_key::Registration, + ) -> ::subxt::ext::subxt_core::tx::payload::StaticPayload< + types::RegisterAttestationKey, + > { + ::subxt::ext::subxt_core::tx::payload::StaticPayload::new_static( + "Attestations", + "register_attestation_key", + types::RegisterAttestationKey { who, registration }, + [ + 39u8, 53u8, 72u8, 229u8, 254u8, 68u8, 8u8, 168u8, 208u8, 250u8, 231u8, + 184u8, 189u8, 56u8, 226u8, 181u8, 174u8, 240u8, 189u8, 227u8, 118u8, + 210u8, 46u8, 123u8, 247u8, 69u8, 43u8, 200u8, 149u8, 207u8, 138u8, + 81u8, + ], + ) + } + #[doc = "TODO"] + pub fn attest_block( + &self, + block_number: types::attest_block::BlockNumber, + attestation: types::attest_block::Attestation, + ) -> ::subxt::ext::subxt_core::tx::payload::StaticPayload + { + ::subxt::ext::subxt_core::tx::payload::StaticPayload::new_static( + "Attestations", + "attest_block", + types::AttestBlock { + block_number, + attestation, + }, + [ + 36u8, 147u8, 142u8, 58u8, 34u8, 200u8, 174u8, 175u8, 29u8, 123u8, + 192u8, 98u8, 13u8, 59u8, 66u8, 216u8, 70u8, 203u8, 100u8, 85u8, 218u8, + 192u8, 84u8, 120u8, 200u8, 1u8, 130u8, 204u8, 126u8, 31u8, 155u8, + 208u8, + ], + ) + } + } + } + #[doc = "The `Event` enum of this pallet"] + pub type Event = runtime_types::pallet_attestation::pallet::Event; + pub mod events { + use super::runtime_types; + #[derive( + :: subxt :: ext :: subxt_core :: ext :: codec :: Decode, + :: subxt :: ext :: subxt_core :: ext :: codec :: Encode, + :: subxt :: ext :: subxt_core :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: subxt_core :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] + #[doc = "A block has been attested"] + pub struct BlockAttested { + pub block_number: block_attested::BlockNumber, + pub attestation: block_attested::Attestation, + pub who: block_attested::Who, + } + pub mod block_attested { + use super::runtime_types; + pub type BlockNumber = ::core::primitive::u32; + pub type Attestation = runtime_types::sxt_core::attestation::Attestation; + pub type Who = ::subxt::ext::subxt_core::utils::AccountId32; + } + impl ::subxt::ext::subxt_core::events::StaticEvent for BlockAttested { + const PALLET: &'static str = "Attestations"; + const EVENT: &'static str = "BlockAttested"; + } + } + pub mod storage { + use super::runtime_types; + pub mod types { + use super::runtime_types; + pub mod attestation_keys { + use super::runtime_types; + pub type AttestationKeys = + runtime_types::bounded_collections::bounded_vec::BoundedVec<( + ::subxt::ext::subxt_core::utils::AccountId32, + runtime_types::sxt_core::attestation::AttestationKey, + )>; + } + pub mod attestations { + use super::runtime_types; + pub type Attestations = + runtime_types::bounded_collections::bounded_vec::BoundedVec< + runtime_types::sxt_core::attestation::Attestation, + >; + pub type Param0 = ::core::primitive::u32; + } + } + pub struct StorageApi; + impl StorageApi { + pub fn attestation_keys( + &self, + ) -> ::subxt::ext::subxt_core::storage::address::StaticAddress< + (), + types::attestation_keys::AttestationKeys, + ::subxt::ext::subxt_core::utils::Yes, + ::subxt::ext::subxt_core::utils::Yes, + (), + > { + ::subxt::ext::subxt_core::storage::address::StaticAddress::new_static( + "Attestations", + "AttestationKeys", + (), + [ + 158u8, 54u8, 76u8, 100u8, 208u8, 213u8, 181u8, 118u8, 36u8, 238u8, + 30u8, 27u8, 192u8, 194u8, 46u8, 197u8, 76u8, 173u8, 190u8, 47u8, 86u8, + 20u8, 28u8, 223u8, 133u8, 213u8, 246u8, 37u8, 177u8, 183u8, 114u8, + 30u8, ], ) } - #[doc = " Mapping of tables to their current commitments, stored on chain."] - pub fn commitment_storage_map( + pub fn attestations_iter( &self, - _0: impl ::core::borrow::Borrow, - _1: impl ::core::borrow::Borrow, ) -> ::subxt::ext::subxt_core::storage::address::StaticAddress< - ( - ::subxt::ext::subxt_core::storage::address::StaticStorageKey< - types::commitment_storage_map::Param0, - >, - ::subxt::ext::subxt_core::storage::address::StaticStorageKey< - types::commitment_storage_map::Param1, - >, - ), - types::commitment_storage_map::CommitmentStorageMap, - ::subxt::ext::subxt_core::utils::Yes, (), + types::attestations::Attestations, (), + ::subxt::ext::subxt_core::utils::Yes, + ::subxt::ext::subxt_core::utils::Yes, > { ::subxt::ext::subxt_core::storage::address::StaticAddress::new_static( - "Commitments", - "CommitmentStorageMap", - ( - ::subxt::ext::subxt_core::storage::address::StaticStorageKey::new( - _0.borrow(), - ), - ::subxt::ext::subxt_core::storage::address::StaticStorageKey::new( - _1.borrow(), - ), - ), + "Attestations", + "Attestations", + (), [ - 86u8, 192u8, 207u8, 246u8, 148u8, 237u8, 137u8, 43u8, 159u8, 125u8, - 100u8, 195u8, 104u8, 180u8, 108u8, 149u8, 183u8, 44u8, 161u8, 35u8, - 56u8, 246u8, 69u8, 210u8, 199u8, 139u8, 154u8, 235u8, 92u8, 148u8, - 138u8, 42u8, + 75u8, 175u8, 75u8, 5u8, 231u8, 64u8, 185u8, 122u8, 198u8, 16u8, 173u8, + 142u8, 244u8, 250u8, 3u8, 130u8, 211u8, 28u8, 214u8, 196u8, 29u8, 65u8, + 90u8, 182u8, 112u8, 116u8, 71u8, 157u8, 64u8, 87u8, 98u8, 197u8, ], ) } - #[doc = " Default schemes used when committing to new tables."] - pub fn default_commitment_schemes( + pub fn attestations( &self, + _0: impl ::core::borrow::Borrow, ) -> ::subxt::ext::subxt_core::storage::address::StaticAddress< - (), - types::default_commitment_schemes::DefaultCommitmentSchemes, + ::subxt::ext::subxt_core::storage::address::StaticStorageKey< + types::attestations::Param0, + >, + types::attestations::Attestations, + ::subxt::ext::subxt_core::utils::Yes, ::subxt::ext::subxt_core::utils::Yes, - (), (), > { ::subxt::ext::subxt_core::storage::address::StaticAddress::new_static( - "Commitments", - "DefaultCommitmentSchemes", - (), + "Attestations", + "Attestations", + ::subxt::ext::subxt_core::storage::address::StaticStorageKey::new( + _0.borrow(), + ), [ - 107u8, 56u8, 234u8, 43u8, 253u8, 96u8, 181u8, 8u8, 24u8, 137u8, 246u8, - 176u8, 162u8, 174u8, 107u8, 175u8, 41u8, 35u8, 58u8, 123u8, 206u8, - 16u8, 150u8, 210u8, 218u8, 70u8, 133u8, 29u8, 111u8, 56u8, 149u8, 67u8, + 75u8, 175u8, 75u8, 5u8, 231u8, 64u8, 185u8, 122u8, 198u8, 16u8, 173u8, + 142u8, 244u8, 250u8, 3u8, 130u8, 211u8, 28u8, 214u8, 196u8, 29u8, 65u8, + 90u8, 182u8, 112u8, 116u8, 71u8, 157u8, 64u8, 87u8, 98u8, 197u8, ], ) } @@ -7862,7 +8477,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -7881,7 +8495,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -7901,7 +8514,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub struct Equivocation<_0, _1, _2> { @@ -7918,7 +8530,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub struct Precommit<_0, _1> { @@ -7933,7 +8544,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub struct Prevote<_0, _1> { @@ -7953,7 +8563,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -7976,7 +8585,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -7996,7 +8604,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -8017,7 +8624,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -8044,7 +8650,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -8065,7 +8670,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -8094,7 +8698,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -8113,7 +8716,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -8132,7 +8734,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -8151,7 +8752,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -8170,7 +8770,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -8189,7 +8788,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -8208,7 +8806,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -8228,7 +8825,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -8248,7 +8844,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -8270,7 +8865,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -8297,7 +8891,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -8400,7 +8993,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -8449,7 +9041,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -8504,7 +9095,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub struct AccountInfo<_0, _1> { @@ -8522,7 +9112,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub struct CodeUpgradeAuthorization { @@ -8537,7 +9126,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub struct EventRecord<_0, _1> { @@ -8553,7 +9141,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub struct LastRuntimeUpgradeInfo { @@ -8569,7 +9156,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub enum Phase { @@ -8581,6 +9167,112 @@ pub mod api { Initialization, } } + pub mod pallet_attestation { + use super::runtime_types; + pub mod pallet { + use super::runtime_types; + #[derive( + :: subxt :: ext :: subxt_core :: ext :: codec :: Decode, + :: subxt :: ext :: subxt_core :: ext :: codec :: Encode, + :: subxt :: ext :: subxt_core :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: subxt_core :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[decode_as_type( + crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" + )] + #[encode_as_type( + crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode" + )] + #[doc = "Pallet call implementation"] + pub enum Call { + #[codec(index = 0)] + #[doc = "Register an external attestation key"] + register_attestation_key { + who: ::subxt::ext::subxt_core::utils::AccountId32, + registration: runtime_types::sxt_core::attestation::RegisterExternalAddress, + }, + #[codec(index = 1)] + #[doc = "TODO"] + attest_block { + block_number: ::core::primitive::u32, + attestation: runtime_types::sxt_core::attestation::Attestation, + }, + } + #[derive( + :: subxt :: ext :: subxt_core :: ext :: codec :: Decode, + :: subxt :: ext :: subxt_core :: ext :: codec :: Encode, + :: subxt :: ext :: subxt_core :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: subxt_core :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[decode_as_type( + crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" + )] + #[encode_as_type( + crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode" + )] + #[doc = "The `Error` enum of this pallet."] + pub enum Error { + #[codec(index = 0)] + #[doc = "Error validating the ownership of this external address"] + VerificationError, + #[codec(index = 1)] + #[doc = "There are already a maximum number of attestation keys and no more can be added"] + MaxAttestationKeys, + #[codec(index = 2)] + #[doc = "This public key has already been registered"] + PublicKeyAlreadyRegistered, + #[codec(index = 3)] + #[doc = "This account id has already been linked to an account"] + AccountIdAlreadyLinked, + #[codec(index = 4)] + #[doc = "This account id and attestation key combo are not registered attestors"] + InsufficientPermissions, + #[codec(index = 5)] + #[doc = "There was an error verifying the signature using the proposed public key"] + AttestationSignatureError, + #[codec(index = 6)] + #[doc = "The max attestations for this block have already been collected"] + MaxAttestationsForBlockError, + #[codec(index = 7)] + #[doc = "There is already an attestation for this public key and this block number"] + AttestationAlreadyRecordedError, + #[codec(index = 8)] + #[doc = "You cannot attest a block that has not happened yet"] + CannotAttestFutureBlock, + #[codec(index = 9)] + #[doc = "You cannot attest the current (non-finalized) block"] + CannotAttestCurrentBlock, + } + #[derive( + :: subxt :: ext :: subxt_core :: ext :: codec :: Decode, + :: subxt :: ext :: subxt_core :: ext :: codec :: Encode, + :: subxt :: ext :: subxt_core :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: subxt_core :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[decode_as_type( + crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" + )] + #[encode_as_type( + crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode" + )] + #[doc = "The `Event` enum of this pallet"] + pub enum Event { + #[codec(index = 0)] + #[doc = "A block has been attested"] + BlockAttested { + block_number: ::core::primitive::u32, + attestation: runtime_types::sxt_core::attestation::Attestation, + who: ::subxt::ext::subxt_core::utils::AccountId32, + }, + } + } + } pub mod pallet_balances { use super::runtime_types; pub mod pallet { @@ -8593,7 +9285,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -8741,7 +9432,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -8795,7 +9485,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -8947,7 +9636,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -8968,7 +9656,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -8989,7 +9676,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -9010,7 +9696,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -9026,7 +9711,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -9049,7 +9733,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -9074,7 +9757,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -9161,7 +9843,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -9229,7 +9910,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -9270,7 +9950,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -9303,7 +9982,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub struct StoredPendingChange<_0> { @@ -9324,7 +10002,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub enum StoredState<_0> { @@ -9350,7 +10027,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -9380,7 +10056,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -9428,7 +10103,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -9473,7 +10147,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -9505,7 +10178,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -9535,7 +10207,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -9555,6 +10226,112 @@ pub mod api { } } } + pub mod pallet_session { + use super::runtime_types; + pub mod pallet { + use super::runtime_types; + #[derive( + :: subxt :: ext :: subxt_core :: ext :: codec :: Decode, + :: subxt :: ext :: subxt_core :: ext :: codec :: Encode, + :: subxt :: ext :: subxt_core :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: subxt_core :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[decode_as_type( + crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" + )] + #[encode_as_type( + crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode" + )] + #[doc = "Contains a variant per dispatchable extrinsic that this pallet has."] + pub enum Call { + #[codec(index = 0)] + #[doc = "Sets the session key(s) of the function caller to `keys`."] + #[doc = "Allows an account to set its session key prior to becoming a validator."] + #[doc = "This doesn't take effect until the next session."] + #[doc = ""] + #[doc = "The dispatch origin of this function must be signed."] + #[doc = ""] + #[doc = "## Complexity"] + #[doc = "- `O(1)`. Actual cost depends on the number of length of `T::Keys::key_ids()` which is"] + #[doc = " fixed."] + set_keys { + keys: runtime_types::sxt_runtime::opaque::SessionKeys, + proof: ::subxt::ext::subxt_core::alloc::vec::Vec<::core::primitive::u8>, + }, + #[codec(index = 1)] + #[doc = "Removes any session key(s) of the function caller."] + #[doc = ""] + #[doc = "This doesn't take effect until the next session."] + #[doc = ""] + #[doc = "The dispatch origin of this function must be Signed and the account must be either be"] + #[doc = "convertible to a validator ID using the chain's typical addressing system (this usually"] + #[doc = "means being a controller account) or directly convertible into a validator ID (which"] + #[doc = "usually means being a stash account)."] + #[doc = ""] + #[doc = "## Complexity"] + #[doc = "- `O(1)` in number of key types. Actual cost depends on the number of length of"] + #[doc = " `T::Keys::key_ids()` which is fixed."] + purge_keys, + } + #[derive( + :: subxt :: ext :: subxt_core :: ext :: codec :: Decode, + :: subxt :: ext :: subxt_core :: ext :: codec :: Encode, + :: subxt :: ext :: subxt_core :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: subxt_core :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[decode_as_type( + crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" + )] + #[encode_as_type( + crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode" + )] + #[doc = "Error for the session pallet."] + pub enum Error { + #[codec(index = 0)] + #[doc = "Invalid ownership proof."] + InvalidProof, + #[codec(index = 1)] + #[doc = "No associated validator ID for account."] + NoAssociatedValidatorId, + #[codec(index = 2)] + #[doc = "Registered duplicate key."] + DuplicatedKey, + #[codec(index = 3)] + #[doc = "No keys are associated with this account."] + NoKeys, + #[codec(index = 4)] + #[doc = "Key setting account is not live, so it's impossible to associate keys."] + NoAccount, + } + #[derive( + :: subxt :: ext :: subxt_core :: ext :: codec :: Decode, + :: subxt :: ext :: subxt_core :: ext :: codec :: Encode, + :: subxt :: ext :: subxt_core :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: subxt_core :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[decode_as_type( + crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" + )] + #[encode_as_type( + crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode" + )] + #[doc = "The `Event` enum of this pallet"] + pub enum Event { + #[codec(index = 0)] + #[doc = "New session has happened. Note that the argument is the session index, not the"] + #[doc = "block number as the type might suggest."] + NewSession { + session_index: ::core::primitive::u32, + }, + } + } + } pub mod pallet_sudo { use super::runtime_types; pub mod pallet { @@ -9567,7 +10344,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -9632,7 +10408,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -9653,7 +10428,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -9680,88 +10454,13 @@ pub mod api { #[codec(index = 3)] #[doc = "A [sudo_as](Pallet::sudo_as) call just took place."] SudoAsDone { - sudo_result: - ::core::result::Result<(), runtime_types::sp_runtime::DispatchError>, - }, - } - } - } - pub mod pallet_tables { - use super::runtime_types; - pub mod pallet { - use super::runtime_types; - #[derive( - :: subxt :: ext :: subxt_core :: ext :: codec :: Decode, - :: subxt :: ext :: subxt_core :: ext :: codec :: Encode, - :: subxt :: ext :: subxt_core :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: subxt_core :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] - #[decode_as_type( - crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" - )] - #[encode_as_type( - crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode" - )] - #[doc = "Contains a variant per dispatchable extrinsic that this pallet has."] - pub enum Call { - # [codec (index = 0)] # [doc = "TODO: add docs"] update_tables { source_and_mode : runtime_types :: sxt_core :: tables :: SourceAndMode , tables : runtime_types :: bounded_collections :: bounded_vec :: BoundedVec < (runtime_types :: sxt_core :: tables :: TableIdentifier , runtime_types :: bounded_collections :: bounded_vec :: BoundedVec < :: core :: primitive :: u8 > ,) > , } , # [codec (index = 1)] # [doc = "Create tables with a known commit and snapshot url from which data can be loaded"] create_tables_with_snapshot_and_commitment { source_and_mode : runtime_types :: sxt_core :: tables :: SourceAndMode , tables : runtime_types :: bounded_collections :: bounded_vec :: BoundedVec < (runtime_types :: sxt_core :: tables :: TableIdentifier , runtime_types :: bounded_collections :: bounded_vec :: BoundedVec < :: core :: primitive :: u8 > , runtime_types :: proof_of_sql_commitment_map :: commitment_scheme :: PerCommitmentScheme < runtime_types :: proof_of_sql_commitment_map :: generic_over_commitment :: OptionType < runtime_types :: proof_of_sql_commitment_map :: generic_over_commitment :: ConcreteType < runtime_types :: proof_of_sql_commitment_map :: commitment_storage_map :: TableCommitmentBytes > > > , runtime_types :: bounded_collections :: bounded_vec :: BoundedVec < :: core :: primitive :: u8 > ,) > , } , # [codec (index = 3)] # [doc = "Clear schemas and tables from chain state for all namespaces and identifiers"] clear_tables , # [codec (index = 2)] # [doc = "Attempts to recreate all tables stored in the genesis, but does not start loading from"] # [doc = "snapshot"] create_empty_genesis_tables , } - #[derive( - :: subxt :: ext :: subxt_core :: ext :: codec :: Decode, - :: subxt :: ext :: subxt_core :: ext :: codec :: Encode, - :: subxt :: ext :: subxt_core :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: subxt_core :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] - #[decode_as_type( - crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" - )] - #[encode_as_type( - crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode" - )] - #[doc = "The `Error` enum of this pallet."] - pub enum Error { - #[codec(index = 0)] - #[doc = "There was an error deserializing the Arrow schema"] - ArrowDeserializationError, - #[codec(index = 1)] - #[doc = "Existing commit for this table identifier"] - IdentifierAlreadyExists, - #[codec(index = 2)] - #[doc = "Failed to parse Create Statement DDL"] - CreateStatementParseError, - #[codec(index = 3)] - #[doc = "Not all schemas were removed"] - NotAllSchemasRemovedError, - #[codec(index = 4)] - #[doc = "Not all commitments were removed"] - NotAllCommitmentsRemovedError, + sudo_result: + ::core::result::Result<(), runtime_types::sp_runtime::DispatchError>, + }, } - #[derive( - :: subxt :: ext :: subxt_core :: ext :: codec :: Decode, - :: subxt :: ext :: subxt_core :: ext :: codec :: Encode, - :: subxt :: ext :: subxt_core :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: subxt_core :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] - #[decode_as_type( - crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" - )] - #[encode_as_type( - crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode" - )] - #[doc = "The `Event` enum of this pallet"] - pub enum Event { - # [codec (index = 0)] # [doc = "The schema for a table has been updated"] SchemaUpdated (runtime_types :: sxt_core :: tables :: SourceAndMode , runtime_types :: bounded_collections :: bounded_vec :: BoundedVec < (runtime_types :: sxt_core :: tables :: TableIdentifier , runtime_types :: bounded_collections :: bounded_vec :: BoundedVec < :: core :: primitive :: u8 > ,) > ,) , # [codec (index = 1)] # [doc = "Tables have been created with known commitments"] TablesCreatedWithCommitments { source_and_mode : runtime_types :: sxt_core :: tables :: SourceAndMode , table_list : runtime_types :: bounded_collections :: bounded_vec :: BoundedVec < (runtime_types :: sxt_core :: tables :: TableIdentifier , runtime_types :: bounded_collections :: bounded_vec :: BoundedVec < :: core :: primitive :: u8 > , runtime_types :: proof_of_sql_commitment_map :: commitment_scheme :: PerCommitmentScheme < runtime_types :: proof_of_sql_commitment_map :: generic_over_commitment :: OptionType < runtime_types :: proof_of_sql_commitment_map :: generic_over_commitment :: ConcreteType < runtime_types :: proof_of_sql_commitment_map :: commitment_storage_map :: TableCommitmentBytes > > > , runtime_types :: bounded_collections :: bounded_vec :: BoundedVec < :: core :: primitive :: u8 > ,) > , } , } } } - pub mod pallet_template { + pub mod pallet_tables { use super::runtime_types; pub mod pallet { use super::runtime_types; @@ -9773,49 +10472,15 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] #[encode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode" )] - #[doc = "The pallet's dispatchable functions ([`Call`]s)."] - #[doc = ""] - #[doc = "Dispatchable functions allows users to interact with the pallet and invoke state changes."] - #[doc = "These functions materialize as \"extrinsics\", which are often compared to transactions."] - #[doc = "They must always return a `DispatchResult` and be annotated with a weight and call index."] - #[doc = ""] - #[doc = "The [`call_index`] macro is used to explicitly"] - #[doc = "define an index for calls in the [`Call`] enum. This is useful for pallets that may"] - #[doc = "introduce new dispatchables over time. If the order of a dispatchable changes, its index"] - #[doc = "will also change which will break backwards compatibility."] - #[doc = ""] - #[doc = "The [`weight`] macro is used to assign a weight to each call."] + #[doc = "Contains a variant per dispatchable extrinsic that this pallet has."] pub enum Call { - #[codec(index = 0)] - #[doc = "An example dispatchable that takes a single u32 value as a parameter, writes the value"] - #[doc = "to storage and emits an event."] - #[doc = ""] - #[doc = "It checks that the _origin_ for this call is _Signed_ and returns a dispatch"] - #[doc = "error if it isn't. Learn more about origins here: "] - do_something { something: ::core::primitive::u32 }, - #[codec(index = 1)] - #[doc = "An example dispatchable that may throw a custom error."] - #[doc = ""] - #[doc = "It checks that the caller is a signed origin and reads the current value from the"] - #[doc = "`Something` storage item. If a current value exists, it is incremented by 1 and then"] - #[doc = "written back to storage."] - #[doc = ""] - #[doc = "## Errors"] - #[doc = ""] - #[doc = "The function will return an error under the following conditions:"] - #[doc = ""] - #[doc = "- If no value has been set ([`Error::NoneValue`])"] - #[doc = "- If incrementing the value in storage causes an arithmetic overflow"] - #[doc = " ([`Error::StorageOverflow`])"] - cause_error, - } + # [codec (index = 0)] # [doc = "TODO: add docs"] update_tables { source_and_mode : runtime_types :: sxt_core :: tables :: SourceAndMode , tables : runtime_types :: bounded_collections :: bounded_vec :: BoundedVec < (runtime_types :: sxt_core :: tables :: TableIdentifier , runtime_types :: bounded_collections :: bounded_vec :: BoundedVec < :: core :: primitive :: u8 > ,) > , } , # [codec (index = 1)] # [doc = "Create tables with a known commit and snapshot url from which data can be loaded"] create_tables_with_snapshot_and_commitment { source_and_mode : runtime_types :: sxt_core :: tables :: SourceAndMode , tables : runtime_types :: bounded_collections :: bounded_vec :: BoundedVec < (runtime_types :: sxt_core :: tables :: TableIdentifier , runtime_types :: bounded_collections :: bounded_vec :: BoundedVec < :: core :: primitive :: u8 > , runtime_types :: proof_of_sql_commitment_map :: commitment_scheme :: PerCommitmentScheme < runtime_types :: proof_of_sql_commitment_map :: generic_over_commitment :: OptionType < runtime_types :: proof_of_sql_commitment_map :: generic_over_commitment :: ConcreteType < runtime_types :: proof_of_sql_commitment_map :: commitment_storage_map :: TableCommitmentBytes > > > , runtime_types :: bounded_collections :: bounded_vec :: BoundedVec < :: core :: primitive :: u8 > ,) > , } , # [codec (index = 3)] # [doc = "Clear schemas and tables from chain state for all namespaces and identifiers"] clear_tables , # [codec (index = 2)] # [doc = "Attempts to recreate all tables stored in the genesis, but does not start loading from"] # [doc = "snapshot"] create_empty_genesis_tables , } #[derive( :: subxt :: ext :: subxt_core :: ext :: codec :: Decode, :: subxt :: ext :: subxt_core :: ext :: codec :: Encode, @@ -9824,28 +10489,29 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] #[encode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode" )] - #[doc = "Errors that can be returned by this pallet."] - #[doc = ""] - #[doc = "Errors tell users that something went wrong so it's important that their naming is"] - #[doc = "informative. Similar to events, error documentation is added to a node's metadata so it's"] - #[doc = "equally important that they have helpful documentation associated with them."] - #[doc = ""] - #[doc = "This type of runtime error can be up to 4 bytes in size should you want to return additional"] - #[doc = "information."] + #[doc = "The `Error` enum of this pallet."] pub enum Error { #[codec(index = 0)] - #[doc = "The value retrieved was `None` as no value was previously set."] - NoneValue, + #[doc = "There was an error deserializing the Arrow schema"] + ArrowDeserializationError, #[codec(index = 1)] - #[doc = "There was an attempt to increment the value in storage over `u32::MAX`."] - StorageOverflow, + #[doc = "Existing commit for this table identifier"] + IdentifierAlreadyExists, + #[codec(index = 2)] + #[doc = "Failed to parse Create Statement DDL"] + CreateStatementParseError, + #[codec(index = 3)] + #[doc = "Not all schemas were removed"] + NotAllSchemasRemovedError, + #[codec(index = 4)] + #[doc = "Not all commitments were removed"] + NotAllCommitmentsRemovedError, } #[derive( :: subxt :: ext :: subxt_core :: ext :: codec :: Decode, @@ -9855,31 +10521,15 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] #[encode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode" )] - #[doc = "Events that functions in this pallet can emit."] - #[doc = ""] - #[doc = "Events are a simple means of indicating to the outside world (such as dApps, chain explorers"] - #[doc = "or other users) that some notable update in the runtime has occurred. In a FRAME pallet, the"] - #[doc = "documentation for each event field and its parameters is added to a node's metadata so it"] - #[doc = "can be used by external interfaces or tools."] - #[doc = ""] - #[doc = "\tThe `generate_deposit` macro generates a function on `Pallet` called `deposit_event` which"] - #[doc = "will convert the event type of your pallet into `RuntimeEvent` (declared in the pallet's"] - #[doc = "[`Config`] trait) and deposit it using [`frame_system::Pallet::deposit_event`]."] + #[doc = "The `Event` enum of this pallet"] pub enum Event { - #[codec(index = 0)] - #[doc = "A user has successfully set a new value."] - SomethingStored { - something: ::core::primitive::u32, - who: ::subxt::ext::subxt_core::utils::AccountId32, - }, - } + # [codec (index = 0)] # [doc = "The schema for a table has been updated"] SchemaUpdated (runtime_types :: sxt_core :: tables :: SourceAndMode , runtime_types :: bounded_collections :: bounded_vec :: BoundedVec < (runtime_types :: sxt_core :: tables :: TableIdentifier , runtime_types :: bounded_collections :: bounded_vec :: BoundedVec < :: core :: primitive :: u8 > ,) > ,) , # [codec (index = 1)] # [doc = "Tables have been created with known commitments"] TablesCreatedWithCommitments { source_and_mode : runtime_types :: sxt_core :: tables :: SourceAndMode , table_list : runtime_types :: bounded_collections :: bounded_vec :: BoundedVec < (runtime_types :: sxt_core :: tables :: TableIdentifier , runtime_types :: bounded_collections :: bounded_vec :: BoundedVec < :: core :: primitive :: u8 > , runtime_types :: proof_of_sql_commitment_map :: commitment_scheme :: PerCommitmentScheme < runtime_types :: proof_of_sql_commitment_map :: generic_over_commitment :: OptionType < runtime_types :: proof_of_sql_commitment_map :: generic_over_commitment :: ConcreteType < runtime_types :: proof_of_sql_commitment_map :: commitment_storage_map :: TableCommitmentBytes > > > , runtime_types :: bounded_collections :: bounded_vec :: BoundedVec < :: core :: primitive :: u8 > ,) > , } , } } } pub mod pallet_timestamp { @@ -9894,7 +10544,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -9942,7 +10591,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -9971,7 +10619,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -9992,7 +10639,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -10012,7 +10658,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -10033,7 +10678,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub struct ChargeTransactionPayment(#[codec(compact)] pub ::core::primitive::u128); @@ -10045,7 +10689,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub enum Releases { @@ -10055,6 +10698,88 @@ pub mod api { V2, } } + pub mod pallet_validators { + use super::runtime_types; + pub mod pallet { + use super::runtime_types; + #[derive( + :: subxt :: ext :: subxt_core :: ext :: codec :: Decode, + :: subxt :: ext :: subxt_core :: ext :: codec :: Encode, + :: subxt :: ext :: subxt_core :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: subxt_core :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[decode_as_type( + crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" + )] + #[encode_as_type( + crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode" + )] + #[doc = "The pallet's dispatchable functions ([`Call`]s)."] + pub enum Call { + #[codec(index = 0)] + #[doc = "Add a new validator."] + add_validator { + validator_id: ::subxt::ext::subxt_core::utils::AccountId32, + }, + #[codec(index = 1)] + #[doc = "Remove a validator."] + remove_validator { + validator_id: ::subxt::ext::subxt_core::utils::AccountId32, + }, + } + #[derive( + :: subxt :: ext :: subxt_core :: ext :: codec :: Decode, + :: subxt :: ext :: subxt_core :: ext :: codec :: Encode, + :: subxt :: ext :: subxt_core :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: subxt_core :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[decode_as_type( + crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" + )] + #[encode_as_type( + crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode" + )] + #[doc = "Errors that can be returned by this pallet."] + pub enum Error { + #[codec(index = 0)] + #[doc = "The validator id is already registered"] + DuplicateValidatorError, + #[codec(index = 1)] + #[doc = "Removing this validator will drop the total validators below the acceptable threshold"] + TooLowValidatorCountError, + #[codec(index = 2)] + #[doc = "Error adding a new item to the list"] + ErrorPushingValidatorListError, + } + #[derive( + :: subxt :: ext :: subxt_core :: ext :: codec :: Decode, + :: subxt :: ext :: subxt_core :: ext :: codec :: Encode, + :: subxt :: ext :: subxt_core :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: subxt_core :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[decode_as_type( + crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" + )] + #[encode_as_type( + crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode" + )] + #[doc = "The `Event` enum of this pallet"] + pub enum Event { + #[codec(index = 0)] + #[doc = "New validator addition initiated. Effective in ~2 sessions."] + ValidatorAdditionInitiated(::subxt::ext::subxt_core::utils::AccountId32), + #[codec(index = 1)] + #[doc = "Validator removal initiated. Effective in ~2 sessions."] + ValidatorRemovalInitiated(::subxt::ext::subxt_core::utils::AccountId32), + } + } + } pub mod primitive_types { use super::runtime_types; #[derive( @@ -10065,7 +10790,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub struct U256(pub [::core::primitive::u64; 4usize]); @@ -10082,7 +10806,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -10103,7 +10826,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -10122,7 +10844,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -10141,7 +10862,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -10164,7 +10884,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -10180,7 +10899,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -10203,7 +10921,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -10220,7 +10937,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub enum ArithmeticError { @@ -10246,7 +10962,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -10269,7 +10984,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -10285,7 +10999,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -10302,7 +11015,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub enum Equivocation<_0, _1> { @@ -10331,7 +11043,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub struct EquivocationProof<_0, _1> { @@ -10350,7 +11061,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub struct Slot(pub ::core::primitive::u64); @@ -10363,7 +11073,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub struct SlotDuration(pub ::core::primitive::u64); @@ -10380,7 +11089,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -10397,7 +11105,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub struct OpaqueMetadata( @@ -10411,7 +11118,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub enum Void {} @@ -10426,7 +11132,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub struct CheckInherentsResult { @@ -10442,7 +11147,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub struct InherentData { @@ -10466,7 +11170,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -10488,7 +11191,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -10508,7 +11210,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -10547,7 +11248,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -11079,7 +11779,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -11106,7 +11805,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -11145,7 +11843,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -11168,7 +11865,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -11189,7 +11885,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -11212,7 +11907,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -11239,7 +11933,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub enum DispatchError { @@ -11280,7 +11973,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub enum ExtrinsicInclusionMode { @@ -11297,7 +11989,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub struct ModuleError { @@ -11312,7 +12003,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub enum MultiSignature { @@ -11331,7 +12021,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub struct OpaqueValue( @@ -11345,7 +12034,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub enum TokenError { @@ -11378,7 +12066,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub enum TransactionalError { @@ -11398,7 +12085,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub struct RuntimeVersion { @@ -11427,7 +12113,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -11449,7 +12134,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub struct RuntimeDbWeight { @@ -11459,6 +12143,91 @@ pub mod api { } pub mod sxt_core { use super::runtime_types; + pub mod attestation { + use super::runtime_types; + #[derive( + :: subxt :: ext :: subxt_core :: ext :: codec :: Decode, + :: subxt :: ext :: subxt_core :: ext :: codec :: Encode, + :: subxt :: ext :: subxt_core :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: subxt_core :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[decode_as_type( + crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" + )] + #[encode_as_type( + crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode" + )] + pub enum Attestation { + #[codec(index = 0)] + EthereumAttestation { + signature: runtime_types::sxt_core::attestation::EthereumSignature, + proposed_pub_key: [::core::primitive::u8; 33usize], + state_root: ::subxt::ext::subxt_core::utils::H256, + }, + } + #[derive( + :: subxt :: ext :: subxt_core :: ext :: codec :: Decode, + :: subxt :: ext :: subxt_core :: ext :: codec :: Encode, + :: subxt :: ext :: subxt_core :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: subxt_core :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[decode_as_type( + crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" + )] + #[encode_as_type( + crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode" + )] + pub enum AttestationKey { + #[codec(index = 0)] + EthereumKey { + pub_key: [::core::primitive::u8; 33usize], + }, + } + #[derive( + :: subxt :: ext :: subxt_core :: ext :: codec :: Decode, + :: subxt :: ext :: subxt_core :: ext :: codec :: Encode, + :: subxt :: ext :: subxt_core :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: subxt_core :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[decode_as_type( + crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" + )] + #[encode_as_type( + crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode" + )] + pub struct EthereumSignature { + pub r: [::core::primitive::u8; 32usize], + pub s: [::core::primitive::u8; 32usize], + pub v: ::core::primitive::u8, + } + #[derive( + :: subxt :: ext :: subxt_core :: ext :: codec :: Decode, + :: subxt :: ext :: subxt_core :: ext :: codec :: Encode, + :: subxt :: ext :: subxt_core :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: subxt_core :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[decode_as_type( + crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" + )] + #[encode_as_type( + crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode" + )] + pub enum RegisterExternalAddress { + #[codec(index = 0)] + EthereumAddress { + signature: runtime_types::sxt_core::attestation::EthereumSignature, + proposed_pub_key: [::core::primitive::u8; 33usize], + }, + } + } pub mod indexing { use super::runtime_types; #[derive( @@ -11469,7 +12238,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -11494,7 +12262,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -11519,7 +12286,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -11540,7 +12306,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -11559,7 +12324,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -11592,7 +12356,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -11616,7 +12379,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -11640,7 +12402,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -11660,7 +12421,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -11695,7 +12455,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -11726,7 +12485,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -11745,7 +12503,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -11764,6 +12521,27 @@ pub mod api { } pub mod sxt_runtime { use super::runtime_types; + pub mod opaque { + use super::runtime_types; + #[derive( + :: subxt :: ext :: subxt_core :: ext :: codec :: Decode, + :: subxt :: ext :: subxt_core :: ext :: codec :: Encode, + :: subxt :: ext :: subxt_core :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: subxt_core :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[decode_as_type( + crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" + )] + #[encode_as_type( + crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode" + )] + pub struct SessionKeys { + pub aura: runtime_types::sp_consensus_aura::sr25519::app_sr25519::Public, + pub grandpa: runtime_types::sp_consensus_grandpa::app::Public, + } + } #[derive( :: subxt :: ext :: subxt_core :: ext :: codec :: Decode, :: subxt :: ext :: subxt_core :: ext :: codec :: Encode, @@ -11772,7 +12550,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub struct Runtime; @@ -11784,7 +12561,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub enum RuntimeCall { @@ -11792,20 +12568,24 @@ pub mod api { System(runtime_types::frame_system::pallet::Call), #[codec(index = 1)] Timestamp(runtime_types::pallet_timestamp::pallet::Call), + #[codec(index = 2)] + Session(runtime_types::pallet_session::pallet::Call), #[codec(index = 3)] + Validators(runtime_types::pallet_validators::pallet::Call), + #[codec(index = 5)] Grandpa(runtime_types::pallet_grandpa::pallet::Call), - #[codec(index = 4)] - Balances(runtime_types::pallet_balances::pallet::Call), #[codec(index = 6)] - Sudo(runtime_types::pallet_sudo::pallet::Call), - #[codec(index = 7)] - TemplateModule(runtime_types::pallet_template::pallet::Call), + Balances(runtime_types::pallet_balances::pallet::Call), #[codec(index = 8)] - Permissions(runtime_types::pallet_permissions::pallet::Call), + Sudo(runtime_types::pallet_sudo::pallet::Call), #[codec(index = 9)] - Tables(runtime_types::pallet_tables::pallet::Call), + Permissions(runtime_types::pallet_permissions::pallet::Call), #[codec(index = 10)] + Tables(runtime_types::pallet_tables::pallet::Call), + #[codec(index = 11)] Indexing(runtime_types::pallet_indexing::pallet::Call), + #[codec(index = 13)] + Attestations(runtime_types::pallet_attestation::pallet::Call), } #[derive( :: subxt :: ext :: subxt_core :: ext :: codec :: Decode, @@ -11815,28 +12595,31 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub enum RuntimeError { #[codec(index = 0)] System(runtime_types::frame_system::pallet::Error), + #[codec(index = 2)] + Session(runtime_types::pallet_session::pallet::Error), #[codec(index = 3)] + Validators(runtime_types::pallet_validators::pallet::Error), + #[codec(index = 5)] Grandpa(runtime_types::pallet_grandpa::pallet::Error), - #[codec(index = 4)] - Balances(runtime_types::pallet_balances::pallet::Error), #[codec(index = 6)] - Sudo(runtime_types::pallet_sudo::pallet::Error), - #[codec(index = 7)] - TemplateModule(runtime_types::pallet_template::pallet::Error), + Balances(runtime_types::pallet_balances::pallet::Error), #[codec(index = 8)] - Permissions(runtime_types::pallet_permissions::pallet::Error), + Sudo(runtime_types::pallet_sudo::pallet::Error), #[codec(index = 9)] - Tables(runtime_types::pallet_tables::pallet::Error), + Permissions(runtime_types::pallet_permissions::pallet::Error), #[codec(index = 10)] - Indexing(runtime_types::pallet_indexing::pallet::Error), + Tables(runtime_types::pallet_tables::pallet::Error), #[codec(index = 11)] + Indexing(runtime_types::pallet_indexing::pallet::Error), + #[codec(index = 12)] Commitments(runtime_types::pallet_commitments::pallet::Error), + #[codec(index = 13)] + Attestations(runtime_types::pallet_attestation::pallet::Error), } #[derive( :: subxt :: ext :: subxt_core :: ext :: codec :: Decode, @@ -11846,28 +12629,31 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub enum RuntimeEvent { #[codec(index = 0)] System(runtime_types::frame_system::pallet::Event), + #[codec(index = 2)] + Session(runtime_types::pallet_session::pallet::Event), #[codec(index = 3)] - Grandpa(runtime_types::pallet_grandpa::pallet::Event), - #[codec(index = 4)] - Balances(runtime_types::pallet_balances::pallet::Event), + Validators(runtime_types::pallet_validators::pallet::Event), #[codec(index = 5)] - TransactionPayment(runtime_types::pallet_transaction_payment::pallet::Event), + Grandpa(runtime_types::pallet_grandpa::pallet::Event), #[codec(index = 6)] - Sudo(runtime_types::pallet_sudo::pallet::Event), + Balances(runtime_types::pallet_balances::pallet::Event), #[codec(index = 7)] - TemplateModule(runtime_types::pallet_template::pallet::Event), + TransactionPayment(runtime_types::pallet_transaction_payment::pallet::Event), #[codec(index = 8)] - Permissions(runtime_types::pallet_permissions::pallet::Event), + Sudo(runtime_types::pallet_sudo::pallet::Event), #[codec(index = 9)] - Tables(runtime_types::pallet_tables::pallet::Event), + Permissions(runtime_types::pallet_permissions::pallet::Event), #[codec(index = 10)] + Tables(runtime_types::pallet_tables::pallet::Event), + #[codec(index = 11)] Indexing(runtime_types::pallet_indexing::pallet::Event), + #[codec(index = 13)] + Attestations(runtime_types::pallet_attestation::pallet::Event), } #[derive( :: subxt :: ext :: subxt_core :: ext :: codec :: Decode, @@ -11877,7 +12663,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub enum RuntimeFreezeReason {} @@ -11889,7 +12674,6 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub enum RuntimeHoldReason {} diff --git a/crates/proof-of-sql-sdk/Cargo.toml b/crates/proof-of-sql-sdk/Cargo.toml index ad381f3..a285d1f 100644 --- a/crates/proof-of-sql-sdk/Cargo.toml +++ b/crates/proof-of-sql-sdk/Cargo.toml @@ -21,6 +21,8 @@ subxt = { workspace = true, features = ["jsonrpsee"] } sxt-proof-of-sql-sdk-local = { workspace = true, features = ["native", "prover-client"] } tokio = { workspace = true, features = ["rt-multi-thread", "macros"] } tonic = { workspace = true, features = ["tls", "tls-roots"] } +snafu = { workspace = true } +itertools = { workspace = true } [[example]] name = "cli" diff --git a/crates/proof-of-sql-sdk/src/client.rs b/crates/proof-of-sql-sdk/src/client.rs index 0a43eb4..5dc1c83 100644 --- a/crates/proof-of-sql-sdk/src/client.rs +++ b/crates/proof-of-sql-sdk/src/client.rs @@ -1,4 +1,7 @@ -use crate::{get_access_token, query_commitments, substrate::SxtConfig}; +use crate::{ + get_access_token, query_commitments, + substrate::{verify_attestations_for_block, AttestationError, SxtConfig}, +}; use clap::ValueEnum; use proof_of_sql::{ base::database::{OwnedTable, TableRef}, @@ -145,4 +148,21 @@ impl SxTClient { _ => Err("Required postprocessing is not allowed. Please examine your query or change `PostprocessingLevel` using `SxTClient::with_postprocessing`".into()), } } + + /// Verify attestations for a specific block number + /// + /// This method uses the `verify_attestations_for_block` function to validate + /// attestations for a given block number. + /// + /// # Arguments + /// + /// * `block_number` - The block number for which attestations need to be verified. + /// + /// # Returns + /// + /// Returns `Ok(())` if all attestations are valid and consistent. Otherwise, it returns an + /// `AttestationError` describing the failure. + pub async fn verify_attestations(&self, block_number: u32) -> Result<(), AttestationError> { + verify_attestations_for_block(&self.substrate_node_url, block_number).await + } } diff --git a/crates/proof-of-sql-sdk/src/substrate.rs b/crates/proof-of-sql-sdk/src/substrate.rs index cf0a938..ffe6d6b 100644 --- a/crates/proof-of-sql-sdk/src/substrate.rs +++ b/crates/proof-of-sql-sdk/src/substrate.rs @@ -1,4 +1,5 @@ use futures::future::try_join_all; +use itertools::Itertools; use proof_of_sql::{ base::{ commitment::{QueryCommitments, TableCommitment}, @@ -7,14 +8,19 @@ use proof_of_sql::{ proof_primitive::dory::DynamicDoryCommitment, }; use proof_of_sql_parser::ResourceId; +use snafu::{ResultExt, Snafu}; use subxt::{blocks::BlockRef, Config, OnlineClient, PolkadotConfig}; use sxt_proof_of_sql_sdk_local::{ + attestation::{self, create_attestation_message, verify_signature}, resource_id_to_table_id, - sxt_chain_runtime::api::{ - runtime_types::proof_of_sql_commitment_map::{ - commitment_scheme::CommitmentScheme, commitment_storage_map::TableCommitmentBytes, + sxt_chain_runtime::{ + self, + api::{ + runtime_types::proof_of_sql_commitment_map::{ + commitment_scheme::CommitmentScheme, commitment_storage_map::TableCommitmentBytes, + }, + storage, }, - storage, }, }; @@ -69,3 +75,116 @@ where .collect::>(); Ok(results) } + +/// Errors that may occur during the attestation process. +#[derive(Debug, Snafu)] +#[allow(dead_code)] +pub enum AttestationError { + /// Represents an error originating from the Subxt library. + #[snafu(display("Subxt error: {source}"))] + SubxtError { source: subxt::Error }, + + /// Represents an error fetching attestations for a specific block. + #[snafu(display( + "There was an error reading the attestations for block {block_number} on chain" + ))] + ErrorFetchingAttestations { block_number: u32 }, + + /// Error indicating that attestations for a block have inconsistent state roots. + #[snafu(display("The attestations have different state roots, impossible to verify"))] + StateRootMismatch, + + #[snafu(display("Attestation error: {source}"))] + LocalError { + source: attestation::AttestationError, + }, +} + +/// Verifies the attestations for a given block by checking their validity and consistency. +/// +/// This function performs the following steps: +/// 1. Connects to a blockchain node using the provided `url`. +/// 2. Fetches the attestations for the specified `block_number`. +/// 3. Ensures all attestations have consistent `state_root` values. +/// 4. Verifies the signature for each attestation. +/// +/// # Arguments +/// +/// * `url` - The URL of the blockchain node to connect to. +/// * `block_number` - The block number for which attestations need to be verified. +/// +/// # Returns +/// +/// Returns `Ok(())` if all attestations are valid and consistent. Otherwise, it returns an +/// `AttestationError` describing the failure. +/// +/// # Errors +/// +/// This function can return the following errors: +/// - `AttestationError::SubxtError`: If there is an error communicating with the blockchain node. +/// - `AttestationError::ErrorFetchingAttestations`: If the attestations for the block cannot be fetched. +/// - `AttestationError::StateRootMismatch`: If the attestations have inconsistent state roots. +/// - `AttestationError::InvalidSignature`: If a signature verification fails. +/// +/// # Examples +/// +/// ```rust +/// use your_crate::{verify_attestations_for_block, AttestationError}; +/// +/// #[tokio::main] +/// async fn main() -> Result<(), AttestationError> { +/// let url = "http://localhost:9933"; +/// let block_number = 12345; +/// +/// verify_attestations_for_block(url, block_number).await?; +/// println!("Attestations verified successfully!"); +/// Ok(()) +/// } +/// ``` +#[allow(dead_code)] +pub async fn verify_attestations_for_block( + url: &str, + block_number: u32, +) -> Result<(), AttestationError> { + let api = OnlineClient::::from_insecure_url(url) + .await + .context(SubxtSnafu)?; // Updated to SubxtErrorSnafu + + let attestations_addr = sxt_chain_runtime::api::storage() + .attestations() + .attestations(block_number); + + let attestations = api + .storage() + .at_latest() + .await + .context(SubxtSnafu)? // Updated to SubxtErrorSnafu + .fetch(&attestations_addr) + .await + .context(SubxtSnafu)? // Updated to SubxtErrorSnafu + .ok_or_else(|| ErrorFetchingAttestationsSnafu { block_number }.build())?; + + let attestations = attestations.0; + + if !attestations + .iter() + .map(|attestation| { + let sxt_chain_runtime::api::runtime_types::sxt_core::attestation::Attestation::EthereumAttestation { state_root, ..} = attestation; + Some(state_root) + }) + .all_equal() + { + return Err(AttestationError::StateRootMismatch); + } + attestations + .iter().try_for_each(|attestation| { + let sxt_chain_runtime::api::runtime_types::sxt_core::attestation::Attestation::EthereumAttestation { + signature, + proposed_pub_key, + state_root, + } = attestation; + let msg = create_attestation_message(state_root, block_number); + verify_signature(&msg, signature, proposed_pub_key) + .map_err(|err| AttestationError::LocalError { source: err }) + }) +}