From 506471db24817a94c26cd093e40b96d710bec5f2 Mon Sep 17 00:00:00 2001 From: Steve Degosserie <723552+stiiifff@users.noreply.github.com> Date: Mon, 2 Feb 2026 15:42:14 +0100 Subject: [PATCH 1/5] feat(test): expand Moonwall test coverage with balance and precompile tests (#414) ## Summary - Import and adapt balance tests from Moonbeam's test suite for DataHaven runtime compatibility - Add comprehensive precompile tests covering ERC20, modexp, proxy, identity, and cryptographic precompiles - Add helper utilities for precompile testing including address constants and contract call wrappers ## Changes ### Balance Tests - `test-balance-existential.ts` - Existential deposit behavior - `test-balance-extrinsics.ts` - Balance extrinsics (transfer, force_transfer) - `test-balance-genesis.ts` - Genesis balance verification - `test-balance-transfer.ts` - Various transfer scenarios ### Precompile Tests - **ERC20**: Native token interface tests including overflow handling - **Modexp**: Comprehensive modular exponentiation tests with extensive test vectors - **Proxy**: Proxy account management and proxy call tests - **Identity**: Full identity precompile test coverage (14 test files) - **Cryptographic**: blake2, bn128add, bn128mul, bn128pairing, ecrecover, ripemd160, sha3fips - **Preimage**: Preimage noting and unnoting tests ### Helper Utilities - `precompile-addresses.ts` - Precompile address constants - `precompile-contract-calls.ts` - Typed contract call helpers (Preimage class) - `modexp.ts` - Modexp test utilities ### Runtime Fixes - Fix Ethan's address in genesis presets to match Moonwall util constants --------- Co-authored-by: Claude Opus 4.5 Co-authored-by: Ahmad Kaouk <56095276+ahmadkaouk@users.noreply.github.com> Co-authored-by: Ahmad Kaouk --- biome.json | 1 + .../mainnet/src/genesis_config_presets.rs | 2 +- .../stagenet/src/genesis_config_presets.rs | 2 +- .../testnet/src/genesis_config_presets.rs | 2 +- test/moonwall/contracts/src/ECContracts.sol | 51 ++ test/moonwall/contracts/src/HasherChecker.sol | 226 +++++ test/moonwall/helpers/constants.ts | 37 +- test/moonwall/helpers/index.ts | 3 + test/moonwall/helpers/modexp.ts | 97 +++ test/moonwall/helpers/precompile-addresses.ts | 17 + .../helpers/precompile-contract-calls.ts | 136 +++ .../balance/test-balance-existential.ts | 93 ++ .../balance/test-balance-extrinsics.ts | 87 ++ .../stagenet/balance/test-balance-genesis.ts | 38 + .../stagenet/balance/test-balance-transfer.ts | 242 +++++ .../precompile/test-precompile-blake2.ts | 37 + .../precompile/test-precompile-bn128add.ts | 39 + .../precompile/test-precompile-bn128mul.ts | 39 + .../test-precompile-bn128pairing.ts | 39 + .../precompile/test-precompile-ecrecover.ts | 81 ++ .../test-precompile-erc20-overflow.ts | 31 + .../precompile/test-precompile-erc20.ts | 291 +++++++ .../precompile/test-precompile-identity.ts | 116 +++ .../precompile/test-precompile-identity10.ts | 61 ++ .../precompile/test-precompile-identity11.ts | 95 ++ .../precompile/test-precompile-identity12.ts | 87 ++ .../precompile/test-precompile-identity13.ts | 76 ++ .../precompile/test-precompile-identity14.ts | 73 ++ .../precompile/test-precompile-identity2.ts | 102 +++ .../precompile/test-precompile-identity3.ts | 67 ++ .../precompile/test-precompile-identity4.ts | 82 ++ .../precompile/test-precompile-identity5.ts | 82 ++ .../precompile/test-precompile-identity6.ts | 98 +++ .../precompile/test-precompile-identity7.ts | 82 ++ .../precompile/test-precompile-identity8.ts | 61 ++ .../precompile/test-precompile-identity9.ts | 73 ++ .../precompile/test-precompile-modexp.ts | 824 ++++++++++++++++++ .../precompile/test-precompile-preimage.ts | 106 +++ .../precompile/test-precompile-proxy.ts | 544 ++++++++++++ .../precompile/test-precompile-ripemd160.ts | 50 ++ .../precompile/test-precompile-sha3fips.ts | 30 + 41 files changed, 4291 insertions(+), 9 deletions(-) create mode 100644 test/moonwall/contracts/src/ECContracts.sol create mode 100644 test/moonwall/contracts/src/HasherChecker.sol create mode 100644 test/moonwall/helpers/modexp.ts create mode 100644 test/moonwall/helpers/precompile-addresses.ts create mode 100644 test/moonwall/helpers/precompile-contract-calls.ts create mode 100644 test/moonwall/suites/dev/stagenet/balance/test-balance-existential.ts create mode 100644 test/moonwall/suites/dev/stagenet/balance/test-balance-extrinsics.ts create mode 100644 test/moonwall/suites/dev/stagenet/balance/test-balance-genesis.ts create mode 100644 test/moonwall/suites/dev/stagenet/balance/test-balance-transfer.ts create mode 100644 test/moonwall/suites/dev/stagenet/precompile/test-precompile-blake2.ts create mode 100644 test/moonwall/suites/dev/stagenet/precompile/test-precompile-bn128add.ts create mode 100644 test/moonwall/suites/dev/stagenet/precompile/test-precompile-bn128mul.ts create mode 100644 test/moonwall/suites/dev/stagenet/precompile/test-precompile-bn128pairing.ts create mode 100644 test/moonwall/suites/dev/stagenet/precompile/test-precompile-ecrecover.ts create mode 100644 test/moonwall/suites/dev/stagenet/precompile/test-precompile-erc20-overflow.ts create mode 100644 test/moonwall/suites/dev/stagenet/precompile/test-precompile-erc20.ts create mode 100644 test/moonwall/suites/dev/stagenet/precompile/test-precompile-identity.ts create mode 100644 test/moonwall/suites/dev/stagenet/precompile/test-precompile-identity10.ts create mode 100644 test/moonwall/suites/dev/stagenet/precompile/test-precompile-identity11.ts create mode 100644 test/moonwall/suites/dev/stagenet/precompile/test-precompile-identity12.ts create mode 100644 test/moonwall/suites/dev/stagenet/precompile/test-precompile-identity13.ts create mode 100644 test/moonwall/suites/dev/stagenet/precompile/test-precompile-identity14.ts create mode 100644 test/moonwall/suites/dev/stagenet/precompile/test-precompile-identity2.ts create mode 100644 test/moonwall/suites/dev/stagenet/precompile/test-precompile-identity3.ts create mode 100644 test/moonwall/suites/dev/stagenet/precompile/test-precompile-identity4.ts create mode 100644 test/moonwall/suites/dev/stagenet/precompile/test-precompile-identity5.ts create mode 100644 test/moonwall/suites/dev/stagenet/precompile/test-precompile-identity6.ts create mode 100644 test/moonwall/suites/dev/stagenet/precompile/test-precompile-identity7.ts create mode 100644 test/moonwall/suites/dev/stagenet/precompile/test-precompile-identity8.ts create mode 100644 test/moonwall/suites/dev/stagenet/precompile/test-precompile-identity9.ts create mode 100644 test/moonwall/suites/dev/stagenet/precompile/test-precompile-modexp.ts create mode 100644 test/moonwall/suites/dev/stagenet/precompile/test-precompile-preimage.ts create mode 100644 test/moonwall/suites/dev/stagenet/precompile/test-precompile-proxy.ts create mode 100644 test/moonwall/suites/dev/stagenet/precompile/test-precompile-ripemd160.ts create mode 100644 test/moonwall/suites/dev/stagenet/precompile/test-precompile-sha3fips.ts diff --git a/biome.json b/biome.json index 9c5ae7a4..aed14936 100644 --- a/biome.json +++ b/biome.json @@ -8,6 +8,7 @@ "**/*.yml", "**/*.md", "!node_modules/*", + "!**/moonwall/**/*", "!target/*", "!**/tmp/*", "!**/*.spec.json", diff --git a/operator/runtime/mainnet/src/genesis_config_presets.rs b/operator/runtime/mainnet/src/genesis_config_presets.rs index 15e9d2da..321df0a1 100644 --- a/operator/runtime/mainnet/src/genesis_config_presets.rs +++ b/operator/runtime/mainnet/src/genesis_config_presets.rs @@ -258,7 +258,7 @@ pub fn dorothy() -> AccountId { } pub fn ethan() -> AccountId { - AccountId::from(hex!("Ff64d3F6efE2317EE2807d2235B1ac2AA69d9E87")) + AccountId::from(hex!("Ff64d3F6efE2317EE2807d223a0Bdc4c0c49dfDB")) } pub fn frank() -> AccountId { diff --git a/operator/runtime/stagenet/src/genesis_config_presets.rs b/operator/runtime/stagenet/src/genesis_config_presets.rs index 2fcbd983..0265f5a3 100644 --- a/operator/runtime/stagenet/src/genesis_config_presets.rs +++ b/operator/runtime/stagenet/src/genesis_config_presets.rs @@ -267,7 +267,7 @@ pub fn dorothy() -> AccountId { } pub fn ethan() -> AccountId { - AccountId::from(hex!("Ff64d3F6efE2317EE2807d2235B1ac2AA69d9E87")) + AccountId::from(hex!("Ff64d3F6efE2317EE2807d223a0Bdc4c0c49dfDB")) } pub fn frank() -> AccountId { diff --git a/operator/runtime/testnet/src/genesis_config_presets.rs b/operator/runtime/testnet/src/genesis_config_presets.rs index d40eb073..e568f266 100644 --- a/operator/runtime/testnet/src/genesis_config_presets.rs +++ b/operator/runtime/testnet/src/genesis_config_presets.rs @@ -265,7 +265,7 @@ pub fn dorothy() -> AccountId { } pub fn ethan() -> AccountId { - AccountId::from(hex!("Ff64d3F6efE2317EE2807d2235B1ac2AA69d9E87")) + AccountId::from(hex!("Ff64d3F6efE2317EE2807d223a0Bdc4c0c49dfDB")) } pub fn frank() -> AccountId { diff --git a/test/moonwall/contracts/src/ECContracts.sol b/test/moonwall/contracts/src/ECContracts.sol new file mode 100644 index 00000000..2faab0db --- /dev/null +++ b/test/moonwall/contracts/src/ECContracts.sol @@ -0,0 +1,51 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity >=0.8.3; + +contract RecoveryChecker { + constructor() {} + + function checkRecovery( + bytes32 msgHash, + uint256 v, + bytes32 r, + bytes32 s + ) public view returns (address) { + (, bytes memory data) = address(0x01).staticcall( + abi.encode(msgHash, v, r, s) + ); + return abi.decode(data, (address)); + } +} + +contract PairingChecker { + bool public status = false; + + function callBn256Pairing(bytes memory input) + public + returns (bytes32 result) + { + uint256 len = input.length; + assembly { + let memPtr := mload(0x40) + let success := call( + gas(), + 0x08, + 0, + add(input, 0x20), + len, + memPtr, + 0x20 + ) + switch success + case 0 { + revert(0, 0) + } + default { + result := mload(memPtr) + } + } + status = + result == + 0x0000000000000000000000000000000000000000000000000000000000000001; + } +} diff --git a/test/moonwall/contracts/src/HasherChecker.sol b/test/moonwall/contracts/src/HasherChecker.sol new file mode 100644 index 00000000..b49eed63 --- /dev/null +++ b/test/moonwall/contracts/src/HasherChecker.sol @@ -0,0 +1,226 @@ +// SPDX-License-Identifier: GPL-3.0-only +pragma solidity >=0.8.3; + +contract HasherChecker { + uint256 public lastResult; + + function ripemd160Check() public pure { + require( + ripemd160(bytes("Hello World!")) == + hex"8476ee4631b9b30ac2754b0ee0c47e161d3f724c" + ); + } + + function bn128AdditionCheck() public { + bool success; + uint256[4] memory input = [ + 0x2243525c5efd4b9c3d3c45ac0ca3fe4dd85e830a4ce6b65fa1eeaee202839703, + 0x301d1d33be6da8e509df21cc35964723180eed7532537db9ae5e7d48f195c915, + 0x18b18acfb4c2c30276db5411368e7185b311dd124691610c5d3b74034e093dc9, + 0x063c909c4720840cb5134cb9f59fa749755796819658d32efc0d288198f37266 + ]; + uint256[2] memory result; + + assembly { + // 0x06 id of the bn256Add precompile + // 0 number of ether to transfer + // 128 size of call parameters, i.e. 128 bytes total + // 64 size of return value, i.e. 64 bytes / 512 bit for a BN256 curve point + success := call(not(0), 0x06, 0, input, 128, result, 64) + } + require(success, "elliptic curve addition failed"); + require( + result[0] == + 0x2bd3e6d0f3b142924f5ca7b49ce5b9d54c4703d7ae5648e61d02268b1a0a9fb7, + "failed" + ); + require( + result[1] == + 0x21611ce0a6af85915e2f1d70300909ce2e49dfad4a4619c8390cae66cefdb204, + "failed" + ); + } + + function bn128MultiplyCheck() public { + bool success; + uint256[3] memory input = [ + 0x1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe3, + 0x1a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f6, + 0x30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000000 + ]; + uint256[2] memory result; + + assembly { + // 0x07 id of the bn256Mul precompile + // 0 number of ether to transfer + // 96 size of call parameters, i.e. 128 bytes total + // 64 size of return value, i.e. 64 bytes / 512 bit for a BN256 curve point + success := call(not(0), 0x07, 0, input, 96, result, 64) + } + require(success, "elliptic curve addition failed"); + require( + result[0] == + 0x1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe3, + "failed" + ); + require( + result[1] == + 0x163511ddc1c3f25d396745388200081287b3fd1472d8339d5fecb2eae0830451, + "failed" + ); + } + + function bn128PairingCheck() public { + uint256[12] memory input = [ + 0x2eca0c7238bf16e83e7a1e6c5d49540685ff51380f309842a98561558019fc02, + 0x03d3260361bb8451de5ff5ecd17f010ff22f5c31cdf184e9020b06fa5997db84, + 0x1213d2149b006137fcfb23036606f848d638d576a120ca981b5b1a5f9300b3ee, + 0x2276cf730cf493cd95d64677bbb75fc42db72513a4c1e387b476d056f80aa75f, + 0x21ee6226d31426322afcda621464d0611d226783262e21bb3bc86b537e986237, + 0x096df1f82dff337dd5972e32a8ad43e28a78a96a823ef1cd4debe12b6552ea5f, + 0x06967a1237ebfeca9aaae0d6d0bab8e28c198c5a339ef8a2407e31cdac516db9, + 0x22160fa257a5fd5b280642ff47b65eca77e626cb685c84fa6d3b6882a283ddd1, + 0x198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c2, + 0x1800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed, + 0x090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b, + 0x12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa + ]; + uint256[1] memory result; + bool success; + assembly { + // 0x08 id of the bn256CheckPairing precompile + // 0 number of ether to transfer + // 0 since we have an array of fixed length, our input starts in 0 + // 384 size of call parameters, i.e. 12*256 bits == 384 bytes + // 32 size of result (one 32 byte boolean!) + success := call(sub(gas(), 2000), 0x08, 0, input, 384, result, 32) + } + require(success, "elliptic curve pairing failed"); + require(result[0] == 1, "failed"); + } + + function modExpWrapper( + uint256 _b, + uint256 _e, + uint256 _m + ) public returns (uint256 result) { + assembly { + // Free memory pointer + let pointer := mload(0x40) + // Define length of base, exponent and modulus. 0x20 == 32 bytes + mstore(pointer, 0x20) + mstore(add(pointer, 0x20), 0x20) + mstore(add(pointer, 0x40), 0x20) + // Define variables base, exponent and modulus + mstore(add(pointer, 0x60), _b) + mstore(add(pointer, 0x80), _e) + + mstore(add(pointer, 0xa0), _m) + // Store the result + let value := mload(0xc0) + // Call the precompiled contract 0x05 = bigModExp + if iszero(call(not(0), 0x05, 0, pointer, 0xc0, value, 0x20)) { + revert(0, 0) + } + result := mload(value) + } + } + + function modExpVerify( + uint256 _base, + uint256 _exponent, + uint256 _modulus + ) public { + lastResult = modExpWrapper(_base, _exponent, _modulus); + } + + function getResult() public view returns (uint256) { + return lastResult; + } + + function modExpChecker() public { + require(modExpWrapper(3, 5, 7) == 5); + require(modExpWrapper(5, 7, 11) == 3); + } + + function blake2Wrapper( + uint32 rounds, + bytes32[2] memory h, + bytes32[4] memory m, + bytes8[2] memory t, + bool f + ) public view returns (bytes32[2] memory) { + bytes32[2] memory output; + + bytes memory args = abi.encodePacked( + rounds, + h[0], + h[1], + m[0], + m[1], + m[2], + m[3], + t[0], + t[1], + f + ); + + assembly { + if iszero( + staticcall(not(0), 0x09, add(args, 32), 0xd5, output, 0x40) + ) { + revert(0, 0) + } + } + + return output; + } + + function blake2Check() public { + uint32 rounds = 12; + + bytes32[2] memory h; + h[ + 0 + ] = hex"48c9bdf267e6096a3ba7ca8485ae67bb2bf894fe72f36e3cf1361d5f3af54fa5"; + h[ + 1 + ] = hex"d182e6ad7f520e511f6c3e2b8c68059b6bbd41fbabd9831f79217e1319cde05b"; + + bytes32[4] memory m; + m[ + 0 + ] = hex"6162630000000000000000000000000000000000000000000000000000000000"; + m[ + 1 + ] = hex"0000000000000000000000000000000000000000000000000000000000000000"; + m[ + 2 + ] = hex"0000000000000000000000000000000000000000000000000000000000000000"; + m[ + 3 + ] = hex"0000000000000000000000000000000000000000000000000000000000000000"; + + bytes8[2] memory t; + t[0] = hex"03000000"; + t[1] = hex"00000000"; + + bool f = true; + + // Expected output: + // ba80a53f981c4d0d6a2797b69f12f6e94c212f14685ac4b74b12bb6fdbffa2d1 + // 7d87c5392aab792dc252d5de4533cc9518d38aa8dbf1925ab92386edd4009923 + + bytes32[2] memory result = blake2Wrapper(rounds, h, m, t, f); + require( + result[0] == + 0xba80a53f981c4d0d6a2797b69f12f6e94c212f14685ac4b74b12bb6fdbffa2d1, + "failed" + ); + require( + result[1] == + 0x7d87c5392aab792dc252d5de4533cc9518d38aa8dbf1925ab92386edd4009923, + "failed" + ); + } +} diff --git a/test/moonwall/helpers/constants.ts b/test/moonwall/helpers/constants.ts index 8b3123c2..d241ca69 100644 --- a/test/moonwall/helpers/constants.ts +++ b/test/moonwall/helpers/constants.ts @@ -4,11 +4,14 @@ */ import type { GenericContext } from "@moonwall/cli"; -import { - ALITH_GENESIS_FREE_BALANCE, - ALITH_GENESIS_LOCK_BALANCE, - ALITH_GENESIS_RESERVE_BALANCE -} from "@moonwall/util"; + +// DataHaven genesis balance constants +// From operator/runtime/stagenet/src/genesis_config_presets.rs: +// Each endowed account receives: 1u128 << 80 +// No locks or reserves are set at genesis +export const ALITH_GENESIS_FREE_BALANCE = 1n << 80n; // 1208925819614629174706176n +export const ALITH_GENESIS_LOCK_BALANCE = 0n; +export const ALITH_GENESIS_RESERVE_BALANCE = 0n; export const ALITH_GENESIS_TRANSFERABLE_COUNT = ALITH_GENESIS_FREE_BALANCE + ALITH_GENESIS_RESERVE_BALANCE - ALITH_GENESIS_LOCK_BALANCE; @@ -35,6 +38,27 @@ class RuntimeConstant { } } +// Currency units for DataHaven stagenet +// These match the runtime configuration in operator/runtime/stagenet/src/lib.rs +export const HAVE = 1_000_000_000_000_000_000n; // 10^18 +export const MICROHAVE = 1_000_000_000_000n; // 10^12 +export const SUPPLY_FACTOR = 1n; +export const STORAGE_BYTE_FEE = 100n * MICROHAVE * SUPPLY_FACTOR; // 100_000_000_000_000n + +/** + * Calculate deposit cost matching the runtime's deposit() function + * deposit(items, bytes) = items * HAVE * SUPPLY_FACTOR + bytes * STORAGE_BYTE_FEE + */ +export function deposit(items: number, bytes: number): bigint { + return BigInt(items) * HAVE * SUPPLY_FACTOR + BigInt(bytes) * STORAGE_BYTE_FEE; +} + +// Identity pallet deposit constants (stagenet) +// Calculated from: operator/runtime/stagenet/src/configs/mod.rs +export const IDENTITY_BASIC_DEPOSIT = deposit(1, 258); // 1_025_800_000_000_000_000n +export const IDENTITY_BYTE_DEPOSIT = deposit(0, 1); // 100_000_000_000_000n +export const IDENTITY_SUB_ACCOUNT_DEPOSIT = deposit(1, 53); // 1_005_300_000_000_000_000n + const DATAHAVEN_CONSTANTS = { BLOCK_WEIGHT_LIMIT: new RuntimeConstant({ 0: 2_000_000_000_000n @@ -57,7 +81,8 @@ const DATAHAVEN_CONSTANTS = { CALL_PERMIT: "0x000000000000000000000000000000000000080a" as const, PROXY: "0x000000000000000000000000000000000000080b" as const, ERC20_BALANCES: "0x0000000000000000000000000000000000000802" as const, - PRECOMPILE_REGISTRY: "0x0000000000000000000000000000000000000815" as const + PRECOMPILE_REGISTRY: "0x0000000000000000000000000000000000000815" as const, + IDENTITY: "0x0000000000000000000000000000000000000818" as const } } as const; diff --git a/test/moonwall/helpers/index.ts b/test/moonwall/helpers/index.ts index 76578e1e..ea1dffea 100644 --- a/test/moonwall/helpers/index.ts +++ b/test/moonwall/helpers/index.ts @@ -8,6 +8,7 @@ export * from "./block"; export * from "./constants"; +export { PRECOMPILE_IDENTITY_ADDRESS, PRECOMPILE_PROXY_ADDRESS } from "./precompile-addresses"; export * from "./contracts"; // Export unique functions from eth-transactions that aren't in evm.ts export { extractRevertReason } from "./eth-transactions"; @@ -16,3 +17,5 @@ export * from "./expect"; export * from "./fees"; export * from "./parameters"; export * from "./transactions"; +export * from "./modexp"; +export * from "./precompile-contract-calls"; diff --git a/test/moonwall/helpers/modexp.ts b/test/moonwall/helpers/modexp.ts new file mode 100644 index 00000000..1842468b --- /dev/null +++ b/test/moonwall/helpers/modexp.ts @@ -0,0 +1,97 @@ +/** + * Test vectors for modular exponentiation precompile tests + * Adapted from Moonbeam test helpers + */ + +export const testVectors = { + "nagydani-1-square": { + base: "e09ad9675465c53a109fac66a445c91b292d2bb2c5268addb30cd82f80fcb0033ff97c80a5fc6f39193ae969c6ede6710a6b7ac27078a06d90ef1c72e5c85fb5", + exponent: "02", + modulus: + "fc9e1f6beb81516545975218075ec2af118cd8798df6e08a147c60fd6095ac2bb02c2908cf4dd7c81f11c289e4bce98f3553768f392a80ce22bf5c4f4a248c6b", + }, + "nagydani-1-qube": { + base: "e09ad9675465c53a109fac66a445c91b292d2bb2c5268addb30cd82f80fcb0033ff97c80a5fc6f39193ae969c6ede6710a6b7ac27078a06d90ef1c72e5c85fb5", + exponent: "03", + modulus: + "fc9e1f6beb81516545975218075ec2af118cd8798df6e08a147c60fd6095ac2bb02c2908cf4dd7c81f11c289e4bce98f3553768f392a80ce22bf5c4f4a248c6b", + }, + "nagydani-1-pow0x10001": { + base: "e09ad9675465c53a109fac66a445c91b292d2bb2c5268addb30cd82f80fcb0033ff97c80a5fc6f39193ae969c6ede6710a6b7ac27078a06d90ef1c72e5c85fb5", + exponent: "010001", + modulus: + "fc9e1f6beb81516545975218075ec2af118cd8798df6e08a147c60fd6095ac2bb02c2908cf4dd7c81f11c289e4bce98f3553768f392a80ce22bf5c4f4a248c6b", + }, + "nagydani-2-square": { + base: "cad7d991a00047dd54d3399b6b0b937c718abddef7917c75b6681f40cc15e2be0003657d8d4c34167b2f0bbbca0ccaa407c2a6a07d50f1517a8f22979ce12a81dcaf707cc0cebfc0ce2ee84ee7f77c38b9281b9822a8d3de62784c089c9b18dcb9a2a5eecbede90ea788a862a9ddd9d609c2c52972d63e289e28f6a590ffbf51", + exponent: "02", + modulus: + "e6d893b80aeed5e6e9ce9afa8a5d5675c93a32ac05554cb20e9951b2c140e3ef4e433068cf0fb73bc9f33af1853f64aa27a0028cbf570d7ac9048eae5dc7b28c87c31e5810f1e7fa2cda6adf9f1076dbc1ec1238560071e7efc4e9565c49be9e7656951985860a558a754594115830bcdb421f741408346dd5997bb01c287087", + }, + "nagydani-2-qube": { + base: "cad7d991a00047dd54d3399b6b0b937c718abddef7917c75b6681f40cc15e2be0003657d8d4c34167b2f0bbbca0ccaa407c2a6a07d50f1517a8f22979ce12a81dcaf707cc0cebfc0ce2ee84ee7f77c38b9281b9822a8d3de62784c089c9b18dcb9a2a5eecbede90ea788a862a9ddd9d609c2c52972d63e289e28f6a590ffbf51", + exponent: "03", + modulus: + "e6d893b80aeed5e6e9ce9afa8a5d5675c93a32ac05554cb20e9951b2c140e3ef4e433068cf0fb73bc9f33af1853f64aa27a0028cbf570d7ac9048eae5dc7b28c87c31e5810f1e7fa2cda6adf9f1076dbc1ec1238560071e7efc4e9565c49be9e7656951985860a558a754594115830bcdb421f741408346dd5997bb01c287087", + }, + "nagydani-2-pow0x10001": { + base: "cad7d991a00047dd54d3399b6b0b937c718abddef7917c75b6681f40cc15e2be0003657d8d4c34167b2f0bbbca0ccaa407c2a6a07d50f1517a8f22979ce12a81dcaf707cc0cebfc0ce2ee84ee7f77c38b9281b9822a8d3de62784c089c9b18dcb9a2a5eecbede90ea788a862a9ddd9d609c2c52972d63e289e28f6a590ffbf51", + exponent: "010001", + modulus: + "e6d893b80aeed5e6e9ce9afa8a5d5675c93a32ac05554cb20e9951b2c140e3ef4e433068cf0fb73bc9f33af1853f64aa27a0028cbf570d7ac9048eae5dc7b28c87c31e5810f1e7fa2cda6adf9f1076dbc1ec1238560071e7efc4e9565c49be9e7656951985860a558a754594115830bcdb421f741408346dd5997bb01c287087", + }, + "nagydani-3-square": { + base: "c9130579f243e12451760976261416413742bd7c91d39ae087f46794062b8c239f2a74abf3918605a0e046a7890e049475ba7fbb78f5de6490bd22a710cc04d30088179a919d86c2da62cf37f59d8f258d2310d94c24891be2d7eeafaa32a8cb4b0cfe5f475ed778f45907dc8916a73f03635f233f7a77a00a3ec9ca6761a5bbd558a2318ecd0caa1c5016691523e7e1fa267dd35e70c66e84380bdcf7c0582f540174e572c41f81e93da0b757dff0b0fe23eb03aa19af0bdec3afb474216febaacb8d0381e631802683182b0fe72c28392539850650b70509f54980241dc175191a35d967288b532a7a8223ce2440d010615f70df269501944d4ec16fe4a3cb", + exponent: "02", + modulus: + "d7a85909174757835187cb52e71934e6c07ef43b4c46fc30bbcd0bc72913068267c54a4aabebb493922492820babdeb7dc9b1558fcf7bd82c37c82d3147e455b623ab0efa752fe0b3a67ca6e4d126639e645a0bf417568adbb2a6a4eef62fa1fa29b2a5a43bebea1f82193a7dd98eb483d09bb595af1fa9c97c7f41f5649d976aee3e5e59e2329b43b13bea228d4a93f16ba139ccb511de521ffe747aa2eca664f7c9e33da59075cc335afcd2bf3ae09765f01ab5a7c3e3938ec168b74724b5074247d200d9970382f683d6059b94dbc336603d1dfee714e4b447ac2fa1d99ecb4961da2854e03795ed758220312d101e1e3d87d5313a6d052aebde75110363d", + }, + "nagydani-3-qube": { + base: "c9130579f243e12451760976261416413742bd7c91d39ae087f46794062b8c239f2a74abf3918605a0e046a7890e049475ba7fbb78f5de6490bd22a710cc04d30088179a919d86c2da62cf37f59d8f258d2310d94c24891be2d7eeafaa32a8cb4b0cfe5f475ed778f45907dc8916a73f03635f233f7a77a00a3ec9ca6761a5bbd558a2318ecd0caa1c5016691523e7e1fa267dd35e70c66e84380bdcf7c0582f540174e572c41f81e93da0b757dff0b0fe23eb03aa19af0bdec3afb474216febaacb8d0381e631802683182b0fe72c28392539850650b70509f54980241dc175191a35d967288b532a7a8223ce2440d010615f70df269501944d4ec16fe4a3cb", + exponent: "03", + modulus: + "d7a85909174757835187cb52e71934e6c07ef43b4c46fc30bbcd0bc72913068267c54a4aabebb493922492820babdeb7dc9b1558fcf7bd82c37c82d3147e455b623ab0efa752fe0b3a67ca6e4d126639e645a0bf417568adbb2a6a4eef62fa1fa29b2a5a43bebea1f82193a7dd98eb483d09bb595af1fa9c97c7f41f5649d976aee3e5e59e2329b43b13bea228d4a93f16ba139ccb511de521ffe747aa2eca664f7c9e33da59075cc335afcd2bf3ae09765f01ab5a7c3e3938ec168b74724b5074247d200d9970382f683d6059b94dbc336603d1dfee714e4b447ac2fa1d99ecb4961da2854e03795ed758220312d101e1e3d87d5313a6d052aebde75110363d", + }, + "nagydani-3-pow0x10001": { + base: "c9130579f243e12451760976261416413742bd7c91d39ae087f46794062b8c239f2a74abf3918605a0e046a7890e049475ba7fbb78f5de6490bd22a710cc04d30088179a919d86c2da62cf37f59d8f258d2310d94c24891be2d7eeafaa32a8cb4b0cfe5f475ed778f45907dc8916a73f03635f233f7a77a00a3ec9ca6761a5bbd558a2318ecd0caa1c5016691523e7e1fa267dd35e70c66e84380bdcf7c0582f540174e572c41f81e93da0b757dff0b0fe23eb03aa19af0bdec3afb474216febaacb8d0381e631802683182b0fe72c28392539850650b70509f54980241dc175191a35d967288b532a7a8223ce2440d010615f70df269501944d4ec16fe4a3cb", + exponent: "010001", + modulus: + "d7a85909174757835187cb52e71934e6c07ef43b4c46fc30bbcd0bc72913068267c54a4aabebb493922492820babdeb7dc9b1558fcf7bd82c37c82d3147e455b623ab0efa752fe0b3a67ca6e4d126639e645a0bf417568adbb2a6a4eef62fa1fa29b2a5a43bebea1f82193a7dd98eb483d09bb595af1fa9c97c7f41f5649d976aee3e5e59e2329b43b13bea228d4a93f16ba139ccb511de521ffe747aa2eca664f7c9e33da59075cc335afcd2bf3ae09765f01ab5a7c3e3938ec168b74724b5074247d200d9970382f683d6059b94dbc336603d1dfee714e4b447ac2fa1d99ecb4961da2854e03795ed758220312d101e1e3d87d5313a6d052aebde75110363d", + }, + "nagydani-4-square": { + base: "db34d0e438249c0ed685c949cc28776a05094e1c48691dc3f2dca5fc3356d2a0663bd376e4712839917eb9a19c670407e2c377a2de385a3ff3b52104f7f1f4e0c7bf7717fb913896693dc5edbb65b760ef1b00e42e9d8f9af17352385e1cd742c9b006c0f669995cb0bb21d28c0aced2892267637b6470d8cee0ab27fc5d42658f6e88240c31d6774aa60a7ebd25cd48b56d0da11209f1928e61005c6eb709f3e8e0aaf8d9b10f7d7e296d772264dc76897ccdddadc91efa91c1903b7232a9e4c3b941917b99a3bc0c26497dedc897c25750af60237aa67934a26a2bc491db3dcc677491944bc1f51d3e5d76b8d846a62db03dedd61ff508f91a56d71028125035c3a44cbb041497c83bf3e4ae2a9613a401cc721c547a2afa3b16a2969933d3626ed6d8a7428648f74122fd3f2a02a20758f7f693892c8fd798b39abac01d18506c45e71432639e9f9505719ee822f62ccbf47f6850f096ff77b5afaf4be7d772025791717dbe5abf9b3f40cff7d7aab6f67e38f62faf510747276e20a42127e7500c444f9ed92baf65ade9e836845e39c4316d9dce5f8e2c8083e2c0acbb95296e05e51aab13b6b8f53f06c9c4276e12b0671133218cc3ea907da3bd9a367096d9202128d14846cc2e20d56fc8473ecb07cecbfb8086919f3971926e7045b853d85a69d026195c70f9f7a823536e2a8f4b3e12e94d9b53a934353451094b81", + exponent: "02", + modulus: + "df3143a0057457d75e8c708b6337a6f5a4fd1a06727acf9fb93e2993c62f3378b37d56c85e7b1e00f0145ebf8e4095bd723166293c60b6ac1252291ef65823c9e040ddad14969b3b340a4ef714db093a587c37766d68b8d6b5016e741587e7e6bf7e763b44f0247e64bae30f994d248bfd20541a333e5b225ef6a61199e301738b1e688f70ec1d7fb892c183c95dc543c3e12adf8a5e8b9ca9d04f9445cced3ab256f29e998e69efaa633a7b60e1db5a867924ccab0a171d9d6e1098dfa15acde9553de599eaa56490c8f411e4985111f3d40bddfc5e301edb01547b01a886550a61158f7e2033c59707789bf7c854181d0c2e2a42a93cf09209747d7082e147eb8544de25c3eb14f2e35559ea0c0f5877f2f3fc92132c0ae9da4e45b2f6c866a224ea6d1f28c05320e287750fbc647368d41116e528014cc1852e5531d53e4af938374daba6cee4baa821ed07117253bb3601ddd00d59a3d7fb2ef1f5a2fbba7c429f0cf9a5b3462410fd833a69118f8be9c559b1000cc608fd877fb43f8e65c2d1302622b944462579056874b387208d90623fcdaf93920ca7a9e4ba64ea208758222ad868501cc2c345e2d3a5ea2a17e5069248138c8a79c0251185d29ee73e5afab5354769142d2bf0cb6712727aa6bf84a6245fcdae66e4938d84d1b9dd09a884818622080ff5f98942fb20acd7e0c916c2d5ea7ce6f7e173315384518f", + }, + "nagydani-4-qube": { + base: "db34d0e438249c0ed685c949cc28776a05094e1c48691dc3f2dca5fc3356d2a0663bd376e4712839917eb9a19c670407e2c377a2de385a3ff3b52104f7f1f4e0c7bf7717fb913896693dc5edbb65b760ef1b00e42e9d8f9af17352385e1cd742c9b006c0f669995cb0bb21d28c0aced2892267637b6470d8cee0ab27fc5d42658f6e88240c31d6774aa60a7ebd25cd48b56d0da11209f1928e61005c6eb709f3e8e0aaf8d9b10f7d7e296d772264dc76897ccdddadc91efa91c1903b7232a9e4c3b941917b99a3bc0c26497dedc897c25750af60237aa67934a26a2bc491db3dcc677491944bc1f51d3e5d76b8d846a62db03dedd61ff508f91a56d71028125035c3a44cbb041497c83bf3e4ae2a9613a401cc721c547a2afa3b16a2969933d3626ed6d8a7428648f74122fd3f2a02a20758f7f693892c8fd798b39abac01d18506c45e71432639e9f9505719ee822f62ccbf47f6850f096ff77b5afaf4be7d772025791717dbe5abf9b3f40cff7d7aab6f67e38f62faf510747276e20a42127e7500c444f9ed92baf65ade9e836845e39c4316d9dce5f8e2c8083e2c0acbb95296e05e51aab13b6b8f53f06c9c4276e12b0671133218cc3ea907da3bd9a367096d9202128d14846cc2e20d56fc8473ecb07cecbfb8086919f3971926e7045b853d85a69d026195c70f9f7a823536e2a8f4b3e12e94d9b53a934353451094b81", + exponent: "03", + modulus: + "df3143a0057457d75e8c708b6337a6f5a4fd1a06727acf9fb93e2993c62f3378b37d56c85e7b1e00f0145ebf8e4095bd723166293c60b6ac1252291ef65823c9e040ddad14969b3b340a4ef714db093a587c37766d68b8d6b5016e741587e7e6bf7e763b44f0247e64bae30f994d248bfd20541a333e5b225ef6a61199e301738b1e688f70ec1d7fb892c183c95dc543c3e12adf8a5e8b9ca9d04f9445cced3ab256f29e998e69efaa633a7b60e1db5a867924ccab0a171d9d6e1098dfa15acde9553de599eaa56490c8f411e4985111f3d40bddfc5e301edb01547b01a886550a61158f7e2033c59707789bf7c854181d0c2e2a42a93cf09209747d7082e147eb8544de25c3eb14f2e35559ea0c0f5877f2f3fc92132c0ae9da4e45b2f6c866a224ea6d1f28c05320e287750fbc647368d41116e528014cc1852e5531d53e4af938374daba6cee4baa821ed07117253bb3601ddd00d59a3d7fb2ef1f5a2fbba7c429f0cf9a5b3462410fd833a69118f8be9c559b1000cc608fd877fb43f8e65c2d1302622b944462579056874b387208d90623fcdaf93920ca7a9e4ba64ea208758222ad868501cc2c345e2d3a5ea2a17e5069248138c8a79c0251185d29ee73e5afab5354769142d2bf0cb6712727aa6bf84a6245fcdae66e4938d84d1b9dd09a884818622080ff5f98942fb20acd7e0c916c2d5ea7ce6f7e173315384518f", + }, + "nagydani-4-pow0x10001": { + base: "db34d0e438249c0ed685c949cc28776a05094e1c48691dc3f2dca5fc3356d2a0663bd376e4712839917eb9a19c670407e2c377a2de385a3ff3b52104f7f1f4e0c7bf7717fb913896693dc5edbb65b760ef1b00e42e9d8f9af17352385e1cd742c9b006c0f669995cb0bb21d28c0aced2892267637b6470d8cee0ab27fc5d42658f6e88240c31d6774aa60a7ebd25cd48b56d0da11209f1928e61005c6eb709f3e8e0aaf8d9b10f7d7e296d772264dc76897ccdddadc91efa91c1903b7232a9e4c3b941917b99a3bc0c26497dedc897c25750af60237aa67934a26a2bc491db3dcc677491944bc1f51d3e5d76b8d846a62db03dedd61ff508f91a56d71028125035c3a44cbb041497c83bf3e4ae2a9613a401cc721c547a2afa3b16a2969933d3626ed6d8a7428648f74122fd3f2a02a20758f7f693892c8fd798b39abac01d18506c45e71432639e9f9505719ee822f62ccbf47f6850f096ff77b5afaf4be7d772025791717dbe5abf9b3f40cff7d7aab6f67e38f62faf510747276e20a42127e7500c444f9ed92baf65ade9e836845e39c4316d9dce5f8e2c8083e2c0acbb95296e05e51aab13b6b8f53f06c9c4276e12b0671133218cc3ea907da3bd9a367096d9202128d14846cc2e20d56fc8473ecb07cecbfb8086919f3971926e7045b853d85a69d026195c70f9f7a823536e2a8f4b3e12e94d9b53a934353451094b81", + exponent: "010001", + modulus: + "df3143a0057457d75e8c708b6337a6f5a4fd1a06727acf9fb93e2993c62f3378b37d56c85e7b1e00f0145ebf8e4095bd723166293c60b6ac1252291ef65823c9e040ddad14969b3b340a4ef714db093a587c37766d68b8d6b5016e741587e7e6bf7e763b44f0247e64bae30f994d248bfd20541a333e5b225ef6a61199e301738b1e688f70ec1d7fb892c183c95dc543c3e12adf8a5e8b9ca9d04f9445cced3ab256f29e998e69efaa633a7b60e1db5a867924ccab0a171d9d6e1098dfa15acde9553de599eaa56490c8f411e4985111f3d40bddfc5e301edb01547b01a886550a61158f7e2033c59707789bf7c854181d0c2e2a42a93cf09209747d7082e147eb8544de25c3eb14f2e35559ea0c0f5877f2f3fc92132c0ae9da4e45b2f6c866a224ea6d1f28c05320e287750fbc647368d41116e528014cc1852e5531d53e4af938374daba6cee4baa821ed07117253bb3601ddd00d59a3d7fb2ef1f5a2fbba7c429f0cf9a5b3462410fd833a69118f8be9c559b1000cc608fd877fb43f8e65c2d1302622b944462579056874b387208d90623fcdaf93920ca7a9e4ba64ea208758222ad868501cc2c345e2d3a5ea2a17e5069248138c8a79c0251185d29ee73e5afab5354769142d2bf0cb6712727aa6bf84a6245fcdae66e4938d84d1b9dd09a884818622080ff5f98942fb20acd7e0c916c2d5ea7ce6f7e173315384518f", + }, + "nagydani-5-square": { + base: "c5a1611f8be90071a43db23cc2fe01871cc4c0e8ab5743f6378e4fef77f7f6db0095c0727e20225beb665645403453e325ad5f9aeb9ba99bf3c148f63f9c07cf4fe8847ad5242d6b7d4499f93bd47056ddab8f7dee878fc2314f344dbee2a7c41a5d3db91eff372c730c2fdd3a141a4b61999e36d549b9870cf2f4e632c4d5df5f024f81c028000073a0ed8847cfb0593d36a47142f578f05ccbe28c0c06aeb1b1da027794c48db880278f79ba78ae64eedfea3c07d10e0562668d839749dc95f40467d15cf65b9cfc52c7c4bcef1cda3596dd52631aac942f146c7cebd46065131699ce8385b0db1874336747ee020a5698a3d1a1082665721e769567f579830f9d259cec1a836845109c21cf6b25da572512bf3c42fd4b96e43895589042ab60dd41f497db96aec102087fe784165bb45f942859268fd2ff6c012d9d00c02ba83eace047cc5f7b2c392c2955c58a49f0338d6fc58749c9db2155522ac17914ec216ad87f12e0ee95574613942fa615898c4d9e8a3be68cd6afa4e7a003dedbdf8edfee31162b174f965b20ae752ad89c967b3068b6f722c16b354456ba8e280f987c08e0a52d40a2e8f3a59b94d590aeef01879eb7a90b3ee7d772c839c85519cbeaddc0c193ec4874a463b53fcaea3271d80ebfb39b33489365fc039ae549a17a9ff898eea2f4cb27b8dbee4c17b998438575b2b8d107e4a0d66ba7fca85b41a58a8d51f191a35c856dfbe8aef2b00048a694bbccff832d23c8ca7a7ff0b6c0b3011d00b97c86c0628444d267c951d9e4fb8f83e154b8f74fb51aa16535e498235c5597dac9606ed0be3173a3836baa4e7d756ffe1e2879b415d3846bccd538c05b847785699aefde3e305decb600cd8fb0e7d8de5efc26971a6ad4e6d7a2d91474f1023a0ac4b78dc937da0ce607a45974d2cac1c33a2631ff7fe6144a3b2e5cf98b531a9627dea92c1dc82204d09db0439b6a11dd64b484e1263aa45fd9539b6020b55e3baece3986a8bffc1003406348f5c61265099ed43a766ee4f93f5f9c5abbc32a0fd3ac2b35b87f9ec26037d88275bd7dd0a54474995ee34ed3727f3f97c48db544b1980193a4b76a8a3ddab3591ce527f16d91882e67f0103b5cda53f7da54d489fc4ac08b6ab358a5a04aa9daa16219d50bd672a7cb804ed769d218807544e5993f1c27427104b349906a0b654df0bf69328afd3013fbe430155339c39f236df5557bf92f1ded7ff609a8502f49064ec3d1dbfb6c15d3a4c11a4f8acd12278cbf68acd5709463d12e3338a6eddb8c112f199645e23154a8e60879d2a654e3ed9296aa28f134168619691cd2c6b9e2eba4438381676173fc63c2588a3c5910dc149cf3760f0aa9fa9c3f5faa9162b0bf1aac9dd32b706a60ef53cbdb394b6b40222b5bc80eea82ba8958386672564cae3794f977871ab62337cf", + exponent: "02", + modulus: + "e30049201ec12937e7ce79d0f55d9c810e20acf52212aca1d3888949e0e4830aad88d804161230eb89d4d329cc83570fe257217d2119134048dd2ed167646975fc7d77136919a049ea74cf08ddd2b896890bb24a0ba18094a22baa351bf29ad96c66bbb1a598f2ca391749620e62d61c3561a7d3653ccc8892c7b99baaf76bf836e2991cb06d6bc0514568ff0d1ec8bb4b3d6984f5eaefb17d3ea2893722375d3ddb8e389a8eef7d7d198f8e687d6a513983df906099f9a2d23f4f9dec6f8ef2f11fc0a21fac45353b94e00486f5e17d386af42502d09db33cf0cf28310e049c07e88682aeeb00cb833c5174266e62407a57583f1f88b304b7c6e0c84bbe1c0fd423072d37a5bd0aacf764229e5c7cd02473460ba3645cd8e8ae144065bf02d0dd238593d8e230354f67e0b2f23012c23274f80e3ee31e35e2606a4a3f31d94ab755e6d163cff52cbb36b6d0cc67ffc512aeed1dce4d7a0d70ce82f2baba12e8d514dc92a056f994adfb17b5b9712bd5186f27a2fda1f7039c5df2c8587fdc62f5627580c13234b55be4df3056050e2d1ef3218f0dd66cb05265fe1acfb0989d8213f2c19d1735a7cf3fa65d88dad5af52dc2bba22b7abf46c3bc77b5091baab9e8f0ddc4d5e581037de91a9f8dcbc69309be29cc815cf19a20a7585b8b3073edf51fc9baeb3e509b97fa4ecfd621e0fd57bd61cac1b895c03248ff12bdbc57509250df3517e8a3fe1d776836b34ab352b973d932ef708b14f7418f9eceb1d87667e61e3e758649cb083f01b133d37ab2f5afa96d6c84bcacf4efc3851ad308c1e7d9113624fce29fab460ab9d2a48d92cdb281103a5250ad44cb2ff6e67ac670c02fdafb3e0f1353953d6d7d5646ca1568dea55275a050ec501b7c6250444f7219f1ba7521ba3b93d089727ca5f3bbe0d6c1300b423377004954c5628fdb65770b18ced5c9b23a4a5a6d6ef25fe01b4ce278de0bcc4ed86e28a0a68818ffa40970128cf2c38740e80037984428c1bd5113f40ff47512ee6f4e4d8f9b8e8e1b3040d2928d003bd1c1329dc885302fbce9fa81c23b4dc49c7c82d29b52957847898676c89aa5d32b5b0e1c0d5a2b79a19d67562f407f19425687971a957375879d90c5f57c857136c17106c9ab1b99d80e69c8c954ed386493368884b55c939b8d64d26f643e800c56f90c01079d7c534e3b2b7ae352cefd3016da55f6a85eb803b85e2304915fd2001f77c74e28746293c46e4f5f0fd49cf988aafd0026b8e7a3bab2da5cdce1ea26c2e29ec03f4807fac432662b2d6c060be1c7be0e5489de69d0a6e03a4b9117f9244b34a0f1ecba89884f781c6320412413a00c4980287409a2a78c2cd7e65cecebbe4ec1c28cac4dd95f6998e78fc6f1392384331c9436aa10e10e2bf8ad2c4eafbcf276aa7bae64b74428911b3269c749338b0fc5075ad", + }, + "nagydani-5-qube": { + base: "c5a1611f8be90071a43db23cc2fe01871cc4c0e8ab5743f6378e4fef77f7f6db0095c0727e20225beb665645403453e325ad5f9aeb9ba99bf3c148f63f9c07cf4fe8847ad5242d6b7d4499f93bd47056ddab8f7dee878fc2314f344dbee2a7c41a5d3db91eff372c730c2fdd3a141a4b61999e36d549b9870cf2f4e632c4d5df5f024f81c028000073a0ed8847cfb0593d36a47142f578f05ccbe28c0c06aeb1b1da027794c48db880278f79ba78ae64eedfea3c07d10e0562668d839749dc95f40467d15cf65b9cfc52c7c4bcef1cda3596dd52631aac942f146c7cebd46065131699ce8385b0db1874336747ee020a5698a3d1a1082665721e769567f579830f9d259cec1a836845109c21cf6b25da572512bf3c42fd4b96e43895589042ab60dd41f497db96aec102087fe784165bb45f942859268fd2ff6c012d9d00c02ba83eace047cc5f7b2c392c2955c58a49f0338d6fc58749c9db2155522ac17914ec216ad87f12e0ee95574613942fa615898c4d9e8a3be68cd6afa4e7a003dedbdf8edfee31162b174f965b20ae752ad89c967b3068b6f722c16b354456ba8e280f987c08e0a52d40a2e8f3a59b94d590aeef01879eb7a90b3ee7d772c839c85519cbeaddc0c193ec4874a463b53fcaea3271d80ebfb39b33489365fc039ae549a17a9ff898eea2f4cb27b8dbee4c17b998438575b2b8d107e4a0d66ba7fca85b41a58a8d51f191a35c856dfbe8aef2b00048a694bbccff832d23c8ca7a7ff0b6c0b3011d00b97c86c0628444d267c951d9e4fb8f83e154b8f74fb51aa16535e498235c5597dac9606ed0be3173a3836baa4e7d756ffe1e2879b415d3846bccd538c05b847785699aefde3e305decb600cd8fb0e7d8de5efc26971a6ad4e6d7a2d91474f1023a0ac4b78dc937da0ce607a45974d2cac1c33a2631ff7fe6144a3b2e5cf98b531a9627dea92c1dc82204d09db0439b6a11dd64b484e1263aa45fd9539b6020b55e3baece3986a8bffc1003406348f5c61265099ed43a766ee4f93f5f9c5abbc32a0fd3ac2b35b87f9ec26037d88275bd7dd0a54474995ee34ed3727f3f97c48db544b1980193a4b76a8a3ddab3591ce527f16d91882e67f0103b5cda53f7da54d489fc4ac08b6ab358a5a04aa9daa16219d50bd672a7cb804ed769d218807544e5993f1c27427104b349906a0b654df0bf69328afd3013fbe430155339c39f236df5557bf92f1ded7ff609a8502f49064ec3d1dbfb6c15d3a4c11a4f8acd12278cbf68acd5709463d12e3338a6eddb8c112f199645e23154a8e60879d2a654e3ed9296aa28f134168619691cd2c6b9e2eba4438381676173fc63c2588a3c5910dc149cf3760f0aa9fa9c3f5faa9162b0bf1aac9dd32b706a60ef53cbdb394b6b40222b5bc80eea82ba8958386672564cae3794f977871ab62337cf", + exponent: "03", + modulus: + "e30049201ec12937e7ce79d0f55d9c810e20acf52212aca1d3888949e0e4830aad88d804161230eb89d4d329cc83570fe257217d2119134048dd2ed167646975fc7d77136919a049ea74cf08ddd2b896890bb24a0ba18094a22baa351bf29ad96c66bbb1a598f2ca391749620e62d61c3561a7d3653ccc8892c7b99baaf76bf836e2991cb06d6bc0514568ff0d1ec8bb4b3d6984f5eaefb17d3ea2893722375d3ddb8e389a8eef7d7d198f8e687d6a513983df906099f9a2d23f4f9dec6f8ef2f11fc0a21fac45353b94e00486f5e17d386af42502d09db33cf0cf28310e049c07e88682aeeb00cb833c5174266e62407a57583f1f88b304b7c6e0c84bbe1c0fd423072d37a5bd0aacf764229e5c7cd02473460ba3645cd8e8ae144065bf02d0dd238593d8e230354f67e0b2f23012c23274f80e3ee31e35e2606a4a3f31d94ab755e6d163cff52cbb36b6d0cc67ffc512aeed1dce4d7a0d70ce82f2baba12e8d514dc92a056f994adfb17b5b9712bd5186f27a2fda1f7039c5df2c8587fdc62f5627580c13234b55be4df3056050e2d1ef3218f0dd66cb05265fe1acfb0989d8213f2c19d1735a7cf3fa65d88dad5af52dc2bba22b7abf46c3bc77b5091baab9e8f0ddc4d5e581037de91a9f8dcbc69309be29cc815cf19a20a7585b8b3073edf51fc9baeb3e509b97fa4ecfd621e0fd57bd61cac1b895c03248ff12bdbc57509250df3517e8a3fe1d776836b34ab352b973d932ef708b14f7418f9eceb1d87667e61e3e758649cb083f01b133d37ab2f5afa96d6c84bcacf4efc3851ad308c1e7d9113624fce29fab460ab9d2a48d92cdb281103a5250ad44cb2ff6e67ac670c02fdafb3e0f1353953d6d7d5646ca1568dea55275a050ec501b7c6250444f7219f1ba7521ba3b93d089727ca5f3bbe0d6c1300b423377004954c5628fdb65770b18ced5c9b23a4a5a6d6ef25fe01b4ce278de0bcc4ed86e28a0a68818ffa40970128cf2c38740e80037984428c1bd5113f40ff47512ee6f4e4d8f9b8e8e1b3040d2928d003bd1c1329dc885302fbce9fa81c23b4dc49c7c82d29b52957847898676c89aa5d32b5b0e1c0d5a2b79a19d67562f407f19425687971a957375879d90c5f57c857136c17106c9ab1b99d80e69c8c954ed386493368884b55c939b8d64d26f643e800c56f90c01079d7c534e3b2b7ae352cefd3016da55f6a85eb803b85e2304915fd2001f77c74e28746293c46e4f5f0fd49cf988aafd0026b8e7a3bab2da5cdce1ea26c2e29ec03f4807fac432662b2d6c060be1c7be0e5489de69d0a6e03a4b9117f9244b34a0f1ecba89884f781c6320412413a00c4980287409a2a78c2cd7e65cecebbe4ec1c28cac4dd95f6998e78fc6f1392384331c9436aa10e10e2bf8ad2c4eafbcf276aa7bae64b74428911b3269c749338b0fc5075ad", + }, + "nagydani-5-pow0x10001": { + base: "c5a1611f8be90071a43db23cc2fe01871cc4c0e8ab5743f6378e4fef77f7f6db0095c0727e20225beb665645403453e325ad5f9aeb9ba99bf3c148f63f9c07cf4fe8847ad5242d6b7d4499f93bd47056ddab8f7dee878fc2314f344dbee2a7c41a5d3db91eff372c730c2fdd3a141a4b61999e36d549b9870cf2f4e632c4d5df5f024f81c028000073a0ed8847cfb0593d36a47142f578f05ccbe28c0c06aeb1b1da027794c48db880278f79ba78ae64eedfea3c07d10e0562668d839749dc95f40467d15cf65b9cfc52c7c4bcef1cda3596dd52631aac942f146c7cebd46065131699ce8385b0db1874336747ee020a5698a3d1a1082665721e769567f579830f9d259cec1a836845109c21cf6b25da572512bf3c42fd4b96e43895589042ab60dd41f497db96aec102087fe784165bb45f942859268fd2ff6c012d9d00c02ba83eace047cc5f7b2c392c2955c58a49f0338d6fc58749c9db2155522ac17914ec216ad87f12e0ee95574613942fa615898c4d9e8a3be68cd6afa4e7a003dedbdf8edfee31162b174f965b20ae752ad89c967b3068b6f722c16b354456ba8e280f987c08e0a52d40a2e8f3a59b94d590aeef01879eb7a90b3ee7d772c839c85519cbeaddc0c193ec4874a463b53fcaea3271d80ebfb39b33489365fc039ae549a17a9ff898eea2f4cb27b8dbee4c17b998438575b2b8d107e4a0d66ba7fca85b41a58a8d51f191a35c856dfbe8aef2b00048a694bbccff832d23c8ca7a7ff0b6c0b3011d00b97c86c0628444d267c951d9e4fb8f83e154b8f74fb51aa16535e498235c5597dac9606ed0be3173a3836baa4e7d756ffe1e2879b415d3846bccd538c05b847785699aefde3e305decb600cd8fb0e7d8de5efc26971a6ad4e6d7a2d91474f1023a0ac4b78dc937da0ce607a45974d2cac1c33a2631ff7fe6144a3b2e5cf98b531a9627dea92c1dc82204d09db0439b6a11dd64b484e1263aa45fd9539b6020b55e3baece3986a8bffc1003406348f5c61265099ed43a766ee4f93f5f9c5abbc32a0fd3ac2b35b87f9ec26037d88275bd7dd0a54474995ee34ed3727f3f97c48db544b1980193a4b76a8a3ddab3591ce527f16d91882e67f0103b5cda53f7da54d489fc4ac08b6ab358a5a04aa9daa16219d50bd672a7cb804ed769d218807544e5993f1c27427104b349906a0b654df0bf69328afd3013fbe430155339c39f236df5557bf92f1ded7ff609a8502f49064ec3d1dbfb6c15d3a4c11a4f8acd12278cbf68acd5709463d12e3338a6eddb8c112f199645e23154a8e60879d2a654e3ed9296aa28f134168619691cd2c6b9e2eba4438381676173fc63c2588a3c5910dc149cf3760f0aa9fa9c3f5faa9162b0bf1aac9dd32b706a60ef53cbdb394b6b40222b5bc80eea82ba8958386672564cae3794f977871ab62337cf", + exponent: "010001", + modulus: + "e30049201ec12937e7ce79d0f55d9c810e20acf52212aca1d3888949e0e4830aad88d804161230eb89d4d329cc83570fe257217d2119134048dd2ed167646975fc7d77136919a049ea74cf08ddd2b896890bb24a0ba18094a22baa351bf29ad96c66bbb1a598f2ca391749620e62d61c3561a7d3653ccc8892c7b99baaf76bf836e2991cb06d6bc0514568ff0d1ec8bb4b3d6984f5eaefb17d3ea2893722375d3ddb8e389a8eef7d7d198f8e687d6a513983df906099f9a2d23f4f9dec6f8ef2f11fc0a21fac45353b94e00486f5e17d386af42502d09db33cf0cf28310e049c07e88682aeeb00cb833c5174266e62407a57583f1f88b304b7c6e0c84bbe1c0fd423072d37a5bd0aacf764229e5c7cd02473460ba3645cd8e8ae144065bf02d0dd238593d8e230354f67e0b2f23012c23274f80e3ee31e35e2606a4a3f31d94ab755e6d163cff52cbb36b6d0cc67ffc512aeed1dce4d7a0d70ce82f2baba12e8d514dc92a056f994adfb17b5b9712bd5186f27a2fda1f7039c5df2c8587fdc62f5627580c13234b55be4df3056050e2d1ef3218f0dd66cb05265fe1acfb0989d8213f2c19d1735a7cf3fa65d88dad5af52dc2bba22b7abf46c3bc77b5091baab9e8f0ddc4d5e581037de91a9f8dcbc69309be29cc815cf19a20a7585b8b3073edf51fc9baeb3e509b97fa4ecfd621e0fd57bd61cac1b895c03248ff12bdbc57509250df3517e8a3fe1d776836b34ab352b973d932ef708b14f7418f9eceb1d87667e61e3e758649cb083f01b133d37ab2f5afa96d6c84bcacf4efc3851ad308c1e7d9113624fce29fab460ab9d2a48d92cdb281103a5250ad44cb2ff6e67ac670c02fdafb3e0f1353953d6d7d5646ca1568dea55275a050ec501b7c6250444f7219f1ba7521ba3b93d089727ca5f3bbe0d6c1300b423377004954c5628fdb65770b18ced5c9b23a4a5a6d6ef25fe01b4ce278de0bcc4ed86e28a0a68818ffa40970128cf2c38740e80037984428c1bd5113f40ff47512ee6f4e4d8f9b8e8e1b3040d2928d003bd1c1329dc885302fbce9fa81c23b4dc49c7c82d29b52957847898676c89aa5d32b5b0e1c0d5a2b79a19d67562f407f19425687971a957375879d90c5f57c857136c17106c9ab1b99d80e69c8c954ed386493368884b55c939b8d64d26f643e800c56f90c01079d7c534e3b2b7ae352cefd3016da55f6a85eb803b85e2304915fd2001f77c74e28746293c46e4f5f0fd49cf988aafd0026b8e7a3bab2da5cdce1ea26c2e29ec03f4807fac432662b2d6c060be1c7be0e5489de69d0a6e03a4b9117f9244b34a0f1ecba89884f781c6320412413a00c4980287409a2a78c2cd7e65cecebbe4ec1c28cac4dd95f6998e78fc6f1392384331c9436aa10e10e2bf8ad2c4eafbcf276aa7bae64b74428911b3269c749338b0fc5075ad", + }, +} as const; diff --git a/test/moonwall/helpers/precompile-addresses.ts b/test/moonwall/helpers/precompile-addresses.ts new file mode 100644 index 00000000..4eac619b --- /dev/null +++ b/test/moonwall/helpers/precompile-addresses.ts @@ -0,0 +1,17 @@ +/** + * Precompile addresses for DataHaven + * These addresses match Moonbeam's precompile address scheme + */ + +export const PRECOMPILE_NATIVE_ERC20_ADDRESS = "0x0000000000000000000000000000000000000802" as const; +export const PRECOMPILE_ERC20_BALANCES_ADDRESS = PRECOMPILE_NATIVE_ERC20_ADDRESS; // Alias +export const PRECOMPILE_BATCH_ADDRESS = "0x0000000000000000000000000000000000000808" as const; +export const PRECOMPILE_CALL_PERMIT_ADDRESS = "0x000000000000000000000000000000000000080a" as const; +export const PRECOMPILE_PROXY_ADDRESS = "0x000000000000000000000000000000000000080b" as const; +export const PRECOMPILE_TREASURY_COUNCIL_ADDRESS = "0x0000000000000000000000000000000000000810" as const; +export const PRECOMPILE_REFERENDA_ADDRESS = "0x0000000000000000000000000000000000000811" as const; +export const PRECOMPILE_CONVICTION_VOTING_ADDRESS = "0x0000000000000000000000000000000000000812" as const; +export const PRECOMPILE_PREIMAGE_ADDRESS = "0x0000000000000000000000000000000000000813" as const; +export const PRECOMPILE_TECHNICAL_COMMITTEE_ADDRESS = "0x0000000000000000000000000000000000000814" as const; +export const PRECOMPILE_REGISTRY_ADDRESS = "0x0000000000000000000000000000000000000815" as const; +export const PRECOMPILE_IDENTITY_ADDRESS = "0x0000000000000000000000000000000000000818" as const; diff --git a/test/moonwall/helpers/precompile-contract-calls.ts b/test/moonwall/helpers/precompile-contract-calls.ts new file mode 100644 index 00000000..4753f08e --- /dev/null +++ b/test/moonwall/helpers/precompile-contract-calls.ts @@ -0,0 +1,136 @@ +/** + * Precompile contract call helpers + * Adapted from Moonbeam test suite + */ + +import type { BlockCreation, DevModeContext, PrecompileCallOptions } from "@moonwall/cli"; +import type { KeyringPair } from "@moonwall/util"; + +class PrecompileContract { + precompileName: string; + context: DevModeContext; + privateKey?: `0x${string}`; + gas?: bigint | "estimate"; + rawTxOnly?: boolean; + signer?: KeyringPair; + expectEvents?: [any]; + + constructor(precompileName: string, context: DevModeContext) { + this.precompileName = precompileName; + this.context = context; + this.reset(); + } + + reset() { + this.privateKey = undefined; + this.gas = undefined; + this.rawTxOnly = true; + this.signer = undefined; + this.expectEvents = undefined; + return this; + } + + withPrivateKey(privateKey: `0x${string}`) { + this.privateKey = privateKey; + return this; + } + + withGas(gas: bigint | "estimate") { + this.gas = gas; + return this; + } + + withRawTxOnly(rawTxOnly: boolean) { + if (rawTxOnly === false) { + this.rawTxOnly = undefined; + } + return this; + } + + withSigner(signer: KeyringPair) { + this.signer = signer; + return this; + } + + withExpectEvents(expectEvents: [any]) { + this.expectEvents = expectEvents; + return this; + } + + callExtrinsic(functionName: string, args: any[]): PrecompileCall { + return this.callRpc(functionName, args, true); + } + + callQuery(functionName: string, args: any[]): PrecompileCall { + return this.callRpc(functionName, args, false); + } + + private callRpc(functionName: string, args: any[], isExtrinsic: boolean): PrecompileCall { + const params = { + precompileName: this.precompileName, + functionName, + args, + privateKey: this.privateKey, + rawTxOnly: this.rawTxOnly, + gas: this.gas, + }; + const blockCreationOptions = { + signer: this.signer, + expectEvents: this.expectEvents, + }; + if (!isExtrinsic) { + return new ReadPrecompileCall(params, this.context, blockCreationOptions); + } + return new WritePrecompileCall(params, this.context, blockCreationOptions); + } +} + +export class PrecompileCall { + params: PrecompileCallOptions; + context: DevModeContext; + blockCreationOptions: BlockCreation; + + constructor( + params: PrecompileCallOptions, + context: DevModeContext, + blockCreationOptions: BlockCreation + ) { + this.params = params; + this.context = context; + this.blockCreationOptions = blockCreationOptions; + } + + async tx(): Promise { + throw new Error("Not implemented"); + } + + async block() { + return await this.context.createBlock((await this.tx()) as any, this.blockCreationOptions); + } +} + +class ReadPrecompileCall extends PrecompileCall { + async tx(): Promise { + return await this.context.readPrecompile!(this.params); + } +} + +class WritePrecompileCall extends PrecompileCall { + async tx(): Promise { + return await this.context.writePrecompile!(this.params); + } +} + +export class Preimage extends PrecompileContract { + constructor(context: DevModeContext) { + super("Preimage", context); + } + + notePreimage(data: string): PrecompileCall { + return this.callExtrinsic("notePreimage", [data]); + } + + unnotePreimage(data: string): PrecompileCall { + return this.callExtrinsic("unnotePreimage", [data]); + } +} diff --git a/test/moonwall/suites/dev/stagenet/balance/test-balance-existential.ts b/test/moonwall/suites/dev/stagenet/balance/test-balance-existential.ts new file mode 100644 index 00000000..a64afb84 --- /dev/null +++ b/test/moonwall/suites/dev/stagenet/balance/test-balance-existential.ts @@ -0,0 +1,93 @@ +/** + * Existential deposit tests + * Adapted from Moonbeam test suite + */ + +import { expect, describeSuite, beforeEach, TransactionTypes } from "@moonwall/cli"; +import { ALITH_ADDRESS, baltathar, GLMR } from "@moonwall/util"; +import { createRawTransfer } from "@moonwall/util"; +import { Wallet } from "ethers"; +import { ConstantStore } from "../../../../helpers"; + +describeSuite({ + id: "D030203", + title: "Existential Deposit", + foundationMethods: "dev", + testCases: ({ context, log, it }) => { + let privateKey: `0x${string}`; + let randomWeb3Account: any; + let GENESIS_BASE_FEE: bigint; + + beforeEach(async function () { + const { specVersion } = await context.polkadotJs().consts.system.version; + GENESIS_BASE_FEE = ConstantStore(context).GENESIS_BASE_FEE.get(specVersion.toNumber()); + + randomWeb3Account = context.web3().eth.accounts.create(); + privateKey = randomWeb3Account.privateKey; + const { result } = await context.createBlock( + context.polkadotJs().tx.balances.transferAllowDeath(randomWeb3Account.address, 10n * GLMR) + ); + expect(result!.successful, result!.error?.name).to.be.true; + }); + + for (const txnType of TransactionTypes) { + it({ + id: `T0${TransactionTypes.indexOf(txnType) + 1}`, + title: `full ${txnType} transfer should not reap on 0 account balance`, + test: async function () { + const raw = await createRawTransfer( + context, + ALITH_ADDRESS, + 10n * GLMR - 21000n * GENESIS_BASE_FEE, + { + privateKey, + type: txnType, + gasPrice: GENESIS_BASE_FEE, + gas: 21000n, + maxFeePerGas: GENESIS_BASE_FEE, + } + ); + const { result } = await context.createBlock(raw); + + expect( + await context.viem().getTransactionCount({ address: randomWeb3Account.address }) + ).toBe(1); + expect(result!.successful, result!.error?.name).toBe(true); + expect(await context.viem().getBalance({ address: randomWeb3Account.address })).toBe(0n); + }, + }); + } + + it({ + id: "T04", + title: "should not reap on tiny balance", + test: async function () { + const signer = new Wallet(privateKey, context.ethers().provider); + await signer.sendTransaction({ + to: baltathar.address, + value: 10n * GLMR - 21000n * GENESIS_BASE_FEE - 1n, + gasPrice: GENESIS_BASE_FEE, + gasLimit: 21000n, + }); + + await context.createBlock(); + + expect(await context.viem().getBalance({ address: randomWeb3Account.address })).toBe(1n); + expect( + await context.viem().getTransactionCount({ address: randomWeb3Account.address }) + ).toBe(1); + }, + }); + + it({ + id: "T05", + title: "runtime constant should be set to zero", + test: async function () { + const existentialDeposit = context + .polkadotJs() + .consts.balances.existentialDeposit.toBigInt(); + expect(existentialDeposit).toBe(0n); + }, + }); + }, +}); diff --git a/test/moonwall/suites/dev/stagenet/balance/test-balance-extrinsics.ts b/test/moonwall/suites/dev/stagenet/balance/test-balance-extrinsics.ts new file mode 100644 index 00000000..7704c1fe --- /dev/null +++ b/test/moonwall/suites/dev/stagenet/balance/test-balance-extrinsics.ts @@ -0,0 +1,87 @@ +/** + * Balance extrinsics tests + * Adapted from Moonbeam test suite + */ + +import { TransactionTypes, beforeAll, beforeEach, describeSuite, expect } from "@moonwall/cli"; +import { + ALITH_ADDRESS, + BALTATHAR_ADDRESS, + GLMR, + createRawTransfer, + mapExtrinsics, +} from "@moonwall/util"; +import type { PrivateKeyAccount } from "viem"; +import { generatePrivateKey, privateKeyToAccount } from "viem/accounts"; + +describeSuite({ + id: "D030204", + title: "Balance - Extrinsic Events", + foundationMethods: "dev", + testCases: ({ context, log, it }) => { + let randomAccount: PrivateKeyAccount; + + beforeAll(async function () { + // To create the treasury account + await context.createBlock(createRawTransfer(context, BALTATHAR_ADDRESS, 1337)); + }); + + beforeEach(async function () { + const privateKey = generatePrivateKey(); + randomAccount = privateKeyToAccount(privateKey); + }); + + for (const txnType of TransactionTypes) { + it({ + id: `T0${TransactionTypes.indexOf(txnType) + 1}`, + title: `should emit events for ${txnType} ethereum/transfers`, + test: async function () { + await context.createBlock( + createRawTransfer(context, randomAccount.address, 1n * GLMR, { + type: txnType, + gas: 500000n, + }) + ); + + const signedBlock = await context.polkadotJs().rpc.chain.getBlock(); + const allRecords = await context.polkadotJs().query.system.events(); + const txsWithEvents = mapExtrinsics(signedBlock.block.extrinsics, allRecords); + + const ethTx = txsWithEvents.find( + ({ extrinsic: { method } }) => method.section === "ethereum" + )!; + + // Check key events are present + const hasNewAccount = ethTx.events.some((e) => + context.polkadotJs().events.system.NewAccount.is(e) + ); + const hasEndowed = ethTx.events.some((e) => + context.polkadotJs().events.balances.Endowed.is(e) + ); + const hasTransfer = ethTx.events.some((e) => + context.polkadotJs().events.balances.Transfer.is(e) + ); + const hasExecuted = ethTx.events.some((e) => + context.polkadotJs().events.ethereum.Executed.is(e) + ); + const hasSuccess = ethTx.events.some((e) => + context.polkadotJs().events.system.ExtrinsicSuccess.is(e) + ); + + expect(hasNewAccount, "NewAccount event should be present").to.be.true; + expect(hasEndowed, "Endowed event should be present").to.be.true; + expect(hasTransfer, "Transfer event should be present").to.be.true; + expect(hasExecuted, "Executed event should be present").to.be.true; + expect(hasSuccess, "ExtrinsicSuccess event should be present").to.be.true; + + // Verify transfer event data + const transferEvent = ethTx.events.find((e) => + context.polkadotJs().events.balances.Transfer.is(e) + )!; + expect(transferEvent.data[0].toString()).to.eq(ALITH_ADDRESS); + expect(transferEvent.data[1].toString()).to.eq(randomAccount.address); + }, + }); + } + }, +}); diff --git a/test/moonwall/suites/dev/stagenet/balance/test-balance-genesis.ts b/test/moonwall/suites/dev/stagenet/balance/test-balance-genesis.ts new file mode 100644 index 00000000..41762f3b --- /dev/null +++ b/test/moonwall/suites/dev/stagenet/balance/test-balance-genesis.ts @@ -0,0 +1,38 @@ +import "@moonbeam-network/api-augment"; +import { expect, describeSuite } from "@moonwall/cli"; +import { ALITH_ADDRESS } from "@moonwall/util"; +import { + ALITH_GENESIS_FREE_BALANCE, + ALITH_GENESIS_RESERVE_BALANCE, + ALITH_GENESIS_TRANSFERABLE_BALANCE, +} from "../../../../helpers"; + +describeSuite({ + id: "D030201", + title: "Balance genesis", + foundationMethods: "dev", + testCases: ({ context, it }) => { + it({ + id: "T01", + title: "should be accessible through web3", + test: async function () { + expect(await context.viem().getBalance({ address: ALITH_ADDRESS })).toBe( + ALITH_GENESIS_TRANSFERABLE_BALANCE + ); + }, + }); + + it({ + id: "T02", + title: "should be accessible through polkadotJs", + test: async function () { + const genesisHash = await context.polkadotJs().rpc.chain.getBlockHash(0); + const account = await (await context.polkadotJs().at(genesisHash)).query.system.account( + ALITH_ADDRESS + ); + expect(account.data.free.toBigInt()).toBe(ALITH_GENESIS_FREE_BALANCE); + expect(account.data.reserved.toBigInt()).toBe(ALITH_GENESIS_RESERVE_BALANCE); + }, + }); + }, +}); diff --git a/test/moonwall/suites/dev/stagenet/balance/test-balance-transfer.ts b/test/moonwall/suites/dev/stagenet/balance/test-balance-transfer.ts new file mode 100644 index 00000000..9c49a53f --- /dev/null +++ b/test/moonwall/suites/dev/stagenet/balance/test-balance-transfer.ts @@ -0,0 +1,242 @@ +import "@moonbeam-network/api-augment"; +import { beforeEach, describeSuite, expect } from "@moonwall/cli"; +import { + ALITH_ADDRESS, + CHARLETH_ADDRESS, + BALTATHAR_ADDRESS, + BALTATHAR_PRIVATE_KEY, + CHARLETH_PRIVATE_KEY, + FAITH_PRIVATE_KEY, + GLMR, + checkBalance, + createViemTransaction, + createRawTransfer, + generateKeyringPair, + sendRawTransaction, +} from "@moonwall/util"; +import { + ALITH_GENESIS_TRANSFERABLE_BALANCE, + ConstantStore, + verifyLatestBlockFees, +} from "../../../../helpers"; + +import { parseGwei } from "viem"; + +describeSuite({ + id: "D030202", + title: "Balance Transfers", + foundationMethods: "dev", + testCases: ({ context, log, it }) => { + let randomAddress: `0x${string}`; + let GENESIS_BASE_FEE; + + beforeEach(async function () { + const randomAccount = generateKeyringPair(); + randomAddress = randomAccount.address as `0x${string}`; + const { specVersion } = await context.polkadotJs().consts.system.version; + GENESIS_BASE_FEE = ConstantStore(context).GENESIS_BASE_FEE.get(specVersion.toNumber()); + }); + + it({ + id: "T01", + title: "should cost 21000 gas for a transfer", + test: async function () { + const estimatedGas = await context.viem().estimateGas({ + account: ALITH_ADDRESS, + value: 0n * GLMR, + to: randomAddress, + }); + expect(estimatedGas, "Estimated bal transfer incorrect").toBe(21000n); + + await context.createBlock(createRawTransfer(context, randomAddress, 0n)); + expect(await context.viem().getBalance({ address: ALITH_ADDRESS })).toBe( + ALITH_GENESIS_TRANSFERABLE_BALANCE - 21000n * GENESIS_BASE_FEE + ); + }, + }); + + it({ + id: "T02", + title: "unsent txns should be in pending", + test: async function () { + await context.createBlock(); + const rawTx = (await createRawTransfer(context, randomAddress, 512n, { + privateKey: CHARLETH_PRIVATE_KEY, + gasPrice: GENESIS_BASE_FEE, + gas: 21000n, + txnType: "legacy", + })) as `0x${string}`; + await sendRawTransaction(context, rawTx); + + expect( + await context.viem().getBalance({ address: randomAddress, blockTag: "pending" }) + ).toBe(512n); + }, + }); + + it({ + id: "T03", + title: "should decrease from account", + test: async function () { + const balanceBefore = await context.viem().getBalance({ address: CHARLETH_ADDRESS }); + const fees = 21000n * GENESIS_BASE_FEE; + await context.createBlock( + await createRawTransfer(context, randomAddress, 512n, { + gas: 21000n, + gasPrice: GENESIS_BASE_FEE, + txnType: "legacy", + privateKey: CHARLETH_PRIVATE_KEY, + }) + ); + const balanceAfter = await context.viem().getBalance({ address: CHARLETH_ADDRESS }); + expect(balanceBefore - balanceAfter - fees).toBe(512n); + }, + }); + + it({ + id: "T04", + title: "should increase to account", + test: async function () { + const balanceBefore = await checkBalance(context, randomAddress); + + await context.createBlock( + await createRawTransfer(context, randomAddress, 512n, { + gas: 21000n, + gasPrice: GENESIS_BASE_FEE, + type: "legacy", + }) + ); + const balanceAfter = await checkBalance(context, randomAddress); + expect(balanceBefore).toBe(0n); + expect(balanceAfter).toBe(512n); + }, + }); + + it({ + id: "T05", + title: "should reflect balance identically on polkadot/web3", + test: async function () { + await context.createBlock( + await createRawTransfer(context, randomAddress, 512n, { + gas: 21000n, + gasPrice: GENESIS_BASE_FEE, + type: "legacy", + }) + ); + + const blockNumber = ( + await context.polkadotJs().rpc.chain.getBlock() + ).block.header.number.toBigInt(); + + const block1Hash = await context.polkadotJs().rpc.chain.getBlockHash(blockNumber); + const balance = await (await context.polkadotJs().at(block1Hash)).query.system.account( + ALITH_ADDRESS + ); + + expect(await context.viem().getBalance({ blockNumber, address: ALITH_ADDRESS })).to.equal( + balance.data.free.toBigInt() + + balance.data.reserved.toBigInt() - + balance.data.frozen.toBigInt() + ); + }, + }); + + it({ + id: "T06", + title: "should check latest block fees", + test: async function () { + await context.createBlock( + await createRawTransfer(context, randomAddress, 512n, { + gas: 21000n, + gasPrice: GENESIS_BASE_FEE, + type: "legacy", + }) + ); + + await verifyLatestBlockFees(context, BigInt(512)); + }, + }); + + // NOTE: Uses FAITH_PRIVATE_KEY (aka Frank in DataHaven) instead of GERALD_PRIVATE_KEY + // because Gerald is not endowed at genesis in DataHaven (unlike Moonbeam). + it({ + id: "T07", + title: "multiple transfer should be successful", + test: async function () { + const { result } = await context.createBlock([ + await createRawTransfer(context, randomAddress, 10n * GLMR, { + privateKey: FAITH_PRIVATE_KEY, + nonce: 0, + }), + await createRawTransfer(context, randomAddress, 10n * GLMR, { + privateKey: FAITH_PRIVATE_KEY, + nonce: 1, + }), + await createRawTransfer(context, randomAddress, 10n * GLMR, { + privateKey: FAITH_PRIVATE_KEY, + nonce: 2, + }), + await createRawTransfer(context, randomAddress, 10n * GLMR, { + privateKey: FAITH_PRIVATE_KEY, + nonce: 3, + }), + await createRawTransfer(context, randomAddress, 10n * GLMR, { + privateKey: FAITH_PRIVATE_KEY, + nonce: 4, + }), + ]); + + expect((result as any).filter((r: any) => r.successful)).to.be.length(5); + }, + }); + + it({ + id: "T08", + title: "should handle max_fee_per_gas", + test: async function () { + const balanceBefore = await checkBalance(context, CHARLETH_ADDRESS); + await context.createBlock( + await createRawTransfer(context, randomAddress, 1n * GLMR, { + gas: 21000n, + maxFeePerGas: GENESIS_BASE_FEE, + maxPriorityFeePerGas: parseGwei("0.2"), + gasPrice: GENESIS_BASE_FEE, + type: "eip1559", + privateKey: CHARLETH_PRIVATE_KEY, + }) + ); + const balanceAfter = await checkBalance(context, CHARLETH_ADDRESS); + const fee = 21000n * GENESIS_BASE_FEE; + + expect(balanceAfter + fee + 1n * GLMR).toBe(balanceBefore); + }, + }); + + it({ + id: "T09", + title: "should use partial max_priority_fee_per_gas", + test: async function () { + // With this configuration only half of the priority fee will be used, + // as the max_fee_per_gas is 2GWEI and the base fee is 1GWEI. + const accountData = (await context.polkadotJs().query.system.account(BALTATHAR_ADDRESS)) + .data; + const freeBal = accountData.free.toBigInt() - accountData.reserved.toBigInt(); + const maxFeePerGas = 10_000_000_000n * 2n; + await context.createBlock( + await createViemTransaction(context, { + privateKey: BALTATHAR_PRIVATE_KEY, + gas: 21000n, + to: randomAddress, + data: "0x", + maxFeePerGas, + maxPriorityFeePerGas: maxFeePerGas, + type: "eip1559", + }) + ); + const balanceAfter = await checkBalance(context, BALTATHAR_ADDRESS); + const fee = 21_000n * maxFeePerGas; + expect(freeBal - balanceAfter - fee).toBe(0n); + }, + }); + }, +}); diff --git a/test/moonwall/suites/dev/stagenet/precompile/test-precompile-blake2.ts b/test/moonwall/suites/dev/stagenet/precompile/test-precompile-blake2.ts new file mode 100644 index 00000000..c936fd84 --- /dev/null +++ b/test/moonwall/suites/dev/stagenet/precompile/test-precompile-blake2.ts @@ -0,0 +1,37 @@ +/** + * Blake2 precompile tests + * Adapted from Moonbeam test suite + */ + +import { deployCreateCompiledContract, describeSuite } from "@moonwall/cli"; +import { expectEVMResult } from "../../../../helpers"; + +import { createViemTransaction } from "@moonwall/util"; +import { encodeFunctionData } from "viem"; + +describeSuite({ + id: "D030101", + title: "Precompiles - blake2", + foundationMethods: "dev", + testCases: ({ context, log, it }) => { + it({ + id: "T01", + title: "should be accessible from a smart contract", + test: async function () { + const { abi } = await deployCreateCompiledContract(context, "HasherChecker"); + + // Execute the contract blake2 call + const { result } = await context.createBlock( + createViemTransaction(context, { + data: encodeFunctionData({ + abi, + functionName: "blake2Check", + }), + }) + ); + + expectEVMResult(result!.events, "Succeed"); + }, + }); + }, +}); diff --git a/test/moonwall/suites/dev/stagenet/precompile/test-precompile-bn128add.ts b/test/moonwall/suites/dev/stagenet/precompile/test-precompile-bn128add.ts new file mode 100644 index 00000000..9e7c455a --- /dev/null +++ b/test/moonwall/suites/dev/stagenet/precompile/test-precompile-bn128add.ts @@ -0,0 +1,39 @@ +/** + * BN128 addition precompile tests + * Adapted from Moonbeam test suite + */ + +import { deployCreateCompiledContract, describeSuite } from "@moonwall/cli"; +import { createViemTransaction } from "@moonwall/util"; +import { encodeFunctionData } from "viem"; +import { expectEVMResult } from "../../../../helpers"; + +describeSuite({ + id: "D030102", + title: "Precompiles - bn128add", + foundationMethods: "dev", + testCases: ({ context, it, log }) => { + it({ + id: "T01", + title: "should be accessible from a smart contract", + test: async function () { + const { abi, contractAddress } = await deployCreateCompiledContract( + context, + "HasherChecker" + ); + + const { result } = await context.createBlock( + createViemTransaction(context, { + to: contractAddress, + data: encodeFunctionData({ + abi, + functionName: "bn128AdditionCheck", + }), + }) + ); + + expectEVMResult(result!.events, "Succeed"); + }, + }); + }, +}); diff --git a/test/moonwall/suites/dev/stagenet/precompile/test-precompile-bn128mul.ts b/test/moonwall/suites/dev/stagenet/precompile/test-precompile-bn128mul.ts new file mode 100644 index 00000000..ffd0144b --- /dev/null +++ b/test/moonwall/suites/dev/stagenet/precompile/test-precompile-bn128mul.ts @@ -0,0 +1,39 @@ +/** + * BN128 multiplication precompile tests + * Adapted from Moonbeam test suite + */ + +import { deployCreateCompiledContract, describeSuite } from "@moonwall/cli"; +import { createViemTransaction } from "@moonwall/util"; +import { encodeFunctionData } from "viem"; +import { expectEVMResult } from "../../../../helpers"; + +describeSuite({ + id: "D030103", + title: "Precompiles - bn128mul", + foundationMethods: "dev", + testCases: ({ context, it, log }) => { + it({ + id: "T01", + title: "should be accessible from a smart contract", + test: async function () { + const { abi, contractAddress } = await deployCreateCompiledContract( + context, + "HasherChecker" + ); + + const { result } = await context.createBlock( + createViemTransaction(context, { + to: contractAddress, + data: encodeFunctionData({ + abi, + functionName: "bn128MultiplyCheck", + }), + }) + ); + + expectEVMResult(result!.events, "Succeed"); + }, + }); + }, +}); diff --git a/test/moonwall/suites/dev/stagenet/precompile/test-precompile-bn128pairing.ts b/test/moonwall/suites/dev/stagenet/precompile/test-precompile-bn128pairing.ts new file mode 100644 index 00000000..dd65daad --- /dev/null +++ b/test/moonwall/suites/dev/stagenet/precompile/test-precompile-bn128pairing.ts @@ -0,0 +1,39 @@ +/** + * BN128 pairing precompile tests + * Adapted from Moonbeam test suite + */ + +import { deployCreateCompiledContract, describeSuite } from "@moonwall/cli"; +import { createViemTransaction } from "@moonwall/util"; +import { encodeFunctionData } from "viem"; +import { expectEVMResult } from "../../../../helpers"; + +describeSuite({ + id: "D030104", + title: "Precompiles - bn128pairing", + foundationMethods: "dev", + testCases: ({ context, it, log }) => { + it({ + id: "T01", + title: "should be accessible from a smart contract", + test: async function () { + const { abi, contractAddress } = await deployCreateCompiledContract( + context, + "HasherChecker" + ); + + const { result } = await context.createBlock( + createViemTransaction(context, { + to: contractAddress, + data: encodeFunctionData({ + abi, + functionName: "bn128PairingCheck", + }), + }) + ); + + expectEVMResult(result!.events, "Succeed"); + }, + }); + }, +}); diff --git a/test/moonwall/suites/dev/stagenet/precompile/test-precompile-ecrecover.ts b/test/moonwall/suites/dev/stagenet/precompile/test-precompile-ecrecover.ts new file mode 100644 index 00000000..5a7ef7c4 --- /dev/null +++ b/test/moonwall/suites/dev/stagenet/precompile/test-precompile-ecrecover.ts @@ -0,0 +1,81 @@ +/** + * Ecrecover precompile tests + * Adapted from Moonbeam test suite + */ + +import { beforeAll, describeSuite, expect } from "@moonwall/cli"; +import { ALITH_ADDRESS, ALITH_PRIVATE_KEY } from "@moonwall/util"; + +describeSuite({ + id: "D030107", + title: "Precompiles - ecrecover", + foundationMethods: "dev", + testCases: ({ context, log, it }) => { + let contractAddress: `0x${string}`; + + beforeAll(async function () { + const { contractAddress: deployedAddr } = await context.deployContract!("RecoveryChecker"); + contractAddress = deployedAddr; + }); + + it({ + id: "T01", + title: "returns a matching address", + test: async function () { + const msg = context.web3().utils.sha3("Hello World!"); + const sig = context.web3().eth.accounts.sign(msg!, ALITH_PRIVATE_KEY); + + const address = await context.readContract!({ + contractAddress, + contractName: "RecoveryChecker", + functionName: "checkRecovery", + args: [sig.messageHash, sig.v, sig.r, sig.s], + }); + + expect(address, "Recovered address doesn't match signer!").to.equals(ALITH_ADDRESS); + }, + }); + + it({ + id: "T02", + title: "returns different address on modified message", + test: async function () { + const msg = context.web3().utils.sha3("Hello World!"); + const sig = context.web3().eth.accounts.sign(msg!, ALITH_PRIVATE_KEY); + + const address = await context.readContract!({ + contractAddress, + contractName: "RecoveryChecker", + functionName: "checkRecovery", + args: [sig.messageHash.replace("1", "f"), sig.v, sig.r, sig.s], + }); + + expect(address, "Recovered address doesn't match signer!").to.equals( + "0x58188b9AE77F7C865b04B12F5D29bF4fbDcbd937" + ); + }, + }); + + it({ + id: "T03", + title: "returns empty on invalid V", + test: async function () { + const msg = context.web3().utils.sha3("Hello World!"); + const sig = context.web3().eth.accounts.sign(msg!, ALITH_PRIVATE_KEY); + const v = "0x565656ff5656ffffffffffff3d3d02000000000040003dffff565656560f0000"; + + await expect( + async () => + await context.readContract!({ + contractAddress, + contractName: "RecoveryChecker", + functionName: "checkRecovery", + args: [sig.messageHash, v, sig.r, sig.s], + web3Library: "ethers", + gas: 1_000_000n, + }) + ).rejects.toThrowError("revert"); + }, + }); + }, +}); diff --git a/test/moonwall/suites/dev/stagenet/precompile/test-precompile-erc20-overflow.ts b/test/moonwall/suites/dev/stagenet/precompile/test-precompile-erc20-overflow.ts new file mode 100644 index 00000000..0409f157 --- /dev/null +++ b/test/moonwall/suites/dev/stagenet/precompile/test-precompile-erc20-overflow.ts @@ -0,0 +1,31 @@ +import "@moonbeam-network/api-augment"; +import { describeSuite, expect } from "@moonwall/cli"; +import { generateKeyringPair } from "@moonwall/util"; + +describeSuite({ + id: "D030402", + title: "Precompile ERC20 - Transfering through precompile", + foundationMethods: "dev", + testCases: ({ context, it, log }) => { + const randomAccount = generateKeyringPair(); + it({ + id: "T01", + title: "should not allow overflowing the value", + test: async function () { + await expect( + async () => + await context.writePrecompile!({ + precompileName: "Batch", + functionName: "batchAll", + args: [ + [randomAccount.address], + [`${(2n ** 128n + 5_000_000_000_000_000_000n).toString()}`], + [], + [], + ], + }) + ).rejects.toThrowError("evm error: OutOfFund"); + }, + }); + }, +}); diff --git a/test/moonwall/suites/dev/stagenet/precompile/test-precompile-erc20.ts b/test/moonwall/suites/dev/stagenet/precompile/test-precompile-erc20.ts new file mode 100644 index 00000000..0d9a132d --- /dev/null +++ b/test/moonwall/suites/dev/stagenet/precompile/test-precompile-erc20.ts @@ -0,0 +1,291 @@ +import "@moonbeam-network/api-augment"; +import { beforeEach, describeSuite, expect } from "@moonwall/cli"; +import { + ALITH_ADDRESS, + BALTATHAR_ADDRESS, + BALTATHAR_PRIVATE_KEY, + CHARLETH_ADDRESS, + PRECOMPILE_NATIVE_ERC20_ADDRESS, + baltathar, +} from "@moonwall/util"; +import { type PrivateKeyAccount, keccak256, pad, parseEther, toBytes, toHex } from "viem"; +import { generatePrivateKey, privateKeyToAccount } from "viem/accounts"; +import { ALITH_GENESIS_TRANSFERABLE_BALANCE } from "../../../../helpers"; + +// const SELECTORS = { +// balanceOf: "70a08231", +// totalSupply: "18160ddd", +// approve: "095ea7b3", +// allowance: "dd62ed3e", +// transfer: "a9059cbb", +// transferFrom: "23b872dd", +// deposit: "d0e30db0", +// logApprove: "0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925", +// logTransfer: "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", +// }; + +// Error(string) +const ABI_REVERT_SELECTOR = "0x08c379a0"; + +describeSuite({ + id: "D030401", + title: "Precompiles - ERC20 Native", + foundationMethods: "dev", + testCases: ({ context, it, log }) => { + let randomAccount: PrivateKeyAccount; + + beforeEach(async () => { + randomAccount = privateKeyToAccount(generatePrivateKey()); + }); + + it({ + id: "T01", + title: "allows to call getBalance", + test: async function () { + const balance = await context.readPrecompile!({ + precompileName: "NativeErc20", + functionName: "balanceOf", + args: [ALITH_ADDRESS], + }); + + const signedTx = context + .polkadotJs() + .tx.balances.transferAllowDeath(CHARLETH_ADDRESS, 1000) + .signAsync(baltathar); + await context.createBlock(signedTx); + + const tx = context.polkadotJs().tx.balances.transferAllowDeath(CHARLETH_ADDRESS, 1000); + await context.createBlock(tx, { + signer: { privateKey: BALTATHAR_PRIVATE_KEY, type: "ethereum" }, + }); + + expect(balance).equals(ALITH_GENESIS_TRANSFERABLE_BALANCE); + }, + }); + + it({ + id: "T02", + title: "allows to call totalSupply", + test: async function () { + const totalSupply = await context.readPrecompile!({ + precompileName: "NativeErc20", + functionName: "totalSupply", + }); + + const totalIssuance = ( + await context.polkadotJs().query.balances.totalIssuance() + ).toBigInt(); + expect(totalSupply).toBe(totalIssuance); + }, + }); + + it({ + id: "T03", + title: "allows to approve transfers, and allowance matches", + test: async function () { + const allowanceBefore = (await context.readPrecompile!({ + precompileName: "NativeErc20", + functionName: "allowance", + args: [ALITH_ADDRESS, BALTATHAR_ADDRESS], + })) as bigint; + const amount = parseEther("10"); + + const rawTx = await context.writePrecompile!({ + precompileName: "NativeErc20", + functionName: "approve", + args: [BALTATHAR_ADDRESS, amount], + rawTxOnly: true, + }); + const { result } = await context.createBlock(rawTx); + + const allowanceAfter = (await context.readPrecompile!({ + precompileName: "NativeErc20", + functionName: "allowance", + args: [ALITH_ADDRESS, BALTATHAR_ADDRESS], + })) as bigint; + + expect(allowanceAfter - allowanceBefore).equals(BigInt(amount)); + + const { status, logs } = await context + .viem() + .getTransactionReceipt({ hash: result?.hash as `0x${string}` }); + + expect(status).to.equal("success"); + expect(logs.length).to.eq(1); + expect(logs[0].topics[0]).toBe(keccak256(toBytes("Approval(address,address,uint256)"))); + expect(logs[0].topics[1]?.toLowerCase()).toBe( + pad(ALITH_ADDRESS.toLowerCase() as `0x${string}`) + ); + expect(logs[0].topics[2]?.toLowerCase()).toBe( + pad(BALTATHAR_ADDRESS.toLowerCase() as `0x${string}`) + ); + }, + }); + + it({ + id: "T04", + title: "allows to call transfer", + test: async function () { + expect( + await context.readPrecompile!({ + precompileName: "NativeErc20", + functionName: "balanceOf", + args: [randomAccount.address], + }) + ).equals(0n); + + const balanceBefore = await context.viem().getBalance({ address: BALTATHAR_ADDRESS }); + + const rawTx = await context.writePrecompile!({ + precompileName: "NativeErc20", + functionName: "transfer", + args: [randomAccount.address, parseEther("3")], + privateKey: BALTATHAR_PRIVATE_KEY, + rawTxOnly: true, + }); + const { result } = await context.createBlock(rawTx); + const { status, gasUsed } = await context + .viem() + .getTransactionReceipt({ hash: result?.hash as `0x${string}` }); + expect(status).to.equal("success"); + + const balanceAfter = await context.viem().getBalance({ address: BALTATHAR_ADDRESS }); + const block = await context.viem().getBlock(); + const fees = gasUsed * block.baseFeePerGas!; + expect(balanceAfter).toBeLessThanOrEqual(balanceBefore - parseEther("3") - fees); + expect(await context.viem().getBalance({ address: randomAccount.address })).to.equal( + parseEther("3") + ); + }, + }); + + it({ + id: "T05", + title: "allows to approve transfer and use transferFrom", + test: async function () { + const allowedAmount = parseEther("10"); + const transferAmount = parseEther("5"); + + await context.writePrecompile!({ + precompileName: "NativeErc20", + functionName: "approve", + args: [BALTATHAR_ADDRESS, allowedAmount], + }); + await context.createBlock(); + + const fromBalBefore = ( + await context.polkadotJs().query.system.account(ALITH_ADDRESS) + ).data.free.toBigInt(); + const toBalBefore = await context.viem().getBalance({ address: CHARLETH_ADDRESS }); + + const rawTx = await context.writePrecompile!({ + precompileName: "NativeErc20", + functionName: "transferFrom", + args: [ALITH_ADDRESS, CHARLETH_ADDRESS, transferAmount], + privateKey: BALTATHAR_PRIVATE_KEY, + rawTxOnly: true, + }); + + const { result } = await context.createBlock(rawTx); + const { logs, status } = await context + .viem() + .getTransactionReceipt({ hash: result?.hash as `0x${string}` }); + + const fromBalAfter = ( + await context.polkadotJs().query.system.account(ALITH_ADDRESS) + ).data.free.toBigInt(); + + const toBalAfter = await context.viem().getBalance({ address: CHARLETH_ADDRESS }); + expect(logs.length).to.eq(1); + expect(logs[0].address).to.eq(PRECOMPILE_NATIVE_ERC20_ADDRESS); + expect(logs[0].data).to.eq(pad(toHex(transferAmount))); + expect(logs[0].topics.length).to.eq(3); + expect(logs[0].topics[0]).toBe(keccak256(toBytes("Transfer(address,address,uint256)"))); + expect(logs[0].topics[1]?.toLowerCase()).toBe( + pad(ALITH_ADDRESS.toLowerCase() as `0x${string}`) + ); + expect(logs[0].topics[2]?.toLowerCase()).toBe( + pad(CHARLETH_ADDRESS.toLowerCase() as `0x${string}`) + ); + expect(status).to.equal("success"); + expect(toBalAfter).toBe(toBalBefore + transferAmount); + expect(fromBalAfter).toBe(fromBalBefore - transferAmount); + const newAllowedAmount = allowedAmount - transferAmount; + expect( + await context.readPrecompile!({ + precompileName: "NativeErc20", + functionName: "allowance", + args: [ALITH_ADDRESS, BALTATHAR_ADDRESS], + }) + ).toBe(newAllowedAmount); + }, + }); + + it({ + id: "T06", + title: "refuses to transferFrom more than allowed", + test: async function () { + const allowedAmount = parseEther("10"); + const transferAmount = parseEther("15"); + + await context.writePrecompile!({ + precompileName: "NativeErc20", + functionName: "approve", + args: [BALTATHAR_ADDRESS, allowedAmount], + }); + await context.createBlock(); + + const fromBalBefore = ( + await context.polkadotJs().query.system.account(ALITH_ADDRESS) + ).data.free.toBigInt(); + const toBalBefore = await context.viem().getBalance({ address: CHARLETH_ADDRESS }); + + const rawTxn = await context.writePrecompile!({ + precompileName: "NativeErc20", + functionName: "transferFrom", + args: [ALITH_ADDRESS, CHARLETH_ADDRESS, transferAmount], + privateKey: BALTATHAR_PRIVATE_KEY, + rawTxOnly: true, + gas: 200_000n, + web3Library: "ethers", + }); + + const { result } = await context.createBlock(rawTxn); + expect(result?.successful).toBe(false); + + const fromBalAfter = ( + await context.polkadotJs().query.system.account(ALITH_ADDRESS) + ).data.free.toBigInt(); + + const toBalAfter = await context.viem().getBalance({ address: CHARLETH_ADDRESS }); + expect(toBalAfter).toBe(toBalBefore); + expect(fromBalAfter).toBe(fromBalBefore); + expect( + await context.readPrecompile!({ + precompileName: "NativeErc20", + functionName: "allowance", + args: [ALITH_ADDRESS, BALTATHAR_ADDRESS], + }) + ).toBe(allowedAmount); + }, + }); + }, +}); + +// describeDevMoonbeamAllEthTxTypes("Precompiles - ERC20 Native", (context) => { +// it("revert message is abi-encoded as a String(error) call", async function () { +// const request = await web3EthCall(context.web3, { +// to: PRECOMPILE_NATIVE_ERC20_ADDRESS, +// data: `0x${SELECTORS.deposit}`, +// }); +// expect(request as any).to.haveOwnProperty("error"); +// // Data +// let data = (request as any).error.data; +// expect(data.length).to.be.eq(266); +// expect(data.slice(0, 10)).to.be.eq(ABI_REVERT_SELECTOR); +// // Message +// expect((request as any).error.message).to.be.eq( +// "VM Exception while processing transaction: revert deposited amount must be non-zero" +// ); +// }); +// }); diff --git a/test/moonwall/suites/dev/stagenet/precompile/test-precompile-identity.ts b/test/moonwall/suites/dev/stagenet/precompile/test-precompile-identity.ts new file mode 100644 index 00000000..d5921eae --- /dev/null +++ b/test/moonwall/suites/dev/stagenet/precompile/test-precompile-identity.ts @@ -0,0 +1,116 @@ +/** + * Identity precompile tests - retrieve registrars and identity + * Adapted from Moonbeam test suite + */ + +import { beforeAll, describeSuite, expect } from "@moonwall/cli"; +import { alith, baltathar } from "@moonwall/util"; +import { toHex } from "viem"; +import { PRECOMPILE_IDENTITY_ADDRESS } from "../../../../helpers"; + +describeSuite({ + id: "D030301", + title: "Precompiles - Identity precompile", + foundationMethods: "dev", + testCases: ({ it, log, context }) => { + beforeAll(async function () { + await context.createBlock( + context + .polkadotJs() + .tx.sudo.sudo(context.polkadotJs().tx.identity.addRegistrar(alith.address)) + ); + + await context.createBlock(context.polkadotJs().tx.identity.setFee(0, 100)); + await context.createBlock( + // With 0b111 we are indicating the pallet to use "Display", "Legal" and "Web" fields. + context + .polkadotJs() + .tx.identity.setFields(0, 0b111 as any) + ); + + await context.createBlock( + context + .polkadotJs() + .tx.identity.setIdentity({ + additional: [[{ raw: "discord" }, { raw: "my-discord" }]], + display: { raw: "display" }, + legal: { raw: "legal" }, + web: { raw: "web" }, + riot: { raw: "riot" }, + email: { raw: "email" }, + pgpFingerprint: new Array(20).fill(1), + image: { raw: "image" }, + twitter: { raw: "twitter" }, + }) + .signAsync(baltathar) + ); + }); + + it({ + id: "T01", + title: "should retrieve registrars", + test: async function () { + const registrars = (await context.readContract!({ + contractAddress: PRECOMPILE_IDENTITY_ADDRESS, + contractName: "Identity", + functionName: "registrars", + args: [], + })) as any; + + expect(registrars.length).to.equal(1); + expect(registrars[0].isValid).to.be.true; + expect(registrars[0].index).to.equal(0); + expect(registrars[0].account).to.equal(alith.address); + expect(registrars[0].fee).to.equal(100n); + expect(registrars[0].fields.display).to.be.true; + expect(registrars[0].fields.web).to.be.true; + expect(registrars[0].fields.legal).to.be.true; + expect(registrars[0].fields.riot).to.be.false; + expect(registrars[0].fields.email).to.be.false; + expect(registrars[0].fields.pgpFingerprint).to.be.false; + expect(registrars[0].fields.image).to.be.false; + expect(registrars[0].fields.twitter).to.be.false; + }, + }); + + it({ + id: "T02", + title: "should retrieve identity", + test: async function () { + const identity = (await context.readContract!({ + contractAddress: PRECOMPILE_IDENTITY_ADDRESS, + contractName: "Identity", + functionName: "identity", + args: [baltathar.address], + })) as any; + + expect(identity.isValid).to.be.true; + expect(identity.judgements).to.be.empty; + expect(identity.deposit).to.equal(1034200000000000000n); + expect(identity.info.additional.length).to.equal(1); + expect(identity.info.additional[0].key.hasData).to.be.true; + expect(identity.info.additional[0].key.value).to.equal(toHex("discord")); + expect(identity.info.additional[0].value.hasData).to.be.true; + expect(identity.info.additional[0].value.value).to.equal(toHex("my-discord")); + expect(identity.info.display.hasData).to.be.true; + expect(identity.info.display.value).to.equal(toHex("display")); + expect(identity.info.legal.hasData).to.be.true; + expect(identity.info.legal.value).to.equal(toHex("legal")); + expect(identity.info.web.hasData).to.be.true; + expect(identity.info.web.value).to.equal(toHex("web")); + expect(identity.info.riot.hasData).to.be.true; + expect(identity.info.riot.value).to.equal(toHex("riot")); + expect(identity.info.email.hasData).to.be.true; + expect(identity.info.email.value).to.equal(toHex("email")); + expect(identity.info.hasPgpFingerprint).to.be.true; + expect(identity.info.pgpFingerprint).to.equal( + toHex(Uint8Array.from(new Array(20).fill(1))) + ); + expect(identity.info.image.hasData).to.be.true; + expect(identity.info.image.value).to.equal(toHex("image")); + expect(identity.info.twitter.hasData).to.be.true; + expect(identity.info.twitter.value).to.equal(toHex("twitter")); + }, + }); + }, +}); diff --git a/test/moonwall/suites/dev/stagenet/precompile/test-precompile-identity10.ts b/test/moonwall/suites/dev/stagenet/precompile/test-precompile-identity10.ts new file mode 100644 index 00000000..d58b871b --- /dev/null +++ b/test/moonwall/suites/dev/stagenet/precompile/test-precompile-identity10.ts @@ -0,0 +1,61 @@ +/** + * Identity precompile tests - set account id + * Adapted from Moonbeam test suite + */ + +import { beforeAll, describeSuite, expect } from "@moonwall/cli"; +import { alith, charleth } from "@moonwall/util"; +import { expectEVMResult, PRECOMPILE_IDENTITY_ADDRESS } from "../../../../helpers"; + +describeSuite({ + id: "D030310", + title: "Precompiles - Identity precompile - set account id", + foundationMethods: "dev", + testCases: ({ it, log, context }) => { + beforeAll(async function () { + await context.createBlock( + context + .polkadotJs() + .tx.sudo.sudo(context.polkadotJs().tx.identity.addRegistrar(alith.address)) + ); + + const block = await context.createBlock( + await context.writeContract!({ + contractName: "Identity", + contractAddress: PRECOMPILE_IDENTITY_ADDRESS, + functionName: "setAccountId", + rawTxOnly: true, + args: [0, charleth.address], + }) + ); + + expectEVMResult(block.result!.events, "Succeed"); + }); + + it({ + id: "T01", + title: "should retrieve the registrar", + test: async function () { + const registrars = (await context.readContract!({ + contractAddress: PRECOMPILE_IDENTITY_ADDRESS, + contractName: "Identity", + functionName: "registrars", + })) as any; + + expect(registrars.length).to.equal(1); + expect(registrars[0].isValid).to.be.true; + expect(registrars[0].index).to.equal(0); + expect(registrars[0].account).to.equal(charleth.address); + expect(registrars[0].fee).to.equal(0n); + expect(registrars[0].fields.display).to.be.false; + expect(registrars[0].fields.web).to.be.false; + expect(registrars[0].fields.legal).to.be.false; + expect(registrars[0].fields.riot).to.be.false; + expect(registrars[0].fields.email).to.be.false; + expect(registrars[0].fields.pgpFingerprint).to.be.false; + expect(registrars[0].fields.image).to.be.false; + expect(registrars[0].fields.twitter).to.be.false; + }, + }); + }, +}); diff --git a/test/moonwall/suites/dev/stagenet/precompile/test-precompile-identity11.ts b/test/moonwall/suites/dev/stagenet/precompile/test-precompile-identity11.ts new file mode 100644 index 00000000..d8d2d726 --- /dev/null +++ b/test/moonwall/suites/dev/stagenet/precompile/test-precompile-identity11.ts @@ -0,0 +1,95 @@ +/** + * Identity precompile tests - add sub + * Adapted from Moonbeam test suite + */ + +import { beforeAll, describeSuite, expect, fetchCompiledContract } from "@moonwall/cli"; +import { BALTATHAR_PRIVATE_KEY, baltathar, charleth } from "@moonwall/util"; +import { decodeEventLog, toHex } from "viem"; +import { + PRECOMPILE_IDENTITY_ADDRESS, + expectEVMResult, + expectSubstrateEvent, +} from "../../../../helpers"; + +describeSuite({ + id: "D030311", + title: "Precompiles - Identity precompile - add sub", + foundationMethods: "dev", + testCases: ({ it, log, context }) => { + beforeAll(async function () { + await context.createBlock( + context + .polkadotJs() + .tx.identity.setIdentity({ + display: { raw: "display" }, + }) + .signAsync(baltathar) + ); + + const block = await context.createBlock( + await context.writeContract!({ + contractName: "Identity", + contractAddress: PRECOMPILE_IDENTITY_ADDRESS, + functionName: "addSub", + privateKey: BALTATHAR_PRIVATE_KEY, + rawTxOnly: true, + args: [ + charleth.address, + { + hasData: true, + value: toHex("test"), + }, + ], + }) + ); + + expectEVMResult(block.result!.events, "Succeed"); + const { data } = expectSubstrateEvent(block, "evm", "Log"); + const evmLog = decodeEventLog({ + abi: fetchCompiledContract("Identity").abi, + topics: data[0].topics.map((t) => t.toHex()) as any, + data: data[0].data.toHex(), + }) as any; + + expect(evmLog.eventName).to.equal("SubIdentityAdded"); + expect(evmLog.args.sub).to.equal(charleth.address); + expect(evmLog.args.main).to.equal(baltathar.address); + }); + + it({ + id: "T01", + title: "should retrieve subs", + test: async function () { + const subs = (await context.readContract!({ + contractAddress: PRECOMPILE_IDENTITY_ADDRESS, + contractName: "Identity", + functionName: "subsOf", + args: [baltathar.address], + })) as any; + + expect(subs.deposit).to.equal(1005300000000000000n); + expect(subs.accounts).to.have.length(1); + expect(subs.accounts[0]).to.be.equal(charleth.address); + }, + }); + + it({ + id: "T02", + title: "should retrieve super", + test: async function () { + const superOf = (await context.readContract!({ + contractAddress: PRECOMPILE_IDENTITY_ADDRESS, + contractName: "Identity", + functionName: "superOf", + args: [charleth.address], + })) as any; + + expect(superOf.isValid).to.be.true; + expect(superOf.account).to.be.equal(baltathar.address); + expect(superOf.data.hasData).to.be.true; + expect(superOf.data.value).to.be.equal(toHex("test")); + }, + }); + }, +}); diff --git a/test/moonwall/suites/dev/stagenet/precompile/test-precompile-identity12.ts b/test/moonwall/suites/dev/stagenet/precompile/test-precompile-identity12.ts new file mode 100644 index 00000000..f656e399 --- /dev/null +++ b/test/moonwall/suites/dev/stagenet/precompile/test-precompile-identity12.ts @@ -0,0 +1,87 @@ +/** + * Identity precompile tests - rename sub + * Adapted from Moonbeam test suite + */ + +import { beforeAll, describeSuite, expect } from "@moonwall/cli"; +import { BALTATHAR_PRIVATE_KEY, baltathar, charleth } from "@moonwall/util"; +import { toHex } from "viem"; +import { PRECOMPILE_IDENTITY_ADDRESS, expectEVMResult } from "../../../../helpers"; + +describeSuite({ + id: "D030312", + title: "Precompiles - Identity precompile - rename sub", + foundationMethods: "dev", + testCases: ({ it, log, context }) => { + beforeAll(async function () { + await context.createBlock( + context + .polkadotJs() + .tx.identity.setIdentity({ + display: { raw: "display" }, + }) + .signAsync(baltathar) + ); + await context.createBlock( + context + .polkadotJs() + .tx.identity.addSub(charleth.address, { Raw: "test" }) + .signAsync(baltathar) + ); + + const block = await context.createBlock( + await context.writeContract!({ + contractName: "Identity", + contractAddress: PRECOMPILE_IDENTITY_ADDRESS, + functionName: "renameSub", + privateKey: BALTATHAR_PRIVATE_KEY, + rawTxOnly: true, + args: [ + charleth.address, + { + hasData: true, + value: toHex("foobar"), + }, + ], + }) + ); + + expectEVMResult(block.result!.events, "Succeed"); + }); + + it({ + id: "T01", + title: "should retrieve subs", + test: async function () { + const subs = (await context.readContract!({ + contractAddress: PRECOMPILE_IDENTITY_ADDRESS, + contractName: "Identity", + functionName: "subsOf", + args: [baltathar.address], + })) as any; + + expect(subs.deposit).to.equal(1005300000000000000n); + expect(subs.accounts).to.have.length(1); + expect(subs.accounts[0]).to.be.equal(charleth.address); + }, + }); + + it({ + id: "T02", + title: "should retrieve super", + test: async function () { + const superOf = (await context.readContract!({ + contractAddress: PRECOMPILE_IDENTITY_ADDRESS, + contractName: "Identity", + functionName: "superOf", + args: [charleth.address], + })) as any; + + expect(superOf.isValid).to.be.true; + expect(superOf.account).to.be.equal(baltathar.address); + expect(superOf.data.hasData).to.be.true; + expect(superOf.data.value).to.be.equal(toHex("foobar")); + }, + }); + }, +}); diff --git a/test/moonwall/suites/dev/stagenet/precompile/test-precompile-identity13.ts b/test/moonwall/suites/dev/stagenet/precompile/test-precompile-identity13.ts new file mode 100644 index 00000000..bf140c82 --- /dev/null +++ b/test/moonwall/suites/dev/stagenet/precompile/test-precompile-identity13.ts @@ -0,0 +1,76 @@ +/** + * Identity precompile tests - remove sub + * Adapted from Moonbeam test suite + */ + +import { beforeAll, describeSuite, expect, fetchCompiledContract } from "@moonwall/cli"; +import { BALTATHAR_PRIVATE_KEY, baltathar, charleth } from "@moonwall/util"; +import { decodeEventLog } from "viem"; +import { + PRECOMPILE_IDENTITY_ADDRESS, + expectEVMResult, + expectSubstrateEvent, +} from "../../../../helpers"; + +describeSuite({ + id: "D030313", + title: "Precompiles - Identity precompile - remove sub", + foundationMethods: "dev", + testCases: ({ it, log, context }) => { + beforeAll(async function () { + await context.createBlock( + context + .polkadotJs() + .tx.identity.setIdentity({ + display: { raw: "display" }, + }) + .signAsync(baltathar) + ); + await context.createBlock( + context + .polkadotJs() + .tx.identity.addSub(charleth.address, { Raw: "test" }) + .signAsync(baltathar) + ); + + const block = await context.createBlock( + await context.writeContract!({ + contractName: "Identity", + contractAddress: PRECOMPILE_IDENTITY_ADDRESS, + functionName: "removeSub", + privateKey: BALTATHAR_PRIVATE_KEY, + rawTxOnly: true, + args: [charleth.address], + }) + ); + + expectEVMResult(block.result!.events, "Succeed"); + const { data } = expectSubstrateEvent(block, "evm", "Log"); + const evmLog = decodeEventLog({ + abi: fetchCompiledContract("Identity").abi, + topics: data[0].topics.map((t) => t.toHex()) as any, + data: data[0].data.toHex(), + }) as any; + + expect(evmLog.eventName).to.equal("SubIdentityRemoved"); + expect(evmLog.args.sub).to.equal(charleth.address); + expect(evmLog.args.main).to.equal(baltathar.address); + }); + + it({ + id: "T01", + title: "should have no subs", + test: async function () { + const subs = (await context.readContract!({ + contractAddress: PRECOMPILE_IDENTITY_ADDRESS, + contractName: "Identity", + functionName: "subsOf", + args: [baltathar.address], + })) as any; + + expect(subs.deposit).to.be.equal(0n); + expect(subs.accounts).to.be.empty; + }, + }); + }, +}); diff --git a/test/moonwall/suites/dev/stagenet/precompile/test-precompile-identity14.ts b/test/moonwall/suites/dev/stagenet/precompile/test-precompile-identity14.ts new file mode 100644 index 00000000..d2569605 --- /dev/null +++ b/test/moonwall/suites/dev/stagenet/precompile/test-precompile-identity14.ts @@ -0,0 +1,73 @@ +/** + * Identity precompile tests - quit sub + * Adapted from Moonbeam test suite + */ + +import { beforeAll, describeSuite, expect, fetchCompiledContract } from "@moonwall/cli"; +import { CHARLETH_PRIVATE_KEY, baltathar, charleth } from "@moonwall/util"; +import { decodeEventLog } from "viem"; +import { + PRECOMPILE_IDENTITY_ADDRESS, + expectEVMResult, + expectSubstrateEvent, +} from "../../../../helpers"; + +describeSuite({ + id: "D030314", + title: "Precompiles - Identity precompile - quit sub", + foundationMethods: "dev", + testCases: ({ it, log, context }) => { + beforeAll(async function () { + await context.createBlock( + context + .polkadotJs() + .tx.identity.setIdentity({ + display: { raw: "display" }, + }) + .signAsync(baltathar) + ); + await context.createBlock( + context + .polkadotJs() + .tx.identity.addSub(charleth.address, { Raw: "test" }) + .signAsync(baltathar) + ); + + const block = await context.createBlock( + await context.writeContract!({ + contractName: "Identity", + contractAddress: PRECOMPILE_IDENTITY_ADDRESS, + functionName: "quitSub", + privateKey: CHARLETH_PRIVATE_KEY, + rawTxOnly: true, + }) + ); + + expectEVMResult(block.result!.events, "Succeed"); + const { data } = expectSubstrateEvent(block, "evm", "Log"); + const evmLog = decodeEventLog({ + abi: fetchCompiledContract("Identity").abi, + topics: data[0].topics.map((t) => t.toHex()) as any, + data: data[0].data.toHex(), + }) as any; + + expect(evmLog.eventName).to.equal("SubIdentityRevoked"); + expect(evmLog.args.sub).to.equal(charleth.address); + }); + + it({ + id: "T01", + title: "should have no super", + test: async function () { + const superOf = (await context.readContract!({ + contractAddress: PRECOMPILE_IDENTITY_ADDRESS, + contractName: "Identity", + functionName: "superOf", + args: [charleth.address], + })) as any; + + expect(superOf.isValid).to.be.false; + }, + }); + }, +}); diff --git a/test/moonwall/suites/dev/stagenet/precompile/test-precompile-identity2.ts b/test/moonwall/suites/dev/stagenet/precompile/test-precompile-identity2.ts new file mode 100644 index 00000000..97c2a795 --- /dev/null +++ b/test/moonwall/suites/dev/stagenet/precompile/test-precompile-identity2.ts @@ -0,0 +1,102 @@ +/** + * Identity precompile tests - set identity + * Adapted from Moonbeam test suite + */ + +import { beforeAll, describeSuite, expect, fetchCompiledContract } from "@moonwall/cli"; +import { BALTATHAR_PRIVATE_KEY, baltathar } from "@moonwall/util"; +import { decodeEventLog, toHex } from "viem"; +import { + PRECOMPILE_IDENTITY_ADDRESS, + expectEVMResult, + expectSubstrateEvent, +} from "../../../../helpers"; + +describeSuite({ + id: "D030302", + title: "Precompiles - Identity precompile - set identity", + foundationMethods: "dev", + testCases: ({ it, log, context }) => { + beforeAll(async function () { + const block = await context.createBlock( + await context.writeContract!({ + contractName: "Identity", + contractAddress: PRECOMPILE_IDENTITY_ADDRESS, + functionName: "setIdentity", + privateKey: BALTATHAR_PRIVATE_KEY, + rawTxOnly: true, + args: [ + { + additional: [ + { + key: { hasData: true, value: toHex("discord") }, + value: { hasData: true, value: toHex("my-discord") }, + }, + ], + display: { hasData: true, value: toHex("display") }, + legal: { hasData: true, value: toHex("legal") }, + web: { hasData: true, value: toHex("web") }, + riot: { hasData: true, value: toHex("riot") }, + email: { hasData: true, value: toHex("email") }, + hasPgpFingerprint: true, + pgpFingerprint: toHex(Uint8Array.from(new Array(20).fill(1))), + image: { hasData: true, value: toHex("image") }, + twitter: { hasData: true, value: toHex("twitter") }, + }, + ], + }) + ); + + expectEVMResult(block.result!.events, "Succeed"); + const { data } = expectSubstrateEvent(block, "evm", "Log"); + const evmLog = decodeEventLog({ + abi: fetchCompiledContract("Identity").abi, + topics: data[0].topics.map((t) => t.toHex()) as any, + data: data[0].data.toHex(), + }) as any; + + expect(evmLog.eventName).to.equal("IdentitySet"); + expect(evmLog.args.who).to.equal(baltathar.address); + }); + + it({ + id: "T01", + title: "should retrieve newly set identity", + test: async function () { + const identity = (await context.readContract!({ + contractAddress: PRECOMPILE_IDENTITY_ADDRESS, + contractName: "Identity", + functionName: "identity", + args: [baltathar.address], + })) as any; + + expect(identity.isValid).to.be.true; + expect(identity.judgements).to.be.empty; + expect(identity.deposit).to.equal(1034200000000000000n); + expect(identity.info.additional.length).to.equal(1); + expect(identity.info.additional[0].key.hasData).to.be.true; + expect(identity.info.additional[0].key.value).to.equal(toHex("discord")); + expect(identity.info.additional[0].value.hasData).to.be.true; + expect(identity.info.additional[0].value.value).to.equal(toHex("my-discord")); + expect(identity.info.display.hasData).to.be.true; + expect(identity.info.display.value).to.equal(toHex("display")); + expect(identity.info.legal.hasData).to.be.true; + expect(identity.info.legal.value).to.equal(toHex("legal")); + expect(identity.info.web.hasData).to.be.true; + expect(identity.info.web.value).to.equal(toHex("web")); + expect(identity.info.riot.hasData).to.be.true; + expect(identity.info.riot.value).to.equal(toHex("riot")); + expect(identity.info.email.hasData).to.be.true; + expect(identity.info.email.value).to.equal(toHex("email")); + expect(identity.info.hasPgpFingerprint).to.be.true; + expect(identity.info.pgpFingerprint).to.equal( + toHex(Uint8Array.from(new Array(20).fill(1))) + ); + expect(identity.info.image.hasData).to.be.true; + expect(identity.info.image.value).to.equal(toHex("image")); + expect(identity.info.twitter.hasData).to.be.true; + expect(identity.info.twitter.value).to.equal(toHex("twitter")); + }, + }); + }, +}); diff --git a/test/moonwall/suites/dev/stagenet/precompile/test-precompile-identity3.ts b/test/moonwall/suites/dev/stagenet/precompile/test-precompile-identity3.ts new file mode 100644 index 00000000..7702797f --- /dev/null +++ b/test/moonwall/suites/dev/stagenet/precompile/test-precompile-identity3.ts @@ -0,0 +1,67 @@ +/** + * Identity precompile tests - clear identity + * Adapted from Moonbeam test suite + */ + +import { beforeAll, describeSuite, expect, fetchCompiledContract } from "@moonwall/cli"; +import { BALTATHAR_PRIVATE_KEY, baltathar } from "@moonwall/util"; +import { decodeEventLog } from "viem"; +import { + PRECOMPILE_IDENTITY_ADDRESS, + expectEVMResult, + expectSubstrateEvent, +} from "../../../../helpers"; + +describeSuite({ + id: "D030303", + title: "Precompiles - Identity precompile - clear identity", + foundationMethods: "dev", + testCases: ({ it, log, context }) => { + beforeAll(async function () { + await context.createBlock([ + context + .polkadotJs() + .tx.identity.setIdentity({ + display: { raw: "display" }, + }) + .signAsync(baltathar), + ]); + + const block = await context.createBlock( + await context.writeContract!({ + contractName: "Identity", + contractAddress: PRECOMPILE_IDENTITY_ADDRESS, + functionName: "clearIdentity", + privateKey: BALTATHAR_PRIVATE_KEY, + rawTxOnly: true, + }) + ); + + expectEVMResult(block.result!.events, "Succeed"); + const { data } = expectSubstrateEvent(block, "evm", "Log"); + const evmLog = decodeEventLog({ + abi: fetchCompiledContract("Identity").abi, + topics: data[0].topics.map((t) => t.toHex()) as any, + data: data[0].data.toHex(), + }) as any; + + expect(evmLog.eventName).to.equal("IdentityCleared"); + expect(evmLog.args.who).to.equal(baltathar.address); + }); + + it({ + id: "T01", + title: "should have no identity", + test: async function () { + const identity = (await context.readContract!({ + contractAddress: PRECOMPILE_IDENTITY_ADDRESS, + contractName: "Identity", + functionName: "identity", + args: [baltathar.address], + })) as any; + + expect(identity.isValid).to.be.false; + }, + }); + }, +}); diff --git a/test/moonwall/suites/dev/stagenet/precompile/test-precompile-identity4.ts b/test/moonwall/suites/dev/stagenet/precompile/test-precompile-identity4.ts new file mode 100644 index 00000000..16f5db4a --- /dev/null +++ b/test/moonwall/suites/dev/stagenet/precompile/test-precompile-identity4.ts @@ -0,0 +1,82 @@ +/** + * Identity precompile tests - request judgement + * Adapted from Moonbeam test suite + */ + +import { beforeAll, describeSuite, expect, fetchCompiledContract } from "@moonwall/cli"; +import { BALTATHAR_PRIVATE_KEY, alith, baltathar } from "@moonwall/util"; +import { decodeEventLog, toHex } from "viem"; +import { + PRECOMPILE_IDENTITY_ADDRESS, + expectEVMResult, + expectSubstrateEvent, +} from "../../../../helpers"; + +describeSuite({ + id: "D030304", + title: "Precompiles - Identity precompile - request judgement", + foundationMethods: "dev", + testCases: ({ it, log, context }) => { + beforeAll(async function () { + await context.createBlock( + context + .polkadotJs() + .tx.sudo.sudo(context.polkadotJs().tx.identity.addRegistrar(alith.address)) + ); + await context.createBlock([ + context.polkadotJs().tx.identity.setFee(0, 100n), + context + .polkadotJs() + .tx.identity.setIdentity({ + display: { raw: "display" }, + }) + .signAsync(baltathar), + ]); + + const block = await context.createBlock( + await context.writeContract!({ + contractName: "Identity", + contractAddress: PRECOMPILE_IDENTITY_ADDRESS, + functionName: "requestJudgement", + privateKey: BALTATHAR_PRIVATE_KEY, + rawTxOnly: true, + args: [0, 100], + }) + ); + + expectEVMResult(block.result!.events, "Succeed"); + const { data } = expectSubstrateEvent(block, "evm", "Log"); + const evmLog = decodeEventLog({ + abi: fetchCompiledContract("Identity").abi, + topics: data[0].topics.map((t) => t.toHex()) as any, + data: data[0].data.toHex(), + }) as any; + + expect(evmLog.eventName).to.equal("JudgementRequested"); + expect(evmLog.args.who).to.equal(baltathar.address); + expect(evmLog.args.registrarIndex).to.equal(0); + }); + + it({ + id: "T01", + title: "should retrieve requested judgement as part of identity", + test: async function () { + const identity = (await context.readContract!({ + contractAddress: PRECOMPILE_IDENTITY_ADDRESS, + contractName: "Identity", + functionName: "identity", + args: [baltathar.address], + })) as any; + + expect(identity.isValid).to.be.true; + expect(identity.judgements).to.have.length(1); + expect(identity.judgements[0].registrarIndex).to.equal(0); + expect(identity.judgements[0].judgement.isFeePaid).to.be.true; + expect(identity.judgements[0].judgement.feePaidDeposit).to.equal(100n); + expect(identity.deposit).to.equal(1027400000000000000n); + expect(identity.info.display.hasData).to.be.true; + expect(identity.info.display.value).to.equal(toHex("display")); + }, + }); + }, +}); diff --git a/test/moonwall/suites/dev/stagenet/precompile/test-precompile-identity5.ts b/test/moonwall/suites/dev/stagenet/precompile/test-precompile-identity5.ts new file mode 100644 index 00000000..5c10543b --- /dev/null +++ b/test/moonwall/suites/dev/stagenet/precompile/test-precompile-identity5.ts @@ -0,0 +1,82 @@ +/** + * Identity precompile tests - cancel requested judgement + * Adapted from Moonbeam test suite + */ + +import { beforeAll, describeSuite, expect, fetchCompiledContract } from "@moonwall/cli"; +import { BALTATHAR_PRIVATE_KEY, alith, baltathar } from "@moonwall/util"; +import { decodeEventLog, toHex } from "viem"; +import { + PRECOMPILE_IDENTITY_ADDRESS, + expectEVMResult, + expectSubstrateEvent, +} from "../../../../helpers"; + +describeSuite({ + id: "D030305", + title: "Precompiles - Identity precompile - cancel requested judgement", + foundationMethods: "dev", + testCases: ({ it, log, context }) => { + beforeAll(async function () { + await context.createBlock( + context + .polkadotJs() + .tx.sudo.sudo(context.polkadotJs().tx.identity.addRegistrar(alith.address)) + ); + await context.createBlock([ + context.polkadotJs().tx.identity.setFee(0, 100n), + context + .polkadotJs() + .tx.identity.setIdentity({ + display: { raw: "display" }, + }) + .signAsync(baltathar), + ]); + await context.createBlock( + context.polkadotJs().tx.identity.requestJudgement(0, 1000n).signAsync(baltathar) + ); + + const block = await context.createBlock( + await context.writeContract!({ + contractName: "Identity", + contractAddress: PRECOMPILE_IDENTITY_ADDRESS, + functionName: "cancelRequest", + privateKey: BALTATHAR_PRIVATE_KEY, + rawTxOnly: true, + args: [0], + }) + ); + + expectEVMResult(block.result!.events, "Succeed"); + const { data } = expectSubstrateEvent(block, "evm", "Log"); + const evmLog = decodeEventLog({ + abi: fetchCompiledContract("Identity").abi, + topics: data[0].topics.map((t) => t.toHex()) as any, + data: data[0].data.toHex(), + }) as any; + + expect(evmLog.eventName).to.equal("JudgementUnrequested"); + expect(evmLog.args.who).to.equal(baltathar.address); + expect(evmLog.args.registrarIndex).to.equal(0); + }); + + it({ + id: "T01", + title: "should have no requested judgement as part of identity", + test: async function () { + const identity = (await context.readContract!({ + contractAddress: PRECOMPILE_IDENTITY_ADDRESS, + contractName: "Identity", + functionName: "identity", + args: [baltathar.address], + })) as any; + + expect(identity.isValid).to.be.true; + expect(identity.judgements).to.be.empty; + expect(identity.deposit).to.equal(1027400000000000000n); + expect(identity.info.display.hasData).to.be.true; + expect(identity.info.display.value).to.equal(toHex("display")); + }, + }); + }, +}); diff --git a/test/moonwall/suites/dev/stagenet/precompile/test-precompile-identity6.ts b/test/moonwall/suites/dev/stagenet/precompile/test-precompile-identity6.ts new file mode 100644 index 00000000..8591a33f --- /dev/null +++ b/test/moonwall/suites/dev/stagenet/precompile/test-precompile-identity6.ts @@ -0,0 +1,98 @@ +/** + * Identity precompile tests - provide judgement + * Adapted from Moonbeam test suite + */ + +import { beforeAll, describeSuite, expect, fetchCompiledContract } from "@moonwall/cli"; +import { alith, baltathar } from "@moonwall/util"; +import { decodeEventLog, toHex } from "viem"; +import { + PRECOMPILE_IDENTITY_ADDRESS, + expectEVMResult, + expectSubstrateEvent, +} from "../../../../helpers"; + +describeSuite({ + id: "D030306", + title: "Precompiles - Identity precompile - provide judgement", + foundationMethods: "dev", + testCases: ({ it, log, context }) => { + beforeAll(async function () { + await context.createBlock( + context + .polkadotJs() + .tx.sudo.sudo(context.polkadotJs().tx.identity.addRegistrar(alith.address)) + ); + const identityData = { + display: { raw: "display" }, + }; + await context.createBlock([ + context.polkadotJs().tx.identity.setFee(0, 100n), + context.polkadotJs().tx.identity.setIdentity(identityData).signAsync(baltathar), + ]); + await context.createBlock( + context.polkadotJs().tx.identity.requestJudgement(0, 1000n).signAsync(baltathar) + ); + + const identityHash = context + .polkadotJs() + .registry.createType("PalletIdentityLegacyIdentityInfo", identityData) + .hash.toHex(); + const block = await context.createBlock( + await context.writeContract!({ + contractName: "Identity", + contractAddress: PRECOMPILE_IDENTITY_ADDRESS, + functionName: "provideJudgement", + rawTxOnly: true, + args: [ + 0, + baltathar.address, + { + isUnknown: false, + isFeePaid: false, + feePaidDeposit: 0, + isReasonable: false, + isKnownGood: true, + isOutOfDate: false, + isLowQuality: false, + isErroneous: false, + }, + identityHash, + ], + }) + ); + + expectEVMResult(block.result!.events, "Succeed"); + const { data } = expectSubstrateEvent(block, "evm", "Log"); + const evmLog = decodeEventLog({ + abi: fetchCompiledContract("Identity").abi, + topics: data[0].topics.map((t) => t.toHex()) as any, + data: data[0].data.toHex(), + }) as any; + + expect(evmLog.eventName).to.equal("JudgementGiven"); + expect(evmLog.args.target).to.equal(baltathar.address); + expect(evmLog.args.registrarIndex).to.equal(0); + }); + + it({ + id: "T01", + title: "should have provided judgement as part of identity", + test: async function () { + const identity = (await context.readContract!({ + contractAddress: PRECOMPILE_IDENTITY_ADDRESS, + contractName: "Identity", + functionName: "identity", + args: [baltathar.address], + })) as any; + + expect(identity.isValid).to.be.true; + expect(identity.judgements).to.have.length(1); + expect(identity.judgements[0].judgement.isKnownGood).to.be.true; + expect(identity.deposit).to.equal(1027400000000000000n); + expect(identity.info.display.hasData).to.be.true; + expect(identity.info.display.value).to.equal(toHex("display")); + }, + }); + }, +}); diff --git a/test/moonwall/suites/dev/stagenet/precompile/test-precompile-identity7.ts b/test/moonwall/suites/dev/stagenet/precompile/test-precompile-identity7.ts new file mode 100644 index 00000000..0675dbc1 --- /dev/null +++ b/test/moonwall/suites/dev/stagenet/precompile/test-precompile-identity7.ts @@ -0,0 +1,82 @@ +/** + * Identity precompile tests - set subs + * Adapted from Moonbeam test suite + */ + +import { beforeAll, describeSuite, expect } from "@moonwall/cli"; +import { BALTATHAR_PRIVATE_KEY, baltathar, charleth } from "@moonwall/util"; +import { toHex } from "viem"; +import { PRECOMPILE_IDENTITY_ADDRESS, expectEVMResult } from "../../../../helpers"; + +describeSuite({ + id: "D030307", + title: "Precompiles - Identity precompile - set subs", + foundationMethods: "dev", + testCases: ({ it, log, context }) => { + beforeAll(async function () { + await context.createBlock( + context + .polkadotJs() + .tx.identity.setIdentity({ + display: { raw: "display" }, + }) + .signAsync(baltathar) + ); + + const block = await context.createBlock( + await context.writeContract!({ + contractName: "Identity", + contractAddress: PRECOMPILE_IDENTITY_ADDRESS, + functionName: "setSubs", + privateKey: BALTATHAR_PRIVATE_KEY, + rawTxOnly: true, + args: [ + [ + { + account: charleth.address, + data: { hasData: true, value: toHex("test") }, + }, + ], + ], + }) + ); + + expectEVMResult(block.result!.events, "Succeed"); + }); + + it({ + id: "T01", + title: "should retrieve subs", + test: async function () { + const subs = (await context.readContract!({ + contractAddress: PRECOMPILE_IDENTITY_ADDRESS, + contractName: "Identity", + functionName: "subsOf", + args: [baltathar.address], + })) as any; + + expect(subs.deposit).to.equal(1005300000000000000n); + expect(subs.accounts).to.have.length(1); + expect(subs.accounts[0]).to.be.equal(charleth.address); + }, + }); + + it({ + id: "T02", + title: "should retrieve super", + test: async function () { + const superOf = (await context.readContract!({ + contractAddress: PRECOMPILE_IDENTITY_ADDRESS, + contractName: "Identity", + functionName: "superOf", + args: [charleth.address], + })) as any; + + expect(superOf.isValid).to.be.true; + expect(superOf.account).to.be.equal(baltathar.address); + expect(superOf.data.hasData).to.be.true; + expect(superOf.data.value).to.be.equal(toHex("test")); + }, + }); + }, +}); diff --git a/test/moonwall/suites/dev/stagenet/precompile/test-precompile-identity8.ts b/test/moonwall/suites/dev/stagenet/precompile/test-precompile-identity8.ts new file mode 100644 index 00000000..549001a5 --- /dev/null +++ b/test/moonwall/suites/dev/stagenet/precompile/test-precompile-identity8.ts @@ -0,0 +1,61 @@ +/** + * Identity precompile tests - set fee + * Adapted from Moonbeam test suite + */ + +import { beforeAll, describeSuite, expect } from "@moonwall/cli"; +import { alith } from "@moonwall/util"; +import { expectEVMResult, PRECOMPILE_IDENTITY_ADDRESS } from "../../../../helpers"; + +describeSuite({ + id: "D030308", + title: "Precompiles - Identity precompile - set fee", + foundationMethods: "dev", + testCases: ({ it, log, context }) => { + beforeAll(async function () { + await context.createBlock( + context + .polkadotJs() + .tx.sudo.sudo(context.polkadotJs().tx.identity.addRegistrar(alith.address)) + ); + + const block = await context.createBlock( + await context.writeContract!({ + contractName: "Identity", + contractAddress: PRECOMPILE_IDENTITY_ADDRESS, + functionName: "setFee", + rawTxOnly: true, + args: [0, 100], + }) + ); + + expectEVMResult(block.result!.events, "Succeed"); + }); + + it({ + id: "T01", + title: "should retrieve the registrar", + test: async function () { + const registrars = (await context.readContract!({ + contractAddress: PRECOMPILE_IDENTITY_ADDRESS, + contractName: "Identity", + functionName: "registrars", + })) as any; + + expect(registrars.length).to.equal(1); + expect(registrars[0].isValid).to.be.true; + expect(registrars[0].index).to.equal(0); + expect(registrars[0].account).to.equal(alith.address); + expect(registrars[0].fee).to.equal(100n); + expect(registrars[0].fields.display).to.be.false; + expect(registrars[0].fields.web).to.be.false; + expect(registrars[0].fields.legal).to.be.false; + expect(registrars[0].fields.riot).to.be.false; + expect(registrars[0].fields.email).to.be.false; + expect(registrars[0].fields.pgpFingerprint).to.be.false; + expect(registrars[0].fields.image).to.be.false; + expect(registrars[0].fields.twitter).to.be.false; + }, + }); + }, +}); diff --git a/test/moonwall/suites/dev/stagenet/precompile/test-precompile-identity9.ts b/test/moonwall/suites/dev/stagenet/precompile/test-precompile-identity9.ts new file mode 100644 index 00000000..fbfb4ce1 --- /dev/null +++ b/test/moonwall/suites/dev/stagenet/precompile/test-precompile-identity9.ts @@ -0,0 +1,73 @@ +/** + * Identity precompile tests - set fields + * Adapted from Moonbeam test suite + */ + +import { beforeAll, describeSuite, expect } from "@moonwall/cli"; +import { alith } from "@moonwall/util"; +import { expectEVMResult, PRECOMPILE_IDENTITY_ADDRESS } from "../../../../helpers"; + +describeSuite({ + id: "D030309", + title: "Precompiles - Identity precompile - set fields", + foundationMethods: "dev", + testCases: ({ it, log, context }) => { + beforeAll(async function () { + await context.createBlock( + context + .polkadotJs() + .tx.sudo.sudo(context.polkadotJs().tx.identity.addRegistrar(alith.address)) + ); + + const block = await context.createBlock( + await context.writeContract!({ + contractName: "Identity", + contractAddress: PRECOMPILE_IDENTITY_ADDRESS, + functionName: "setFields", + rawTxOnly: true, + args: [ + 0, + { + display: true, + web: true, + legal: true, + riot: true, + email: true, + pgpFingerprint: true, + image: true, + twitter: true, + }, + ], + }) + ); + + expectEVMResult(block.result!.events, "Succeed"); + }); + + it({ + id: "T01", + title: "should retrieve the registrar", + test: async function () { + const registrars = (await context.readContract!({ + contractAddress: PRECOMPILE_IDENTITY_ADDRESS, + contractName: "Identity", + functionName: "registrars", + })) as any; + + expect(registrars.length).to.equal(1); + expect(registrars[0].isValid).to.be.true; + expect(registrars[0].index).to.equal(0); + expect(registrars[0].account).to.equal(alith.address); + expect(registrars[0].fee).to.equal(0n); + expect(registrars[0].fields.display).to.be.true; + expect(registrars[0].fields.web).to.be.true; + expect(registrars[0].fields.legal).to.be.true; + expect(registrars[0].fields.riot).to.be.true; + expect(registrars[0].fields.email).to.be.true; + expect(registrars[0].fields.pgpFingerprint).to.be.true; + expect(registrars[0].fields.image).to.be.true; + expect(registrars[0].fields.twitter).to.be.true; + }, + }); + }, +}); diff --git a/test/moonwall/suites/dev/stagenet/precompile/test-precompile-modexp.ts b/test/moonwall/suites/dev/stagenet/precompile/test-precompile-modexp.ts new file mode 100644 index 00000000..fe4e6d07 --- /dev/null +++ b/test/moonwall/suites/dev/stagenet/precompile/test-precompile-modexp.ts @@ -0,0 +1,824 @@ +import "@moonbeam-network/api-augment"; +import { beforeAll, describeSuite, expect } from "@moonwall/cli"; +import { EXTRINSIC_GAS_LIMIT, createViemTransaction } from "@moonwall/util"; +import { hexToU8a, u8aToHex } from "@polkadot/util"; +import { expectEVMResult, testVectors } from "../../../../helpers"; +import { calculateEIP7623Gas } from "../../../../helpers/fees"; + +const MODEXP_PRECOMPILE_ADDRESS = "0x0000000000000000000000000000000000000005"; + +// TODO: Gas tests (T03, T05-T21) are skipped because DataHaven uses Frontier stable2412 +// which doesn't include EIP-7623 gas calculation. Re-enable these tests after upgrading +// to Polkadot stable2506 (which includes the newer Frontier with EIP-7623 support). + +describeSuite({ + id: "D030108", + title: "Precompiles - modexp", + foundationMethods: "dev", + testCases: ({ context, it, log }) => { + let hasherAddress: `0x${string}`; + + beforeAll(async function () { + const { contractAddress } = await context.deployContract!("HasherChecker"); + hasherAddress = contractAddress; + }); + + it({ + id: "T01", + title: "should be accessible from a smart contract", + test: async function () { + const rawTx = await context.writeContract!({ + contractName: "HasherChecker", + contractAddress: hasherAddress, + functionName: "modExpChecker", + rawTxOnly: true, + }); + const { result } = await context.createBlock(rawTx); + expectEVMResult(result!.events, "Succeed"); + }, + }); + + it({ + id: "T02", + title: "EIP example 1 - calculation", + test: async function () { + const rawTx = await context.writeContract!({ + contractName: "HasherChecker", + contractAddress: hasherAddress, + functionName: "modExpVerify", + args: [ + "3", + "115792089237316195423570985008687907853269984665640564039457584007908834671662", + "115792089237316195423570985008687907853269984665640564039457584007908834671663", + ], + rawTxOnly: true, + }); + const { result } = await context.createBlock(rawTx); + expectEVMResult(result!.events, "Succeed"); + + expect( + await context.readContract!({ + contractAddress: hasherAddress, + contractName: "HasherChecker", + functionName: "getResult", + }) + ).to.be.equals(1n); + }, + }); + + it({ + id: "T03", + title: "EIP example 1 - gas", + modifier: "skip", + test: async function () { + const expectedModExpGasCost = 3728n; + const inputData = + "0000000000000000000000000000000000000000000000000000000000000001" + // base length + "0000000000000000000000000000000000000000000000000000000000000020" + // exponent length + "0000000000000000000000000000000000000000000000000000000000000020" + // modulus length + "03" + // base + "fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2e" + // exponent + "fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"; // modulus + const byteArray = hexToU8a(inputData); + const inputLength = byteArray.length; + const numZeroBytes = byteArray.filter((a) => a === 0).length; + const numNonZeroBytes = inputLength - numZeroBytes; + + const rawTxn = await createViemTransaction(context, { + to: MODEXP_PRECOMPILE_ADDRESS, + data: ("0x" + inputData) as `0x${string}`, + gas: EXTRINSIC_GAS_LIMIT, + }); + const { result } = await context.createBlock(rawTxn); + + const receipt = await context + .viem() + .getTransactionReceipt({ hash: result!.hash as `0x${string}` }); + expect(receipt.status).toBe("success"); + const expectedGasUsed = calculateEIP7623Gas( + numZeroBytes, + numNonZeroBytes, + expectedModExpGasCost + ); + expect(receipt.gasUsed, "ModExp gas pricing mismatch").to.equal(expectedGasUsed); + }, + }); + + it({ + id: "T04", + title: "EIP example 2", + test: async function () { + await context.writeContract!({ + contractName: "HasherChecker", + contractAddress: hasherAddress, + functionName: "modExpVerify", + args: [ + "0", + "115792089237316195423570985008687907853269984665640564039457584007908834671662", + "115792089237316195423570985008687907853269984665640564039457584007908834671663", + ], + }); + + await context.createBlock(); + expect( + await context.readContract!({ + contractAddress: hasherAddress, + contractName: "HasherChecker", + functionName: "getResult", + }) + ).toBe(0n); + }, + }); + + it({ + id: "T05", + title: "EIP example 2 - gas", + modifier: "skip", + test: async function () { + const expectedModExpGasCost = 3728n; + const inputData = + "0000000000000000000000000000000000000000000000000000000000000000" + // base length + "0000000000000000000000000000000000000000000000000000000000000020" + // exponent length + "0000000000000000000000000000000000000000000000000000000000000020" + // modulus length + // base length is zero so value is inferred zero + "fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2e" + // exponent + "fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"; // modulus + const byteArray = hexToU8a(inputData); + const inputLength = byteArray.length; + const numZeroBytes = byteArray.filter((a) => a === 0).length; + const numNonZeroBytes = inputLength - numZeroBytes; + + const rawTxn = await createViemTransaction(context, { + to: MODEXP_PRECOMPILE_ADDRESS, + data: ("0x" + inputData) as `0x${string}`, + gas: EXTRINSIC_GAS_LIMIT, + }); + const { result } = await context.createBlock(rawTxn); + const receipt = await context + .viem() + .getTransactionReceipt({ hash: result!.hash as `0x${string}` }); + expect(receipt.status).toBe("success"); + const expectedGasUsed = calculateEIP7623Gas( + numZeroBytes, + numNonZeroBytes, + expectedModExpGasCost + ); + expect(receipt.gasUsed, "ModExp gas pricing mismatch").to.equal(expectedGasUsed); + }, + }); + + it({ + id: "T06", + title: "nagydani-1-square - gas", + modifier: "skip", + test: async function () { + const expectedModExpGasCost = 1869n; + const inputData = + "0000000000000000000000000000000000000000000000000000000000000040" + // base length + "0000000000000000000000000000000000000000000000000000000000000001" + // exponent length + "0000000000000000000000000000000000000000000000000000000000000040" + // modulus length + testVectors["nagydani-1-square"].base + + testVectors["nagydani-1-square"].exponent + + testVectors["nagydani-1-square"].modulus; + const byteArray = hexToU8a(inputData); + const inputLength = byteArray.length; + const numZeroBytes = byteArray.filter((a) => a === 0).length; + const numNonZeroBytes = inputLength - numZeroBytes; + + const rawTxn = await createViemTransaction(context, { + to: MODEXP_PRECOMPILE_ADDRESS, + data: ("0x" + inputData) as `0x${string}`, + gas: EXTRINSIC_GAS_LIMIT, + }); + const { result } = await context.createBlock(rawTxn); + + const receipt = await context + .viem() + .getTransactionReceipt({ hash: result!.hash as `0x${string}` }); + + expect(receipt.status).toBe("success"); + const expectedGasUsed = calculateEIP7623Gas( + numZeroBytes, + numNonZeroBytes, + expectedModExpGasCost + ); + expect(receipt.gasUsed, "ModExp gas pricing mismatch").to.equal(expectedGasUsed); + }, + }); + + it({ + id: "T07", + title: "nagydani-1-qube - gas", + modifier: "skip", + test: async function () { + const expectedModExpGasCost = 1869n; + const inputData = + "0000000000000000000000000000000000000000000000000000000000000040" + // base length + "0000000000000000000000000000000000000000000000000000000000000001" + // exponent length + "0000000000000000000000000000000000000000000000000000000000000040" + // modulus length + testVectors["nagydani-1-square"].base + + testVectors["nagydani-1-qube"].exponent + + testVectors["nagydani-1-qube"].modulus; + const byteArray = hexToU8a(inputData); + const inputLength = byteArray.length; + const numZeroBytes = byteArray.filter((a) => a === 0).length; + const numNonZeroBytes = inputLength - numZeroBytes; + + const rawTxn = await createViemTransaction(context, { + to: MODEXP_PRECOMPILE_ADDRESS, + data: ("0x" + inputData) as `0x${string}`, + gas: EXTRINSIC_GAS_LIMIT, + }); + const { result } = await context.createBlock(rawTxn); + + const receipt = await context + .viem() + .getTransactionReceipt({ hash: result!.hash as `0x${string}` }); + expect(receipt.status).toBe("success"); + const expectedGasUsed = calculateEIP7623Gas( + numZeroBytes, + numNonZeroBytes, + expectedModExpGasCost + ); + expect(receipt.gasUsed, "ModExp gas pricing mismatch").to.equal(expectedGasUsed); + }, + }); + + it({ + id: "T08", + title: "nagydani-1-pow0x10001 - gas", + modifier: "skip", + test: async function () { + const expectedModExpGasCost = 2010n; + const inputData = + "0000000000000000000000000000000000000000000000000000000000000040" + // base length + "0000000000000000000000000000000000000000000000000000000000000003" + // exponent length + "0000000000000000000000000000000000000000000000000000000000000040" + // modulus length + testVectors["nagydani-1-pow0x10001"].base + + testVectors["nagydani-1-pow0x10001"].exponent + + testVectors["nagydani-1-pow0x10001"].modulus; + const byteArray = hexToU8a(inputData); + const inputLength = byteArray.length; + const numZeroBytes = byteArray.filter((a) => a === 0).length; + const numNonZeroBytes = inputLength - numZeroBytes; + + const rawTxn = await createViemTransaction(context, { + to: MODEXP_PRECOMPILE_ADDRESS, + data: ("0x" + inputData) as `0x${string}`, + gas: EXTRINSIC_GAS_LIMIT, + }); + const { result } = await context.createBlock(rawTxn); + + const receipt = await context + .viem() + .getTransactionReceipt({ hash: result!.hash as `0x${string}` }); + expect(receipt.status).toBe("success"); + const expectedGasUsed = calculateEIP7623Gas( + numZeroBytes, + numNonZeroBytes, + expectedModExpGasCost + ); + expect(receipt.gasUsed, "ModExp gas pricing mismatch").to.equal(expectedGasUsed); + }, + }); + + it({ + id: "T09", + title: "nagydani-2-square - gas", + modifier: "skip", + test: async function () { + const expectedModExpGasCost = 1869n; + const inputData = + "0000000000000000000000000000000000000000000000000000000000000080" + // base length + "0000000000000000000000000000000000000000000000000000000000000001" + // exponent length + "0000000000000000000000000000000000000000000000000000000000000080" + // modulus length + testVectors["nagydani-2-square"].base + + testVectors["nagydani-2-square"].exponent + + testVectors["nagydani-2-square"].modulus; + const byteArray = hexToU8a(inputData); + const inputLength = byteArray.length; + const numZeroBytes = byteArray.filter((a) => a === 0).length; + const numNonZeroBytes = inputLength - numZeroBytes; + + const rawTxn = await createViemTransaction(context, { + to: MODEXP_PRECOMPILE_ADDRESS, + data: ("0x" + inputData) as `0x${string}`, + gas: EXTRINSIC_GAS_LIMIT, + }); + const { result } = await context.createBlock(rawTxn); + + const receipt = await context + .viem() + .getTransactionReceipt({ hash: result!.hash as `0x${string}` }); + expect(receipt.status).toBe("success"); + const expectedGasUsed = calculateEIP7623Gas( + numZeroBytes, + numNonZeroBytes, + expectedModExpGasCost + ); + expect(receipt.gasUsed, "ModExp gas pricing mismatch").to.equal(expectedGasUsed); + }, + }); + + it({ + id: "T10", + title: "nagydani-2-qube - gas", + modifier: "skip", + test: async function () { + const expectedModExpGasCost = 1869n; + const inputData = + "0000000000000000000000000000000000000000000000000000000000000080" + // base length + "0000000000000000000000000000000000000000000000000000000000000001" + // exponent length + "0000000000000000000000000000000000000000000000000000000000000080" + // modulus length + testVectors["nagydani-2-qube"].base + + testVectors["nagydani-2-qube"].exponent + + testVectors["nagydani-2-qube"].modulus; + const byteArray = hexToU8a(inputData); + const inputLength = byteArray.length; + const numZeroBytes = byteArray.filter((a) => a === 0).length; + const numNonZeroBytes = inputLength - numZeroBytes; + + const rawTxn = await createViemTransaction(context, { + to: MODEXP_PRECOMPILE_ADDRESS, + data: ("0x" + inputData) as `0x${string}`, + gas: EXTRINSIC_GAS_LIMIT, + }); + const { result } = await context.createBlock(rawTxn); + + const receipt = await context + .viem() + .getTransactionReceipt({ hash: result!.hash as `0x${string}` }); + expect(receipt.status).toBe("success"); + const expectedGasUsed = calculateEIP7623Gas( + numZeroBytes, + numNonZeroBytes, + expectedModExpGasCost + ); + expect(receipt.gasUsed, "ModExp gas pricing mismatch").to.equal(expectedGasUsed); + }, + }); + + it({ + id: "T11", + title: "nagydani-2-pow0x10001 - gas", + modifier: "skip", + test: async function () { + const expectedModExpGasCost = 3034n; + const inputData = + "0000000000000000000000000000000000000000000000000000000000000080" + // base length + "0000000000000000000000000000000000000000000000000000000000000003" + // exponent length + "0000000000000000000000000000000000000000000000000000000000000080" + // modulus length + testVectors["nagydani-2-pow0x10001"].base + + testVectors["nagydani-2-pow0x10001"].exponent + + testVectors["nagydani-2-pow0x10001"].modulus; + const byteArray = hexToU8a(inputData); + const inputLength = byteArray.length; + const numZeroBytes = byteArray.filter((a) => a === 0).length; + const numNonZeroBytes = inputLength - numZeroBytes; + + const rawTxn = await createViemTransaction(context, { + to: MODEXP_PRECOMPILE_ADDRESS, + data: ("0x" + inputData) as `0x${string}`, + gas: EXTRINSIC_GAS_LIMIT, + }); + const { result } = await context.createBlock(rawTxn); + + const receipt = await context + .viem() + .getTransactionReceipt({ hash: result!.hash as `0x${string}` }); + expect(receipt.status).toBe("success"); + const expectedGasUsed = calculateEIP7623Gas( + numZeroBytes, + numNonZeroBytes, + expectedModExpGasCost + ); + expect(receipt.gasUsed, "ModExp gas pricing mismatch").to.equal(expectedGasUsed); + }, + }); + + it({ + id: "T12", + title: "nagydani-3-square - gas", + modifier: "skip", + test: async function () { + const expectedModExpGasCost = 2010n; + const inputData = + "0000000000000000000000000000000000000000000000000000000000000100" + // base length + "0000000000000000000000000000000000000000000000000000000000000001" + // exponent length + "0000000000000000000000000000000000000000000000000000000000000100" + // modulus length + testVectors["nagydani-3-square"].base + + testVectors["nagydani-3-square"].exponent + + testVectors["nagydani-3-square"].modulus; + const byteArray = hexToU8a(inputData); + const inputLength = byteArray.length; + const numZeroBytes = byteArray.filter((a) => a === 0).length; + const numNonZeroBytes = inputLength - numZeroBytes; + + const rawTxn = await createViemTransaction(context, { + to: MODEXP_PRECOMPILE_ADDRESS, + data: ("0x" + inputData) as `0x${string}`, + gas: EXTRINSIC_GAS_LIMIT, + }); + const { result } = await context.createBlock(rawTxn); + + const receipt = await context + .viem() + .getTransactionReceipt({ hash: result!.hash as `0x${string}` }); + expect(receipt.status).toBe("success"); + const expectedGasUsed = calculateEIP7623Gas( + numZeroBytes, + numNonZeroBytes, + expectedModExpGasCost + ); + expect(receipt.gasUsed, "ModExp gas pricing mismatch").to.equal(expectedGasUsed); + }, + }); + + it({ + id: "T13", + title: "nagydani-3-qube - gas", + modifier: "skip", + test: async function () { + const expectedModExpGasCost = 2010n; + const inputData = + "0000000000000000000000000000000000000000000000000000000000000100" + // base length + "0000000000000000000000000000000000000000000000000000000000000001" + // exponent length + "0000000000000000000000000000000000000000000000000000000000000100" + // modulus length + testVectors["nagydani-3-qube"].base + + testVectors["nagydani-3-qube"].exponent + + testVectors["nagydani-3-qube"].modulus; + const byteArray = hexToU8a(inputData); + const inputLength = byteArray.length; + const numZeroBytes = byteArray.filter((a) => a === 0).length; + const numNonZeroBytes = inputLength - numZeroBytes; + + const rawTxn = await createViemTransaction(context, { + to: MODEXP_PRECOMPILE_ADDRESS, + data: ("0x" + inputData) as `0x${string}`, + gas: EXTRINSIC_GAS_LIMIT, + }); + const { result } = await context.createBlock(rawTxn); + + const receipt = await context + .viem() + .getTransactionReceipt({ hash: result!.hash as `0x${string}` }); + expect(receipt.status).toBe("success"); + const expectedGasUsed = calculateEIP7623Gas( + numZeroBytes, + numNonZeroBytes, + expectedModExpGasCost + ); + expect(receipt.gasUsed, "ModExp gas pricing mismatch").to.equal(expectedGasUsed); + }, + }); + + it({ + id: "T14", + title: "nagydani-3-pow0x10001 - gas", + modifier: "skip", + test: async function () { + const expectedModExpGasCost = 7130n; + const inputData = + "0000000000000000000000000000000000000000000000000000000000000100" + // base length + "0000000000000000000000000000000000000000000000000000000000000003" + // exponent length + "0000000000000000000000000000000000000000000000000000000000000100" + // modulus length + testVectors["nagydani-3-pow0x10001"].base + + testVectors["nagydani-3-pow0x10001"].exponent + + testVectors["nagydani-3-pow0x10001"].modulus; + const byteArray = hexToU8a(inputData); + const inputLength = byteArray.length; + const numZeroBytes = byteArray.filter((a) => a === 0).length; + const numNonZeroBytes = inputLength - numZeroBytes; + + const rawTxn = await createViemTransaction(context, { + to: MODEXP_PRECOMPILE_ADDRESS, + data: ("0x" + inputData) as `0x${string}`, + gas: EXTRINSIC_GAS_LIMIT, + }); + const { result } = await context.createBlock(rawTxn); + + const receipt = await context + .viem() + .getTransactionReceipt({ hash: result!.hash as `0x${string}` }); + expect(receipt.status).toBe("success"); + const expectedGasUsed = calculateEIP7623Gas( + numZeroBytes, + numNonZeroBytes, + expectedModExpGasCost + ); + expect(receipt.gasUsed, "ModExp gas pricing mismatch").to.equal(expectedGasUsed); + }, + }); + + it({ + id: "T15", + title: "nagydani-4-square - gas", + modifier: "skip", + test: async function () { + const expectedModExpGasCost = 3034n; + const inputData = + "0000000000000000000000000000000000000000000000000000000000000200" + // base length + "0000000000000000000000000000000000000000000000000000000000000001" + // exponent length + "0000000000000000000000000000000000000000000000000000000000000200" + // modulus length + testVectors["nagydani-4-square"].base + + testVectors["nagydani-4-square"].exponent + + testVectors["nagydani-4-square"].modulus; + const byteArray = hexToU8a(inputData); + const inputLength = byteArray.length; + const numZeroBytes = byteArray.filter((a) => a === 0).length; + const numNonZeroBytes = inputLength - numZeroBytes; + + const rawTxn = await createViemTransaction(context, { + to: MODEXP_PRECOMPILE_ADDRESS, + data: ("0x" + inputData) as `0x${string}`, + gas: EXTRINSIC_GAS_LIMIT, + }); + const { result } = await context.createBlock(rawTxn); + + const receipt = await context + .viem() + .getTransactionReceipt({ hash: result!.hash as `0x${string}` }); + expect(receipt.status).toBe("success"); + const expectedGasUsed = calculateEIP7623Gas( + numZeroBytes, + numNonZeroBytes, + expectedModExpGasCost + ); + expect(receipt.gasUsed, "ModExp gas pricing mismatch").to.equal(expectedGasUsed); + }, + }); + + it({ + id: "T16", + title: "nagydani-4-qube - gas", + modifier: "skip", + test: async function () { + const expectedModExpGasCost = 3034n; + const inputData = + "0000000000000000000000000000000000000000000000000000000000000200" + // base length + "0000000000000000000000000000000000000000000000000000000000000001" + // exponent length + "0000000000000000000000000000000000000000000000000000000000000200" + // modulus length + testVectors["nagydani-4-qube"].base + + testVectors["nagydani-4-qube"].exponent + + testVectors["nagydani-4-qube"].modulus; + const byteArray = hexToU8a(inputData); + const inputLength = byteArray.length; + const numZeroBytes = byteArray.filter((a) => a === 0).length; + const numNonZeroBytes = inputLength - numZeroBytes; + + const rawTxn = await createViemTransaction(context, { + to: MODEXP_PRECOMPILE_ADDRESS, + data: ("0x" + inputData) as `0x${string}`, + gas: EXTRINSIC_GAS_LIMIT, + }); + const { result } = await context.createBlock(rawTxn); + + const receipt = await context + .viem() + .getTransactionReceipt({ hash: result!.hash as `0x${string}` }); + expect(receipt.status).toBe("success"); + const expectedGasUsed = calculateEIP7623Gas( + numZeroBytes, + numNonZeroBytes, + expectedModExpGasCost + ); + expect(receipt.gasUsed, "ModExp gas pricing mismatch").to.equal(expectedGasUsed); + }, + }); + + it({ + id: "T17", + title: "nagydani-4-pow0x10001 - gas", + modifier: "skip", + test: async function () { + const expectedModExpGasCost = 23514n; + const inputData = + "0000000000000000000000000000000000000000000000000000000000000200" + // base length + "0000000000000000000000000000000000000000000000000000000000000003" + // exponent length + "0000000000000000000000000000000000000000000000000000000000000200" + // modulus length + testVectors["nagydani-4-pow0x10001"].base + + testVectors["nagydani-4-pow0x10001"].exponent + + testVectors["nagydani-4-pow0x10001"].modulus; + const byteArray = hexToU8a(inputData); + const inputLength = byteArray.length; + const numZeroBytes = byteArray.filter((a) => a === 0).length; + const numNonZeroBytes = inputLength - numZeroBytes; + + const rawTxn = await createViemTransaction(context, { + to: MODEXP_PRECOMPILE_ADDRESS, + data: ("0x" + inputData) as `0x${string}`, + gas: EXTRINSIC_GAS_LIMIT, + }); + const { result } = await context.createBlock(rawTxn); + + const receipt = await context + .viem() + .getTransactionReceipt({ hash: result!.hash as `0x${string}` }); + expect(receipt.status).toBe("success"); + const expectedGasUsed = calculateEIP7623Gas( + numZeroBytes, + numNonZeroBytes, + expectedModExpGasCost + ); + expect(receipt.gasUsed, "ModExp gas pricing mismatch").to.equal(expectedGasUsed); + }, + }); + + it({ + id: "T18", + title: "nagydani-5-square - gas", + modifier: "skip", + test: async function () { + const expectedModExpGasCost = 7130n; + const inputData = + "0000000000000000000000000000000000000000000000000000000000000400" + // base length + "0000000000000000000000000000000000000000000000000000000000000001" + // exponent length + "0000000000000000000000000000000000000000000000000000000000000400" + // modulus length + testVectors["nagydani-5-square"].base + + testVectors["nagydani-5-square"].exponent + + testVectors["nagydani-5-square"].modulus; + const byteArray = hexToU8a(inputData); + const inputLength = byteArray.length; + const numZeroBytes = byteArray.filter((a) => a === 0).length; + const numNonZeroBytes = inputLength - numZeroBytes; + + const rawTxn = await createViemTransaction(context, { + to: MODEXP_PRECOMPILE_ADDRESS, + data: ("0x" + inputData) as `0x${string}`, + gas: EXTRINSIC_GAS_LIMIT, + }); + const { result } = await context.createBlock(rawTxn); + + const receipt = await context + .viem() + .getTransactionReceipt({ hash: result!.hash as `0x${string}` }); + expect(receipt.status).toBe("success"); + const expectedGasUsed = calculateEIP7623Gas( + numZeroBytes, + numNonZeroBytes, + expectedModExpGasCost + ); + expect(receipt.gasUsed, "ModExp gas pricing mismatch").to.equal(expectedGasUsed); + }, + }); + + it({ + id: "T19", + title: "nagydani-5-qube - gas", + modifier: "skip", + test: async function () { + const expectedModExpGasCost = 7130n; + const inputData = + "0000000000000000000000000000000000000000000000000000000000000400" + // base length + "0000000000000000000000000000000000000000000000000000000000000001" + // exponent length + "0000000000000000000000000000000000000000000000000000000000000400" + // modulus length + testVectors["nagydani-5-qube"].base + + testVectors["nagydani-5-qube"].exponent + + testVectors["nagydani-5-qube"].modulus; + const byteArray = hexToU8a(inputData); + const inputLength = byteArray.length; + const numZeroBytes = byteArray.filter((a) => a === 0).length; + const numNonZeroBytes = inputLength - numZeroBytes; + + const rawTxn = await createViemTransaction(context, { + to: MODEXP_PRECOMPILE_ADDRESS, + data: ("0x" + inputData) as `0x${string}`, + gas: EXTRINSIC_GAS_LIMIT, + }); + const { result } = await context.createBlock(rawTxn); + + const receipt = await context + .viem() + .getTransactionReceipt({ hash: result!.hash as `0x${string}` }); + expect(receipt.status).toBe("success"); + const expectedGasUsed = calculateEIP7623Gas( + numZeroBytes, + numNonZeroBytes, + expectedModExpGasCost + ); + expect(receipt.gasUsed, "ModExp gas pricing mismatch").to.equal(expectedGasUsed); + }, + }); + + it({ + id: "T20", + title: "nagydani-5-pow0x10001 - gas", + modifier: "skip", + test: async function () { + const expectedModExpGasCost = 89749n; + const inputData = + "0000000000000000000000000000000000000000000000000000000000000400" + // base length + "0000000000000000000000000000000000000000000000000000000000000003" + // exponent length + "0000000000000000000000000000000000000000000000000000000000000400" + // modulus length + testVectors["nagydani-5-pow0x10001"].base + + testVectors["nagydani-5-pow0x10001"].exponent + + testVectors["nagydani-5-pow0x10001"].modulus; + const byteArray = hexToU8a(inputData); + const inputLength = byteArray.length; + const numZeroBytes = byteArray.filter((a) => a === 0).length; + const numNonZeroBytes = inputLength - numZeroBytes; + + const rawTxn = await createViemTransaction(context, { + to: MODEXP_PRECOMPILE_ADDRESS, + data: ("0x" + inputData) as `0x${string}`, + gas: EXTRINSIC_GAS_LIMIT, + }); + const { result } = await context.createBlock(rawTxn); + + const receipt = await context + .viem() + .getTransactionReceipt({ hash: result!.hash as `0x${string}` }); + expect(receipt.status).toBe("success"); + const expectedGasUsed = calculateEIP7623Gas( + numZeroBytes, + numNonZeroBytes, + expectedModExpGasCost + ); + expect(receipt.gasUsed, "ModExp gas pricing mismatch").to.equal(expectedGasUsed); + }, + }); + + it({ + id: "T21", + title: "Exponent > 32", + modifier: "skip", + test: async function () { + // We multiply by a factor of 20 for an even mod. + // See https://github.com/paritytech/frontier/pull/1017 + const expectedModExpGasCost = 7104n * 20n; + const byteArray = new Uint8Array([ + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x26, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x60, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x10, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0x02, 0x0, 0x0, + 0xb3, 0x0, 0x0, 0x02, 0x0, 0x0, 0x7a, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, + 0xfb, 0x0, 0x0, 0x0, 0x0, 0x04, 0x26, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 96, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x10, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0x02, 0x0, 0x0, 0xb3, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0xff, 0xf9, + ]); + const inputData = u8aToHex(byteArray); + const inputLength = byteArray.length; + const numZeroBytes = byteArray.filter((a) => a === 0).length; + const numNonZeroBytes = inputLength - numZeroBytes; + + const rawTxn = await createViemTransaction(context, { + to: MODEXP_PRECOMPILE_ADDRESS, + data: inputData, + gas: EXTRINSIC_GAS_LIMIT, + }); + const { result } = await context.createBlock(rawTxn); + + const receipt = await context + .viem() + .getTransactionReceipt({ hash: result!.hash as `0x${string}` }); + expect(receipt.status).toBe("success"); + const isPrecompileCheckGas = 2368n; + const expectedGasUsed = calculateEIP7623Gas( + numZeroBytes, + numNonZeroBytes, + expectedModExpGasCost + isPrecompileCheckGas + ); + expect(receipt.gasUsed, "ModExp gas pricing mismatch").to.equal(expectedGasUsed); + }, + }); + + it({ + id: "T22", + title: "should pad input when too short", + test: async function () { + const inputData = + "0000000000000000000000000000000000000000000000000000000000000001" + // base length + "0000000000000000000000000000000000000000000000000000000000000001" + // exponent length + "0000000000000000000000000000000000000000000000000000000000000002" + // modulus length + "05" + // base + "03" + // exponent + "01"; // modulus + + const rawTxn = await createViemTransaction(context, { + to: MODEXP_PRECOMPILE_ADDRESS, + data: ("0x" + inputData) as `0x${string}`, + gas: EXTRINSIC_GAS_LIMIT, + }); + const { result } = await context.createBlock(rawTxn); + + const receipt = await context + .viem() + .getTransactionReceipt({ hash: result!.hash as `0x${string}` }); + expect(receipt.status).toBe("success"); + }, + }); + }, +}); diff --git a/test/moonwall/suites/dev/stagenet/precompile/test-precompile-preimage.ts b/test/moonwall/suites/dev/stagenet/precompile/test-precompile-preimage.ts new file mode 100644 index 00000000..7e6cb95d --- /dev/null +++ b/test/moonwall/suites/dev/stagenet/precompile/test-precompile-preimage.ts @@ -0,0 +1,106 @@ +import "@moonbeam-network/api-augment"; +import { beforeAll, beforeEach, describeSuite, expect, fetchCompiledContract } from "@moonwall/cli"; +import { type Abi, decodeEventLog } from "viem"; +import { Preimage, expectEVMResult, expectSubstrateEvent } from "../../../../helpers"; + +// Each test is instantiating a new proposal (Not ideal for isolation but easier to write) +// Be careful to not reach the maximum number of proposals. +describeSuite({ + id: "D030501", + title: "Precompiles - Preimage precompile", + foundationMethods: "dev", + testCases: ({ it, log, context }) => { + let PreimageAbi: Abi; + let preimage: Preimage; + + beforeAll(async function () { + const { abi } = fetchCompiledContract("Preimage"); + PreimageAbi = abi; + }); + + beforeEach(async function () { + preimage = new Preimage(context); + }); + + it({ + id: "T01", + title: "should allow to note Preimage", + test: async function () { + const call = context.polkadotJs().tx.identity.setIdentity({ display: { raw: "Me" } }); + const block = await preimage.notePreimage(call.toHex()).block(); + + // Verifies the EVM Side + expectEVMResult(block.result!.events, "Succeed"); + const { data } = expectSubstrateEvent(block, "evm", "Log"); + const evmLog = decodeEventLog({ + abi: PreimageAbi, + topics: data[0].topics.map((t) => t.toHex()) as any, + data: data[0].data.toHex(), + }) as any; + expect(evmLog.eventName, "Wrong event").to.equal("PreimageNoted"); + expect(evmLog.args.hash).to.equal(call.hash.toHex()); + + // Verifies the Substrate side + const preImage = await context + .polkadotJs() + .query.preimage.preimageFor([call.hash.toHex(), 15]); + expect(preImage.unwrap().toHex()).to.equal(call.toHex()); + }, + }); + + it({ + id: "T02", + title: "should allow to unnote a Preimage", + test: async function () { + const call = context.polkadotJs().tx.identity.setIdentity({ display: { raw: "You" } }); + await preimage.notePreimage(call.toHex()).block(); + const block = await preimage.unnotePreimage(call.hash.toHex()).block(); + + // Verifies the EVM Side + expectEVMResult(block.result!.events, "Succeed"); + const { data } = expectSubstrateEvent(block, "evm", "Log"); + const evmLog = decodeEventLog({ + abi: PreimageAbi, + topics: data[0].topics.map((t) => t.toHex()) as any, + data: data[0].data.toHex(), + }) as any; + // context.readPrecompile!({functionName}) + expect(evmLog.eventName, "Wrong event").to.equal("PreimageUnnoted"); + expect(evmLog.args.hash).to.equal(call.hash.toHex()); + + // Verifies the Substrate side + const preImage = await context + .polkadotJs() + .query.preimage.preimageFor([call.hash.toHex(), 1000]); + expect(preImage.isNone).to.equal(true); + }, + }); + + it({ + id: "T03", + title: "should fail to note the same Preimage twice", + test: async function () { + const call = context.polkadotJs().tx.identity.setIdentity({ display: { raw: "Repeated" } }); + await preimage.notePreimage(call.toHex()).block(); + await expect( + async () => await preimage.notePreimage(call.toHex()).block(), + "Transaction should be reverted but instead preimage noted" + ).rejects.toThrowError("AlreadyNoted"); + }, + }); + + it({ + id: "T04", + title: "should fail to unnote a missing Preimage", + test: async function () { + const call = context + .polkadotJs() + .tx.identity.setIdentity({ display: { raw: "Missing Preimage" } }); + await expect( + async () => await preimage.unnotePreimage(call.hash.toHex()).block(), + "Transaction should be reverted but instead preimage unnoted" + ).rejects.toThrowError("NotNoted"); + }, + }); + }, +}); diff --git a/test/moonwall/suites/dev/stagenet/precompile/test-precompile-proxy.ts b/test/moonwall/suites/dev/stagenet/precompile/test-precompile-proxy.ts new file mode 100644 index 00000000..62c39bb0 --- /dev/null +++ b/test/moonwall/suites/dev/stagenet/precompile/test-precompile-proxy.ts @@ -0,0 +1,544 @@ +/** + * Proxy precompile tests + * Tests the Proxy precompile API for managing proxy accounts via EVM + */ + +import { describeSuite, expect, fetchCompiledContract } from "@moonwall/cli"; +import { + ALITH_ADDRESS, + BALTATHAR_ADDRESS, + BALTATHAR_PRIVATE_KEY, + CHARLETH_ADDRESS, + CHARLETH_PRIVATE_KEY, + createViemTransaction, + sendRawTransaction, +} from "@moonwall/util"; +import { encodeFunctionData } from "viem"; +import { generatePrivateKey, privateKeyToAccount } from "viem/accounts"; +import { expectEVMResult, PRECOMPILE_PROXY_ADDRESS } from "../../../../helpers"; + +// Proxy type constants (matching Substrate proxy types from Proxy.sol) +const CONTRACT_PROXY_TYPE_ANY = 0; +const CONTRACT_PROXY_TYPE_NON_TRANSFER = 1; +const CONTRACT_PROXY_TYPE_GOVERNANCE = 2; +const CONTRACT_PROXY_TYPE_STAKING = 3; +const CONTRACT_PROXY_TYPE_CANCEL_PROXY = 4; +const CONTRACT_PROXY_TYPE_BALANCES = 5; + +// Invalid proxy type for testing error handling +const CONTRACT_PROXY_TYPE_INVALID = 99; + +describeSuite({ + id: "D030601", + title: "Precompile - Proxy", + foundationMethods: "dev", + testCases: ({ it, log, context }) => { + it({ + id: "T01", + title: "should succeed adding a proxy", + test: async () => { + const randomAccount = privateKeyToAccount(generatePrivateKey()).address; + + const rawTx = await context.writeContract!({ + contractAddress: PRECOMPILE_PROXY_ADDRESS, + contractName: "Proxy", + functionName: "addProxy", + args: [randomAccount, CONTRACT_PROXY_TYPE_STAKING, 0], + rawTxOnly: true, + }); + const { result } = await context.createBlock(rawTx); + expectEVMResult(result!.events, "Succeed"); + + // Verify proxy was added via substrate + const proxies = await context.polkadotJs().query.proxy.proxies(ALITH_ADDRESS); + const hasProxy = proxies[0].some( + (p: any) => + p.delegate.toString() === randomAccount && p.proxyType.toString() === "Staking" + ); + expect(hasProxy).to.be.true; + }, + }); + + it({ + id: "T02", + title: "should fail re-adding the same proxy", + test: async () => { + const randomAccount = privateKeyToAccount(generatePrivateKey()).address; + + // First add + const rawTx = await context.writeContract!({ + contractAddress: PRECOMPILE_PROXY_ADDRESS, + contractName: "Proxy", + functionName: "addProxy", + args: [randomAccount, CONTRACT_PROXY_TYPE_STAKING, 0], + rawTxOnly: true, + }); + await context.createBlock(rawTx); + + // Second add should fail with exact error message + await expect( + async () => + await context.writeContract!({ + contractAddress: PRECOMPILE_PROXY_ADDRESS, + contractName: "Proxy", + functionName: "addProxy", + args: [randomAccount, CONTRACT_PROXY_TYPE_STAKING, 0], + }) + ).rejects.toThrowError("Cannot add more than one proxy"); + }, + }); + + it({ + id: "T03", + title: "should fail removing non-existent proxy", + test: async () => { + const randomAccount = privateKeyToAccount(generatePrivateKey()).address; + + await expect( + async () => + await context.writeContract!({ + contractAddress: PRECOMPILE_PROXY_ADDRESS, + contractName: "Proxy", + functionName: "removeProxy", + args: [randomAccount, CONTRACT_PROXY_TYPE_STAKING, 0], + }) + ).rejects.toThrowError(/NotFound/i); + }, + }); + + it({ + id: "T04", + title: "should succeed removing an existing proxy", + test: async () => { + const randomAccount = privateKeyToAccount(generatePrivateKey()).address; + + // Add proxy + const addTx = await context.writeContract!({ + contractAddress: PRECOMPILE_PROXY_ADDRESS, + contractName: "Proxy", + functionName: "addProxy", + args: [randomAccount, CONTRACT_PROXY_TYPE_STAKING, 0], + rawTxOnly: true, + }); + await context.createBlock(addTx); + + // Remove proxy + const rawTx = await context.writeContract!({ + contractAddress: PRECOMPILE_PROXY_ADDRESS, + contractName: "Proxy", + functionName: "removeProxy", + args: [randomAccount, CONTRACT_PROXY_TYPE_STAKING, 0], + rawTxOnly: true, + }); + const { result } = await context.createBlock(rawTx); + expectEVMResult(result!.events, "Succeed"); + + // Verify proxy was removed + const proxies = await context.polkadotJs().query.proxy.proxies(ALITH_ADDRESS); + const hasProxy = proxies[0].some((p: any) => p.delegate.toString() === randomAccount); + expect(hasProxy).to.be.false; + }, + }); + + it({ + id: "T05", + title: "should succeed removing all proxies", + test: async () => { + // First ensure no proxies exist + const proxiesInitial = await context.polkadotJs().query.proxy.proxies(ALITH_ADDRESS); + if (proxiesInitial[0].length > 0) { + const clearTx = await context.writeContract!({ + contractAddress: PRECOMPILE_PROXY_ADDRESS, + contractName: "Proxy", + functionName: "removeProxies", + rawTxOnly: true, + }); + await context.createBlock(clearTx); + } + + // Add exactly two proxies + const account1 = privateKeyToAccount(generatePrivateKey()).address; + const account2 = privateKeyToAccount(generatePrivateKey()).address; + + const addTx1 = await context.writeContract!({ + contractAddress: PRECOMPILE_PROXY_ADDRESS, + contractName: "Proxy", + functionName: "addProxy", + args: [account1, CONTRACT_PROXY_TYPE_STAKING, 0], + rawTxOnly: true, + }); + await context.createBlock(addTx1); + + const addTx2 = await context.writeContract!({ + contractAddress: PRECOMPILE_PROXY_ADDRESS, + contractName: "Proxy", + functionName: "addProxy", + args: [account2, CONTRACT_PROXY_TYPE_GOVERNANCE, 0], + rawTxOnly: true, + }); + await context.createBlock(addTx2); + + const proxiesBefore = await context.polkadotJs().query.proxy.proxies(ALITH_ADDRESS); + expect(proxiesBefore[0].length).toBe(2); + + // Remove all proxies + const rawTx = await context.writeContract!({ + contractAddress: PRECOMPILE_PROXY_ADDRESS, + contractName: "Proxy", + functionName: "removeProxies", + rawTxOnly: true, + }); + const { result } = await context.createBlock(rawTx); + expectEVMResult(result!.events, "Succeed"); + + const proxiesAfter = await context.polkadotJs().query.proxy.proxies(ALITH_ADDRESS); + expect(proxiesAfter[0].length).toBe(0); + }, + }); + + it({ + id: "T06", + title: "should correctly report proxy status via isProxy", + test: async () => { + const randomAccount = privateKeyToAccount(generatePrivateKey()).address; + + // Check isProxy returns false before adding any proxy + const isProxyBefore = await context.readContract!({ + contractAddress: PRECOMPILE_PROXY_ADDRESS, + contractName: "Proxy", + functionName: "isProxy", + args: [ALITH_ADDRESS, randomAccount, CONTRACT_PROXY_TYPE_STAKING, 0], + }); + expect(isProxyBefore).to.be.false; + + // Add proxy + const rawTx = await context.writeContract!({ + contractAddress: PRECOMPILE_PROXY_ADDRESS, + contractName: "Proxy", + functionName: "addProxy", + args: [randomAccount, CONTRACT_PROXY_TYPE_STAKING, 0], + rawTxOnly: true, + }); + await context.createBlock(rawTx); + + // Check isProxy returns true for correct parameters + const isProxy = await context.readContract!({ + contractAddress: PRECOMPILE_PROXY_ADDRESS, + contractName: "Proxy", + functionName: "isProxy", + args: [ALITH_ADDRESS, randomAccount, CONTRACT_PROXY_TYPE_STAKING, 0], + }); + expect(isProxy).to.be.true; + + // Check isProxy returns false for wrong type + const isProxyWrongType = await context.readContract!({ + contractAddress: PRECOMPILE_PROXY_ADDRESS, + contractName: "Proxy", + functionName: "isProxy", + args: [ALITH_ADDRESS, randomAccount, CONTRACT_PROXY_TYPE_ANY, 0], + }); + expect(isProxyWrongType).to.be.false; + + // Check isProxy returns false for wrong delay + const isProxyWrongDelay = await context.readContract!({ + contractAddress: PRECOMPILE_PROXY_ADDRESS, + contractName: "Proxy", + functionName: "isProxy", + args: [ALITH_ADDRESS, randomAccount, CONTRACT_PROXY_TYPE_STAKING, 2], + }); + expect(isProxyWrongDelay).to.be.false; + }, + }); + + it({ + id: "T07", + title: "should reject proxy call from non-proxy account", + test: async () => { + // BALTATHAR tries to make a proxy call on behalf of ALITH without being a proxy + const { abi } = fetchCompiledContract("Proxy"); + await expect( + async () => + await context.writeContract!({ + contractAddress: PRECOMPILE_PROXY_ADDRESS, + contractName: "Proxy", + functionName: "proxy", + args: [ALITH_ADDRESS, CHARLETH_ADDRESS, "0x00"], + privateKey: BALTATHAR_PRIVATE_KEY, + }) + ).rejects.toThrowError("Not proxy"); + }, + }); + + it({ + id: "T08", + title: "should allow proxy call from valid proxy account", + test: async () => { + const privateKey = generatePrivateKey(); + const randomAccount = privateKeyToAccount(privateKey).address; + + // Add BALTATHAR as proxy for ALITH with Any type + const rawTx = await context.writeContract!({ + contractAddress: PRECOMPILE_PROXY_ADDRESS, + contractName: "Proxy", + functionName: "addProxy", + args: [BALTATHAR_ADDRESS, CONTRACT_PROXY_TYPE_ANY, 0], + rawTxOnly: true, + }); + await context.createBlock(rawTx); + + // Use BALTATHAR to transfer value on behalf of ALITH + const { abi } = fetchCompiledContract("Proxy"); + const proxyTx = await createViemTransaction(context, { + to: PRECOMPILE_PROXY_ADDRESS, + privateKey: BALTATHAR_PRIVATE_KEY, + value: 1000n, + data: encodeFunctionData({ + abi, + functionName: "proxy", + args: [ALITH_ADDRESS, randomAccount, "0x00"], + }), + }); + const txHash = (await sendRawTransaction(context, proxyTx)) as `0x${string}`; + + // Create two blocks to ensure the transaction is included + await context.createBlock(); + await context.createBlock(); + + const receipt = await context.viem().getTransactionReceipt({ hash: txHash }); + expect(receipt.status).toBe("success"); + + // Verify transfer happened + expect(await context.viem().getBalance({ address: randomAccount })).toBe(1000n); + }, + }); + + it({ + id: "T09", + title: "should succeed with proxyForceType for matching proxy type", + test: async () => { + const privateKey = generatePrivateKey(); + const randomAccount = privateKeyToAccount(privateKey).address; + + // Add CHARLETH as Balances proxy for ALITH + const rawTx = await context.writeContract!({ + contractAddress: PRECOMPILE_PROXY_ADDRESS, + contractName: "Proxy", + functionName: "addProxy", + args: [CHARLETH_ADDRESS, CONTRACT_PROXY_TYPE_BALANCES, 0], + rawTxOnly: true, + }); + await context.createBlock(rawTx); + + // Use CHARLETH to transfer value on behalf of ALITH using proxyForceType + const { abi } = fetchCompiledContract("Proxy"); + const proxyTx = await createViemTransaction(context, { + to: PRECOMPILE_PROXY_ADDRESS, + privateKey: CHARLETH_PRIVATE_KEY, + value: 500n, + data: encodeFunctionData({ + abi, + functionName: "proxyForceType", + args: [ALITH_ADDRESS, CONTRACT_PROXY_TYPE_BALANCES, randomAccount, "0x00"], + }), + }); + const { result } = await context.createBlock(proxyTx); + expectEVMResult(result!.events, "Succeed"); + + // Verify transfer happened + expect(await context.viem().getBalance({ address: randomAccount })).toBe(500n); + }, + }); + + it({ + id: "T10", + title: "should fail proxyForceType with mismatched proxy type", + test: async () => { + // CHARLETH is a Balances proxy for ALITH (from T09 or set up here) + const proxies = await context.polkadotJs().query.proxy.proxies(ALITH_ADDRESS); + const hasBalancesProxy = proxies[0].some( + (p: any) => + p.delegate.toString() === CHARLETH_ADDRESS && p.proxyType.toString() === "Balances" + ); + + if (!hasBalancesProxy) { + const rawTx = await context.writeContract!({ + contractAddress: PRECOMPILE_PROXY_ADDRESS, + contractName: "Proxy", + functionName: "addProxy", + args: [CHARLETH_ADDRESS, CONTRACT_PROXY_TYPE_BALANCES, 0], + rawTxOnly: true, + }); + await context.createBlock(rawTx); + } + + // Try to use proxyForceType with Governance type (CHARLETH only has Balances) + await expect( + async () => + await context.writeContract!({ + contractAddress: PRECOMPILE_PROXY_ADDRESS, + contractName: "Proxy", + functionName: "proxyForceType", + args: [ALITH_ADDRESS, CONTRACT_PROXY_TYPE_GOVERNANCE, BALTATHAR_ADDRESS, "0x00"], + privateKey: CHARLETH_PRIVATE_KEY, + }) + ).rejects.toThrowError(/Not proxy/i); + }, + }); + + it({ + id: "T11", + title: "should fail addProxy with invalid proxy type value", + test: async () => { + const randomAccount = privateKeyToAccount(generatePrivateKey()).address; + + await expect( + async () => + await context.writeContract!({ + contractAddress: PRECOMPILE_PROXY_ADDRESS, + contractName: "Proxy", + functionName: "addProxy", + args: [randomAccount, CONTRACT_PROXY_TYPE_INVALID, 0], + }) + ).rejects.toThrowError(/Failed decoding value to ProxyType/i); + }, + }); + + it({ + id: "T12", + title: "should succeed removeProxies when no proxies exist", + test: async () => { + // Use a fresh account that has no proxies + const privateKey = generatePrivateKey(); + const freshAccount = privateKeyToAccount(privateKey); + + // Fund the fresh account so it can make transactions + const fundTx = await createViemTransaction(context, { + to: freshAccount.address, + value: 10n * 10n ** 18n, // 10 tokens + }); + await context.createBlock(fundTx); + + // Verify no proxies exist for this account + const proxiesBefore = await context + .polkadotJs() + .query.proxy.proxies(freshAccount.address); + expect(proxiesBefore[0].length).toBe(0); + + // removeProxies should succeed even with no proxies + const rawTx = await context.writeContract!({ + contractAddress: PRECOMPILE_PROXY_ADDRESS, + contractName: "Proxy", + functionName: "removeProxies", + privateKey: privateKey, + rawTxOnly: true, + }); + const { result } = await context.createBlock(rawTx); + expectEVMResult(result!.events, "Succeed"); + }, + }); + + it({ + id: "T13", + title: "should correctly handle non-zero delay proxy", + test: async () => { + const randomAccount = privateKeyToAccount(generatePrivateKey()).address; + const delay = 5; + + // Add proxy with non-zero delay + const rawTx = await context.writeContract!({ + contractAddress: PRECOMPILE_PROXY_ADDRESS, + contractName: "Proxy", + functionName: "addProxy", + args: [randomAccount, CONTRACT_PROXY_TYPE_STAKING, delay], + rawTxOnly: true, + }); + const { result } = await context.createBlock(rawTx); + expectEVMResult(result!.events, "Succeed"); + + // Verify proxy was added with correct delay via substrate + const proxies = await context.polkadotJs().query.proxy.proxies(ALITH_ADDRESS); + const proxyEntry = proxies[0].find( + (p: any) => + p.delegate.toString() === randomAccount && p.proxyType.toString() === "Staking" + ); + expect(proxyEntry).toBeDefined(); + expect(proxyEntry.delay.toNumber()).toBe(delay); + + // isProxy should return true with correct delay + const isProxyCorrectDelay = await context.readContract!({ + contractAddress: PRECOMPILE_PROXY_ADDRESS, + contractName: "Proxy", + functionName: "isProxy", + args: [ALITH_ADDRESS, randomAccount, CONTRACT_PROXY_TYPE_STAKING, delay], + }); + expect(isProxyCorrectDelay).to.be.true; + + // isProxy should return false with wrong delay (0) + const isProxyWrongDelay = await context.readContract!({ + contractAddress: PRECOMPILE_PROXY_ADDRESS, + contractName: "Proxy", + functionName: "isProxy", + args: [ALITH_ADDRESS, randomAccount, CONTRACT_PROXY_TYPE_STAKING, 0], + }); + expect(isProxyWrongDelay).to.be.false; + }, + }); + + it({ + id: "T14", + title: "should fail proxyForceType with invalid proxy type value", + test: async () => { + await expect( + async () => + await context.writeContract!({ + contractAddress: PRECOMPILE_PROXY_ADDRESS, + contractName: "Proxy", + functionName: "proxyForceType", + args: [ALITH_ADDRESS, CONTRACT_PROXY_TYPE_INVALID, CHARLETH_ADDRESS, "0x00"], + privateKey: BALTATHAR_PRIVATE_KEY, + }) + ).rejects.toThrowError(/Failed decoding value to ProxyType/i); + }, + }); + + it({ + id: "T15", + title: "should fail adding proxy with different type for same delegate", + test: async () => { + const randomAccount = privateKeyToAccount(generatePrivateKey()).address; + + // First add with Staking type + const rawTx = await context.writeContract!({ + contractAddress: PRECOMPILE_PROXY_ADDRESS, + contractName: "Proxy", + functionName: "addProxy", + args: [randomAccount, CONTRACT_PROXY_TYPE_STAKING, 0], + rawTxOnly: true, + }); + await context.createBlock(rawTx); + + // Try to add same delegate with different type (Any - more permissive) + await expect( + async () => + await context.writeContract!({ + contractAddress: PRECOMPILE_PROXY_ADDRESS, + contractName: "Proxy", + functionName: "addProxy", + args: [randomAccount, CONTRACT_PROXY_TYPE_ANY, 0], + }) + ).rejects.toThrowError("Cannot add more than one proxy"); + + // Try to add same delegate with different type (Governance - less permissive) + await expect( + async () => + await context.writeContract!({ + contractAddress: PRECOMPILE_PROXY_ADDRESS, + contractName: "Proxy", + functionName: "addProxy", + args: [randomAccount, CONTRACT_PROXY_TYPE_GOVERNANCE, 0], + }) + ).rejects.toThrowError("Cannot add more than one proxy"); + }, + }); + }, +}); diff --git a/test/moonwall/suites/dev/stagenet/precompile/test-precompile-ripemd160.ts b/test/moonwall/suites/dev/stagenet/precompile/test-precompile-ripemd160.ts new file mode 100644 index 00000000..05167d35 --- /dev/null +++ b/test/moonwall/suites/dev/stagenet/precompile/test-precompile-ripemd160.ts @@ -0,0 +1,50 @@ +/** + * RIPEMD-160 precompile tests + * Adapted from Moonbeam test suite + */ + +import { describeSuite, expect } from "@moonwall/cli"; +import { toHex } from "viem"; +import { expectEVMResult } from "../../../../helpers"; + +describeSuite({ + id: "D030105", + title: "Precompiles - ripemd160", + foundationMethods: "dev", + testCases: ({ context, log, it }) => { + it({ + id: "T01", + title: "should be valid", + test: async function () { + expect( + ( + await context.viem().call({ + to: "0x0000000000000000000000000000000000000003", + data: toHex("Hello world!"), + }) + ).data + ).equals("0x0000000000000000000000007f772647d88750add82d8e1a7a3e5c0902a346a3"); + }, + }); + + it({ + id: "T02", + title: "should be accessible from a smart contract", + test: async function () { + const { contractAddress } = await context.deployContract!("HasherChecker"); + + // Execute the contract ripemd160 call + const rawTxn = await context.writeContract!({ + contractAddress, + contractName: "HasherChecker", + functionName: "ripemd160Check", + rawTxOnly: true, + }); + + const { result } = await context.createBlock(rawTxn); + + expectEVMResult(result!.events, "Succeed"); + }, + }); + }, +}); diff --git a/test/moonwall/suites/dev/stagenet/precompile/test-precompile-sha3fips.ts b/test/moonwall/suites/dev/stagenet/precompile/test-precompile-sha3fips.ts new file mode 100644 index 00000000..c98efe96 --- /dev/null +++ b/test/moonwall/suites/dev/stagenet/precompile/test-precompile-sha3fips.ts @@ -0,0 +1,30 @@ +/** + * SHA3-FIPS precompile tests + * Adapted from Moonbeam test suite + */ + +import { describeSuite, expect } from "@moonwall/cli"; + +describeSuite({ + id: "D030106", + title: "Precompiles - sha3fips", + foundationMethods: "dev", + testCases: ({ context, it, log }) => { + // Test taken from https://github.com/binance-chain/bsc/pull/118 + it({ + id: "T01", + title: "sha3fips should be valid", + test: async function () { + expect( + ( + await context.viem().call({ + to: "0x0000000000000000000000000000000000000400", + data: ("0x0448250ebe88d77e0a12bcf530fe6a2cf1ac176945638d309b840d631940c93b78c2bd" + + "6d16f227a8877e3f1604cd75b9c5a8ab0cac95174a8a0a0f8ea9e4c10bca") as `0x${string}`, + }) + ).data + ).equals("0xc7647f7e251bf1bd70863c8693e93a4e77dd0c9a689073e987d51254317dc704"); + }, + }); + }, +}); From 46d752da015e49c5b9af5f2058b3eb3ab03c0353 Mon Sep 17 00:00:00 2001 From: Steve Degosserie <723552+stiiifff@users.noreply.github.com> Date: Mon, 2 Feb 2026 16:41:15 +0100 Subject: [PATCH 2/5] feat: Add DH-AVS stagenet/testnet Hoodi deployment support (#422) ## Summary - Add multi-environment deployment support (stagenet, testnet, mainnet) to CLI and contracts - Configure stagenet and testnet runtimes with correct genesis hashes and Snowbridge Agent IDs - Add CLI commands for BEEFY checkpoint updates and rewards origin computation - Add ETH validator strategies (native beacon chain ETH + LSTs) to all config files ## Changes ### Runtime Configuration **Stagenet Runtime:** - Set `StagenetGenesisHash` to DataHaven stagenet genesis hash - Configure `RewardsAgentOrigin` with computed Snowbridge Agent ID - Add tests verifying rewards account derivation and agent ID computation **Testnet Runtime:** - Set `TestnetGenesisHash` to DataHaven testnet genesis hash - Configure `RewardsAgentOrigin` with computed Snowbridge Agent ID - Add tests verifying rewards account derivation and agent ID computation The Rewards Agent ID is computed following Snowbridge's location description pattern: ``` blake2_256(SCALE_ENCODE("GlobalConsensus", ByGenesis(genesis), "AccountKey20", rewards_account)) ``` ### CLI Enhancements - All contracts subcommands (`status`, `deploy`, `verify`, `update-metadata`) now accept `--environment` option - Config and deployment files use environment-prefixed naming (e.g., `stagenet-hoodi.json`, `testnet-hoodi.json`) - New `update-beefy-checkpoint` command that: - Connects to a live DataHaven chain via WebSocket RPC - Fetches all BEEFY data at the same finalized block for consistency - Uses parallel queries with `Promise.all` for better performance - Computes authority hashes (keccak256 of Ethereum addresses derived from BEEFY public keys) - Uses Snowbridge's quorum formula `n - floor((n-1)/3)` for strictly > 2/3 majority - New `update-rewards-origin` command that computes the Snowbridge Agent ID for the rewards pallet - Centralized validation via `contractsPreActionHook` for all contract commands - Environment validation against allowlist (`stagenet`, `testnet`, `mainnet`) ### Contract Changes - Network validation uses explicit allowlist instead of suffix matching - Added `initialValidatorSetId` and `nextValidatorSetId` fields to `SnowbridgeConfig` struct - `DeployBase.s.sol` now uses config values for validator set IDs instead of hardcoded 0/1 - `DeployParams.s.sol` loads validator set IDs from config with backwards compatibility ### Validator Strategies Added ETH-equivalent strategies to allow validators to stake using native ETH or LSTs: **All Networks:** - `0xbeaC0eeEeeeeEEeEeEEEEeeEEeEeeeEeeEEBEaC0` - Native beacon chain ETH (virtual strategy) **Hoodi Testnet:** - `0xf8a1a66130d614c7360e868576d5e59203475fe0` - stETH - `0x24579aD4fe83aC53546E5c2D3dF5F85D6383420d` - WETH **Ethereum Mainnet:** - `0x93c4b944D05dfe6df7645A86cd2206016c51564D` - stETH - `0x1BeE69b7dFFfA4E2d53C2a2Df135C388AD25dCD2` - rETH - `0x54945180dB7943c0ed0FEE7EdaB2Bd24620256bc` - cbETH ### Config Files - `stagenet-hoodi.json` - Hoodi testnet with stagenet EigenLayer addresses - `testnet-hoodi.json` - Hoodi testnet with testnet EigenLayer addresses - `mainnet-ethereum.json` - Ethereum mainnet with mainnet EigenLayer addresses - Removed `hoodi.json` (replaced by environment-prefixed files) ## Usage ```bash # Deploy to stagenet on Hoodi bun cli contracts deploy --chain hoodi --environment stagenet # Update BEEFY checkpoint from live chain bun cli contracts update-beefy-checkpoint \ --chain hoodi \ --environment stagenet \ --rpc-url wss://services.datahaven-dev.network/stagenet # Compute rewards origin for a chain bun cli contracts update-rewards-origin \ --chain hoodi \ --environment stagenet \ --rpc-url wss://services.datahaven-dev.network/stagenet # Check deployment status bun cli contracts status --chain hoodi --environment stagenet ``` --------- Co-authored-by: Claude Opus 4.5 --- contracts/config/anvil.json | 6 +- contracts/config/example.jsonc | 25 +- contracts/config/mainnet-ethereum.json | 54 +++ .../{hoodi.json => stagenet-hoodi.json} | 30 +- contracts/config/testnet-hoodi.json | 71 ++++ contracts/script/deploy/Config.sol | 2 + contracts/script/deploy/DeployBase.s.sol | 10 +- .../{DeployTestnet.s.sol => DeployLive.s.sol} | 52 +-- contracts/script/deploy/DeployParams.s.sol | 18 + operator/runtime/stagenet/src/configs/mod.rs | 95 ++++- .../stagenet/src/configs/runtime_params.rs | 10 +- operator/runtime/testnet/src/configs/mod.rs | 95 ++++- .../testnet/src/configs/runtime_params.rs | 10 +- .../handlers/contracts/beefy-checkpoint.ts | 305 ++++++++++++++++ test/cli/handlers/contracts/deploy.ts | 109 ++++-- test/cli/handlers/contracts/index.ts | 2 + test/cli/handlers/contracts/rewards-origin.ts | 327 ++++++++++++++++++ test/cli/handlers/contracts/status.ts | 50 ++- test/cli/handlers/contracts/verify.ts | 10 +- test/cli/index.ts | 103 +++++- test/configs/contracts/config.ts | 31 +- test/scripts/deploy-contracts.ts | 36 +- test/utils/contracts.ts | 17 +- 23 files changed, 1346 insertions(+), 122 deletions(-) create mode 100644 contracts/config/mainnet-ethereum.json rename contracts/config/{hoodi.json => stagenet-hoodi.json} (63%) create mode 100644 contracts/config/testnet-hoodi.json rename contracts/script/deploy/{DeployTestnet.s.sol => DeployLive.s.sol} (85%) create mode 100644 test/cli/handlers/contracts/beefy-checkpoint.ts create mode 100644 test/cli/handlers/contracts/rewards-origin.ts diff --git a/contracts/config/anvil.json b/contracts/config/anvil.json index 16652567..ca1afec2 100644 --- a/contracts/config/anvil.json +++ b/contracts/config/anvil.json @@ -29,7 +29,9 @@ "rewardsInitiator": "0x14dC79964da2C08b23698B3D3cc7Ca32193d9955", "vetoCommitteeMember": "0x23618e81E3f5cdF7f54C3d65f7FBc0aBf5B21E8f", "vetoWindowBlocks": 100, - "validatorsStrategies": [] + "validatorsStrategies": [ + "0xbeaC0eeEeeeeEEeEeEEEEeeEEeEeeeEeeEEBEaC0" + ] }, "snowbridge": { "randaoCommitDelay": 4, @@ -37,10 +39,12 @@ "minNumRequiredSignatures": 2, "startBlock": 1, "rewardsMessageOrigin": "0x0000000000000000000000000000000000000000000000000000000000000000", + "initialValidatorSetId": 0, "initialValidatorHashes": [ "0xaeb47a269393297f4b0a3c9c9cfd00c7a4195255274cf39d83dabc2fcc9ff3d7", "0xf68aec7304bf37f340dae2ea20fb5271ee28a3128812b84a615da4789e458bde" ], + "nextValidatorSetId": 1, "nextValidatorHashes": [ "0xaeb47a269393297f4b0a3c9c9cfd00c7a4195255274cf39d83dabc2fcc9ff3d7", "0xf68aec7304bf37f340dae2ea20fb5271ee28a3128812b84a615da4789e458bde" diff --git a/contracts/config/example.jsonc b/contracts/config/example.jsonc index 334abd2a..2550cb11 100644 --- a/contracts/config/example.jsonc +++ b/contracts/config/example.jsonc @@ -74,7 +74,19 @@ /// The number of blocks that the Veto Committee will have to submit a veto. "vetoWindowBlocks": 100, /// The EigenLayer strategy addresses for the Validators to stake into. - "validatorsStrategies": [] + /// The beaconChainETHStrategy is a virtual address representing native beacon chain ETH. + /// All networks: + /// - beaconChainETH: 0xbeaC0eeEeeeeEEeEeEEEEeeEEeEeeeEeeEEBEaC0 (virtual, same on all networks) + /// Hoodi testnet strategies: + /// - stETH: 0xf8a1a66130d614c7360e868576d5e59203475fe0 + /// - WETH: 0x24579aD4fe83aC53546E5c2D3dF5F85D6383420d + /// Mainnet strategies: + /// - stETH: 0x93c4b944D05dfe6df7645A86cd2206016c51564D + /// - rETH: 0x1BeE69b7dFFfA4E2d53C2a2Df135C388AD25dCD2 + /// - cbETH: 0x54945180dB7943c0ed0FEE7EdaB2Bd24620256bc + "validatorsStrategies": [ + "0xbeaC0eeEeeeeEEeEeEEEEeeEEeEeeeEeeEEBEaC0" + ] }, "snowbridge": { /// Minimum delay in number of blocks that a relayer must wait between calling @@ -86,18 +98,27 @@ /// they desire. "randaoCommitExpiration": 24, /// The minimum number of required signatures for a Randao commit to be valid. + /// Auto-calculated by update-beefy-checkpoint as ceil(validators * 2/3) for BFT security. "minNumRequiredSignatures": 2, - /// Initial BEEFY block number. + /// Initial BEEFY block number. Set to latest finalized block by update-beefy-checkpoint. + /// The BeefyClient will only accept BEEFY commitments with block numbers > startBlock. "startBlock": 1, /// The origin linked to the Rewards Agent, the Agent contract who's allowed to submit /// new reward merkle roots to the RewardsRegistry contract. "rewardsMessageOrigin": "0x0000000000000000000000000000000000000000000000000000000000000000", + /// The BEEFY validator set ID for the initial validators. + /// This is fetched from Beefy.ValidatorSetId on the DataHaven chain. + "initialValidatorSetId": 0, /// The initial validator hashes for the BEEFY light client. + /// Each hash is keccak256(ethereum_address) derived from the BEEFY authority public keys. "initialValidatorHashes": [ "0x8626f6940e2eb28930efb4cef49b2d1f2c9c1199914b9e5506744e80bd0fd33d", "0xdf57089febbacf7ba0bc227dafbffa9fc08a93fdc68e1e42411a14efcf23656e" ], + /// The BEEFY validator set ID for the next validators (initialValidatorSetId + 1). + "nextValidatorSetId": 1, /// The next validator hashes for the BEEFY light client. + /// Each hash is keccak256(ethereum_address) derived from the BEEFY authority public keys. "nextValidatorHashes": [ "0x8626f6940e2eb28930efb4cef49b2d1f2c9c1199914b9e5506744e80bd0fd33d", "0xdf57089febbacf7ba0bc227dafbffa9fc08a93fdc68e1e42411a14efcf23656e" diff --git a/contracts/config/mainnet-ethereum.json b/contracts/config/mainnet-ethereum.json new file mode 100644 index 00000000..6481710d --- /dev/null +++ b/contracts/config/mainnet-ethereum.json @@ -0,0 +1,54 @@ +{ + "eigenLayer": { + "pausers": [], + "unpauser": "0x0000000000000000000000000000000000000000", + "rewardsUpdater": "0x0000000000000000000000000000000000000000", + "calculationIntervalSeconds": 86400, + "maxRewardsDuration": 6048000, + "maxRetroactiveLength": 7776000, + "maxFutureLength": 2592000, + "genesisRewardsTimestamp": 1710979200, + "activationDelay": 7200, + "globalCommissionBips": 1000, + "executorMultisig": "0x0000000000000000000000000000000000000000", + "operationsMultisig": "0x0000000000000000000000000000000000000000", + "minWithdrawalDelayBlocks": 50400, + "delegationInitPausedStatus": 0, + "eigenPodManagerInitPausedStatus": 0, + "rewardsCoordinatorInitPausedStatus": 0, + "allocationManagerInitPausedStatus": 0, + "deallocationDelay": 100800, + "allocationConfigurationDelay": 1200, + "beaconChainGenesisTimestamp": 1606824023, + "delegationManager": "0x39053D51B77DC0d36036Fc1fCc8Cb819df8Ef37A", + "strategyManager": "0x858646372CC42E1A627fcE94aa7A7033e7CF075A", + "eigenPodManager": "0x91E677b07F7AF907ec9a428aafA9fc14a0d3A338", + "avsDirectory": "0x135dda560e946695d6f155dacafc6f1f25c1f5af", + "rewardsCoordinator": "0x7750d328b314EfFa365A0402CcfD489B80B0adda", + "allocationManager": "0x948a420b8CC1d6BFd0B6087C2E7c344a2CD0bc39", + "permissionController": "0x25E5F8B1E7aDf44518d35D5B2271f114e081f0E5" + }, + "avs": { + "avsOwner": "0x0000000000000000000000000000000000000000", + "rewardsInitiator": "0x0000000000000000000000000000000000000000", + "vetoCommitteeMember": "0x0000000000000000000000000000000000000000", + "vetoWindowBlocks": 7200, + "validatorsStrategies": [ + "0xbeaC0eeEeeeeEEeEeEEEEeeEEeEeeeEeeEEBEaC0", + "0x93c4b944D05dfe6df7645A86cd2206016c51564D", + "0x1BeE69b7dFFfA4E2d53C2a2Df135C388AD25dCD2", + "0x54945180dB7943c0ed0FEE7EdaB2Bd24620256bc" + ] + }, + "snowbridge": { + "randaoCommitDelay": 4, + "randaoCommitExpiration": 24, + "minNumRequiredSignatures": 16, + "startBlock": 1, + "rewardsMessageOrigin": "0x0000000000000000000000000000000000000000000000000000000000000000", + "initialValidatorSetId": 0, + "initialValidatorHashes": [], + "nextValidatorSetId": 1, + "nextValidatorHashes": [] + } +} diff --git a/contracts/config/hoodi.json b/contracts/config/stagenet-hoodi.json similarity index 63% rename from contracts/config/hoodi.json rename to contracts/config/stagenet-hoodi.json index 02882a2d..0f8ed550 100644 --- a/contracts/config/hoodi.json +++ b/contracts/config/stagenet-hoodi.json @@ -27,7 +27,7 @@ "eigenPodManager": "0xcd1442415Fc5C29Aa848A49d2e232720BE07976c", "avsDirectory": "0xD58f6844f79eB1fbd9f7091d05f7cb30d3363926", "rewardsCoordinator": "0x29e8572678e0c272350aa0b4B8f304E47EBcd5e7", - "allocationManager": "0x95a7431400F362F3647a69535C5666cA0133CAA0", + "allocationManager": "0x95a7431400F362F3647a69535C5666cA0133CAA0", "permissionController": "0xdcCF401fD121d8C542E96BC1d0078884422aFAD2" }, "avs": { @@ -35,21 +35,31 @@ "rewardsInitiator": "0xe30a38ac89ffE5A86D5389Bfbf70C7EC766FbB6e", "vetoCommitteeMember": "0xe30a38ac89ffE5A86D5389Bfbf70C7EC766FbB6e", "vetoWindowBlocks": 100, - "validatorsStrategies": [] + "validatorsStrategies": [ + "0xbeaC0eeEeeeeEEeEeEEEEeeEEeEeeeEeeEEBEaC0", + "0xf8a1a66130d614c7360e868576d5e59203475fe0", + "0x24579aD4fe83aC53546E5c2D3dF5F85D6383420d" + ] }, "snowbridge": { "randaoCommitDelay": 4, "randaoCommitExpiration": 24, - "minNumRequiredSignatures": 2, - "startBlock": 1, - "rewardsMessageOrigin": "0x0000000000000000000000000000000000000000000000000000000000000000", + "minNumRequiredSignatures": 3, + "startBlock": 1299215, + "rewardsMessageOrigin": "0x56490bd3f367447bfaf57bb18e7a45e1b2db7d538fe42098e87d2aa106c6afdd", + "initialValidatorSetId": 2179, "initialValidatorHashes": [ - "0xaeb47a269393297f4b0a3c9c9cfd00c7a4195255274cf39d83dabc2fcc9ff3d7", - "0xf68aec7304bf37f340dae2ea20fb5271ee28a3128812b84a615da4789e458bde" + "0x07ce4f2cd558f4d4b529a3362b6ff7d616ca0893b53252dc62829b8218ea5c10", + "0xaea5344f086d3be7c94cf3a47436bcbb98de23cf1ee773a9180cfecab0453a50", + "0xcd3a33755b27fe810dfb780b3f1df1c25efa1bb826ca618e41022fa900876087", + "0x4f4ce8cad711a4b33d15095091f8a98eaf9bfd1b39a9159e605cf5d6783cc667" ], + "nextValidatorSetId": 2180, "nextValidatorHashes": [ - "0xaeb47a269393297f4b0a3c9c9cfd00c7a4195255274cf39d83dabc2fcc9ff3d7", - "0xf68aec7304bf37f340dae2ea20fb5271ee28a3128812b84a615da4789e458bde" + "0x07ce4f2cd558f4d4b529a3362b6ff7d616ca0893b53252dc62829b8218ea5c10", + "0xaea5344f086d3be7c94cf3a47436bcbb98de23cf1ee773a9180cfecab0453a50", + "0xcd3a33755b27fe810dfb780b3f1df1c25efa1bb826ca618e41022fa900876087", + "0x4f4ce8cad711a4b33d15095091f8a98eaf9bfd1b39a9159e605cf5d6783cc667" ] } -} \ No newline at end of file +} diff --git a/contracts/config/testnet-hoodi.json b/contracts/config/testnet-hoodi.json new file mode 100644 index 00000000..784fba9d --- /dev/null +++ b/contracts/config/testnet-hoodi.json @@ -0,0 +1,71 @@ +{ + "eigenLayer": { + "pausers": [ + "0x64D78399B0fa32EA72959f33edCF313159F3c13D" + ], + "unpauser": "0xE3328cb5068924119d6170496c4AB2dD12c12d15", + "rewardsUpdater": "0xe30a38ac89ffE5A86D5389Bfbf70C7EC766FbB6e", + "calculationIntervalSeconds": 86400, + "maxRewardsDuration": 6048000, + "maxRetroactiveLength": 7776000, + "maxFutureLength": 2592000, + "genesisRewardsTimestamp": 1710979200, + "activationDelay": 7200, + "globalCommissionBips": 1000, + "executorMultisig": "0xE3328cb5068924119d6170496c4AB2dD12c12d15", + "operationsMultisig": "0xE7f4E30D2619273468afe9EC0Acf805E55532257", + "minWithdrawalDelayBlocks": 50, + "delegationInitPausedStatus": 0, + "eigenPodManagerInitPausedStatus": 0, + "rewardsCoordinatorInitPausedStatus": 0, + "allocationManagerInitPausedStatus": 0, + "deallocationDelay": 50, + "allocationConfigurationDelay": 75, + "beaconChainGenesisTimestamp": 1710666600, + "delegationManager": "0x867837a9722C512e0862d8c2E15b8bE220E8b87d", + "strategyManager": "0xeE45e76ddbEDdA2918b8C7E3035cd37Eab3b5D41", + "eigenPodManager": "0xcd1442415Fc5C29Aa848A49d2e232720BE07976c", + "avsDirectory": "0xD58f6844f79eB1fbd9f7091d05f7cb30d3363926", + "rewardsCoordinator": "0x29e8572678e0c272350aa0b4B8f304E47EBcd5e7", + "allocationManager": "0x95a7431400F362F3647a69535C5666cA0133CAA0", + "permissionController": "0xdcCF401fD121d8C542E96BC1d0078884422aFAD2" + }, + "avs": { + "avsOwner": "0x0000000000000000000000000000000000000000", + "rewardsInitiator": "0x0000000000000000000000000000000000000000", + "vetoCommitteeMember": "0x0000000000000000000000000000000000000000", + "vetoWindowBlocks": 100, + "validatorsStrategies": [ + "0xbeaC0eeEeeeeEEeEeEEEEeeEEeEeeeEeeEEBEaC0", + "0xf8a1a66130d614c7360e868576d5e59203475fe0", + "0x24579aD4fe83aC53546E5c2D3dF5F85D6383420d" + ] + }, + "snowbridge": { + "randaoCommitDelay": 4, + "randaoCommitExpiration": 24, + "minNumRequiredSignatures": 5, + "startBlock": 1381173, + "rewardsMessageOrigin": "0xd0d6dbd1ffb401ef613f00e93cd5061ecec03ae35d2f820cd6754a5b5f020215", + "initialValidatorSetId": 2303, + "initialValidatorHashes": [ + "0x0ec3102f334aba804c18b843e45ec874005587122a1b49273b1b04d6fd98b1a2", + "0xb277ac8a7aafc125d7da813a9b0fdae144922c165bfae194ebd94d6f3e4fe68e", + "0xcc6aefdce3f83d204893cb57388a72b4553b613f95b437ce548582470e62d1e7", + "0xcefa9940d25d21ac6d0a579727e8812283ed00d7ace9dfc9e30a0f95a0ea7bdd", + "0x8e720aed537cb30d204f1de9fb5aab6e0129acfc3f41a3c69259231c1f0f2685", + "0x5f883131cf6667cb8c2279caa182298e174bbca35c7c8c5679df6bad73be85cf", + "0x744ae85e99103a5ebcf9dd2fdcc18743012f0336f497fd3a05243a26a1a031b7" + ], + "nextValidatorSetId": 2304, + "nextValidatorHashes": [ + "0x0ec3102f334aba804c18b843e45ec874005587122a1b49273b1b04d6fd98b1a2", + "0xb277ac8a7aafc125d7da813a9b0fdae144922c165bfae194ebd94d6f3e4fe68e", + "0xcc6aefdce3f83d204893cb57388a72b4553b613f95b437ce548582470e62d1e7", + "0xcefa9940d25d21ac6d0a579727e8812283ed00d7ace9dfc9e30a0f95a0ea7bdd", + "0x8e720aed537cb30d204f1de9fb5aab6e0129acfc3f41a3c69259231c1f0f2685", + "0x5f883131cf6667cb8c2279caa182298e174bbca35c7c8c5679df6bad73be85cf", + "0x744ae85e99103a5ebcf9dd2fdcc18743012f0336f497fd3a05243a26a1a031b7" + ] + } +} diff --git a/contracts/script/deploy/Config.sol b/contracts/script/deploy/Config.sol index c23c8804..5d731e95 100644 --- a/contracts/script/deploy/Config.sol +++ b/contracts/script/deploy/Config.sol @@ -8,7 +8,9 @@ contract Config { uint256 randaoCommitExpiration; uint256 minNumRequiredSignatures; uint64 startBlock; + uint128 initialValidatorSetId; bytes32[] initialValidatorHashes; + uint128 nextValidatorSetId; bytes32[] nextValidatorHashes; bytes32 rewardsMessageOrigin; } diff --git a/contracts/script/deploy/DeployBase.s.sol b/contracts/script/deploy/DeployBase.s.sol index 67cfa7af..587bcd81 100644 --- a/contracts/script/deploy/DeployBase.s.sol +++ b/contracts/script/deploy/DeployBase.s.sol @@ -208,10 +208,12 @@ abstract contract DeployBase is Script, DeployParams, Accounts { SnowbridgeConfig memory config ) internal returns (BeefyClient) { // Create validator sets using the MerkleUtils library - BeefyClient.ValidatorSet memory validatorSet = - ValidatorsUtils._buildValidatorSet(0, config.initialValidatorHashes); - BeefyClient.ValidatorSet memory nextValidatorSet = - ValidatorsUtils._buildValidatorSet(1, config.nextValidatorHashes); + BeefyClient.ValidatorSet memory validatorSet = ValidatorsUtils._buildValidatorSet( + config.initialValidatorSetId, config.initialValidatorHashes + ); + BeefyClient.ValidatorSet memory nextValidatorSet = ValidatorsUtils._buildValidatorSet( + config.nextValidatorSetId, config.nextValidatorHashes + ); // Deploy BeefyClient vm.broadcast(_deployerPrivateKey); diff --git a/contracts/script/deploy/DeployTestnet.s.sol b/contracts/script/deploy/DeployLive.s.sol similarity index 85% rename from contracts/script/deploy/DeployTestnet.s.sol rename to contracts/script/deploy/DeployLive.s.sol index bbacd594..74c85f17 100644 --- a/contracts/script/deploy/DeployTestnet.s.sol +++ b/contracts/script/deploy/DeployLive.s.sol @@ -29,10 +29,11 @@ import { } from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; /** - * @title DeployTestnet - * @notice Deployment script for testnets (hoodi) - references existing EigenLayer contracts + * @title DeployLive + * @notice Deployment script for live networks (hoodi testnet, ethereum mainnet) + * @dev References existing EigenLayer contracts on the target chain */ -contract DeployTestnet is DeployBase { +contract DeployLive is DeployBase { string public networkName; function run() public { @@ -40,7 +41,7 @@ contract DeployTestnet is DeployBase { networkName = vm.envString("NETWORK"); require( bytes(networkName).length > 0, - "NETWORK environment variable required for testnet deployment" + "NETWORK environment variable required for live deployment" ); _validateNetwork(networkName); @@ -49,7 +50,7 @@ contract DeployTestnet is DeployBase { address avsOwnerEnv = vm.envOr("AVS_OWNER_ADDRESS", address(0)); require( avsOwnerEnv != address(0), - "AVS_OWNER_ADDRESS env variable required for testnet deployments" + "AVS_OWNER_ADDRESS env variable required for live deployments" ); _executeSharedDeployment(); @@ -60,8 +61,8 @@ contract DeployTestnet is DeployBase { return networkName; } - function _getDeploymentMode() internal pure override returns (string memory) { - return "HOODI_TESTNET"; + function _getDeploymentMode() internal view override returns (string memory) { + return string.concat("LIVE_", networkName); } function _setupEigenLayerContracts( @@ -100,16 +101,16 @@ contract DeployTestnet is DeployBase { Logging.logStep("All EigenLayer contracts referenced successfully"); Logging.logFooter(); - // Testnet deployments create their own ProxyAdmin (no existing one from EigenLayer deployment) + // Live deployments create their own ProxyAdmin (no existing one from EigenLayer deployment) return ProxyAdmin(address(0)); // Will be created in _createServiceManagerProxy } function _createServiceManagerProxy( DataHavenServiceManager implementation, - ProxyAdmin, // Ignored for testnet deployment + ProxyAdmin, // Ignored for live deployment ServiceManagerInitParams memory params ) internal override returns (DataHavenServiceManager) { - // Testnet deployment creates its own ProxyAdmin for the service manager + // Live deployment creates its own ProxyAdmin for the service manager vm.broadcast(_deployerPrivateKey); ProxyAdmin proxyAdmin = new ProxyAdmin(); Logging.logContractDeployed("ProxyAdmin", address(proxyAdmin)); @@ -186,7 +187,7 @@ contract DeployTestnet is DeployBase { ); json = string.concat(json, '"RewardsAgent": "', vm.toString(rewardsAgent), '",'); - // EigenLayer contracts (existing on testnet) + // EigenLayer contracts (existing on live network) json = string.concat(json, '"DelegationManager": "', vm.toString(address(delegation)), '",'); json = string.concat( json, '"StrategyManager": "', vm.toString(address(strategyManager)), '",' @@ -209,23 +210,34 @@ contract DeployTestnet is DeployBase { Logging.logInfo(string.concat("Deployment info saved to: ", deploymentPath)); } - // TESTNET-SPECIFIC FUNCTIONS + // LIVE DEPLOYMENT FUNCTIONS /** - * @notice Validate that the network is hoodi (the only supported testnet) + * @notice Validate that the network is in the supported allowlist + * @dev Supported networks: + * - "hoodi", "stagenet-hoodi", "testnet-hoodi" (Hoodi testnet) + * - "ethereum", "mainnet-ethereum" (Ethereum mainnet) */ function _validateNetwork( string memory network ) internal pure { - bytes32 networkHash = keccak256(abi.encodePacked(network)); + bytes32 h = keccak256(bytes(network)); - if (networkHash != keccak256(abi.encodePacked("hoodi"))) { - revert( - string.concat( - "Unsupported testnet network: ", network, ". Supported networks: hoodi" - ) - ); + if ( + h == keccak256("hoodi") || h == keccak256("stagenet-hoodi") + || h == keccak256("testnet-hoodi") || h == keccak256("mainnet-ethereum") + || h == keccak256("ethereum") + ) { + return; } + + revert( + string.concat( + "Unsupported network: ", + network, + ". Supported: hoodi, stagenet-hoodi, testnet-hoodi, ethereum, mainnet-ethereum" + ) + ); } /** diff --git a/contracts/script/deploy/DeployParams.s.sol b/contracts/script/deploy/DeployParams.s.sol index 4bdbb284..ca390006 100644 --- a/contracts/script/deploy/DeployParams.s.sol +++ b/contracts/script/deploy/DeployParams.s.sol @@ -31,9 +31,27 @@ contract DeployParams is Script, Config { bool isDevMode = keccak256(abi.encodePacked(vm.envOr("DEV_MODE", string("false")))) == keccak256(abi.encodePacked("true")); if (isDevMode) { + config.initialValidatorSetId = 0; config.initialValidatorHashes = TestUtils.generateMockValidators(10); + config.nextValidatorSetId = 1; config.nextValidatorHashes = TestUtils.generateMockValidators(10); } else { + // Load validator set IDs (default to 0/1 for backwards compatibility) + try vm.parseJsonUint(configJson, ".snowbridge.initialValidatorSetId") returns ( + uint256 val + ) { + config.initialValidatorSetId = uint128(val); + } catch { + config.initialValidatorSetId = 0; + } + try vm.parseJsonUint(configJson, ".snowbridge.nextValidatorSetId") returns ( + uint256 val + ) { + config.nextValidatorSetId = uint128(val); + } catch { + config.nextValidatorSetId = config.initialValidatorSetId + 1; + } + config.initialValidatorHashes = _loadValidatorsFromConfig(configJson, ".snowbridge.initialValidatorHashes"); config.nextValidatorHashes = diff --git a/operator/runtime/stagenet/src/configs/mod.rs b/operator/runtime/stagenet/src/configs/mod.rs index 0e2d181f..07cb0ab2 100644 --- a/operator/runtime/stagenet/src/configs/mod.rs +++ b/operator/runtime/stagenet/src/configs/mod.rs @@ -1038,8 +1038,8 @@ impl pallet_evm_chain_id::Config for Runtime {} // --- Snowbridge Config Constants & Parameter Types --- parameter_types! { - // Hoodi testnet genesis hash - pub const StagenetGenesisHash: [u8; 32] = hex_literal::hex!("bbe312868b376a3001692a646dd2d7d1e4406380dfd86b98aa8a34d1557c971b"); + // DataHaven stagenet genesis hash + pub const StagenetGenesisHash: [u8; 32] = hex_literal::hex!("72d0856fd339e09cb21df7bac8ac3120bd871e327ec0e1658395df68acef9bee"); pub UniversalLocation: InteriorLocation = [ GlobalConsensus(ByGenesis(StagenetGenesisHash::get())) ].into(); @@ -1928,4 +1928,95 @@ mod tests { assert!(result.is_ok(), "Message from authorized origin should be accepted"); }); } + + /// Test that the ExternalValidatorRewardsAccount is correctly derived from the pallet ID. + /// + /// This verifies that `PalletId(*b"dh/evrew").into_account_truncating()` produces the + /// expected AccountId20 value, which is used in the Rewards Agent ID computation. + #[test] + fn test_external_validator_rewards_account_derivation() { + // Expected account: "modl" (4 bytes) + "dh/evrew" (8 bytes) + zeros (8 bytes) = 20 bytes + // "modl" = 0x6d6f646c + // "dh/evrew" = 0x64682f6576726577 + // Result = 0x6d6f646c64682f65767265770000000000000000 + let expected_account = AccountId::from(hex_literal::hex!( + "6d6f646c64682f65767265770000000000000000" + )); + + let actual_account = ExternalValidatorRewardsAccount::get(); + + assert_eq!( + actual_account, expected_account, + "ExternalValidatorRewardsAccount must be derived correctly from PalletId 'dh/evrew'" + ); + } + + /// Test that the Rewards Agent ID (used for Snowbridge outbound messages from the rewards pallet) + /// is correctly computed from the chain's genesis hash and the ExternalValidatorRewardsAccount. + /// + /// This test verifies the value that should be set as `RewardsAgentOrigin` in runtime parameters + /// and as `rewardsMessageOrigin` in the AVS contract configuration. + /// + /// The Agent ID is computed following Snowbridge's pattern for GlobalConsensus locations: + /// blake2_256(SCALE_ENCODE("GlobalConsensus", ByGenesis(genesis_hash), compact_len, "AccountKey20", account_key)) + /// + /// Note: Standard `AgentIdOf` doesn't support direct AccountKey20 without a Parachain junction, + /// so we compute the hash directly here. + #[test] + fn test_rewards_agent_id_computation() { + use codec::Encode; + use sp_core::H256; + use sp_io::hashing::blake2_256; + use xcm::prelude::NetworkId; + + // Use the StagenetGenesisHash parameter + let genesis_hash: [u8; 32] = StagenetGenesisHash::get(); + + // Get the rewards pallet account (derived from PalletId "dh/evrew") + let rewards_account: [u8; 20] = ExternalValidatorRewardsAccount::get().into(); + + // Build the location description following Snowbridge's encoding pattern: + // ("GlobalConsensus", ByGenesis(genesis_hash), compact_len(interior), "AccountKey20", account_key) + // + // This matches the pattern in snowbridge_core::location::DescribeGlobalPrefix + // combined with DescribeTokenTerminal for AccountKey20. + + // Interior description: "AccountKey20" + account_key (no length prefix for fixed arrays) + let interior: Vec = (b"AccountKey20", rewards_account).encode(); + + // Full encoding: "GlobalConsensus" + NetworkId::ByGenesis(genesis) + interior + let encoded: Vec = ( + b"GlobalConsensus", + NetworkId::ByGenesis(genesis_hash), + interior, + ) + .encode(); + + // Hash with blake2_256 + let computed_agent_id = H256(blake2_256(&encoded)); + + // Expected Agent ID - this value must match RewardsAgentOrigin in runtime_params.rs + // If this test fails, update RewardsAgentOrigin to match the computed value. + let expected_agent_id = H256(hex_literal::hex!( + "56490bd3f367447bfaf57bb18e7a45e1b2db7d538fe42098e87d2aa106c6afdd" + )); + + assert_eq!( + computed_agent_id, + expected_agent_id, + "Computed Rewards Agent ID must match expected value.\n\ + This value should be set as:\n\ + - RewardsAgentOrigin in runtime_params.rs\n\ + - rewardsMessageOrigin in AVS contract config\n\ + \n\ + Rewards account: 0x{}\n\ + Genesis hash: 0x{}\n\ + Computed: {:?}\n\ + Expected: {:?}", + hex::encode(rewards_account), + hex::encode(genesis_hash), + computed_agent_id, + expected_agent_id + ); + } } diff --git a/operator/runtime/stagenet/src/configs/runtime_params.rs b/operator/runtime/stagenet/src/configs/runtime_params.rs index 26517b51..8b9a35ca 100644 --- a/operator/runtime/stagenet/src/configs/runtime_params.rs +++ b/operator/runtime/stagenet/src/configs/runtime_params.rs @@ -51,10 +51,14 @@ pub mod dynamic_params { #[codec(index = 3)] #[allow(non_upper_case_globals)] - /// The RewardsAgentOrigin is the origin of the rewards agent, which is its ID. - /// TODO: Decide which agent origin we want to use. Currently for testing it's the zero hash + /// The RewardsAgentOrigin is the Agent ID for the rewards pallet's outbound Snowbridge messages. + /// Computed as: blake2_256(SCALE_ENCODE("GlobalConsensus", ByGenesis(genesis_hash), interior)) + /// where interior = SCALE_ENCODE("AccountKey20", ExternalValidatorRewardsAccount) + /// + /// For stagenet with genesis hash 0x72d0856fd339e09cb21df7bac8ac3120bd871e327ec0e1658395df68acef9bee + /// and rewards account 0x6d6f646c64682f65767265770000000000000000 (from PalletId "dh/evrew"): pub static RewardsAgentOrigin: H256 = H256::from_slice(&hex!( - "0000000000000000000000000000000000000000000000000000000000000000" + "56490bd3f367447bfaf57bb18e7a45e1b2db7d538fe42098e87d2aa106c6afdd" )); // Proportion of fees allocated to the Treasury (remainder are burned). diff --git a/operator/runtime/testnet/src/configs/mod.rs b/operator/runtime/testnet/src/configs/mod.rs index 783c0759..4b256a25 100644 --- a/operator/runtime/testnet/src/configs/mod.rs +++ b/operator/runtime/testnet/src/configs/mod.rs @@ -1041,8 +1041,8 @@ impl pallet_evm_chain_id::Config for Runtime {} // --- Snowbridge Config Constants & Parameter Types --- parameter_types! { - // Hoodi testnet genesis hash - pub const TestnetGenesisHash: [u8; 32] = hex_literal::hex!("bbe312868b376a3001692a646dd2d7d1e4406380dfd86b98aa8a34d1557c971b"); + // DataHaven testnet genesis hash + pub const TestnetGenesisHash: [u8; 32] = hex_literal::hex!("dbf403d348916fb0694485bc7f9c0d8c53fdf86664ebac019af209c090c3df99"); pub UniversalLocation: InteriorLocation = [ GlobalConsensus(ByGenesis(TestnetGenesisHash::get())) ].into(); @@ -1950,4 +1950,95 @@ mod tests { assert!(result.is_ok(), "Message from authorized origin should be accepted"); }); } + + /// Test that the ExternalValidatorRewardsAccount is correctly derived from the pallet ID. + /// + /// This verifies that `PalletId(*b"dh/evrew").into_account_truncating()` produces the + /// expected AccountId20 value, which is used in the Rewards Agent ID computation. + #[test] + fn test_external_validator_rewards_account_derivation() { + // Expected account: "modl" (4 bytes) + "dh/evrew" (8 bytes) + zeros (8 bytes) = 20 bytes + // "modl" = 0x6d6f646c + // "dh/evrew" = 0x64682f6576726577 + // Result = 0x6d6f646c64682f65767265770000000000000000 + let expected_account = AccountId::from(hex_literal::hex!( + "6d6f646c64682f65767265770000000000000000" + )); + + let actual_account = ExternalValidatorRewardsAccount::get(); + + assert_eq!( + actual_account, expected_account, + "ExternalValidatorRewardsAccount must be derived correctly from PalletId 'dh/evrew'" + ); + } + + /// Test that the Rewards Agent ID (used for Snowbridge outbound messages from the rewards pallet) + /// is correctly computed from the chain's genesis hash and the ExternalValidatorRewardsAccount. + /// + /// This test verifies the value that should be set as `RewardsAgentOrigin` in runtime parameters + /// and as `rewardsMessageOrigin` in the AVS contract configuration. + /// + /// The Agent ID is computed following Snowbridge's pattern for GlobalConsensus locations: + /// blake2_256(SCALE_ENCODE("GlobalConsensus", ByGenesis(genesis_hash), compact_len, "AccountKey20", account_key)) + /// + /// Note: Standard `AgentIdOf` doesn't support direct AccountKey20 without a Parachain junction, + /// so we compute the hash directly here. + #[test] + fn test_rewards_agent_id_computation() { + use codec::Encode; + use sp_core::H256; + use sp_io::hashing::blake2_256; + use xcm::prelude::NetworkId; + + // Use the TestnetGenesisHash parameter + let genesis_hash: [u8; 32] = TestnetGenesisHash::get(); + + // Get the rewards pallet account (derived from PalletId "dh/evrew") + let rewards_account: [u8; 20] = ExternalValidatorRewardsAccount::get().into(); + + // Build the location description following Snowbridge's encoding pattern: + // ("GlobalConsensus", ByGenesis(genesis_hash), compact_len(interior), "AccountKey20", account_key) + // + // This matches the pattern in snowbridge_core::location::DescribeGlobalPrefix + // combined with DescribeTokenTerminal for AccountKey20. + + // Interior description: "AccountKey20" + account_key (no length prefix for fixed arrays) + let interior: Vec = (b"AccountKey20", rewards_account).encode(); + + // Full encoding: "GlobalConsensus" + NetworkId::ByGenesis(genesis) + interior + let encoded: Vec = ( + b"GlobalConsensus", + NetworkId::ByGenesis(genesis_hash), + interior, + ) + .encode(); + + // Hash with blake2_256 + let computed_agent_id = H256(blake2_256(&encoded)); + + // Expected Agent ID - this value must match RewardsAgentOrigin in runtime_params.rs + // If this test fails, update RewardsAgentOrigin to match the computed value. + let expected_agent_id = H256(hex_literal::hex!( + "d0d6dbd1ffb401ef613f00e93cd5061ecec03ae35d2f820cd6754a5b5f020215" + )); + + assert_eq!( + computed_agent_id, + expected_agent_id, + "Computed Rewards Agent ID must match expected value.\n\ + This value should be set as:\n\ + - RewardsAgentOrigin in runtime_params.rs\n\ + - rewardsMessageOrigin in AVS contract config\n\ + \n\ + Rewards account: 0x{}\n\ + Genesis hash: 0x{}\n\ + Computed: {:?}\n\ + Expected: {:?}", + hex::encode(rewards_account), + hex::encode(genesis_hash), + computed_agent_id, + expected_agent_id + ); + } } diff --git a/operator/runtime/testnet/src/configs/runtime_params.rs b/operator/runtime/testnet/src/configs/runtime_params.rs index 58ef3be2..c9a77d8c 100644 --- a/operator/runtime/testnet/src/configs/runtime_params.rs +++ b/operator/runtime/testnet/src/configs/runtime_params.rs @@ -49,10 +49,14 @@ pub mod dynamic_params { #[codec(index = 3)] #[allow(non_upper_case_globals)] - /// The RewardsAgentOrigin is the hash of the string "external_validators_rewards" - /// TODO: Decide which agent origin we want to use. Currently for testing it's the zero hash + /// The RewardsAgentOrigin is the Agent ID for the rewards pallet's outbound Snowbridge messages. + /// Computed as: blake2_256(SCALE_ENCODE("GlobalConsensus", ByGenesis(genesis_hash), interior)) + /// where interior = SCALE_ENCODE("AccountKey20", ExternalValidatorRewardsAccount) + /// + /// For testnet with genesis hash 0xdbf403d348916fb0694485bc7f9c0d8c53fdf86664ebac019af209c090c3df99 + /// and rewards account 0x6d6f646c64682f65767265770000000000000000 (from PalletId "dh/evrew"): pub static RewardsAgentOrigin: H256 = H256::from_slice(&hex!( - "c505dfb2df107d106d08bd0f1a0acd10052ca9aa078629a4ccfd0c90c6e69b65" + "d0d6dbd1ffb401ef613f00e93cd5061ecec03ae35d2f820cd6754a5b5f020215" )); // Proportion of fees allocated to the Treasury (remainder are burned). diff --git a/test/cli/handlers/contracts/beefy-checkpoint.ts b/test/cli/handlers/contracts/beefy-checkpoint.ts new file mode 100644 index 00000000..6ad07261 --- /dev/null +++ b/test/cli/handlers/contracts/beefy-checkpoint.ts @@ -0,0 +1,305 @@ +import invariant from "tiny-invariant"; +import { logger, printDivider, printHeader } from "utils"; +import { createPapiConnectors } from "utils/papi"; +import { type Hex, keccak256 } from "viem"; +import { buildNetworkId } from "../../../configs/contracts/config"; +import { compressedPubKeyToEthereumAddress } from "../../../launcher/datahaven"; + +interface UpdateBeefyCheckpointOptions { + chain: string; + environment?: string; + rpcUrl: string; +} + +interface BeefyCheckpointData { + startBlock: number; + minNumRequiredSignatures: number; + initialValidatorSetId: number; + initialValidatorHashes: string[]; + nextValidatorSetId: number; + nextValidatorHashes: string[]; +} + +/** + * Converts an array of compressed public keys to authority hashes. + * + * @param authorityPublicKeys - Array of compressed public keys as hex strings + * @returns Array of authority hashes (keccak256 of Ethereum addresses) + */ +const computeAuthorityHashes = (authorityPublicKeys: string[]): string[] => { + const authorityHashes: string[] = []; + for (const compressedKey of authorityPublicKeys) { + const ethAddress = compressedPubKeyToEthereumAddress(compressedKey); + const authorityHash = keccak256(ethAddress as Hex); + authorityHashes.push(authorityHash); + logger.debug( + ` ${compressedKey.slice(0, 20)}... -> ${ethAddress} -> ${authorityHash.slice(0, 20)}...` + ); + } + return authorityHashes; +}; + +/** + * Calculates the minimum number of required signatures for BFT security. + * Uses the same formula as Snowbridge's BeefyClient contract to ensure + * strictly more than 2/3 of validators must sign. + * + * Formula: n - floor((n-1)/3) + * + * This ensures strictly > 2/3 majority. For example: + * - n=3: returns 3 (not 2, which would be exactly 2/3) + * - n=6: returns 5 (not 4, which would be exactly 2/3) + * - n=100: returns 67 (strictly > 66.67) + * + * @see https://github.com/datahaven-xyz/snowbridge/blob/main/contracts/src/BeefyClient.sol + * @param validatorCount - The number of validators + * @returns The minimum number of required signatures + */ +const calculateMinRequiredSignatures = (validatorCount: number): number => { + // For BFT security, we need strictly > 2/3 of validators to sign + // This matches Snowbridge's computeQuorum function + if (validatorCount <= 3) { + return validatorCount; + } + return validatorCount - Math.floor((validatorCount - 1) / 3); +}; + +/** + * Fetches BEEFY checkpoint data from a DataHaven chain including both current and next + * authority sets along with their validator set IDs, the latest finalized block, + * and calculates the minimum required signatures. + * + * All queries are performed at the same finalized block to ensure consistency. + * + * @param rpcUrl - WebSocket RPC endpoint of the DataHaven chain + * @returns BEEFY checkpoint data with validator set IDs, authority hashes, startBlock, and minNumRequiredSignatures + */ +const fetchBeefyCheckpointData = async (rpcUrl: string): Promise => { + logger.info(`📡 Connecting to DataHaven chain at ${rpcUrl}...`); + + const { client: papiClient, typedApi: dhApi } = createPapiConnectors(rpcUrl); + + try { + // First, get the finalized block hash to use for all subsequent queries + logger.info("🔍 Fetching latest finalized block..."); + const finalizedBlock = await papiClient.getFinalizedBlock(); + const startBlock = finalizedBlock.number; + const blockHash = finalizedBlock.hash; + logger.success(`Latest finalized block: ${startBlock} (${blockHash})`); + + // Fetch all BEEFY data in parallel at the same finalized block + logger.info("🔍 Fetching BEEFY data (ValidatorSetId, Authorities, NextAuthorities)..."); + const [validatorSetId, authoritiesRaw, nextAuthoritiesRaw] = await Promise.all([ + dhApi.query.Beefy.ValidatorSetId.getValue({ at: blockHash }), + dhApi.query.Beefy.Authorities.getValue({ at: blockHash }), + dhApi.query.Beefy.NextAuthorities.getValue({ at: blockHash }) + ]); + + // Validate results + invariant(validatorSetId !== undefined, "Failed to fetch BEEFY ValidatorSetId"); + logger.success(`Current ValidatorSetId: ${validatorSetId}`); + + invariant( + authoritiesRaw && authoritiesRaw.length > 0, + "No BEEFY Authorities found on the chain" + ); + const currentAuthorityKeys = authoritiesRaw.map((key) => key.asHex()); + logger.success(`Found ${currentAuthorityKeys.length} current BEEFY authorities`); + + invariant( + nextAuthoritiesRaw && nextAuthoritiesRaw.length > 0, + "No BEEFY NextAuthorities found on the chain" + ); + const nextAuthorityKeys = nextAuthoritiesRaw.map((key) => key.asHex()); + logger.success(`Found ${nextAuthorityKeys.length} next BEEFY authorities`); + + // Calculate minimum required signatures based on validator count + // Uses Snowbridge's formula: n - floor((n-1)/3) for strictly > 2/3 majority + const minNumRequiredSignatures = calculateMinRequiredSignatures(currentAuthorityKeys.length); + logger.info( + `📊 Minimum required signatures: ${minNumRequiredSignatures} (${currentAuthorityKeys.length} - floor((${currentAuthorityKeys.length}-1)/3))` + ); + + // Compute hashes for both sets + logger.info("🔐 Computing authority hashes for current set..."); + const initialValidatorHashes = computeAuthorityHashes(currentAuthorityKeys); + + logger.info("🔐 Computing authority hashes for next set..."); + const nextValidatorHashes = computeAuthorityHashes(nextAuthorityKeys); + + // Check if the sets are identical + const setsAreIdentical = + JSON.stringify(initialValidatorHashes) === JSON.stringify(nextValidatorHashes); + if (setsAreIdentical) { + logger.info("ℹ️ Current and next authority sets are identical"); + } else { + logger.info("ℹ️ Current and next authority sets differ"); + } + + return { + startBlock, + minNumRequiredSignatures, + initialValidatorSetId: Number(validatorSetId), + initialValidatorHashes, + nextValidatorSetId: Number(validatorSetId) + 1, + nextValidatorHashes + }; + } finally { + papiClient.destroy(); + } +}; + +/** + * Updates the config file with the fetched BEEFY checkpoint data. + * + * @param networkId - The network identifier (e.g., "hoodi", "stagenet-hoodi") + * @param checkpointData - BEEFY checkpoint data including validator set IDs, hashes, startBlock, and minNumRequiredSignatures + */ +const updateConfigFile = async ( + networkId: string, + checkpointData: BeefyCheckpointData +): Promise => { + const configFilePath = `../contracts/config/${networkId}.json`; + const configFile = Bun.file(configFilePath); + + if (!(await configFile.exists())) { + throw new Error(`Configuration file not found: ${configFilePath}`); + } + + const configContent = await configFile.text(); + const configJson = JSON.parse(configContent); + + if (!configJson.snowbridge) { + logger.warn(`"snowbridge" section not found in config, creating it.`); + configJson.snowbridge = {}; + } + + // Store the old values for comparison + const oldStartBlock = configJson.snowbridge.startBlock; + const oldMinSigs = configJson.snowbridge.minNumRequiredSignatures; + const oldInitialId = configJson.snowbridge.initialValidatorSetId; + const oldNextId = configJson.snowbridge.nextValidatorSetId; + const oldInitial = configJson.snowbridge.initialValidatorHashes || []; + const oldNext = configJson.snowbridge.nextValidatorHashes || []; + + // Update with new values + configJson.snowbridge.startBlock = checkpointData.startBlock; + configJson.snowbridge.minNumRequiredSignatures = checkpointData.minNumRequiredSignatures; + configJson.snowbridge.initialValidatorSetId = checkpointData.initialValidatorSetId; + configJson.snowbridge.initialValidatorHashes = checkpointData.initialValidatorHashes; + configJson.snowbridge.nextValidatorSetId = checkpointData.nextValidatorSetId; + configJson.snowbridge.nextValidatorHashes = checkpointData.nextValidatorHashes; + + await Bun.write(configFilePath, `${JSON.stringify(configJson, null, 2)}\n`); + + logger.success(`Config file updated: ${configFilePath}`); + + // Show what changed + if (oldStartBlock !== checkpointData.startBlock) { + logger.info(` startBlock: ${oldStartBlock ?? "unset"} -> ${checkpointData.startBlock}`); + } + if (oldMinSigs !== checkpointData.minNumRequiredSignatures) { + logger.info( + ` minNumRequiredSignatures: ${oldMinSigs ?? "unset"} -> ${checkpointData.minNumRequiredSignatures}` + ); + } + if (oldInitialId !== checkpointData.initialValidatorSetId) { + logger.info( + ` initialValidatorSetId: ${oldInitialId ?? "unset"} -> ${checkpointData.initialValidatorSetId}` + ); + } + if (oldNextId !== checkpointData.nextValidatorSetId) { + logger.info( + ` nextValidatorSetId: ${oldNextId ?? "unset"} -> ${checkpointData.nextValidatorSetId}` + ); + } + if (JSON.stringify(oldInitial) !== JSON.stringify(checkpointData.initialValidatorHashes)) { + logger.info( + ` initialValidatorHashes: ${oldInitial.length} -> ${checkpointData.initialValidatorHashes.length} entries` + ); + } + if (JSON.stringify(oldNext) !== JSON.stringify(checkpointData.nextValidatorHashes)) { + logger.info( + ` nextValidatorHashes: ${oldNext.length} -> ${checkpointData.nextValidatorHashes.length} entries` + ); + } +}; + +/** + * Main handler for the update-beefy-checkpoint command. + * Fetches BEEFY authorities from a live DataHaven chain and updates the config file. + */ +export const updateBeefyCheckpoint = async ( + options: UpdateBeefyCheckpointOptions +): Promise => { + const networkId = buildNetworkId(options.chain, options.environment); + + printHeader(`Updating BEEFY Checkpoint for ${networkId}`); + + logger.info("📋 Configuration:"); + logger.info(` Chain: ${options.chain}`); + if (options.environment) { + logger.info(` Environment: ${options.environment}`); + } + logger.info(` RPC URL: ${options.rpcUrl}`); + logger.info(` Config file: contracts/config/${networkId}.json`); + + printDivider(); + + try { + // Fetch checkpoint data from the live chain + const checkpointData = await fetchBeefyCheckpointData(options.rpcUrl); + + printDivider(); + + // Display the checkpoint data + logger.info("📝 BEEFY Checkpoint Data:"); + logger.info(` Start Block: ${checkpointData.startBlock}`); + logger.info(` Min Required Signatures: ${checkpointData.minNumRequiredSignatures}`); + logger.info(` Initial Validator Set ID: ${checkpointData.initialValidatorSetId}`); + logger.info(` Initial Validators (${checkpointData.initialValidatorHashes.length} total):`); + for (let i = 0; i < checkpointData.initialValidatorHashes.length; i++) { + logger.info(` [${i}] ${checkpointData.initialValidatorHashes[i]}`); + } + + logger.info(` Next Validator Set ID: ${checkpointData.nextValidatorSetId}`); + logger.info(` Next Validators (${checkpointData.nextValidatorHashes.length} total):`); + for (let i = 0; i < checkpointData.nextValidatorHashes.length; i++) { + logger.info(` [${i}] ${checkpointData.nextValidatorHashes[i]}`); + } + + printDivider(); + + // Update the config file + await updateConfigFile(networkId, checkpointData); + + printDivider(); + logger.success(`BEEFY checkpoint updated successfully for ${networkId}`); + } catch (error) { + logger.error(`Failed to update BEEFY checkpoint: ${error}`); + throw error; + } +}; + +/** + * CLI action handler for the update-beefy-checkpoint command. + * Note: Chain and environment validation is handled by contractsPreActionHook. + */ +export const contractsUpdateBeefyCheckpoint = async ( + options: any, + _command: any +): Promise => { + const { chain, environment, rpcUrl } = options; + + // Validate rpc-url (specific to this command, not validated by preAction hook) + if (!rpcUrl) { + logger.error("❌ --rpc-url is required (WebSocket URL to the DataHaven chain)"); + process.exit(1); + } + + await updateBeefyCheckpoint({ + chain, + environment, + rpcUrl + }); +}; diff --git a/test/cli/handlers/contracts/deploy.ts b/test/cli/handlers/contracts/deploy.ts index b8dc71f4..1999d6e0 100644 --- a/test/cli/handlers/contracts/deploy.ts +++ b/test/cli/handlers/contracts/deploy.ts @@ -3,8 +3,15 @@ import { deployContracts } from "../../../scripts/deploy-contracts"; import { showDeploymentPlanAndStatus } from "./status"; import { verifyContracts } from "./verify"; -export const contractsDeploy = async (options: any, command: any) => { - // Try to get chain from options or command +/** + * Extracts chain and environment options from command options and parent command. + * This handles the case where options may be specified at either the subcommand + * or parent command level. + */ +const getChainAndEnvironment = ( + options: any, + command: any +): { chain: string | undefined; environment: string | undefined } => { let chain = options.chain; if (!chain && command.parent) { chain = command.parent.getOptionValue("chain"); @@ -13,19 +20,38 @@ export const contractsDeploy = async (options: any, command: any) => { chain = command.getOptionValue("chain"); } - printHeader(`Deploying DataHaven Contracts to ${chain}`); + let environment = options.environment; + if (!environment && command.parent) { + environment = command.parent.getOptionValue("environment"); + } + + return { chain, environment }; +}; + +export const contractsDeploy = async (options: any, command: any) => { + const { chain, environment } = getChainAndEnvironment(options, command); + + // Build display name for logging + const displayName = environment ? `${environment}-${chain}` : chain; + + printHeader(`Deploying DataHaven Contracts to ${displayName}`); const txExecutionOverride = options.executeOwnerTransactions ? true : undefined; try { logger.info("🚀 Starting deployment..."); logger.info(`📡 Using chain: ${chain}`); + if (environment) { + logger.info(`📡 Using environment: ${environment}`); + } if (options.rpcUrl) { logger.info(`📡 Using RPC URL: ${options.rpcUrl}`); } + // Chain is guaranteed to be defined by preAction hook validation await deployContracts({ - chain: chain, + chain: chain!, + environment: environment, rpcUrl: options.rpcUrl, privateKey: options.privateKey, avsOwnerKey: options.avsOwnerKey, @@ -40,34 +66,27 @@ export const contractsDeploy = async (options: any, command: any) => { }; export const contractsCheck = async (options: any, command: any) => { - // Try to get chain from options or command - let chain = options.chain; - if (!chain && command.parent) { - chain = command.parent.getOptionValue("chain"); - } - if (!chain) { - chain = command.getOptionValue("chain"); - } + const { chain, environment } = getChainAndEnvironment(options, command); - printHeader(`Checking DataHaven ${chain} Configuration and Status`); + // Build network identifier with environment prefix if specified + const networkId = environment ? `${environment}-${chain}` : chain; + + printHeader(`Checking DataHaven ${networkId} Configuration and Status`); logger.info("🔍 Showing deployment plan and status"); // Use the status function from status.ts - await showDeploymentPlanAndStatus(chain); + // Chain is guaranteed to be defined by preAction hook validation + await showDeploymentPlanAndStatus(chain!, environment); }; export const contractsVerify = async (options: any, command: any) => { - // Try to get chain from options or command - let chain = options.chain; - if (!chain && command.parent) { - chain = command.parent.getOptionValue("chain"); - } - if (!chain) { - chain = command.getOptionValue("chain"); - } + const { chain, environment } = getChainAndEnvironment(options, command); - printHeader(`Verifying DataHaven Contracts on ${chain} Block Explorer`); + // Build display name for logging + const displayName = environment ? `${environment}-${chain}` : chain; + + printHeader(`Verifying DataHaven Contracts on ${displayName} Block Explorer`); if (options.skipVerification) { logger.info("⏭️ Skipping verification as requested"); @@ -77,7 +96,8 @@ export const contractsVerify = async (options: any, command: any) => { try { const verifyOptions = { ...options, - chain: chain + chain: chain, + environment: environment }; await verifyContracts(verifyOptions); printDivider(); @@ -86,26 +106,63 @@ export const contractsVerify = async (options: any, command: any) => { } }; +/** + * Supported networks for contract deployment. + * These must correspond to config files in contracts/config/{network}.json + */ +export const SUPPORTED_NETWORKS = [ + "anvil", + "hoodi", + "stagenet-hoodi", + "testnet-hoodi", + "ethereum", + "mainnet-ethereum" +] as const; + export const contractsPreActionHook = async (thisCommand: any) => { let chain = thisCommand.getOptionValue("chain"); + let environment = thisCommand.getOptionValue("environment"); if (!chain && thisCommand.parent) { chain = thisCommand.parent.getOptionValue("chain"); } + if (!environment && thisCommand.parent) { + environment = thisCommand.parent.getOptionValue("environment"); + } const privateKey = thisCommand.getOptionValue("privateKey"); if (!chain) { - logger.error("❌ Chain is required. Use --chain option (hoodi, mainnet, anvil)"); + logger.error("❌ Chain is required. Use --chain option (hoodi, ethereum, anvil)"); process.exit(1); } - const supportedChains = ["hoodi", "mainnet", "anvil"]; + const supportedChains = ["hoodi", "ethereum", "anvil"]; if (!supportedChains.includes(chain)) { logger.error(`❌ Unsupported chain: ${chain}. Supported chains: ${supportedChains.join(", ")}`); process.exit(1); } + // Validate environment if provided + if (environment) { + const supportedEnvironments = ["stagenet", "testnet", "mainnet"]; + if (!supportedEnvironments.includes(environment)) { + logger.error( + `❌ Unsupported environment: ${environment}. Supported environments: ${supportedEnvironments.join(", ")}` + ); + process.exit(1); + } + + // Validate the full network identifier exists + const networkId = `${environment}-${chain}`; + if (!SUPPORTED_NETWORKS.includes(networkId as (typeof SUPPORTED_NETWORKS)[number])) { + logger.error( + `❌ Unsupported network combination: ${networkId}. Supported networks: ${SUPPORTED_NETWORKS.join(", ")}` + ); + process.exit(1); + } + } + if (!privateKey && !process.env.DEPLOYER_PRIVATE_KEY) { logger.warn( "⚠️ Private key not provided. Will use DEPLOYER_PRIVATE_KEY environment variable if set, or default Anvil key." diff --git a/test/cli/handlers/contracts/index.ts b/test/cli/handlers/contracts/index.ts index 681b6d8e..b0596e2b 100644 --- a/test/cli/handlers/contracts/index.ts +++ b/test/cli/handlers/contracts/index.ts @@ -1,4 +1,6 @@ +export * from "./beefy-checkpoint"; export * from "./deploy"; +export * from "./rewards-origin"; export * from "./status"; export * from "./update-metadata"; export * from "./verify"; diff --git a/test/cli/handlers/contracts/rewards-origin.ts b/test/cli/handlers/contracts/rewards-origin.ts new file mode 100644 index 00000000..d89c31bd --- /dev/null +++ b/test/cli/handlers/contracts/rewards-origin.ts @@ -0,0 +1,327 @@ +import invariant from "tiny-invariant"; +import { logger, printDivider, printHeader } from "utils"; +import { createPapiConnectors } from "utils/papi"; +import { concat, type Hex, toBytes, toHex } from "viem"; +import { buildNetworkId } from "../../../configs/contracts/config"; + +interface UpdateRewardsOriginOptions { + chain: string; + environment?: string; + rpcUrl: string; + genesisHash?: string; +} + +/** + * Derives an AccountId20 from a PalletId using the same algorithm as Substrate's + * `into_account_truncating()`. + * + * The algorithm (see https://www.shawntabrizi.com/substrate-js-utilities/): + * 1. Prepends "modl" (4 bytes) to the 8-byte pallet ID + * 2. For AccountId20 (H160), takes the first 20 bytes: modl(4) + pallet_id(8) + zeros(8) + * + * Note: This is a simple truncation, NOT a hash operation. + * + * @param palletId - The 8-character pallet ID string (e.g., "dh/evrew") + * @returns The derived AccountId20 as a hex string + */ +const palletIdToAccountId20 = (palletId: string): Hex => { + invariant(palletId.length === 8, "Pallet ID must be exactly 8 characters"); + + // Build: "modl" (4 bytes) + pallet_id (8 bytes) + zeros (8 bytes) = 20 bytes + const prefix = toBytes("modl"); + const palletIdBytes = toBytes(palletId); + const accountId20 = new Uint8Array(20); + accountId20.set(prefix, 0); + accountId20.set(palletIdBytes, 4); + // Remaining 8 bytes are already zeros (padding) + + return toHex(accountId20); +}; + +/** + * Computes the Agent ID (H256) for a pallet's sovereign account on the DataHaven chain. + * + * The Agent ID is computed following Snowbridge's `AgentIdOf` type, which uses + * `HashedDescription` with `DescribeGlobalPrefix`. For an AccountKey20 on a chain + * identified by its genesis hash, the encoding is: + * + * blake2_256(SCALE_ENCODE(("GlobalConsensus", ByGenesis(genesis_hash), ("AccountKey20", account_key)))) + * + * NOTE: This computation follows Snowbridge's pattern but may need verification against + * the actual on-chain Agent ID. The preferred approach is to set RewardsAgentOrigin on + * the chain and fetch it via this command. + * + * @param genesisHash - The chain's genesis hash (32 bytes, hex string with 0x prefix) + * @param accountKey20 - The 20-byte account key (hex string with 0x prefix) + * @returns The computed Agent ID as a hex string + */ +const computeAgentId = async (genesisHash: Hex, accountKey20: Hex): Promise => { + // Import blake2b dynamically (it's an ESM module) + const { blake2b } = await import("@noble/hashes/blake2b"); + + // Validate inputs + invariant( + genesisHash.length === 66, + `Genesis hash must be 32 bytes (66 chars with 0x prefix), got ${genesisHash.length}` + ); + invariant( + accountKey20.length === 42, + `Account key must be 20 bytes (42 chars with 0x prefix), got ${accountKey20.length}` + ); + + // SCALE encoding for the location description follows Snowbridge's pattern: + // ("GlobalConsensus", ByGenesis(genesis_hash), interior_description) + // + // Where interior_description for AccountKey20 is: + // ("AccountKey20", key) + // + // In SCALE for fixed-size arrays (like b"GlobalConsensus"): + // - Fixed-size byte arrays are encoded as raw bytes without length prefix + // - Variable-length Vec gets a compact length prefix + // - Enums are encoded as variant index + payload + + // "GlobalConsensus" as raw bytes (15 bytes, no length prefix for fixed array) + const globalConsensusBytes = toBytes("GlobalConsensus"); + + // ByGenesis variant (index 0 in NetworkId enum) + genesis hash (32 bytes) + // NetworkId::ByGenesis is the first variant, so index = 0 + const byGenesisVariant = new Uint8Array([0]); + const genesisBytes = toBytes(genesisHash); + + // "AccountKey20" as raw bytes (12 bytes, no length prefix for fixed array) + const accountKey20StrBytes = toBytes("AccountKey20"); + + // Account key bytes (20 bytes) + const accountKeyBytes = toBytes(accountKey20); + + // Build the interior description: ("AccountKey20", key) as raw bytes + const interiorDescription = concat([accountKey20StrBytes, accountKeyBytes]); + + // Length prefix for interior (SCALE compact encoding: value << 2 for values < 64) + const interiorLen = interiorDescription.length; + const interiorLenCompact = new Uint8Array([interiorLen << 2]); + + // Final encoding: GlobalConsensus prefix + ByGenesis(genesis) + compact_len(interior) + const encoded = concat([ + globalConsensusBytes, + byGenesisVariant, + genesisBytes, + interiorLenCompact, + interiorDescription + ]); + + // Hash with blake2b-256 to get the Agent ID (same as Snowbridge's blake2_256) + const hash = blake2b(new Uint8Array(encoded), { dkLen: 32 }); + return toHex(hash); +}; + +/** + * Fetches the RewardsAgentOrigin from the runtime parameters. + * + * @param rpcUrl - WebSocket RPC endpoint of the DataHaven chain + * @returns The RewardsAgentOrigin as a hex string, or null if not set or zero + */ +const fetchRewardsAgentOrigin = async (rpcUrl: string): Promise => { + logger.info(`📡 Connecting to DataHaven chain at ${rpcUrl}...`); + + const { client: papiClient, typedApi: dhApi } = createPapiConnectors(rpcUrl); + + try { + logger.info("🔍 Fetching RewardsAgentOrigin from runtime parameters..."); + + // Query the Parameters pallet for RewardsAgentOrigin + const parameter = await dhApi.query.Parameters.Parameters.getValue( + { + type: "RuntimeConfig", + value: { type: "RewardsAgentOrigin", value: undefined } + }, + { at: "best" } + ); + + if (!parameter) { + logger.info("ℹ️ RewardsAgentOrigin parameter not found (using default)"); + return null; + } + + // Extract the value from the parameter result + // The parameter is wrapped in the RuntimeConfig enum variant + if (parameter.type === "RuntimeConfig" && parameter.value.type === "RewardsAgentOrigin") { + const origin = parameter.value.value; + if (origin) { + const originHex = origin.asHex(); + // Check if it's the zero hash + const zeroHash = + "0x0000000000000000000000000000000000000000000000000000000000000000" as Hex; + if (originHex === zeroHash) { + logger.info("ℹ️ RewardsAgentOrigin is set to zero (placeholder)"); + return null; + } + logger.success(`Found RewardsAgentOrigin: ${originHex}`); + return originHex as Hex; + } + } + + logger.info("ℹ️ RewardsAgentOrigin value not available"); + return null; + } finally { + papiClient.destroy(); + } +}; + +/** + * Fetches the genesis hash from the chain. + * + * @param rpcUrl - WebSocket RPC endpoint of the DataHaven chain + * @returns The genesis hash as a hex string + */ +const fetchGenesisHash = async (rpcUrl: string): Promise => { + logger.info("🔍 Fetching genesis hash from chain..."); + + const { client: papiClient } = createPapiConnectors(rpcUrl); + + try { + // Use _request to call chain_getBlockHash RPC method with block number 0 + const genesisHash = await papiClient._request("chain_getBlockHash", [0]); + logger.success(`Genesis hash: ${genesisHash}`); + return genesisHash as Hex; + } finally { + papiClient.destroy(); + } +}; + +/** + * Updates the config file with the rewards message origin. + * + * @param networkId - The network identifier (e.g., "hoodi", "stagenet-hoodi") + * @param rewardsMessageOrigin - The rewards message origin (Agent ID) + */ +const updateConfigFile = async (networkId: string, rewardsMessageOrigin: Hex): Promise => { + const configFilePath = `../contracts/config/${networkId}.json`; + const configFile = Bun.file(configFilePath); + + if (!(await configFile.exists())) { + throw new Error(`Configuration file not found: ${configFilePath}`); + } + + const configContent = await configFile.text(); + const configJson = JSON.parse(configContent); + + if (!configJson.snowbridge) { + logger.warn(`"snowbridge" section not found in config, creating it.`); + configJson.snowbridge = {}; + } + + const oldOrigin = configJson.snowbridge.rewardsMessageOrigin; + configJson.snowbridge.rewardsMessageOrigin = rewardsMessageOrigin; + + await Bun.write(configFilePath, `${JSON.stringify(configJson, null, 2)}\n`); + + logger.success(`Config file updated: ${configFilePath}`); + + if (oldOrigin !== rewardsMessageOrigin) { + logger.info(` rewardsMessageOrigin: ${oldOrigin ?? "unset"} -> ${rewardsMessageOrigin}`); + } +}; + +/** + * Main handler for the update-rewards-origin command. + * Fetches or computes the RewardsAgentOrigin and updates the config file. + */ +export const updateRewardsOrigin = async (options: UpdateRewardsOriginOptions): Promise => { + const networkId = buildNetworkId(options.chain, options.environment); + + printHeader(`Updating Rewards Message Origin for ${networkId}`); + + logger.info("📋 Configuration:"); + logger.info(` Chain: ${options.chain}`); + if (options.environment) { + logger.info(` Environment: ${options.environment}`); + } + logger.info(` RPC URL: ${options.rpcUrl}`); + if (options.genesisHash) { + logger.info(` Genesis hash (provided): ${options.genesisHash}`); + } + logger.info(` Config file: contracts/config/${networkId}.json`); + + printDivider(); + + try { + // Step 1: Try to fetch RewardsAgentOrigin from the chain + let rewardsMessageOrigin = await fetchRewardsAgentOrigin(options.rpcUrl); + + printDivider(); + + if (rewardsMessageOrigin) { + // Use the value from the chain + logger.info("✅ Using RewardsAgentOrigin from chain runtime parameters"); + } else { + // Compute the Agent ID from genesis hash and pallet account + logger.info("🔧 Computing RewardsAgentOrigin from genesis hash and pallet account..."); + + // Get genesis hash (from option or fetch from chain) + const genesisHash = options.genesisHash + ? (options.genesisHash as Hex) + : await fetchGenesisHash(options.rpcUrl); + + // Derive the ExternalValidatorRewardsAccount from the pallet ID "dh/evrew" + const palletId = "dh/evrew"; + logger.info(`🔐 Deriving account from pallet ID: "${palletId}"`); + const rewardsAccount = palletIdToAccountId20(palletId); + logger.info(` Rewards pallet account: ${rewardsAccount}`); + + // Compute the Agent ID + logger.info("🔐 Computing Agent ID..."); + logger.warn( + "⚠️ Note: Computed Agent ID may need verification. Prefer setting RewardsAgentOrigin on-chain." + ); + rewardsMessageOrigin = await computeAgentId(genesisHash, rewardsAccount); + logger.info(` Agent ID: ${rewardsMessageOrigin}`); + } + + printDivider(); + + // Display the final value + logger.info("📝 Rewards Message Origin:"); + logger.info(` ${rewardsMessageOrigin}`); + + printDivider(); + + // Update the config file + await updateConfigFile(networkId, rewardsMessageOrigin); + + printDivider(); + logger.success(`Rewards message origin updated successfully for ${networkId}`); + } catch (error) { + logger.error(`Failed to update rewards message origin: ${error}`); + throw error; + } +}; + +/** + * CLI action handler for the update-rewards-origin command. + * Note: Chain and environment validation is handled by contractsPreActionHook. + */ +export const contractsUpdateRewardsOrigin = async (options: any, _command: any): Promise => { + const { chain, environment, rpcUrl, genesisHash } = options; + + // Validate rpc-url (specific to this command, not validated by preAction hook) + if (!rpcUrl) { + logger.error("❌ --rpc-url is required (WebSocket URL to the DataHaven chain)"); + process.exit(1); + } + + // Validate genesis hash format if provided + if (genesisHash) { + if (!/^0x[0-9a-fA-F]{64}$/.test(genesisHash)) { + logger.error("❌ --genesis-hash must be a 32-byte hex string (0x + 64 hex chars)"); + process.exit(1); + } + } + + await updateRewardsOrigin({ + chain, + environment, + rpcUrl, + genesisHash + }); +}; diff --git a/test/cli/handlers/contracts/status.ts b/test/cli/handlers/contracts/status.ts index a6d34e05..76a86638 100644 --- a/test/cli/handlers/contracts/status.ts +++ b/test/cli/handlers/contracts/status.ts @@ -1,16 +1,24 @@ import { logger, printDivider } from "utils"; -import { getChainDeploymentParams, loadChainConfig } from "../../../configs/contracts/config"; +import { + buildNetworkId, + getChainDeploymentParams, + loadChainConfig +} from "../../../configs/contracts/config"; import { checkContractVerification } from "./verify"; /** * Shows the status of chain deployment and verification + * @param chain - The target chain (hoodi, mainnet, anvil) + * @param environment - Optional deployment environment (stagenet, testnet, mainnet) */ -export const showDeploymentPlanAndStatus = async (chain: string) => { +export const showDeploymentPlanAndStatus = async (chain: string, environment?: string) => { + const networkId = buildNetworkId(chain, environment); + try { - const config = await loadChainConfig(chain); + const config = await loadChainConfig(chain, environment); const deploymentParams = getChainDeploymentParams(chain); - const displayData = { + const displayData: Record = { Network: `${deploymentParams.network} (Chain ID: ${deploymentParams.chainId})`, "RPC URL": deploymentParams.rpcUrl, "Block Explorer": deploymentParams.blockExplorer, @@ -19,19 +27,24 @@ export const showDeploymentPlanAndStatus = async (chain: string) => { "Rewards Initiator": `${config.avs.rewardsInitiator.slice(0, 10)}...${config.avs.rewardsInitiator.slice(-8)}`, "Veto Committee Member": `${config.avs.vetoCommitteeMember.slice(0, 10)}...${config.avs.vetoCommitteeMember.slice(-8)}` }; + + if (environment) { + displayData.Environment = environment; + } + console.table(displayData); - await showDatahavenContractStatus(chain, deploymentParams.rpcUrl); + await showDatahavenContractStatus(networkId, deploymentParams.rpcUrl); await showEigenLayerContractStatus( config, deploymentParams.chainId.toString(), deploymentParams.rpcUrl, - chain + networkId ); printDivider(); } catch (error) { - logger.error(`❌ Failed to load ${chain} configuration: ${error}`); + logger.error(`❌ Failed to load ${networkId} configuration: ${error}`); } }; @@ -69,8 +82,10 @@ const printContractStatus = async ( /** * Shows the status of all contracts (deployment + verification) + * @param networkId - The network identifier (e.g., "hoodi", "stagenet-hoodi") + * @param rpcUrl - The RPC URL for the chain */ -const showDatahavenContractStatus = async (chain: string, rpcUrl: string) => { +const showDatahavenContractStatus = async (networkId: string, rpcUrl: string) => { try { const contracts = [ { name: "DataHavenServiceManager", key: "ServiceManagerImplementation" }, @@ -81,7 +96,7 @@ const showDatahavenContractStatus = async (chain: string, rpcUrl: string) => { logger.info("DataHaven contracts"); - const deploymentsPath = `../contracts/deployments/${chain}.json`; + const deploymentsPath = `../contracts/deployments/${networkId}.json`; const deploymentsFile = Bun.file(deploymentsPath); const exists = await deploymentsFile.exists(); @@ -97,7 +112,12 @@ const showDatahavenContractStatus = async (chain: string, rpcUrl: string) => { for (const contract of contracts) { const address = deployments[contract.key]; - await printContractStatus({ name: contract.name, address }, etherscanApiKey, chain, rpcUrl); + await printContractStatus( + { name: contract.name, address }, + etherscanApiKey, + networkId, + rpcUrl + ); } } catch (error) { logger.warn(`⚠️ Could not check contract status: ${error}`); @@ -106,22 +126,26 @@ const showDatahavenContractStatus = async (chain: string, rpcUrl: string) => { /** * Shows the status of EigenLayer contracts (verification only) + * @param config - The chain configuration + * @param chainId - The chain ID + * @param rpcUrl - The RPC URL for the chain + * @param networkId - The network identifier (e.g., "hoodi", "stagenet-hoodi") */ const showEigenLayerContractStatus = async ( config: any, chainId: string, rpcUrl: string, - chain: string + networkId: string ) => { try { // For local/anvil deployments, read addresses from deployments file // For testnet/mainnet, use addresses from config file let eigenLayerAddresses: Record = {}; - const isLocal = chain === "anvil" || chain === "local"; + const isLocal = networkId === "anvil" || networkId === "local"; if (isLocal) { try { - const deploymentsPath = `../contracts/deployments/${chain === "local" ? "anvil" : chain}.json`; + const deploymentsPath = `../contracts/deployments/${networkId === "local" ? "anvil" : networkId}.json`; const deploymentsFile = Bun.file(deploymentsPath); if (await deploymentsFile.exists()) { const deployments = await deploymentsFile.json(); diff --git a/test/cli/handlers/contracts/verify.ts b/test/cli/handlers/contracts/verify.ts index 063ec23e..5f369b43 100644 --- a/test/cli/handlers/contracts/verify.ts +++ b/test/cli/handlers/contracts/verify.ts @@ -1,10 +1,11 @@ import { execSync } from "node:child_process"; import { logger } from "utils"; import { parseDeploymentsFile } from "utils/contracts"; -import { CHAIN_CONFIGS, getChainConfig } from "../../../configs/contracts/config"; +import { buildNetworkId, CHAIN_CONFIGS, getChainConfig } from "../../../configs/contracts/config"; interface ContractsVerifyOptions { chain: string; + environment?: string; rpcUrl?: string; skipVerification: boolean; } @@ -26,7 +27,10 @@ export const verifyContracts = async (options: ContractsVerifyOptions) => { return; } - logger.info(`🔍 Verifying contracts on ${options.chain} block explorer using Foundry...`); + // Build network identifier for deployment file lookup + const networkId = buildNetworkId(options.chain, options.environment); + + logger.info(`🔍 Verifying contracts on ${networkId} block explorer using Foundry...`); const etherscanApiKey = process.env.ETHERSCAN_API_KEY; if (!etherscanApiKey) { @@ -35,7 +39,7 @@ export const verifyContracts = async (options: ContractsVerifyOptions) => { return; } - const deployments = await parseDeploymentsFile(options.chain); + const deployments = await parseDeploymentsFile(networkId); const contractsToVerify: ContractToVerify[] = [ { diff --git a/test/cli/index.ts b/test/cli/index.ts index b0ee5c10..a9752657 100644 --- a/test/cli/index.ts +++ b/test/cli/index.ts @@ -5,6 +5,8 @@ import { contractsCheck, contractsDeploy, contractsPreActionHook, + contractsUpdateBeefyCheckpoint, + contractsUpdateRewardsOrigin, contractsVerify, deploy, deployPreActionHook, @@ -199,15 +201,20 @@ const contractsCommand = program .addHelpText( "before", `🫎 DataHaven: Contracts Deployment CLI for deploying DataHaven AVS contracts to supported chains - + Commands: - status: Show deployment plan, configuration, and status (default) - deploy: Deploy contracts to specified chain - verify: Verify deployed contracts on block explorer + - update-beefy-checkpoint: Fetch BEEFY authorities from a live chain and update config + - update-rewards-origin: Fetch or compute the RewardsAgentOrigin and update config - update-metadata: Update the metadata URI of an existing AVS contract - + Common options: - --chain: Target chain (required: hoodi, mainnet, anvil) + --chain: Target chain (required: hoodi, ethereum, anvil) + --environment: Deployment environment (stagenet, testnet, mainnet) + When specified, config files are read from {environment}-{chain}.json + and deployments are written to {environment}-{chain}.json --rpc-url: Chain RPC URL (optional, defaults based on chain) --private-key: Private key for deployment --skip-verification: Skip contract verification @@ -219,7 +226,11 @@ const contractsCommand = program contractsCommand .command("status") .description("Show deployment plan, configuration, and status") - .option("--chain ", "Target chain (hoodi, mainnet, anvil)") + .option("--chain ", "Target chain (hoodi, ethereum, anvil)") + .option( + "--environment ", + "Deployment environment (stagenet, testnet, mainnet). Config and deployment files will be prefixed with this value." + ) .option("--rpc-url ", "Chain RPC URL (optional, defaults based on chain)") .option( "--private-key ", @@ -234,7 +245,11 @@ contractsCommand contractsCommand .command("deploy") .description("Deploy DataHaven AVS contracts to specified chain") - .option("--chain ", "Target chain (hoodi, mainnet, anvil)") + .option("--chain ", "Target chain (hoodi, ethereum, anvil)") + .option( + "--environment ", + "Deployment environment (stagenet, testnet, mainnet). Config and deployment files will be prefixed with this value." + ) .option("--rpc-url ", "Chain RPC URL (optional, defaults based on chain)") .option( "--private-key ", @@ -255,17 +270,73 @@ contractsCommand contractsCommand .command("verify") .description("Verify deployed contracts on block explorer") - .option("--chain ", "Target chain (hoodi, mainnet, anvil)") + .option("--chain ", "Target chain (hoodi, ethereum, anvil)") + .option( + "--environment ", + "Deployment environment (stagenet, testnet, mainnet). Config and deployment files will be prefixed with this value." + ) .option("--rpc-url ", "Chain RPC URL (optional, defaults based on chain)") .option("--skip-verification", "Skip contract verification", false) .hook("preAction", contractsPreActionHook) .action(contractsVerify); +// Contracts Update BEEFY Checkpoint +contractsCommand + .command("update-beefy-checkpoint") + .description( + "Fetch BEEFY authorities from a live DataHaven chain and update the config file with validator hashes" + ) + .option("--chain ", "Target chain (hoodi, ethereum, anvil)") + .option( + "--environment ", + "Deployment environment (stagenet, testnet, mainnet). Config and deployment files will be prefixed with this value." + ) + .option( + "--rpc-url ", + "WebSocket RPC URL of the DataHaven chain to fetch BEEFY authorities from" + ) + .hook("preAction", contractsPreActionHook) + .action(async (_options: any, command: any) => { + // Options are captured by parent command due to shared option names + // Use optsWithGlobals() to get all options including inherited ones + const opts = command.optsWithGlobals(); + await contractsUpdateBeefyCheckpoint(opts, command); + }); + +// Contracts Update Rewards Origin +contractsCommand + .command("update-rewards-origin") + .description( + "Fetch or compute the RewardsAgentOrigin and update the config file with the rewards message origin" + ) + .option("--chain ", "Target chain (hoodi, ethereum, anvil)") + .option( + "--environment ", + "Deployment environment (stagenet, testnet, mainnet). Config and deployment files will be prefixed with this value." + ) + .option( + "--rpc-url ", + "WebSocket RPC URL of the DataHaven chain to fetch RewardsAgentOrigin from" + ) + .option( + "--genesis-hash ", + "Chain genesis hash (32 bytes hex). If not provided, will be fetched from the chain." + ) + .hook("preAction", contractsPreActionHook) + .action(async (_options: any, command: any) => { + const opts = command.optsWithGlobals(); + await contractsUpdateRewardsOrigin(opts, command); + }); + // Contracts Update Metadata contractsCommand .command("update-metadata") .description("Update AVS metadata URI for the DataHaven Service Manager") - .option("--chain ", "Target chain (hoodi, mainnet, anvil)") + .option("--chain ", "Target chain (hoodi, ethereum, anvil)") + .option( + "--environment ", + "Deployment environment (stagenet, testnet, mainnet). Config and deployment files will be prefixed with this value." + ) .option("--uri ", "New metadata URI (required)") .option("--reset", "Use if you want to reset the metadata URI") .option("--rpc-url ", "Chain RPC URL (optional, defaults based on chain)") @@ -289,16 +360,24 @@ contractsCommand if (!chain) { throw new Error("--chain parameter is required"); } - await updateAVSMetadataURI(chain, options.uri, { + // Build network identifier with environment prefix if specified + const environment = options.environment; + const networkId = environment ? `${environment}-${chain}` : chain; + await updateAVSMetadataURI(networkId, options.uri, { execute: options.execute, avsOwnerKey: options.avsOwnerKey }); }); -// Default Contracts command (runs check) +// Default Contracts command (runs check when no subcommand is specified) +// preAction hook on subcommands handles validation before the action runs contractsCommand .description("Show deployment plan, configuration, and status") - .option("--chain ", "Target chain (hoodi, mainnet, anvil)") + .option("--chain ", "Target chain (hoodi, ethereum, anvil)") + .option( + "--environment ", + "Deployment environment (stagenet, testnet, mainnet). Config and deployment files will be prefixed with this value." + ) .option("--rpc-url ", "Chain RPC URL (optional, defaults based on chain)") .option( "--private-key ", @@ -307,7 +386,9 @@ contractsCommand ) .option("--skip-verification", "Skip contract verification", false) .hook("preAction", contractsPreActionHook) - .action(contractsCheck); + .action(async (options: any, command: any) => { + await contractsCheck(options, command); + }); // ===== Exec ====== // Disabled until need arises diff --git a/test/configs/contracts/config.ts b/test/configs/contracts/config.ts index 58017e30..1c9971e5 100644 --- a/test/configs/contracts/config.ts +++ b/test/configs/contracts/config.ts @@ -14,8 +14,8 @@ export const CHAIN_CONFIGS = { EPOCHS_PER_SYNC_COMMITTEE_PERIOD: 256, SYNC_COMMITTEE_SIZE: 512 }, - mainnet: { - NETWORK_NAME: "mainnet", + ethereum: { + NETWORK_NAME: "ethereum", CHAIN_ID: 1, RPC_URL: "https://eth.llamarpc.com", BLOCK_EXPLORER: "https://etherscan.io/", @@ -39,22 +39,39 @@ export const getChainConfig = (chain: string) => { return CHAIN_CONFIGS[chain as keyof ChainConfigType]; }; -export const loadChainConfig = async (chain: string) => { +/** + * Builds the network identifier from chain and optional environment + * When environment is specified: {environment}-{chain} (e.g., "stagenet-hoodi") + * When environment is not specified: {chain} (e.g., "hoodi") + */ +export const buildNetworkId = (chain: string, environment?: string): string => { + return environment ? `${environment}-${chain}` : chain; +}; + +/** + * Loads chain configuration from the config file + * @param chain - The target chain (hoodi, mainnet, anvil) + * @param environment - Optional deployment environment (stagenet, testnet, mainnet) + * When specified, loads from {environment}-{chain}.json + */ +export const loadChainConfig = async (chain: string, environment?: string) => { + const networkId = buildNetworkId(chain, environment); + try { - const configPath = `../contracts/config/${chain}.json`; + const configPath = `../contracts/config/${networkId}.json`; const configFile = Bun.file(configPath); if (!(await configFile.exists())) { - throw new Error(`${chain} configuration file not found at ${configPath}`); + throw new Error(`${networkId} configuration file not found at ${configPath}`); } const configContent = await configFile.text(); const config = JSON.parse(configContent); - logger.debug(`✅ ${chain} configuration loaded successfully`); + logger.debug(`✅ ${networkId} configuration loaded successfully`); return config; } catch (error) { - logger.error(`❌ Failed to load ${chain} configuration: ${error}`); + logger.error(`❌ Failed to load ${networkId} configuration: ${error}`); throw error; } }; diff --git a/test/scripts/deploy-contracts.ts b/test/scripts/deploy-contracts.ts index 934426ef..22dffd06 100644 --- a/test/scripts/deploy-contracts.ts +++ b/test/scripts/deploy-contracts.ts @@ -9,6 +9,7 @@ import { dataHavenServiceManagerAbi } from "../contract-bindings/generated"; interface ContractDeploymentOptions { chain?: string; + environment?: string; rpcUrl?: string; privateKey?: string | undefined; verified?: boolean; @@ -18,6 +19,15 @@ interface ContractDeploymentOptions { txExecution?: boolean; } +/** + * Builds the network identifier from chain and optional environment + * When environment is specified: {environment}-{chain} (e.g., "stagenet-hoodi") + * When environment is not specified: {chain} (e.g., "hoodi") + */ +export const buildNetworkId = (chain: string, environment?: string): string => { + return environment ? `${environment}-${chain}` : chain; +}; + /** * Validates deployment parameters */ @@ -52,20 +62,23 @@ export const buildContracts = async () => { * Constructs the deployment command */ export const constructDeployCommand = (options: ContractDeploymentOptions): string => { - const { chain, rpcUrl, verified, blockscoutBackendUrl } = options; + const { chain, environment, rpcUrl, verified, blockscoutBackendUrl } = options; const deploymentScript = !chain || chain === "anvil" ? "script/deploy/DeployLocal.s.sol" - : "script/deploy/DeployTestnet.s.sol"; + : "script/deploy/DeployLive.s.sol"; - logger.info(`🚀 Deploying contracts to ${chain} using ${deploymentScript}`); + // Build the network identifier for display and environment variable + const networkId = buildNetworkId(chain || "anvil", environment); + + logger.info(`🚀 Deploying contracts to ${networkId} using ${deploymentScript}`); let deployCommand = `forge script ${deploymentScript} --rpc-url ${rpcUrl} --color never -vv --no-rpc-rate-limit --non-interactive --broadcast`; - // Add environment variable for chain if specified + // Add environment variables for network (used by Solidity scripts for config/output file naming) if (chain) { - deployCommand = `NETWORK=${chain} ${deployCommand}`; + deployCommand = `NETWORK=${networkId} ${deployCommand}`; } if (verified && blockscoutBackendUrl) { @@ -146,6 +159,7 @@ export const updateParameters = async ( */ export const deployContracts = async (options: { chain: string; + environment?: string; rpcUrl?: string; privateKey?: string | undefined; verified?: boolean; @@ -160,6 +174,9 @@ export const deployContracts = async (options: { throw new Error(`Unsupported chain: ${options.chain}`); } + // Build network identifier for config/deployment file naming + const networkId = buildNetworkId(options.chain, options.environment); + const finalRpcUrl = options.rpcUrl || chainConfig.RPC_URL; const isLocalChain = options.chain === "anvil"; const txExecutionEnabled = options.txExecution ?? isLocalChain; @@ -173,7 +190,7 @@ export const deployContracts = async (options: { } if (!resolvedAvsOwnerAddress && isLocalChain) { - const config = await loadChainConfig(options.chain); + const config = await loadChainConfig(options.chain, options.environment); resolvedAvsOwnerAddress = config?.avs?.avsOwner; } @@ -191,6 +208,7 @@ export const deployContracts = async (options: { const deploymentOptions: ContractDeploymentOptions = { chain: options.chain, + environment: options.environment, rpcUrl: finalRpcUrl, privateKey: options.privateKey, verified: options.verified, @@ -209,13 +227,13 @@ export const deployContracts = async (options: { // Construct and execute deployment const deployCommand = constructDeployCommand(deploymentOptions); const env = buildDeploymentEnv(deploymentOptions); - await executeDeployment(deployCommand, undefined, options.chain, env); + await executeDeployment(deployCommand, undefined, networkId, env); if (!txExecutionEnabled) { - await emitOwnerTransactionCalldata(options.chain); + await emitOwnerTransactionCalldata(networkId); } - logger.success(`DataHaven contracts deployed successfully to ${options.chain}`); + logger.success(`DataHaven contracts deployed successfully to ${networkId}`); }; const normalizePrivateKey = (key?: string): `0x${string}` | undefined => { diff --git a/test/utils/contracts.ts b/test/utils/contracts.ts index 48803aee..cc55dee8 100644 --- a/test/utils/contracts.ts +++ b/test/utils/contracts.ts @@ -39,22 +39,27 @@ const DeploymentsSchema = z.object({ export type Deployments = z.infer; -export const parseDeploymentsFile = async (network = "anvil"): Promise => { - const deploymentsPath = `../contracts/deployments/${network}.json`; +/** + * Parses the deployments file for a given network + * @param networkId - The network identifier (e.g., "anvil", "hoodi", "stagenet-hoodi") + * This can include an environment prefix like "stagenet-" or "testnet-" + */ +export const parseDeploymentsFile = async (networkId = "anvil"): Promise => { + const deploymentsPath = `../contracts/deployments/${networkId}.json`; const deploymentsFile = Bun.file(deploymentsPath); if (!(await deploymentsFile.exists())) { logger.error(`File ${deploymentsPath} does not exist`); - throw new Error(`Error reading ${network} deployments file`); + throw new Error(`Error reading ${networkId} deployments file`); } const deploymentsJson = await deploymentsFile.json(); logger.info(`Deployments: ${JSON.stringify(deploymentsJson, null, 2)}`); try { const parsedDeployments = DeploymentsSchema.parse(deploymentsJson); - logger.debug(`Successfully parsed ${network} deployments file.`); + logger.debug(`Successfully parsed ${networkId} deployments file.`); return parsedDeployments; } catch (error) { - logger.error(`Failed to parse ${network} deployments file:`, error); - throw new Error(`Invalid ${network} deployments file format`); + logger.error(`Failed to parse ${networkId} deployments file:`, error); + throw new Error(`Invalid ${networkId} deployments file format`); } }; From a97f1a0ae233fa807357cd13b2ba998886d27e8d Mon Sep 17 00:00:00 2001 From: Steve Degosserie <723552+stiiifff@users.noreply.github.com> Date: Mon, 2 Feb 2026 17:33:23 +0100 Subject: [PATCH 3/5] =?UTF-8?q?feat:=20=E2=9C=A8=20Bump=20client=20version?= =?UTF-8?q?=20to=20v0.22.0=20and=20runtime=20to=20RT1100=20(#427)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- operator/Cargo.lock | 118 +++++++++++++-------------- operator/Cargo.toml | 2 +- operator/runtime/mainnet/src/lib.rs | 2 +- operator/runtime/stagenet/src/lib.rs | 2 +- operator/runtime/testnet/src/lib.rs | 2 +- test/.papi/metadata/datahaven.scale | Bin 627696 -> 627696 bytes 6 files changed, 63 insertions(+), 63 deletions(-) diff --git a/operator/Cargo.lock b/operator/Cargo.lock index 652aa154..0f5d3708 100644 --- a/operator/Cargo.lock +++ b/operator/Cargo.lock @@ -1521,7 +1521,7 @@ dependencies = [ "pallet-message-queue", "parity-scale-codec", "scale-info", - "snowbridge-core 0.21.0", + "snowbridge-core 0.22.0", "sp-core", "sp-runtime", "sp-std", @@ -2607,7 +2607,7 @@ dependencies = [ [[package]] name = "datahaven-mainnet-runtime" -version = "0.21.0" +version = "0.22.0" dependencies = [ "alloy-core", "bridge-hub-common 0.13.1", @@ -2718,8 +2718,8 @@ dependencies = [ "shp-treasury-funding", "shp-tx-implicits-runtime-api", "smallvec", - "snowbridge-beacon-primitives 0.21.0", - "snowbridge-core 0.21.0", + "snowbridge-beacon-primitives 0.22.0", + "snowbridge-core 0.22.0", "snowbridge-inbound-queue-primitives", "snowbridge-merkle-tree", "snowbridge-outbound-queue-primitives", @@ -2762,7 +2762,7 @@ dependencies = [ [[package]] name = "datahaven-node" -version = "0.21.0" +version = "0.22.0" dependencies = [ "async-channel 1.9.0", "clap", @@ -2873,7 +2873,7 @@ dependencies = [ [[package]] name = "datahaven-runtime-common" -version = "0.21.0" +version = "0.22.0" dependencies = [ "alloy-core", "fp-account", @@ -2907,7 +2907,7 @@ dependencies = [ [[package]] name = "datahaven-stagenet-runtime" -version = "0.21.0" +version = "0.22.0" dependencies = [ "alloy-core", "bridge-hub-common 0.13.1", @@ -3018,8 +3018,8 @@ dependencies = [ "shp-treasury-funding", "shp-tx-implicits-runtime-api", "smallvec", - "snowbridge-beacon-primitives 0.21.0", - "snowbridge-core 0.21.0", + "snowbridge-beacon-primitives 0.22.0", + "snowbridge-core 0.22.0", "snowbridge-inbound-queue-primitives", "snowbridge-merkle-tree", "snowbridge-outbound-queue-primitives", @@ -3062,7 +3062,7 @@ dependencies = [ [[package]] name = "datahaven-testnet-runtime" -version = "0.21.0" +version = "0.22.0" dependencies = [ "alloy-core", "bridge-hub-common 0.13.1", @@ -3173,8 +3173,8 @@ dependencies = [ "shp-treasury-funding", "shp-tx-implicits-runtime-api", "smallvec", - "snowbridge-beacon-primitives 0.21.0", - "snowbridge-core 0.21.0", + "snowbridge-beacon-primitives 0.22.0", + "snowbridge-core 0.22.0", "snowbridge-inbound-queue-primitives", "snowbridge-merkle-tree", "snowbridge-outbound-queue-primitives", @@ -3366,7 +3366,7 @@ dependencies = [ [[package]] name = "dhp-bridge" -version = "0.21.0" +version = "0.22.0" dependencies = [ "frame-support", "frame-system", @@ -3374,7 +3374,7 @@ dependencies = [ "pallet-datahaven-native-transfer", "pallet-external-validators", "parity-scale-codec", - "snowbridge-core 0.21.0", + "snowbridge-core 0.22.0", "snowbridge-inbound-queue-primitives", "sp-core", "sp-std", @@ -8701,7 +8701,7 @@ dependencies = [ [[package]] name = "pallet-datahaven-native-transfer" -version = "0.21.0" +version = "0.22.0" dependencies = [ "frame-benchmarking", "frame-support", @@ -8709,7 +8709,7 @@ dependencies = [ "pallet-balances", "parity-scale-codec", "scale-info", - "snowbridge-core 0.21.0", + "snowbridge-core 0.22.0", "snowbridge-outbound-queue-primitives", "sp-core", "sp-io", @@ -8813,7 +8813,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-balances-erc20" -version = "0.21.0" +version = "0.22.0" dependencies = [ "fp-evm", "frame-support", @@ -8836,7 +8836,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-batch" -version = "0.21.0" +version = "0.22.0" dependencies = [ "evm", "fp-evm", @@ -8875,7 +8875,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-call-permit" -version = "0.21.0" +version = "0.22.0" dependencies = [ "evm", "fp-evm", @@ -8941,7 +8941,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-datahaven-native-transfer" -version = "0.21.0" +version = "0.22.0" dependencies = [ "evm", "fp-evm", @@ -8955,7 +8955,7 @@ dependencies = [ "parity-scale-codec", "precompile-utils", "scale-info", - "snowbridge-core 0.21.0", + "snowbridge-core 0.22.0", "snowbridge-outbound-queue-primitives", "sp-core", "sp-io", @@ -9034,7 +9034,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-proxy" -version = "0.21.0" +version = "0.22.0" dependencies = [ "evm", "fp-evm", @@ -9078,7 +9078,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-registry" -version = "0.21.0" +version = "0.22.0" dependencies = [ "fp-evm", "frame-support", @@ -9129,7 +9129,7 @@ dependencies = [ "parity-scale-codec", "scale-info", "serde", - "snowbridge-core 0.21.0", + "snowbridge-core 0.22.0", "snowbridge-outbound-queue-primitives", "sp-core", "sp-io", @@ -9139,7 +9139,7 @@ dependencies = [ [[package]] name = "pallet-external-validators" -version = "0.21.0" +version = "0.22.0" dependencies = [ "frame-benchmarking", "frame-support", @@ -9163,7 +9163,7 @@ dependencies = [ [[package]] name = "pallet-external-validators-rewards" -version = "0.21.0" +version = "0.22.0" dependencies = [ "frame-benchmarking", "frame-support", @@ -9176,7 +9176,7 @@ dependencies = [ "pallet-timestamp", "parity-scale-codec", "scale-info", - "snowbridge-core 0.21.0", + "snowbridge-core 0.22.0", "snowbridge-outbound-queue-primitives", "sp-core", "sp-io", @@ -9400,7 +9400,7 @@ dependencies = [ [[package]] name = "pallet-outbound-commitment-store" -version = "0.21.0" +version = "0.22.0" dependencies = [ "frame-support", "frame-system", @@ -9520,7 +9520,7 @@ dependencies = [ [[package]] name = "pallet-proxy-genesis-companion" -version = "0.21.0" +version = "0.22.0" dependencies = [ "frame-support", "frame-system", @@ -14782,7 +14782,7 @@ dependencies = [ [[package]] name = "snowbridge-beacon-primitives" -version = "0.21.0" +version = "0.22.0" dependencies = [ "byte-slice-cast", "frame-support", @@ -14827,7 +14827,7 @@ dependencies = [ [[package]] name = "snowbridge-core" -version = "0.21.0" +version = "0.22.0" dependencies = [ "bp-relayers", "ethabi-decode", @@ -14904,8 +14904,8 @@ dependencies = [ "log", "parity-scale-codec", "scale-info", - "snowbridge-beacon-primitives 0.21.0", - "snowbridge-core 0.21.0", + "snowbridge-beacon-primitives 0.22.0", + "snowbridge-core 0.22.0", "snowbridge-verification-primitives", "sp-core", "sp-io", @@ -14918,7 +14918,7 @@ dependencies = [ [[package]] name = "snowbridge-merkle-tree" -version = "0.21.0" +version = "0.22.0" dependencies = [ "array-bytes", "hex", @@ -14959,7 +14959,7 @@ dependencies = [ [[package]] name = "snowbridge-outbound-queue-primitives" -version = "0.21.0" +version = "0.22.0" dependencies = [ "alloy-core", "ethabi-decode", @@ -14971,7 +14971,7 @@ dependencies = [ "parity-scale-codec", "polkadot-parachain-primitives", "scale-info", - "snowbridge-core 0.21.0", + "snowbridge-core 0.22.0", "snowbridge-verification-primitives", "sp-arithmetic", "sp-core", @@ -14985,12 +14985,12 @@ dependencies = [ [[package]] name = "snowbridge-outbound-queue-v2-runtime-api" -version = "0.21.0" +version = "0.22.0" dependencies = [ "frame-support", "parity-scale-codec", "scale-info", - "snowbridge-core 0.21.0", + "snowbridge-core 0.22.0", "snowbridge-merkle-tree", "snowbridge-outbound-queue-primitives", "sp-api", @@ -15000,7 +15000,7 @@ dependencies = [ [[package]] name = "snowbridge-pallet-ethereum-client" -version = "0.21.0" +version = "0.22.0" dependencies = [ "frame-benchmarking", "frame-support", @@ -15013,8 +15013,8 @@ dependencies = [ "scale-info", "serde", "serde_json", - "snowbridge-beacon-primitives 0.21.0", - "snowbridge-core 0.21.0", + "snowbridge-beacon-primitives 0.22.0", + "snowbridge-core 0.22.0", "snowbridge-ethereum 0.3.0", "snowbridge-inbound-queue-primitives", "snowbridge-pallet-ethereum-client-fixtures", @@ -15030,8 +15030,8 @@ name = "snowbridge-pallet-ethereum-client-fixtures" version = "0.9.0" dependencies = [ "hex-literal 0.3.4", - "snowbridge-beacon-primitives 0.21.0", - "snowbridge-core 0.21.0", + "snowbridge-beacon-primitives 0.22.0", + "snowbridge-core 0.22.0", "snowbridge-inbound-queue-primitives", "sp-core", "sp-std", @@ -15039,7 +15039,7 @@ dependencies = [ [[package]] name = "snowbridge-pallet-inbound-queue-v2" -version = "0.21.0" +version = "0.22.0" dependencies = [ "alloy-core", "bp-relayers", @@ -15053,8 +15053,8 @@ dependencies = [ "parity-scale-codec", "scale-info", "serde", - "snowbridge-beacon-primitives 0.21.0", - "snowbridge-core 0.21.0", + "snowbridge-beacon-primitives 0.22.0", + "snowbridge-core 0.22.0", "snowbridge-inbound-queue-primitives", "snowbridge-pallet-ethereum-client", "snowbridge-pallet-inbound-queue-v2-fixtures", @@ -15075,8 +15075,8 @@ name = "snowbridge-pallet-inbound-queue-v2-fixtures" version = "0.10.0" dependencies = [ "hex-literal 0.3.4", - "snowbridge-beacon-primitives 0.21.0", - "snowbridge-core 0.21.0", + "snowbridge-beacon-primitives 0.22.0", + "snowbridge-core 0.22.0", "snowbridge-inbound-queue-primitives", "sp-core", "sp-std", @@ -15106,7 +15106,7 @@ dependencies = [ [[package]] name = "snowbridge-pallet-outbound-queue-v2" -version = "0.21.0" +version = "0.22.0" dependencies = [ "alloy-core", "bp-relayers", @@ -15120,8 +15120,8 @@ dependencies = [ "parity-scale-codec", "scale-info", "serde", - "snowbridge-beacon-primitives 0.21.0", - "snowbridge-core 0.21.0", + "snowbridge-beacon-primitives 0.22.0", + "snowbridge-core 0.22.0", "snowbridge-inbound-queue-primitives", "snowbridge-merkle-tree", "snowbridge-outbound-queue-primitives", @@ -15152,7 +15152,7 @@ dependencies = [ "parity-scale-codec", "polkadot-primitives", "scale-info", - "snowbridge-core 0.21.0", + "snowbridge-core 0.22.0", "snowbridge-outbound-queue-primitives", "snowbridge-pallet-outbound-queue", "sp-core", @@ -15165,7 +15165,7 @@ dependencies = [ [[package]] name = "snowbridge-pallet-system-v2" -version = "0.21.0" +version = "0.22.0" dependencies = [ "frame-benchmarking", "frame-support", @@ -15177,7 +15177,7 @@ dependencies = [ "parity-scale-codec", "polkadot-primitives", "scale-info", - "snowbridge-core 0.21.0", + "snowbridge-core 0.22.0", "snowbridge-outbound-queue-primitives", "snowbridge-pallet-outbound-queue-v2", "snowbridge-pallet-system", @@ -15193,10 +15193,10 @@ dependencies = [ [[package]] name = "snowbridge-system-v2-runtime-api" -version = "0.21.0" +version = "0.22.0" dependencies = [ "parity-scale-codec", - "snowbridge-core 0.21.0", + "snowbridge-core 0.22.0", "sp-api", "sp-std", "staging-xcm", @@ -15204,7 +15204,7 @@ dependencies = [ [[package]] name = "snowbridge-test-utils" -version = "0.21.0" +version = "0.22.0" dependencies = [ "frame-benchmarking", "frame-support", @@ -15224,12 +15224,12 @@ dependencies = [ [[package]] name = "snowbridge-verification-primitives" -version = "0.21.0" +version = "0.22.0" dependencies = [ "frame-support", "parity-scale-codec", "scale-info", - "snowbridge-beacon-primitives 0.21.0", + "snowbridge-beacon-primitives 0.22.0", "sp-core", "sp-std", ] diff --git a/operator/Cargo.toml b/operator/Cargo.toml index 31eaf63c..fa60a853 100644 --- a/operator/Cargo.toml +++ b/operator/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" homepage = "https://datahaven.xyz/" license = "GPL-3" repository = "https://github.com/datahavenxyz/datahaven" -version = "0.21.0" +version = "0.22.0" [workspace] members = [ diff --git a/operator/runtime/mainnet/src/lib.rs b/operator/runtime/mainnet/src/lib.rs index d27f07e2..c1e3b156 100644 --- a/operator/runtime/mainnet/src/lib.rs +++ b/operator/runtime/mainnet/src/lib.rs @@ -142,7 +142,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // `spec_version`, and `authoring_version` are the same between Wasm and native. // This value is set to 200 to notify Polkadot-JS App (https://polkadot.js.org/apps) to use // the compatible custom types. - spec_version: 1000, + spec_version: 1100, impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 1, diff --git a/operator/runtime/stagenet/src/lib.rs b/operator/runtime/stagenet/src/lib.rs index 36f69c61..1f9da4c1 100644 --- a/operator/runtime/stagenet/src/lib.rs +++ b/operator/runtime/stagenet/src/lib.rs @@ -145,7 +145,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // `spec_version`, and `authoring_version` are the same between Wasm and native. // This value is set to 200 to notify Polkadot-JS App (https://polkadot.js.org/apps) to use // the compatible custom types. - spec_version: 1000, + spec_version: 1100, impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 1, diff --git a/operator/runtime/testnet/src/lib.rs b/operator/runtime/testnet/src/lib.rs index 46a777a5..07878c17 100644 --- a/operator/runtime/testnet/src/lib.rs +++ b/operator/runtime/testnet/src/lib.rs @@ -142,7 +142,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // `spec_version`, and `authoring_version` are the same between Wasm and native. // This value is set to 200 to notify Polkadot-JS App (https://polkadot.js.org/apps) to use // the compatible custom types. - spec_version: 1000, + spec_version: 1100, impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 1, diff --git a/test/.papi/metadata/datahaven.scale b/test/.papi/metadata/datahaven.scale index 0fdd89171ab4024e8018d59f280c10407b8fd264..fdcedc84d70ccc865ed894eb3d8c9e8155440ae4 100644 GIT binary patch delta 44 vcmeycTF7M3lnD>RvWSlU-F7M3lnD>Rv2Ft@MLWCdb2AZ7<*j_s>7Io+}Vik=Wr From 786ddb39a9a5d7324f0d82b4d1730ee61270b59a Mon Sep 17 00:00:00 2001 From: Gonza Montiel Date: Tue, 3 Feb 2026 13:12:11 -0300 Subject: [PATCH 4/5] fix: add missing benchmarks and weights (#302) ## Add missing weights The aim of this PR is to complete our weights by enabling more runtime benchmarks from the pallets used in DataHaven. I will start this effort with Storage Hub pallets. ## What's included - [x] `pallet_nfts` - [x] Added signing helper for pallet nfts - [x] Add pallet to benchmarks - [x] Run benches and generate weights - [x] Wire up weights to runtimes - [x] `pallet_session` - [x] Added a `pallet_session_benchmarking` crate - [x] Added signing helpers - [x] Add pallet to benchmarks - [x] Run benches and generate weights - [x] Wire up weights to runtimes - [x] `pallet_payment_streams` - [x] Add `TreasuryAccount` helper and configure properly - [x] Add pallet to benchmarks - [x] Run benches and generate weights - [x] Wire up weights to runtimes - [x] `pallet_storage_providers` - [x] Add `TreasuryAccount` helper and configure properly - [x] Add pallet to benchmarks - [x] Run benches and generate weights - [x] Wire up weights to runtimes - [x] `pallet_file_system` - [x] Add pallet to benchmarks and configure properly - [ ] Run benches and generate weights - [x] Wire up weights to runtimes - [x] `pallet_proofs_dealer` - [x] Add pallet to benchmarks and configure properly - [x] Run benches and generate weights - [x] Wire up weights to runtimes ## What's not included - `pallet_identity` - We'll enable it once we update to `2506`, that will allow us to have a BenchmarkHelper in the config on the pallet (see [here](https://github.com/datahaven-xyz/datahaven/blob/ac28323e7d9e690ae1ccbb27b55f00c3e6522681/operator/runtime/mainnet/src/configs/mod.rs#L632-L643)) - `pallet_grandpa` - the upstream pallet defines [benchmarks](https://github.com/paritytech/polkadot-sdk/blob/bbc435c7667d3283ba280a8fec44676357392753/substrate/frame/grandpa/src/benchmarking.rs#L25) for `check_equivocation_proof` and `note_stalled`, but the required weights to be wired are actually `report_equivocation`, `report_equivocation_unsigned` and `note_stalled`. That means including `pallet_grandpa` in the benchmarks results in an inconsistent `WeightInfo` implementation, so further understanding in the pallet's approach to benchmarking is needed. - `pallet_file_system` -> Run benches and generate weights. Weights will fail because of a hardcoded `AccountId32` on the [benchmarks](https://github.com/Moonsong-Labs/storage-hub/blob/57d2a195d58d39e0d6e38a927ec312dd0f640522/pallets/file-system/src/benchmark_proofs.rs#L69-L71). I'll create a PR for SH soon. These two are left for a follow up PR. --- operator/Cargo.lock | 16 +- operator/Cargo.toml | 6 +- .../benchmarking/frame-weight-template.hbs | 1 - .../pallets/session-benchmarking/Cargo.toml | 40 + .../session-benchmarking/src/benchmarking.rs | 32 + .../pallets/session-benchmarking/src/lib.rs | 11 + operator/runtime/common/src/benchmarking.rs | 23 + operator/runtime/mainnet/Cargo.toml | 8 + operator/runtime/mainnet/src/benchmarks.rs | 8 + operator/runtime/mainnet/src/configs/mod.rs | 54 +- .../mainnet/src/configs/storagehub/mod.rs | 186 ++++- operator/runtime/mainnet/src/lib.rs | 3 +- operator/runtime/mainnet/src/weights/mod.rs | 6 + .../mainnet/src/weights/pallet_file_system.rs | 5 + .../mainnet/src/weights/pallet_nfts.rs | 726 +++++++++++++++++ .../src/weights/pallet_payment_streams.rs | 449 +++++++++++ .../src/weights/pallet_proofs_dealer.rs | 326 ++++++++ .../mainnet/src/weights/pallet_session.rs | 84 ++ .../src/weights/pallet_storage_providers.rs | 630 +++++++++++++++ operator/runtime/stagenet/Cargo.toml | 8 + operator/runtime/stagenet/src/benchmarks.rs | 8 + operator/runtime/stagenet/src/configs/mod.rs | 54 +- .../stagenet/src/configs/storagehub/mod.rs | 186 ++++- operator/runtime/stagenet/src/lib.rs | 3 +- operator/runtime/stagenet/src/weights/mod.rs | 6 + .../src/weights/pallet_file_system.rs | 5 + .../stagenet/src/weights/pallet_nfts.rs | 728 ++++++++++++++++++ .../src/weights/pallet_payment_streams.rs | 449 +++++++++++ .../src/weights/pallet_proofs_dealer.rs | 326 ++++++++ .../stagenet/src/weights/pallet_session.rs | 84 ++ .../src/weights/pallet_storage_providers.rs | 630 +++++++++++++++ operator/runtime/testnet/Cargo.toml | 8 + operator/runtime/testnet/src/benchmarks.rs | 8 + operator/runtime/testnet/src/configs/mod.rs | 56 +- .../testnet/src/configs/storagehub/mod.rs | 187 ++++- operator/runtime/testnet/src/lib.rs | 3 +- operator/runtime/testnet/src/weights/mod.rs | 10 +- .../testnet/src/weights/pallet_file_system.rs | 5 + .../testnet/src/weights/pallet_nfts.rs | 724 +++++++++++++++++ .../src/weights/pallet_payment_streams.rs | 449 +++++++++++ .../src/weights/pallet_proofs_dealer.rs | 326 ++++++++ .../testnet/src/weights/pallet_session.rs | 84 ++ .../src/weights/pallet_storage_providers.rs | 630 +++++++++++++++ 43 files changed, 7419 insertions(+), 172 deletions(-) create mode 100644 operator/pallets/session-benchmarking/Cargo.toml create mode 100644 operator/pallets/session-benchmarking/src/benchmarking.rs create mode 100644 operator/pallets/session-benchmarking/src/lib.rs create mode 100644 operator/runtime/mainnet/src/weights/pallet_file_system.rs create mode 100644 operator/runtime/mainnet/src/weights/pallet_nfts.rs create mode 100644 operator/runtime/mainnet/src/weights/pallet_payment_streams.rs create mode 100644 operator/runtime/mainnet/src/weights/pallet_proofs_dealer.rs create mode 100644 operator/runtime/mainnet/src/weights/pallet_session.rs create mode 100644 operator/runtime/mainnet/src/weights/pallet_storage_providers.rs create mode 100644 operator/runtime/stagenet/src/weights/pallet_file_system.rs create mode 100644 operator/runtime/stagenet/src/weights/pallet_nfts.rs create mode 100644 operator/runtime/stagenet/src/weights/pallet_payment_streams.rs create mode 100644 operator/runtime/stagenet/src/weights/pallet_proofs_dealer.rs create mode 100644 operator/runtime/stagenet/src/weights/pallet_session.rs create mode 100644 operator/runtime/stagenet/src/weights/pallet_storage_providers.rs create mode 100644 operator/runtime/testnet/src/weights/pallet_file_system.rs create mode 100644 operator/runtime/testnet/src/weights/pallet_nfts.rs create mode 100644 operator/runtime/testnet/src/weights/pallet_payment_streams.rs create mode 100644 operator/runtime/testnet/src/weights/pallet_proofs_dealer.rs create mode 100644 operator/runtime/testnet/src/weights/pallet_session.rs create mode 100644 operator/runtime/testnet/src/weights/pallet_storage_providers.rs diff --git a/operator/Cargo.lock b/operator/Cargo.lock index 0f5d3708..a109b8ea 100644 --- a/operator/Cargo.lock +++ b/operator/Cargo.lock @@ -2629,6 +2629,7 @@ dependencies = [ "hex", "hex-literal 0.3.4", "itoa", + "k256", "log", "num-bigint", "num_enum", @@ -2929,6 +2930,7 @@ dependencies = [ "hex", "hex-literal 0.3.4", "itoa", + "k256", "log", "num-bigint", "num_enum", @@ -3084,6 +3086,7 @@ dependencies = [ "hex", "hex-literal 0.3.4", "itoa", + "k256", "log", "num-bigint", "num_enum", @@ -9211,6 +9214,7 @@ dependencies = [ "frame-benchmarking", "frame-support", "frame-system", + "hex", "log", "num-bigint", "pallet-file-system-runtime-api", @@ -9221,6 +9225,7 @@ dependencies = [ "parity-scale-codec", "scale-info", "shp-constants", + "shp-file-key-verifier", "shp-file-metadata", "shp-traits", "sp-core", @@ -9482,11 +9487,15 @@ dependencies = [ "frame-benchmarking", "frame-support", "frame-system", + "hex", "pallet-balances", "pallet-proofs-dealer-runtime-api", "pallet-storage-providers", "parity-scale-codec", "scale-info", + "shp-file-key-verifier", + "shp-file-metadata", + "shp-forest-verifier", "shp-traits", "sp-core", "sp-keyring", @@ -9631,18 +9640,15 @@ dependencies = [ [[package]] name = "pallet-session-benchmarking" -version = "39.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?tag=polkadot-stable2412-6#bbc435c7667d3283ba280a8fec44676357392753" +version = "0.22.0" dependencies = [ "frame-benchmarking", "frame-support", "frame-system", "pallet-session", - "pallet-staking", "parity-scale-codec", - "rand 0.8.5", "sp-runtime", - "sp-session", + "sp-std", ] [[package]] diff --git a/operator/Cargo.toml b/operator/Cargo.toml index fa60a853..2e155446 100644 --- a/operator/Cargo.toml +++ b/operator/Cargo.toml @@ -28,6 +28,7 @@ datahaven-stagenet-runtime = { path = "./runtime/stagenet", default-features = f datahaven-testnet-runtime = { path = "./runtime/testnet", default-features = false } dhp-bridge = { path = "./primitives/bridge", default-features = false } pallet-datahaven-native-transfer = { path = "./pallets/datahaven-native-transfer", default-features = false } +pallet-session-benchmarking = { path = "./pallets/session-benchmarking", default-features = false } pallet-evm-precompile-balances-erc20 = { path = "./precompiles/erc20-balances", default-features = false } pallet-evm-precompile-batch = { path = "./precompiles/batch", default-features = false } pallet-evm-precompile-call-permit = { path = "./precompiles/call-permit", default-features = false } @@ -67,6 +68,10 @@ impl-serde = { version = "0.5.0", default-features = false } impl-trait-for-tuples = { version = "0.2.2" } itoa = { version = "1.0" } jsonrpsee = { version = "0.24.3" } +k256 = { version = "0.13.4", default-features = false, features = [ + "ecdsa", + "alloc", +] } libsecp256k1 = { version = "0.7", default-features = false } log = { version = "0.4.25" } macro_rules_attribute = { version = "0.2.0" } @@ -139,7 +144,6 @@ pallet-referenda = { git = "https://github.com/paritytech/polkadot-sdk", tag = " pallet-safe-mode = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-6", default-features = false } pallet-scheduler = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-6", default-features = false } pallet-session = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-6", default-features = false } -pallet-session-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-6", default-features = false } pallet-staking = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-6", default-features = false } pallet-sudo = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-6", default-features = false } pallet-timestamp = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-6", default-features = false } diff --git a/operator/benchmarking/frame-weight-template.hbs b/operator/benchmarking/frame-weight-template.hbs index f9508559..9fcc72c5 100644 --- a/operator/benchmarking/frame-weight-template.hbs +++ b/operator/benchmarking/frame-weight-template.hbs @@ -19,7 +19,6 @@ use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; use sp_std::marker::PhantomData; -use crate::{{pallet}}; /// Weights for `{{pallet}}`. pub struct WeightInfo(PhantomData); diff --git a/operator/pallets/session-benchmarking/Cargo.toml b/operator/pallets/session-benchmarking/Cargo.toml new file mode 100644 index 00000000..41b64d87 --- /dev/null +++ b/operator/pallets/session-benchmarking/Cargo.toml @@ -0,0 +1,40 @@ +[package] +authors = { workspace = true } +description = "Benchmarking helpers for pallet-session in DataHaven runtimes." +edition = { workspace = true } +license = { workspace = true } +name = "pallet-session-benchmarking" +version = { workspace = true } + +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + +[lints] +workspace = true + +[dependencies] +codec = { workspace = true } +frame-benchmarking = { workspace = true, optional = true } +frame-support = { workspace = true } +frame-system = { workspace = true } +pallet-session = { workspace = true } +sp-runtime = { workspace = true } +sp-std = { workspace = true } + +[features] +default = ["std"] +std = [ + "codec/std", + "frame-benchmarking?/std", + "frame-support/std", + "frame-system/std", + "pallet-session/std", + "sp-runtime/std", + "sp-std/std", +] +runtime-benchmarks = [ + "frame-benchmarking/runtime-benchmarks", + "frame-support/runtime-benchmarks", + "frame-system/runtime-benchmarks", + "sp-runtime/runtime-benchmarks", +] diff --git a/operator/pallets/session-benchmarking/src/benchmarking.rs b/operator/pallets/session-benchmarking/src/benchmarking.rs new file mode 100644 index 00000000..2b2f814a --- /dev/null +++ b/operator/pallets/session-benchmarking/src/benchmarking.rs @@ -0,0 +1,32 @@ +//! Benchmarks for solochain session usage (no staking dependency). +//! +//! This mirrors the upstream session benchmarks but avoids `pallet_staking` +//! by directly calling `pallet_session::Pallet::set_keys`. The session keys +//! are decoded from zeros, which works as long as the runtime wires Babe and +//! Grandpa into `SessionKeys`. + +use alloc::{vec, vec::Vec}; + +use codec::Decode; +use frame_benchmarking::{benchmarks, whitelisted_caller}; +use frame_system::RawOrigin; + +use crate::{Config, Pallet}; +use pallet_session::Call; + +benchmarks! { + set_keys { + let caller: T::AccountId = whitelisted_caller(); + frame_system::Pallet::::inc_providers(&caller); + let keys = T::Keys::decode(&mut sp_runtime::traits::TrailingZeroInput::zeroes()).unwrap(); + let proof: Vec = vec![0, 1, 2, 3]; + }: _(RawOrigin::Signed(caller), keys, proof) + + purge_keys { + let caller: T::AccountId = whitelisted_caller(); + frame_system::Pallet::::inc_providers(&caller); + let keys = T::Keys::decode(&mut sp_runtime::traits::TrailingZeroInput::zeroes()).unwrap(); + let proof: Vec = vec![0, 1, 2, 3]; + let _ = pallet_session::Pallet::::set_keys(RawOrigin::Signed(caller.clone()).into(), keys, proof); + }: _(RawOrigin::Signed(caller)) +} diff --git a/operator/pallets/session-benchmarking/src/lib.rs b/operator/pallets/session-benchmarking/src/lib.rs new file mode 100644 index 00000000..58849d81 --- /dev/null +++ b/operator/pallets/session-benchmarking/src/lib.rs @@ -0,0 +1,11 @@ +#![cfg_attr(not(feature = "std"), no_std)] + +extern crate alloc; + +pub struct Pallet(pallet_session::Pallet); + +/// Benchmarking configuration for pallet-session in DataHaven. +pub trait Config: pallet_session::Config {} + +#[cfg(feature = "runtime-benchmarks")] +mod benchmarking; diff --git a/operator/runtime/common/src/benchmarking.rs b/operator/runtime/common/src/benchmarking.rs index 746bdaf7..fabd218b 100644 --- a/operator/runtime/common/src/benchmarking.rs +++ b/operator/runtime/common/src/benchmarking.rs @@ -15,7 +15,9 @@ // along with Moonbeam. If not, see . use fp_account::AccountId20; +use frame_support::traits::Currency; use pallet_treasury::ArgumentsFactory; +use sp_runtime::traits::Zero; pub struct BenchmarkHelper; impl ArgumentsFactory<(), AccountId20> for BenchmarkHelper { @@ -31,3 +33,24 @@ impl ArgumentsFactory<(), AccountId20> for BenchmarkHelper { AccountId20::from(seed) } } + +pub struct StorageHubBenchmarking; +impl StorageHubBenchmarking { + pub const SP_MIN_DEPOSIT: u128 = 100_000_000_000_000; + pub const BUCKET_DEPOSIT: u128 = 100_000_000_000_000; + // Keep the benchmark challenge period within u32 limits. + pub const STAKE_TO_CHALLENGE_PERIOD: u128 = 3_000_000_000_000_000; + // Derived from StakeToChallengePeriod / SP_MIN_DEPOSIT + tolerance + 1. + pub const CHECKPOINT_CHALLENGE_PERIOD: u32 = 81; + + pub fn ensure_treasury_account(account: AccountId) -> AccountId + where + Balance: From + Zero, + CurrencyT: Currency, + { + if CurrencyT::free_balance(&account).is_zero() { + let _ = CurrencyT::deposit_creating(&account, 1u128.into()); + } + account + } +} diff --git a/operator/runtime/mainnet/Cargo.toml b/operator/runtime/mainnet/Cargo.toml index a7242a12..4de1517f 100644 --- a/operator/runtime/mainnet/Cargo.toml +++ b/operator/runtime/mainnet/Cargo.toml @@ -86,6 +86,7 @@ polkadot-runtime-common = { workspace = true } precompile-utils = { workspace = true } scale-info = { workspace = true, features = ["derive", "serde"] } serde = { workspace = true, features = ["derive"] } +k256 = { workspace = true, optional = true } serde_json = { workspace = true, default-features = false, features = [ "alloc", ] } @@ -360,6 +361,13 @@ runtime-benchmarks = [ "snowbridge-pallet-system/runtime-benchmarks", "pallet-outbound-commitment-store/runtime-benchmarks", "pallet-datahaven-native-transfer/runtime-benchmarks", + # StorageHub pallets + "pallet-nfts/runtime-benchmarks", + "pallet-file-system/runtime-benchmarks", + "pallet-proofs-dealer/runtime-benchmarks", + "pallet-payment-streams/runtime-benchmarks", + "pallet-storage-providers/runtime-benchmarks", + "dep:k256", ] try-runtime = [ diff --git a/operator/runtime/mainnet/src/benchmarks.rs b/operator/runtime/mainnet/src/benchmarks.rs index 48090e38..62136c7c 100644 --- a/operator/runtime/mainnet/src/benchmarks.rs +++ b/operator/runtime/mainnet/src/benchmarks.rs @@ -27,6 +27,7 @@ frame_benchmarking::define_benchmarks!( // Substrate pallets [pallet_balances, Balances] + [pallet_session, pallet_session_benchmarking::Pallet::] // FIXME: benchmarking identity fail // [pallet_identity, Identity] [pallet_im_online, ImOnline] @@ -47,6 +48,13 @@ frame_benchmarking::define_benchmarks!( // EVM pallets [pallet_evm, EVM] + // StorageHub pallets + [pallet_nfts, Nfts] + [pallet_file_system, FileSystem] + [pallet_proofs_dealer, ProofsDealer] + [pallet_payment_streams, PaymentStreams] + [pallet_storage_providers, Providers] + // Governance pallets [pallet_collective_technical_committee, TechnicalCommittee] [pallet_collective_treasury_council, TreasuryCouncil] diff --git a/operator/runtime/mainnet/src/configs/mod.rs b/operator/runtime/mainnet/src/configs/mod.rs index c65db6b7..c47d432c 100644 --- a/operator/runtime/mainnet/src/configs/mod.rs +++ b/operator/runtime/mainnet/src/configs/mod.rs @@ -91,7 +91,6 @@ use datahaven_runtime_common::{ }, time::{EpochDurationInBlocks, SessionsPerEra, DAYS, MILLISECS_PER_BLOCK}, }; -use dhp_bridge::{EigenLayerMessageProcessor, NativeTokenTransferMessageProcessor}; use frame_support::{ derive_impl, dispatch::DispatchClass, @@ -126,7 +125,7 @@ use snowbridge_core::{gwei, meth, AgentIdOf, PricingParameters, Rewards, TokenId use snowbridge_inbound_queue_primitives::RewardLedger; use snowbridge_outbound_queue_primitives::{ v1::{Fee, Message, SendMessage}, - v2::{Command, ConstantGasMeter}, + v2::ConstantGasMeter, SendError, SendMessageFeeProvider, }; use snowbridge_pallet_outbound_queue_v2::OnNewCommitment; @@ -388,7 +387,7 @@ impl pallet_session::Config for Runtime { >; type SessionHandler = ::KeyTypeIdProviders; type Keys = SessionKeys; - type WeightInfo = pallet_session::weights::SubstrateWeight; + type WeightInfo = mainnet_weights::pallet_session::WeightInfo; } parameter_types! { @@ -1108,47 +1107,13 @@ impl snowbridge_pallet_system_v2::Config for Runtime { type Helper = (); } -// Fork versions for runtime benchmarks - must match the fixtures for BLS verification to work -// The fixtures are generated with standard testnet fork versions -#[cfg(feature = "runtime-benchmarks")] -parameter_types! { - pub const ChainForkVersions: ForkVersions = ForkVersions { - genesis: Fork { - version: hex_literal::hex!("00000000"), - epoch: 0, - }, - altair: Fork { - version: hex_literal::hex!("01000000"), - epoch: 0, - }, - bellatrix: Fork { - version: hex_literal::hex!("02000000"), - epoch: 0, - }, - capella: Fork { - version: hex_literal::hex!("03000000"), - epoch: 0, - }, - deneb: Fork { - version: hex_literal::hex!("04000000"), - epoch: 0, - }, - electra: Fork { - version: hex_literal::hex!("05000000"), - epoch: 80000000000, - }, - fulu: Fork { - version: hex_literal::hex!("06000000"), - epoch: 90000000000, - }, - }; -} - // For tests, fast-runtime and std configurations we use the mocked fork versions // These match the fork versions used by the local Ethereum network in E2E tests -#[cfg(all( - any(feature = "std", feature = "fast-runtime", test), - not(feature = "runtime-benchmarks") +#[cfg(any( + feature = "std", + feature = "fast-runtime", + feature = "runtime-benchmarks", + test ))] parameter_types! { pub const ChainForkVersions: ForkVersions = ForkVersions { @@ -1278,8 +1243,8 @@ impl snowbridge_pallet_inbound_queue_v2::Config for Runtime { type GatewayAddress = runtime_params::dynamic_params::runtime_config::EthereumGatewayAddress; #[cfg(not(feature = "runtime-benchmarks"))] type MessageProcessor = ( - EigenLayerMessageProcessor, - NativeTokenTransferMessageProcessor, + dhp_bridge::EigenLayerMessageProcessor, + dhp_bridge::NativeTokenTransferMessageProcessor, ); #[cfg(feature = "runtime-benchmarks")] type MessageProcessor = NoOpMessageProcessor; @@ -1750,6 +1715,7 @@ mod tests { use snowbridge_inbound_queue_primitives::v2::{ EthereumAsset, Message as SnowbridgeMessage, MessageProcessor, Payload as SnowPayload, }; + use snowbridge_outbound_queue_primitives::v2::Command; use sp_core::H160; use sp_io::TestExternalities; use xcm_builder::GlobalConsensusConvertsFor; diff --git a/operator/runtime/mainnet/src/configs/storagehub/mod.rs b/operator/runtime/mainnet/src/configs/storagehub/mod.rs index ca2f1d30..79a71b14 100644 --- a/operator/runtime/mainnet/src/configs/storagehub/mod.rs +++ b/operator/runtime/mainnet/src/configs/storagehub/mod.rs @@ -14,9 +14,13 @@ // You should have received a copy of the GNU General Public License // along with DataHaven. If not, see . +#[cfg(not(feature = "runtime-benchmarks"))] +use super::HAVE; +#[cfg(feature = "runtime-benchmarks")] +use super::MICROHAVE; use super::{ AccountId, Balance, Balances, BlockNumber, Hash, RuntimeEvent, RuntimeHoldReason, - TreasuryAccount, HAVE, + TreasuryAccount, }; use crate::configs::runtime_params::dynamic_params::runtime_config; use crate::{ @@ -24,6 +28,8 @@ use crate::{ HOURS, }; use core::marker::PhantomData; +#[cfg(feature = "runtime-benchmarks")] +use datahaven_runtime_common::benchmarking::StorageHubBenchmarking; use datahaven_runtime_common::time::{DAYS, MINUTES}; use frame_support::pallet_prelude::DispatchClass; use frame_support::traits::AsEnsureOriginWithArg; @@ -33,7 +39,7 @@ use frame_support::{ weights::Weight, }; use frame_system::pallet_prelude::BlockNumberFor; -use frame_system::{EnsureRoot, EnsureSigned}; +use frame_system::EnsureSigned; use num_bigint::BigUint; use pallet_nfts::PalletFeatures; use polkadot_runtime_common::prod_or_fast; @@ -68,6 +74,7 @@ pub type StorageProofsMerkleTrieLayout = LayoutV1; pub type Hashing = BlakeTwo256; /****** NFTs pallet ******/ +#[cfg(not(feature = "runtime-benchmarks"))] parameter_types! { pub const CollectionDeposit: Balance = 100 * HAVE; pub const ItemDeposit: Balance = 1 * HAVE; @@ -80,6 +87,19 @@ parameter_types! { pub const MaxAttributesPerCall: u32 = 10; pub Features: PalletFeatures = PalletFeatures::all_enabled(); } +#[cfg(feature = "runtime-benchmarks")] +parameter_types! { + pub const CollectionDeposit: Balance = 100 * MICROHAVE; + pub const ItemDeposit: Balance = 1 * MICROHAVE; + pub const MetadataDepositBase: Balance = 10 * MICROHAVE; + pub const MetadataDepositPerByte: Balance = 1 * MICROHAVE; + pub const ApprovalsLimit: u32 = 20; + pub const ItemAttributesApprovalsLimit: u32 = 20; + pub const MaxTips: u32 = 10; + pub const MaxDeadlineDuration: BlockNumber = 12 * 30 * DAYS; + pub const MaxAttributesPerCall: u32 = 10; + pub Features: PalletFeatures = PalletFeatures::all_enabled(); +} impl pallet_nfts::Config for Runtime { type RuntimeEvent = RuntimeEvent; @@ -104,11 +124,66 @@ impl pallet_nfts::Config for Runtime { type Features = Features; type OffchainSignature = Signature; type OffchainPublic = ::Signer; - type WeightInfo = pallet_nfts::weights::SubstrateWeight; + type WeightInfo = crate::weights::pallet_nfts::WeightInfo; type Locker = (); + #[cfg(feature = "runtime-benchmarks")] + type Helper = benchmark_helpers::NftHelper; } /****** ****** ****** ******/ +#[cfg(feature = "runtime-benchmarks")] +pub mod benchmark_helpers { + use crate::{AccountId, Signature}; + use k256::ecdsa::SigningKey; + use sp_runtime::traits::{IdentifyAccount, Verify}; + use sp_runtime::MultiSignature; + + const BENCH_SIGNING_KEY: [u8; 32] = [1u8; 32]; + + fn bench_signing_key() -> SigningKey { + SigningKey::from_bytes(&BENCH_SIGNING_KEY.into()) + .expect("benchmark signing key is valid; qed") + } + + /// Benchmark helper for NFTs pallet + pub struct NftHelper; + + impl pallet_nfts::BenchmarkHelper::Signer, AccountId, Signature> + for NftHelper + { + fn collection(i: u16) -> u32 { + i.into() + } + + fn item(i: u16) -> u32 { + i.into() + } + + fn signer() -> (::Signer, AccountId) { + let signing_key = bench_signing_key(); + let verifying_key = signing_key.verifying_key(); + let encoded = verifying_key.to_encoded_point(true); + let public = + sp_core::ecdsa::Public::from_full(encoded.as_bytes()).expect("valid key; qed"); + let public_key: ::Signer = public.into(); + let account: AccountId = public_key.clone().into_account(); + (public_key, account) + } + + fn sign(_public: &::Signer, message: &[u8]) -> Signature { + let digest = sp_io::hashing::keccak_256(message); + let (sig, recovery_id) = bench_signing_key() + .sign_prehash_recoverable(&digest) + .expect("signing with fixed key never fails; qed"); + let mut sig_bytes = [0u8; 65]; + sig_bytes[..64].copy_from_slice(&sig.to_bytes()); + sig_bytes[64] = recovery_id.to_byte(); + let sig = sp_core::ecdsa::Signature::from_raw(sig_bytes); + Signature::from(MultiSignature::Ecdsa(sig)) + } + } +} + /****** Relay Randomness pallet ******/ impl pallet_randomness::Config for Runtime { type RuntimeEvent = RuntimeEvent; @@ -151,6 +226,7 @@ impl sp_runtime::traits::BlockNumberProvider for BlockNumberGetter { /****** ****** ****** ******/ /****** Storage Providers pallet ******/ +#[cfg(not(feature = "runtime-benchmarks"))] parameter_types! { pub const SpMinDeposit: Balance = 100 * HAVE; pub const BucketDeposit: Balance = 100 * HAVE; @@ -159,10 +235,47 @@ parameter_types! { // TODO: If the next line is uncommented (which should be eventually, replacing the line above), compilation breaks (most likely because of mismatched dependency issues) // pub const MaxBlocksForRandomness: BlockNumber = prod_or_fast!(2 * runtime_constants::time::EPOCH_DURATION_IN_SLOTS, 2 * MINUTES); } +#[cfg(feature = "runtime-benchmarks")] +parameter_types! { + pub const SpMinDeposit: Balance = StorageHubBenchmarking::SP_MIN_DEPOSIT; + pub const BucketDeposit: Balance = StorageHubBenchmarking::BUCKET_DEPOSIT; + pub const BspSignUpLockPeriod: BlockNumber = 90 * DAYS; // ~3 months + pub const MaxBlocksForRandomness: BlockNumber = prod_or_fast!(2 * HOURS, 2 * MINUTES); + // TODO: If the next line is uncommented (which should be eventually, replacing the line above), compilation breaks (most likely because of mismatched dependency issues) + // pub const MaxBlocksForRandomness: BlockNumber = prod_or_fast!(2 * runtime_constants::time::EPOCH_DURATION_IN_SLOTS, 2 * MINUTES); +} + +#[cfg(feature = "runtime-benchmarks")] +pub struct StorageHubTreasuryAccount; +#[cfg(feature = "runtime-benchmarks")] +impl Get for StorageHubTreasuryAccount { + fn get() -> AccountId { + let account = TreasuryAccount::get(); + StorageHubBenchmarking::ensure_treasury_account::(account) + } +} + +// Benchmark helpers for Storage Providers pallet. +#[cfg(feature = "runtime-benchmarks")] +pub struct ProvidersBenchmarkHelpers; +#[cfg(feature = "runtime-benchmarks")] +impl pallet_storage_providers::benchmarking::BenchmarkHelpers + for ProvidersBenchmarkHelpers +{ + type ProviderId = ::ProviderId; + + fn set_accrued_failed_proofs(provider_id: Self::ProviderId, value: u32) { + pallet_proofs_dealer::SlashableProviders::::insert(provider_id, value); + } + + fn get_accrued_failed_proofs(provider_id: Self::ProviderId) -> u32 { + pallet_proofs_dealer::SlashableProviders::::get(provider_id).unwrap_or(0) + } +} impl pallet_storage_providers::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type WeightInfo = pallet_storage_providers::weights::SubstrateWeight; + type WeightInfo = crate::weights::pallet_storage_providers::WeightInfo; type ProvidersRandomness = pallet_randomness::RandomnessFromOneEpochAgo; type PaymentStreams = PaymentStreams; type ProofDealer = ProofsDealer; @@ -188,7 +301,10 @@ impl pallet_storage_providers::Config for Runtime { type ProvidersProofSubmitters = ProofsDealer; type ReputationWeightType = u32; type StorageHubTickGetter = ProofsDealer; + #[cfg(not(feature = "runtime-benchmarks"))] type Treasury = TreasuryAccount; + #[cfg(feature = "runtime-benchmarks")] + type Treasury = StorageHubTreasuryAccount; type SpMinDeposit = SpMinDeposit; type SpMinCapacity = ConstU64<2>; type DepositPerData = ConstU128<2>; @@ -208,6 +324,8 @@ impl pallet_storage_providers::Config for Runtime { type ZeroSizeBucketFixedRate = runtime_config::ZeroSizeBucketFixedRate; type ProviderTopUpTtl = runtime_config::ProviderTopUpTtl; type MaxExpiredItemsInBlock = ConstU32<100>; + #[cfg(feature = "runtime-benchmarks")] + type BenchmarkHelpers = ProvidersBenchmarkHelpers; } pub struct StorageDataUnitAndBalanceConverter; @@ -240,7 +358,7 @@ parameter_types! { impl pallet_payment_streams::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type WeightInfo = pallet_payment_streams::weights::SubstrateWeight; + type WeightInfo = crate::weights::pallet_payment_streams::WeightInfo; type NativeBalance = Balances; type ProvidersPallet = Providers; type RuntimeHoldReason = RuntimeHoldReason; @@ -250,7 +368,10 @@ impl pallet_payment_streams::Config for Runtime { type BlockNumberToBalance = BlockNumberToBalance; type ProvidersProofSubmitters = ProofsDealer; type TreasuryCutCalculator = LinearThenPowerOfTwoTreasuryCutCalculator; + #[cfg(not(feature = "runtime-benchmarks"))] type TreasuryAccount = TreasuryAccount; + #[cfg(feature = "runtime-benchmarks")] + type TreasuryAccount = StorageHubTreasuryAccount; type MaxUsersToCharge = ConstU32<10>; type BaseDeposit = ConstU128<10>; } @@ -279,6 +400,14 @@ const MAX_CUSTOM_CHALLENGES_PER_BLOCK: u32 = 10; const TOTAL_MAX_CHALLENGES_PER_BLOCK: u32 = RANDOM_CHALLENGES_PER_BLOCK + MAX_CUSTOM_CHALLENGES_PER_BLOCK; +#[cfg(feature = "runtime-benchmarks")] +parameter_types! { + pub const BenchmarkStakeToChallengePeriod: Balance = + StorageHubBenchmarking::STAKE_TO_CHALLENGE_PERIOD; + pub const BenchmarkCheckpointChallengePeriod: BlockNumber = + StorageHubBenchmarking::CHECKPOINT_CHALLENGE_PERIOD; +} + parameter_types! { pub const RandomChallengesPerBlock: u32 = RANDOM_CHALLENGES_PER_BLOCK; pub const MaxCustomChallengesPerBlock: u32 = MAX_CUSTOM_CHALLENGES_PER_BLOCK; @@ -293,7 +422,7 @@ parameter_types! { impl pallet_proofs_dealer::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type WeightInfo = pallet_proofs_dealer::weights::SubstrateWeight; + type WeightInfo = crate::weights::pallet_proofs_dealer::WeightInfo; type ProvidersPallet = Providers; type NativeBalance = Balances; type MerkleTrieHash = Hash; @@ -306,29 +435,50 @@ impl pallet_proofs_dealer::Config for Runtime { { shp_constants::FILE_SIZE_TO_CHALLENGES }, >; type StakeToBlockNumber = SaturatingBalanceToBlockNumber; + #[cfg(feature = "runtime-benchmarks")] + type RandomChallengesPerBlock = ConstU32<0>; + #[cfg(not(feature = "runtime-benchmarks"))] type RandomChallengesPerBlock = RandomChallengesPerBlock; + #[cfg(feature = "runtime-benchmarks")] + type MaxCustomChallengesPerBlock = TotalMaxChallengesPerBlock; + #[cfg(not(feature = "runtime-benchmarks"))] type MaxCustomChallengesPerBlock = MaxCustomChallengesPerBlock; type MaxSubmittersPerTick = MaxSubmittersPerTick; type TargetTicksStorageOfSubmitters = TargetTicksStorageOfSubmitters; type ChallengeHistoryLength = ChallengeHistoryLength; type ChallengesQueueLength = ChallengesQueueLength; + #[cfg(not(feature = "runtime-benchmarks"))] type CheckpointChallengePeriod = runtime_config::CheckpointChallengePeriod; + #[cfg(feature = "runtime-benchmarks")] + type CheckpointChallengePeriod = BenchmarkCheckpointChallengePeriod; type ChallengesFee = ChallengesFee; type PriorityChallengesFee = PriorityChallengesFee; + #[cfg(not(feature = "runtime-benchmarks"))] type Treasury = TreasuryAccount; + #[cfg(feature = "runtime-benchmarks")] + type Treasury = StorageHubTreasuryAccount; // TODO: Once the client logic to keep track of CR randomness deadlines and execute their submissions is implemented // AND after the chain has been live for enough time to have enough providers to avoid the commit-reveal randomness being // gameable, the randomness provider should be CrRandomness type RandomnessProvider = pallet_randomness::ParentBlockRandomness; + #[cfg(not(feature = "runtime-benchmarks"))] type StakeToChallengePeriod = runtime_config::StakeToChallengePeriod; + #[cfg(feature = "runtime-benchmarks")] + type StakeToChallengePeriod = BenchmarkStakeToChallengePeriod; type MinChallengePeriod = runtime_config::MinChallengePeriod; type ChallengeTicksTolerance = ChallengeTicksTolerance; type BlockFullnessPeriod = ChallengeTicksTolerance; // We purposely set this to `ChallengeTicksTolerance` so that spamming of the chain is evaluated for the same blocks as the tolerance BSPs are given. type BlockFullnessHeadroom = BlockFullnessHeadroom; type MinNotFullBlocksRatio = MinNotFullBlocksRatio; type MaxSlashableProvidersPerTick = MaxSlashableProvidersPerTick; - type ChallengeOrigin = EnsureRoot; - type PriorityChallengeOrigin = EnsureRoot; + #[cfg(not(feature = "runtime-benchmarks"))] + type ChallengeOrigin = frame_system::EnsureRoot; + #[cfg(feature = "runtime-benchmarks")] + type ChallengeOrigin = EnsureSigned; + #[cfg(not(feature = "runtime-benchmarks"))] + type PriorityChallengeOrigin = frame_system::EnsureRoot; + #[cfg(feature = "runtime-benchmarks")] + type PriorityChallengeOrigin = EnsureSigned; } // Converter from the Balance type to the BlockNumber type for math. @@ -452,12 +602,24 @@ impl Get for MaxSlashableProvidersPerTick { type ThresholdType = u32; pub type ReplicationTargetType = u32; +#[cfg(not(feature = "runtime-benchmarks"))] parameter_types! { pub const BaseStorageRequestCreationDeposit: Balance = 1 * HAVE; pub const FileDeletionRequestCreationDeposit: Balance = 1 * HAVE; pub const FileSystemStorageRequestCreationHoldReason: RuntimeHoldReason = RuntimeHoldReason::FileSystem(pallet_file_system::HoldReason::StorageRequestCreationHold); pub const FileSystemFileDeletionRequestHoldReason: RuntimeHoldReason = RuntimeHoldReason::FileSystem(pallet_file_system::HoldReason::FileDeletionRequestHold); } +#[cfg(feature = "runtime-benchmarks")] +parameter_types! { + pub const BaseStorageRequestCreationDeposit: Balance = 1 * MICROHAVE; + pub const FileDeletionRequestCreationDeposit: Balance = 1 * MICROHAVE; + pub const FileSystemStorageRequestCreationHoldReason: RuntimeHoldReason = RuntimeHoldReason::FileSystem(pallet_file_system::HoldReason::StorageRequestCreationHold); + pub const FileSystemFileDeletionRequestHoldReason: RuntimeHoldReason = RuntimeHoldReason::FileSystem(pallet_file_system::HoldReason::FileDeletionRequestHold); +} +#[cfg(feature = "runtime-benchmarks")] +parameter_types! { + pub const BenchmarkBspStopStoringFilePenalty: Balance = 1 * MICROHAVE; +} // Converts a given signed message in a EIP-191 compliant message bytes to verify. /// EIP-191: https://eips.ethereum.org/EIPS/eip-191 @@ -480,7 +642,7 @@ impl shp_traits::MessageAdapter for Eip191Adapter { impl pallet_file_system::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type WeightInfo = pallet_file_system::weights::SubstrateWeight; + type WeightInfo = crate::weights::pallet_file_system::WeightInfo; type Providers = Providers; type ProofDealer = ProofsDealer; type PaymentStreams = PaymentStreams; @@ -500,8 +662,14 @@ impl pallet_file_system::Config for Runtime { type RuntimeHoldReason = RuntimeHoldReason; type Nfts = Nfts; type CollectionInspector = BucketNfts; + #[cfg(not(feature = "runtime-benchmarks"))] type BspStopStoringFilePenalty = runtime_config::BspStopStoringFilePenalty; + #[cfg(feature = "runtime-benchmarks")] + type BspStopStoringFilePenalty = BenchmarkBspStopStoringFilePenalty; + #[cfg(not(feature = "runtime-benchmarks"))] type TreasuryAccount = TreasuryAccount; + #[cfg(feature = "runtime-benchmarks")] + type TreasuryAccount = StorageHubTreasuryAccount; type MaxBatchConfirmStorageRequests = ConstU32<100>; type MaxFilePathSize = ConstU32<512u32>; type MaxPeerIdSize = ConstU32<100>; diff --git a/operator/runtime/mainnet/src/lib.rs b/operator/runtime/mainnet/src/lib.rs index c1e3b156..7473be08 100644 --- a/operator/runtime/mainnet/src/lib.rs +++ b/operator/runtime/mainnet/src/lib.rs @@ -201,7 +201,7 @@ parameter_types! { parameter_types! { // TODO: Change ED to 1 after upgrade to Polkadot SDK stable2503 // cfr. https://github.com/paritytech/polkadot-sdk/pull/7379 - pub const ExistentialDeposit: Balance = 100; + pub const ExistentialDeposit: Balance = 1; } /// The version information used to identify this runtime when compiled natively. @@ -972,6 +972,7 @@ impl_runtime_apis! { use frame_system_benchmarking::Pallet as SystemBench; impl frame_system_benchmarking::Config for Runtime {} + impl pallet_session_benchmarking::Config for Runtime {} impl baseline::Config for Runtime {} use frame_support::traits::WhitelistedStorageKeys; diff --git a/operator/runtime/mainnet/src/weights/mod.rs b/operator/runtime/mainnet/src/weights/mod.rs index 1ff1a426..4a92b29b 100644 --- a/operator/runtime/mainnet/src/weights/mod.rs +++ b/operator/runtime/mainnet/src/weights/mod.rs @@ -35,18 +35,24 @@ pub mod pallet_babe; pub mod pallet_balances; pub mod pallet_beefy_mmr; pub mod pallet_evm; +pub mod pallet_file_system; pub mod pallet_grandpa; pub mod pallet_im_online; pub mod pallet_message_queue; pub mod pallet_migrations; pub mod pallet_mmr; pub mod pallet_multisig; +pub mod pallet_nfts; pub mod pallet_parameters; +pub mod pallet_payment_streams; pub mod pallet_preimage; +pub mod pallet_proofs_dealer; pub mod pallet_proxy; pub mod pallet_randomness; pub mod pallet_safe_mode; pub mod pallet_scheduler; +pub mod pallet_session; +pub mod pallet_storage_providers; pub mod pallet_sudo; pub mod pallet_timestamp; pub mod pallet_transaction_payment; diff --git a/operator/runtime/mainnet/src/weights/pallet_file_system.rs b/operator/runtime/mainnet/src/weights/pallet_file_system.rs new file mode 100644 index 00000000..4a2a2050 --- /dev/null +++ b/operator/runtime/mainnet/src/weights/pallet_file_system.rs @@ -0,0 +1,5 @@ +//! Weights for `pallet_file_system`. +//! +//! Generated weights should overwrite this file. + +pub use pallet_file_system::weights::SubstrateWeight as WeightInfo; diff --git a/operator/runtime/mainnet/src/weights/pallet_nfts.rs b/operator/runtime/mainnet/src/weights/pallet_nfts.rs new file mode 100644 index 00000000..4ffc4faf --- /dev/null +++ b/operator/runtime/mainnet/src/weights/pallet_nfts.rs @@ -0,0 +1,726 @@ + + +//! Autogenerated weights for `pallet_nfts` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 51.0.0 +//! DATE: 2025-11-14, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ip-10-0-0-176`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` +//! WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --runtime +// target/production/wbuild/datahaven-mainnet-runtime/datahaven_mainnet_runtime.compact.compressed.wasm +// --pallet +// pallet_nfts +// --extrinsic +// +// --template +// benchmarking/frame-weight-template.hbs +// --output +// runtime/mainnet/src/weights/pallet_nfts.rs +// --steps +// 50 +// --repeat +// 20 + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use sp_std::marker::PhantomData; + +/// Weights for `pallet_nfts`. +pub struct WeightInfo(PhantomData); +impl pallet_nfts::WeightInfo for WeightInfo { + /// Storage: `Nfts::NextCollectionId` (r:1 w:1) + /// Proof: `Nfts::NextCollectionId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Collection` (r:1 w:1) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionRoleOf` (r:0 w:1) + /// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionConfigOf` (r:0 w:1) + /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionAccount` (r:0 w:1) + /// Proof: `Nfts::CollectionAccount` (`max_values`: None, `max_size`: Some(56), added: 2531, mode: `MaxEncodedLen`) + fn create() -> Weight { + // Proof Size summary in bytes: + // Measured: `271` + // Estimated: `3537` + // Minimum execution time: 46_980_000 picoseconds. + Weight::from_parts(48_333_000, 3537) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } + /// Storage: `Nfts::NextCollectionId` (r:1 w:1) + /// Proof: `Nfts::NextCollectionId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Collection` (r:1 w:1) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionRoleOf` (r:0 w:1) + /// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionConfigOf` (r:0 w:1) + /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionAccount` (r:0 w:1) + /// Proof: `Nfts::CollectionAccount` (`max_values`: None, `max_size`: Some(56), added: 2531, mode: `MaxEncodedLen`) + fn force_create() -> Weight { + // Proof Size summary in bytes: + // Measured: `76` + // Estimated: `3537` + // Minimum execution time: 25_388_000 picoseconds. + Weight::from_parts(26_185_000, 3537) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } + /// Storage: `Nfts::Collection` (r:1 w:1) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemMetadataOf` (r:1 w:0) + /// Proof: `Nfts::ItemMetadataOf` (`max_values`: None, `max_size`: Some(335), added: 2810, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionRoleOf` (r:1 w:1) + /// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Attribute` (r:1001 w:1000) + /// Proof: `Nfts::Attribute` (`max_values`: None, `max_size`: Some(455), added: 2930, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemConfigOf` (r:1000 w:1000) + /// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionMetadataOf` (r:0 w:1) + /// Proof: `Nfts::CollectionMetadataOf` (`max_values`: None, `max_size`: Some(294), added: 2769, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionConfigOf` (r:0 w:1) + /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionAccount` (r:0 w:1) + /// Proof: `Nfts::CollectionAccount` (`max_values`: None, `max_size`: Some(56), added: 2531, mode: `MaxEncodedLen`) + /// The range of component `m` is `[0, 1000]`. + /// The range of component `c` is `[0, 1000]`. + /// The range of component `a` is `[0, 1000]`. + fn destroy(m: u32, _c: u32, a: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `32179 + a * (366 ±0)` + // Estimated: `2523990 + a * (2930 ±0)` + // Minimum execution time: 1_376_605_000 picoseconds. + Weight::from_parts(1_488_155_322, 2523990) + // Standard Error: 20_663 + .saturating_add(Weight::from_parts(65_636, 0).saturating_mul(m.into())) + // Standard Error: 20_663 + .saturating_add(Weight::from_parts(8_224_542, 0).saturating_mul(a.into())) + .saturating_add(T::DbWeight::get().reads(1004_u64)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(a.into()))) + .saturating_add(T::DbWeight::get().writes(1005_u64)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(a.into()))) + .saturating_add(Weight::from_parts(0, 2930).saturating_mul(a.into())) + } + /// Storage: `Nfts::CollectionConfigOf` (r:1 w:0) + /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Item` (r:1 w:1) + /// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(597), added: 3072, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Collection` (r:1 w:1) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionRoleOf` (r:1 w:0) + /// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemConfigOf` (r:1 w:1) + /// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Account` (r:0 w:1) + /// Proof: `Nfts::Account` (`max_values`: None, `max_size`: Some(76), added: 2551, mode: `MaxEncodedLen`) + fn mint() -> Weight { + // Proof Size summary in bytes: + // Measured: `418` + // Estimated: `4062` + // Minimum execution time: 67_377_000 picoseconds. + Weight::from_parts(68_962_000, 4062) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) + } + /// Storage: `Nfts::CollectionRoleOf` (r:1 w:0) + /// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Item` (r:1 w:1) + /// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(597), added: 3072, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Collection` (r:1 w:1) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionConfigOf` (r:1 w:0) + /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemConfigOf` (r:1 w:1) + /// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Account` (r:0 w:1) + /// Proof: `Nfts::Account` (`max_values`: None, `max_size`: Some(76), added: 2551, mode: `MaxEncodedLen`) + fn force_mint() -> Weight { + // Proof Size summary in bytes: + // Measured: `418` + // Estimated: `4062` + // Minimum execution time: 65_493_000 picoseconds. + Weight::from_parts(67_405_000, 4062) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) + } + /// Storage: `Nfts::Attribute` (r:1 w:0) + /// Proof: `Nfts::Attribute` (`max_values`: None, `max_size`: Some(455), added: 2930, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemConfigOf` (r:1 w:1) + /// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Collection` (r:1 w:1) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Item` (r:1 w:1) + /// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(597), added: 3072, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemMetadataOf` (r:1 w:0) + /// Proof: `Nfts::ItemMetadataOf` (`max_values`: None, `max_size`: Some(335), added: 2810, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Account` (r:0 w:1) + /// Proof: `Nfts::Account` (`max_values`: None, `max_size`: Some(76), added: 2551, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemPriceOf` (r:0 w:1) + /// Proof: `Nfts::ItemPriceOf` (`max_values`: None, `max_size`: Some(77), added: 2552, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemAttributesApprovalsOf` (r:0 w:1) + /// Proof: `Nfts::ItemAttributesApprovalsOf` (`max_values`: None, `max_size`: Some(441), added: 2916, mode: `MaxEncodedLen`) + /// Storage: `Nfts::PendingSwapOf` (r:0 w:1) + /// Proof: `Nfts::PendingSwapOf` (`max_values`: None, `max_size`: Some(71), added: 2546, mode: `MaxEncodedLen`) + fn burn() -> Weight { + // Proof Size summary in bytes: + // Measured: `526` + // Estimated: `4062` + // Minimum execution time: 73_291_000 picoseconds. + Weight::from_parts(75_035_000, 4062) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(7_u64)) + } + /// Storage: `Nfts::Collection` (r:1 w:0) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Attribute` (r:1 w:0) + /// Proof: `Nfts::Attribute` (`max_values`: None, `max_size`: Some(455), added: 2930, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionConfigOf` (r:1 w:0) + /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemConfigOf` (r:1 w:0) + /// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Item` (r:1 w:1) + /// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(597), added: 3072, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Account` (r:0 w:2) + /// Proof: `Nfts::Account` (`max_values`: None, `max_size`: Some(76), added: 2551, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemPriceOf` (r:0 w:1) + /// Proof: `Nfts::ItemPriceOf` (`max_values`: None, `max_size`: Some(77), added: 2552, mode: `MaxEncodedLen`) + /// Storage: `Nfts::PendingSwapOf` (r:0 w:1) + /// Proof: `Nfts::PendingSwapOf` (`max_values`: None, `max_size`: Some(71), added: 2546, mode: `MaxEncodedLen`) + fn transfer() -> Weight { + // Proof Size summary in bytes: + // Measured: `555` + // Estimated: `4062` + // Minimum execution time: 56_413_000 picoseconds. + Weight::from_parts(58_224_000, 4062) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } + /// Storage: `Nfts::Collection` (r:1 w:0) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionConfigOf` (r:1 w:0) + /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Item` (r:5000 w:5000) + /// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(597), added: 3072, mode: `MaxEncodedLen`) + /// The range of component `i` is `[0, 5000]`. + fn redeposit(i: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `750 + i * (83 ±0)` + // Estimated: `3538 + i * (3072 ±0)` + // Minimum execution time: 18_658_000 picoseconds. + Weight::from_parts(19_263_000, 3538) + // Standard Error: 28_107 + .saturating_add(Weight::from_parts(24_930_095, 0).saturating_mul(i.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(i.into()))) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) + .saturating_add(Weight::from_parts(0, 3072).saturating_mul(i.into())) + } + /// Storage: `Nfts::CollectionRoleOf` (r:1 w:0) + /// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemConfigOf` (r:1 w:1) + /// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + fn lock_item_transfer() -> Weight { + // Proof Size summary in bytes: + // Measured: `423` + // Estimated: `3522` + // Minimum execution time: 24_194_000 picoseconds. + Weight::from_parts(25_183_000, 3522) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Nfts::CollectionRoleOf` (r:1 w:0) + /// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemConfigOf` (r:1 w:1) + /// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + fn unlock_item_transfer() -> Weight { + // Proof Size summary in bytes: + // Measured: `423` + // Estimated: `3522` + // Minimum execution time: 24_302_000 picoseconds. + Weight::from_parts(24_760_000, 3522) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Nfts::Collection` (r:1 w:0) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionConfigOf` (r:1 w:1) + /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + fn lock_collection() -> Weight { + // Proof Size summary in bytes: + // Measured: `327` + // Estimated: `3538` + // Minimum execution time: 20_173_000 picoseconds. + Weight::from_parts(20_850_000, 3538) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Nfts::OwnershipAcceptance` (r:1 w:1) + /// Proof: `Nfts::OwnershipAcceptance` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Collection` (r:1 w:1) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionAccount` (r:0 w:2) + /// Proof: `Nfts::CollectionAccount` (`max_values`: None, `max_size`: Some(56), added: 2531, mode: `MaxEncodedLen`) + fn transfer_ownership() -> Weight { + // Proof Size summary in bytes: + // Measured: `524` + // Estimated: `3581` + // Minimum execution time: 35_232_000 picoseconds. + Weight::from_parts(36_300_000, 3581) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } + /// Storage: `Nfts::Collection` (r:1 w:1) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionRoleOf` (r:2 w:4) + /// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + fn set_team() -> Weight { + // Proof Size summary in bytes: + // Measured: `344` + // Estimated: `6054` + // Minimum execution time: 49_520_000 picoseconds. + Weight::from_parts(50_640_000, 6054) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } + /// Storage: `Nfts::Collection` (r:1 w:1) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionAccount` (r:0 w:2) + /// Proof: `Nfts::CollectionAccount` (`max_values`: None, `max_size`: Some(56), added: 2531, mode: `MaxEncodedLen`) + fn force_collection_owner() -> Weight { + // Proof Size summary in bytes: + // Measured: `298` + // Estimated: `3537` + // Minimum execution time: 20_820_000 picoseconds. + Weight::from_parts(21_202_000, 3537) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: `Nfts::Collection` (r:1 w:0) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionConfigOf` (r:0 w:1) + /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + fn force_collection_config() -> Weight { + // Proof Size summary in bytes: + // Measured: `276` + // Estimated: `3537` + // Minimum execution time: 16_693_000 picoseconds. + Weight::from_parts(17_330_000, 3537) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Nfts::CollectionRoleOf` (r:1 w:0) + /// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemConfigOf` (r:1 w:1) + /// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + fn lock_item_properties() -> Weight { + // Proof Size summary in bytes: + // Measured: `423` + // Estimated: `3522` + // Minimum execution time: 23_027_000 picoseconds. + Weight::from_parts(23_442_000, 3522) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Nfts::Collection` (r:1 w:1) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionRoleOf` (r:1 w:0) + /// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionConfigOf` (r:1 w:0) + /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemConfigOf` (r:1 w:0) + /// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Attribute` (r:1 w:1) + /// Proof: `Nfts::Attribute` (`max_values`: None, `max_size`: Some(455), added: 2930, mode: `MaxEncodedLen`) + fn set_attribute() -> Weight { + // Proof Size summary in bytes: + // Measured: `514` + // Estimated: `3920` + // Minimum execution time: 68_689_000 picoseconds. + Weight::from_parts(70_511_000, 3920) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: `Nfts::Collection` (r:1 w:1) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Attribute` (r:1 w:1) + /// Proof: `Nfts::Attribute` (`max_values`: None, `max_size`: Some(455), added: 2930, mode: `MaxEncodedLen`) + fn force_set_attribute() -> Weight { + // Proof Size summary in bytes: + // Measured: `331` + // Estimated: `3920` + // Minimum execution time: 32_782_000 picoseconds. + Weight::from_parts(33_772_000, 3920) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: `Nfts::Attribute` (r:1 w:1) + /// Proof: `Nfts::Attribute` (`max_values`: None, `max_size`: Some(455), added: 2930, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionRoleOf` (r:1 w:0) + /// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemConfigOf` (r:1 w:0) + /// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Collection` (r:1 w:1) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + fn clear_attribute() -> Weight { + // Proof Size summary in bytes: + // Measured: `958` + // Estimated: `3920` + // Minimum execution time: 62_968_000 picoseconds. + Weight::from_parts(64_747_000, 3920) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: `Nfts::Item` (r:1 w:0) + /// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(597), added: 3072, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemAttributesApprovalsOf` (r:1 w:1) + /// Proof: `Nfts::ItemAttributesApprovalsOf` (`max_values`: None, `max_size`: Some(441), added: 2916, mode: `MaxEncodedLen`) + fn approve_item_attributes() -> Weight { + // Proof Size summary in bytes: + // Measured: `356` + // Estimated: `4062` + // Minimum execution time: 20_730_000 picoseconds. + Weight::from_parts(21_384_000, 4062) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Nfts::Item` (r:1 w:0) + /// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(597), added: 3072, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemAttributesApprovalsOf` (r:1 w:1) + /// Proof: `Nfts::ItemAttributesApprovalsOf` (`max_values`: None, `max_size`: Some(441), added: 2916, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Attribute` (r:1001 w:1000) + /// Proof: `Nfts::Attribute` (`max_values`: None, `max_size`: Some(455), added: 2930, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// The range of component `n` is `[0, 1000]`. + fn cancel_item_attributes_approval(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `769 + n * (386 ±0)` + // Estimated: `4062 + n * (2930 ±0)` + // Minimum execution time: 33_379_000 picoseconds. + Weight::from_parts(34_195_000, 4062) + // Standard Error: 4_787 + .saturating_add(Weight::from_parts(7_772_947, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes(2_u64)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 2930).saturating_mul(n.into())) + } + /// Storage: `Nfts::CollectionRoleOf` (r:1 w:0) + /// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Collection` (r:1 w:1) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemConfigOf` (r:1 w:0) + /// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionConfigOf` (r:1 w:0) + /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemMetadataOf` (r:1 w:1) + /// Proof: `Nfts::ItemMetadataOf` (`max_values`: None, `max_size`: Some(335), added: 2810, mode: `MaxEncodedLen`) + fn set_metadata() -> Weight { + // Proof Size summary in bytes: + // Measured: `514` + // Estimated: `3800` + // Minimum execution time: 56_022_000 picoseconds. + Weight::from_parts(57_731_000, 3800) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: `Nfts::CollectionRoleOf` (r:1 w:0) + /// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemMetadataOf` (r:1 w:1) + /// Proof: `Nfts::ItemMetadataOf` (`max_values`: None, `max_size`: Some(335), added: 2810, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Collection` (r:1 w:1) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemConfigOf` (r:1 w:0) + /// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + fn clear_metadata() -> Weight { + // Proof Size summary in bytes: + // Measured: `824` + // Estimated: `3800` + // Minimum execution time: 53_756_000 picoseconds. + Weight::from_parts(54_834_000, 3800) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: `Nfts::CollectionRoleOf` (r:1 w:0) + /// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionConfigOf` (r:1 w:0) + /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Collection` (r:1 w:1) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionMetadataOf` (r:1 w:1) + /// Proof: `Nfts::CollectionMetadataOf` (`max_values`: None, `max_size`: Some(294), added: 2769, mode: `MaxEncodedLen`) + fn set_collection_metadata() -> Weight { + // Proof Size summary in bytes: + // Measured: `373` + // Estimated: `3759` + // Minimum execution time: 50_526_000 picoseconds. + Weight::from_parts(52_262_000, 3759) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: `Nfts::CollectionRoleOf` (r:1 w:0) + /// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Collection` (r:1 w:1) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionConfigOf` (r:1 w:0) + /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionMetadataOf` (r:1 w:1) + /// Proof: `Nfts::CollectionMetadataOf` (`max_values`: None, `max_size`: Some(294), added: 2769, mode: `MaxEncodedLen`) + fn clear_collection_metadata() -> Weight { + // Proof Size summary in bytes: + // Measured: `691` + // Estimated: `3759` + // Minimum execution time: 50_577_000 picoseconds. + Weight::from_parts(51_516_000, 3759) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: `Nfts::Item` (r:1 w:1) + /// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(597), added: 3072, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionConfigOf` (r:1 w:0) + /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + fn approve_transfer() -> Weight { + // Proof Size summary in bytes: + // Measured: `385` + // Estimated: `4062` + // Minimum execution time: 24_204_000 picoseconds. + Weight::from_parts(25_158_000, 4062) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Nfts::Item` (r:1 w:1) + /// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(597), added: 3072, mode: `MaxEncodedLen`) + fn cancel_approval() -> Weight { + // Proof Size summary in bytes: + // Measured: `382` + // Estimated: `4062` + // Minimum execution time: 21_067_000 picoseconds. + Weight::from_parts(21_663_000, 4062) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Nfts::Item` (r:1 w:1) + /// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(597), added: 3072, mode: `MaxEncodedLen`) + fn clear_all_transfer_approvals() -> Weight { + // Proof Size summary in bytes: + // Measured: `382` + // Estimated: `4062` + // Minimum execution time: 19_982_000 picoseconds. + Weight::from_parts(20_493_000, 4062) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Nfts::OwnershipAcceptance` (r:1 w:1) + /// Proof: `Nfts::OwnershipAcceptance` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + fn set_accept_ownership() -> Weight { + // Proof Size summary in bytes: + // Measured: `76` + // Estimated: `3505` + // Minimum execution time: 17_144_000 picoseconds. + Weight::from_parts(17_739_000, 3505) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Nfts::CollectionConfigOf` (r:1 w:1) + /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Collection` (r:1 w:0) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + fn set_collection_max_supply() -> Weight { + // Proof Size summary in bytes: + // Measured: `327` + // Estimated: `3538` + // Minimum execution time: 22_173_000 picoseconds. + Weight::from_parts(22_774_000, 3538) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Nfts::CollectionRoleOf` (r:1 w:0) + /// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionConfigOf` (r:1 w:1) + /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + fn update_mint_settings() -> Weight { + // Proof Size summary in bytes: + // Measured: `311` + // Estimated: `3538` + // Minimum execution time: 21_245_000 picoseconds. + Weight::from_parts(21_957_000, 3538) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Nfts::Item` (r:1 w:0) + /// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(597), added: 3072, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionConfigOf` (r:1 w:0) + /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemConfigOf` (r:1 w:0) + /// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemPriceOf` (r:0 w:1) + /// Proof: `Nfts::ItemPriceOf` (`max_values`: None, `max_size`: Some(77), added: 2552, mode: `MaxEncodedLen`) + fn set_price() -> Weight { + // Proof Size summary in bytes: + // Measured: `493` + // Estimated: `4062` + // Minimum execution time: 30_559_000 picoseconds. + Weight::from_parts(31_877_000, 4062) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Nfts::Item` (r:1 w:1) + /// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(597), added: 3072, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemPriceOf` (r:1 w:1) + /// Proof: `Nfts::ItemPriceOf` (`max_values`: None, `max_size`: Some(77), added: 2552, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Collection` (r:1 w:0) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Attribute` (r:1 w:0) + /// Proof: `Nfts::Attribute` (`max_values`: None, `max_size`: Some(455), added: 2930, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionConfigOf` (r:1 w:0) + /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemConfigOf` (r:1 w:0) + /// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Account` (r:0 w:2) + /// Proof: `Nfts::Account` (`max_values`: None, `max_size`: Some(76), added: 2551, mode: `MaxEncodedLen`) + /// Storage: `Nfts::PendingSwapOf` (r:0 w:1) + /// Proof: `Nfts::PendingSwapOf` (`max_values`: None, `max_size`: Some(71), added: 2546, mode: `MaxEncodedLen`) + fn buy_item() -> Weight { + // Proof Size summary in bytes: + // Measured: `655` + // Estimated: `4062` + // Minimum execution time: 66_567_000 picoseconds. + Weight::from_parts(68_264_000, 4062) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } + /// The range of component `n` is `[0, 10]`. + fn pay_tips(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 3_221_000 picoseconds. + Weight::from_parts(4_654_516, 0) + // Standard Error: 7_679 + .saturating_add(Weight::from_parts(2_619_134, 0).saturating_mul(n.into())) + } + /// Storage: `Nfts::Item` (r:2 w:0) + /// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(597), added: 3072, mode: `MaxEncodedLen`) + /// Storage: `Nfts::PendingSwapOf` (r:0 w:1) + /// Proof: `Nfts::PendingSwapOf` (`max_values`: None, `max_size`: Some(71), added: 2546, mode: `MaxEncodedLen`) + fn create_swap() -> Weight { + // Proof Size summary in bytes: + // Measured: `444` + // Estimated: `7134` + // Minimum execution time: 26_849_000 picoseconds. + Weight::from_parts(27_644_000, 7134) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Nfts::PendingSwapOf` (r:1 w:1) + /// Proof: `Nfts::PendingSwapOf` (`max_values`: None, `max_size`: Some(71), added: 2546, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Item` (r:1 w:0) + /// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(597), added: 3072, mode: `MaxEncodedLen`) + fn cancel_swap() -> Weight { + // Proof Size summary in bytes: + // Measured: `488` + // Estimated: `4062` + // Minimum execution time: 27_431_000 picoseconds. + Weight::from_parts(27_897_000, 4062) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Nfts::Item` (r:2 w:2) + /// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(597), added: 3072, mode: `MaxEncodedLen`) + /// Storage: `Nfts::PendingSwapOf` (r:1 w:2) + /// Proof: `Nfts::PendingSwapOf` (`max_values`: None, `max_size`: Some(71), added: 2546, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Collection` (r:1 w:0) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Attribute` (r:2 w:0) + /// Proof: `Nfts::Attribute` (`max_values`: None, `max_size`: Some(455), added: 2930, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionConfigOf` (r:1 w:0) + /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemConfigOf` (r:2 w:0) + /// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Account` (r:0 w:4) + /// Proof: `Nfts::Account` (`max_values`: None, `max_size`: Some(76), added: 2551, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemPriceOf` (r:0 w:2) + /// Proof: `Nfts::ItemPriceOf` (`max_values`: None, `max_size`: Some(77), added: 2552, mode: `MaxEncodedLen`) + fn claim_swap() -> Weight { + // Proof Size summary in bytes: + // Measured: `771` + // Estimated: `7134` + // Minimum execution time: 110_387_000 picoseconds. + Weight::from_parts(112_526_000, 7134) + .saturating_add(T::DbWeight::get().reads(9_u64)) + .saturating_add(T::DbWeight::get().writes(10_u64)) + } + /// Storage: `Nfts::CollectionRoleOf` (r:2 w:0) + /// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionConfigOf` (r:1 w:0) + /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Item` (r:1 w:1) + /// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(597), added: 3072, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Collection` (r:1 w:1) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemConfigOf` (r:1 w:1) + /// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Attribute` (r:10 w:10) + /// Proof: `Nfts::Attribute` (`max_values`: None, `max_size`: Some(455), added: 2930, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemMetadataOf` (r:1 w:1) + /// Proof: `Nfts::ItemMetadataOf` (`max_values`: None, `max_size`: Some(335), added: 2810, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Account` (r:0 w:1) + /// Proof: `Nfts::Account` (`max_values`: None, `max_size`: Some(76), added: 2551, mode: `MaxEncodedLen`) + /// The range of component `n` is `[0, 10]`. + fn mint_pre_signed(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `580` + // Estimated: `6054 + n * (2930 ±0)` + // Minimum execution time: 159_612_000 picoseconds. + Weight::from_parts(166_084_283, 6054) + // Standard Error: 67_116 + .saturating_add(Weight::from_parts(43_826_364, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes(6_u64)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 2930).saturating_mul(n.into())) + } + /// Storage: `Nfts::Item` (r:1 w:0) + /// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(597), added: 3072, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemAttributesApprovalsOf` (r:1 w:1) + /// Proof: `Nfts::ItemAttributesApprovalsOf` (`max_values`: None, `max_size`: Some(441), added: 2916, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionConfigOf` (r:1 w:0) + /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Collection` (r:1 w:1) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Attribute` (r:10 w:10) + /// Proof: `Nfts::Attribute` (`max_values`: None, `max_size`: Some(455), added: 2930, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// The range of component `n` is `[0, 10]`. + fn set_attributes_pre_signed(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `575` + // Estimated: `4062 + n * (2930 ±0)` + // Minimum execution time: 75_695_000 picoseconds. + Weight::from_parts(89_915_935, 4062) + // Standard Error: 98_709 + .saturating_add(Weight::from_parts(42_240_220, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes(2_u64)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 2930).saturating_mul(n.into())) + } +} diff --git a/operator/runtime/mainnet/src/weights/pallet_payment_streams.rs b/operator/runtime/mainnet/src/weights/pallet_payment_streams.rs new file mode 100644 index 00000000..3022e4da --- /dev/null +++ b/operator/runtime/mainnet/src/weights/pallet_payment_streams.rs @@ -0,0 +1,449 @@ +// Copyright 2025 DataHaven +// This file is part of DataHaven. + +// DataHaven is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// DataHaven is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with DataHaven. If not, see . + + +//! Autogenerated weights for `pallet_payment_streams` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 51.0.0 +//! DATE: 2026-01-29, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ip-10-0-0-176`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` +//! WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --runtime +// target/production/wbuild/datahaven-mainnet-runtime/datahaven_mainnet_runtime.compact.compressed.wasm +// --pallet +// pallet_payment_streams +// --extrinsic +// +// --header +// ../file_header.txt +// --template +// benchmarking/frame-weight-template.hbs +// --output +// runtime/mainnet/src/weights/pallet_payment_streams.rs +// --steps +// 50 +// --repeat +// 20 + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use sp_std::marker::PhantomData; + +/// Weights for `pallet_payment_streams`. +pub struct WeightInfo(PhantomData); +impl pallet_payment_streams::weights::WeightInfo for WeightInfo { + /// Storage: `Providers::BackupStorageProviders` (r:1 w:0) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:2 w:0) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `Providers::AwaitingTopUpFromProviders` (r:2 w:0) + /// Proof: `Providers::AwaitingTopUpFromProviders` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::FixedRatePaymentStreams` (r:1 w:1) + /// Proof: `PaymentStreams::FixedRatePaymentStreams` (`max_values`: None, `max_size`: Some(125), added: 2600, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::UsersWithoutFunds` (r:1 w:0) + /// Proof: `PaymentStreams::UsersWithoutFunds` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::RegisteredUsers` (r:1 w:1) + /// Proof: `PaymentStreams::RegisteredUsers` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::OnPollTicker` (r:1 w:0) + /// Proof: `PaymentStreams::OnPollTicker` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + fn create_fixed_rate_payment_stream() -> Weight { + // Proof Size summary in bytes: + // Measured: `523` + // Estimated: `6054` + // Minimum execution time: 107_606_000 picoseconds. + Weight::from_parts(108_915_000, 6054) + .saturating_add(T::DbWeight::get().reads(11_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) + } + /// Storage: `Providers::BackupStorageProviders` (r:1 w:0) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::FixedRatePaymentStreams` (r:1 w:1) + /// Proof: `PaymentStreams::FixedRatePaymentStreams` (`max_values`: None, `max_size`: Some(125), added: 2600, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::UsersWithoutFunds` (r:1 w:0) + /// Proof: `PaymentStreams::UsersWithoutFunds` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:2 w:0) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `Providers::AwaitingTopUpFromProviders` (r:2 w:0) + /// Proof: `Providers::AwaitingTopUpFromProviders` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::DynamicRatePaymentStreams` (r:1 w:1) + /// Proof: `PaymentStreams::DynamicRatePaymentStreams` (`max_values`: None, `max_size`: Some(129), added: 2604, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::PrivilegedProviders` (r:1 w:0) + /// Proof: `PaymentStreams::PrivilegedProviders` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::LastChargeableInfo` (r:1 w:0) + /// Proof: `PaymentStreams::LastChargeableInfo` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:3 w:3) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Providers::TotalBspsCapacity` (r:1 w:0) + /// Proof: `Providers::TotalBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Providers::UsedBspsCapacity` (r:1 w:0) + /// Proof: `Providers::UsedBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Parameters::Parameters` (r:4 w:0) + /// Proof: `Parameters::Parameters` (`max_values`: None, `max_size`: Some(381), added: 2856, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::OnPollTicker` (r:1 w:0) + /// Proof: `PaymentStreams::OnPollTicker` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + fn update_fixed_rate_payment_stream() -> Weight { + // Proof Size summary in bytes: + // Measured: `1427` + // Estimated: `12414` + // Minimum execution time: 403_134_000 picoseconds. + Weight::from_parts(416_206_000, 12414) + .saturating_add(T::DbWeight::get().reads(21_u64)) + .saturating_add(T::DbWeight::get().writes(6_u64)) + } + /// Storage: `Providers::BackupStorageProviders` (r:1 w:0) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::FixedRatePaymentStreams` (r:1 w:1) + /// Proof: `PaymentStreams::FixedRatePaymentStreams` (`max_values`: None, `max_size`: Some(125), added: 2600, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:2 w:0) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `Providers::AwaitingTopUpFromProviders` (r:2 w:0) + /// Proof: `Providers::AwaitingTopUpFromProviders` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::DynamicRatePaymentStreams` (r:1 w:0) + /// Proof: `PaymentStreams::DynamicRatePaymentStreams` (`max_values`: None, `max_size`: Some(129), added: 2604, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::PrivilegedProviders` (r:1 w:0) + /// Proof: `PaymentStreams::PrivilegedProviders` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::LastChargeableInfo` (r:1 w:0) + /// Proof: `PaymentStreams::LastChargeableInfo` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::UsersWithoutFunds` (r:1 w:0) + /// Proof: `PaymentStreams::UsersWithoutFunds` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:3 w:3) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Providers::TotalBspsCapacity` (r:1 w:0) + /// Proof: `Providers::TotalBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Providers::UsedBspsCapacity` (r:1 w:0) + /// Proof: `Providers::UsedBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Parameters::Parameters` (r:4 w:0) + /// Proof: `Parameters::Parameters` (`max_values`: None, `max_size`: Some(381), added: 2856, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::OnPollTicker` (r:1 w:0) + /// Proof: `PaymentStreams::OnPollTicker` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::RegisteredUsers` (r:1 w:1) + /// Proof: `PaymentStreams::RegisteredUsers` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + fn delete_fixed_rate_payment_stream() -> Weight { + // Proof Size summary in bytes: + // Measured: `1304` + // Estimated: `12414` + // Minimum execution time: 295_969_000 picoseconds. + Weight::from_parts(300_145_000, 12414) + .saturating_add(T::DbWeight::get().reads(22_u64)) + .saturating_add(T::DbWeight::get().writes(6_u64)) + } + /// Storage: `Providers::BackupStorageProviders` (r:1 w:0) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:2 w:0) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `Providers::AwaitingTopUpFromProviders` (r:2 w:0) + /// Proof: `Providers::AwaitingTopUpFromProviders` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::DynamicRatePaymentStreams` (r:1 w:1) + /// Proof: `PaymentStreams::DynamicRatePaymentStreams` (`max_values`: None, `max_size`: Some(129), added: 2604, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::UsersWithoutFunds` (r:1 w:0) + /// Proof: `PaymentStreams::UsersWithoutFunds` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::CurrentPricePerGigaUnitPerTick` (r:1 w:0) + /// Proof: `PaymentStreams::CurrentPricePerGigaUnitPerTick` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::RegisteredUsers` (r:1 w:1) + /// Proof: `PaymentStreams::RegisteredUsers` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::AccumulatedPriceIndex` (r:1 w:0) + /// Proof: `PaymentStreams::AccumulatedPriceIndex` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + fn create_dynamic_rate_payment_stream() -> Weight { + // Proof Size summary in bytes: + // Measured: `525` + // Estimated: `6054` + // Minimum execution time: 110_904_000 picoseconds. + Weight::from_parts(113_365_000, 6054) + .saturating_add(T::DbWeight::get().reads(12_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) + } + /// Storage: `Providers::BackupStorageProviders` (r:1 w:0) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::DynamicRatePaymentStreams` (r:1 w:1) + /// Proof: `PaymentStreams::DynamicRatePaymentStreams` (`max_values`: None, `max_size`: Some(129), added: 2604, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::UsersWithoutFunds` (r:1 w:0) + /// Proof: `PaymentStreams::UsersWithoutFunds` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:2 w:0) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `Providers::AwaitingTopUpFromProviders` (r:2 w:0) + /// Proof: `Providers::AwaitingTopUpFromProviders` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::FixedRatePaymentStreams` (r:1 w:1) + /// Proof: `PaymentStreams::FixedRatePaymentStreams` (`max_values`: None, `max_size`: Some(125), added: 2600, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::PrivilegedProviders` (r:1 w:0) + /// Proof: `PaymentStreams::PrivilegedProviders` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::LastChargeableInfo` (r:1 w:0) + /// Proof: `PaymentStreams::LastChargeableInfo` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:3 w:3) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Providers::TotalBspsCapacity` (r:1 w:0) + /// Proof: `Providers::TotalBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Providers::UsedBspsCapacity` (r:1 w:0) + /// Proof: `Providers::UsedBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Parameters::Parameters` (r:4 w:0) + /// Proof: `Parameters::Parameters` (`max_values`: None, `max_size`: Some(381), added: 2856, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::OnPollTicker` (r:1 w:0) + /// Proof: `PaymentStreams::OnPollTicker` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::CurrentPricePerGigaUnitPerTick` (r:1 w:0) + /// Proof: `PaymentStreams::CurrentPricePerGigaUnitPerTick` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + fn update_dynamic_rate_payment_stream() -> Weight { + // Proof Size summary in bytes: + // Measured: `1387` + // Estimated: `12414` + // Minimum execution time: 351_490_000 picoseconds. + Weight::from_parts(354_309_000, 12414) + .saturating_add(T::DbWeight::get().reads(21_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } + /// Storage: `Providers::BackupStorageProviders` (r:1 w:0) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::DynamicRatePaymentStreams` (r:1 w:1) + /// Proof: `PaymentStreams::DynamicRatePaymentStreams` (`max_values`: None, `max_size`: Some(129), added: 2604, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:2 w:0) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `Providers::AwaitingTopUpFromProviders` (r:2 w:0) + /// Proof: `Providers::AwaitingTopUpFromProviders` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::FixedRatePaymentStreams` (r:1 w:1) + /// Proof: `PaymentStreams::FixedRatePaymentStreams` (`max_values`: None, `max_size`: Some(125), added: 2600, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::PrivilegedProviders` (r:1 w:0) + /// Proof: `PaymentStreams::PrivilegedProviders` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::LastChargeableInfo` (r:1 w:0) + /// Proof: `PaymentStreams::LastChargeableInfo` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::UsersWithoutFunds` (r:1 w:0) + /// Proof: `PaymentStreams::UsersWithoutFunds` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:3 w:3) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Providers::TotalBspsCapacity` (r:1 w:0) + /// Proof: `Providers::TotalBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Providers::UsedBspsCapacity` (r:1 w:0) + /// Proof: `Providers::UsedBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Parameters::Parameters` (r:4 w:0) + /// Proof: `Parameters::Parameters` (`max_values`: None, `max_size`: Some(381), added: 2856, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::OnPollTicker` (r:1 w:0) + /// Proof: `PaymentStreams::OnPollTicker` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::RegisteredUsers` (r:1 w:1) + /// Proof: `PaymentStreams::RegisteredUsers` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + fn delete_dynamic_rate_payment_stream() -> Weight { + // Proof Size summary in bytes: + // Measured: `1455` + // Estimated: `12414` + // Minimum execution time: 399_760_000 picoseconds. + Weight::from_parts(410_315_000, 12414) + .saturating_add(T::DbWeight::get().reads(22_u64)) + .saturating_add(T::DbWeight::get().writes(7_u64)) + } + /// Storage: `Providers::AccountIdToBackupStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToBackupStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:2 w:0) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `Providers::AwaitingTopUpFromProviders` (r:2 w:0) + /// Proof: `Providers::AwaitingTopUpFromProviders` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Providers::BackupStorageProviders` (r:1 w:0) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::FixedRatePaymentStreams` (r:1 w:1) + /// Proof: `PaymentStreams::FixedRatePaymentStreams` (`max_values`: None, `max_size`: Some(125), added: 2600, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::DynamicRatePaymentStreams` (r:1 w:1) + /// Proof: `PaymentStreams::DynamicRatePaymentStreams` (`max_values`: None, `max_size`: Some(129), added: 2604, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::PrivilegedProviders` (r:1 w:0) + /// Proof: `PaymentStreams::PrivilegedProviders` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::LastChargeableInfo` (r:1 w:0) + /// Proof: `PaymentStreams::LastChargeableInfo` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::UsersWithoutFunds` (r:1 w:0) + /// Proof: `PaymentStreams::UsersWithoutFunds` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:3 w:3) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Providers::TotalBspsCapacity` (r:1 w:0) + /// Proof: `Providers::TotalBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Providers::UsedBspsCapacity` (r:1 w:0) + /// Proof: `Providers::UsedBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Parameters::Parameters` (r:4 w:0) + /// Proof: `Parameters::Parameters` (`max_values`: None, `max_size`: Some(381), added: 2856, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::OnPollTicker` (r:1 w:0) + /// Proof: `PaymentStreams::OnPollTicker` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + fn charge_payment_streams() -> Weight { + // Proof Size summary in bytes: + // Measured: `1441` + // Estimated: `12414` + // Minimum execution time: 335_054_000 picoseconds. + Weight::from_parts(339_893_000, 12414) + .saturating_add(T::DbWeight::get().reads(21_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } + /// Storage: `Providers::AccountIdToBackupStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToBackupStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::OnPollTicker` (r:1 w:0) + /// Proof: `PaymentStreams::OnPollTicker` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:2 w:0) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `Providers::AwaitingTopUpFromProviders` (r:2 w:0) + /// Proof: `Providers::AwaitingTopUpFromProviders` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Providers::BackupStorageProviders` (r:1 w:0) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::FixedRatePaymentStreams` (r:10 w:10) + /// Proof: `PaymentStreams::FixedRatePaymentStreams` (`max_values`: None, `max_size`: Some(125), added: 2600, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::DynamicRatePaymentStreams` (r:10 w:10) + /// Proof: `PaymentStreams::DynamicRatePaymentStreams` (`max_values`: None, `max_size`: Some(129), added: 2604, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::PrivilegedProviders` (r:1 w:0) + /// Proof: `PaymentStreams::PrivilegedProviders` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::LastChargeableInfo` (r:1 w:0) + /// Proof: `PaymentStreams::LastChargeableInfo` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::UsersWithoutFunds` (r:10 w:0) + /// Proof: `PaymentStreams::UsersWithoutFunds` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:12 w:12) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Providers::TotalBspsCapacity` (r:1 w:0) + /// Proof: `Providers::TotalBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Providers::UsedBspsCapacity` (r:1 w:0) + /// Proof: `Providers::UsedBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Parameters::Parameters` (r:4 w:0) + /// Proof: `Parameters::Parameters` (`max_values`: None, `max_size`: Some(381), added: 2856, mode: `MaxEncodedLen`) + /// The range of component `n` is `[0, 10]`. + fn charge_multiple_users_payment_streams(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `1122 + n * (331 ±0)` + // Estimated: `12414 + n * (2604 ±0)` + // Minimum execution time: 20_587_000 picoseconds. + Weight::from_parts(44_190_125, 12414) + // Standard Error: 170_219 + .saturating_add(Weight::from_parts(294_748_615, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(12_u64)) + .saturating_add(T::DbWeight::get().reads((5_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes(1_u64)) + .saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 2604).saturating_mul(n.into())) + } + /// Storage: `PaymentStreams::UsersWithoutFunds` (r:1 w:0) + /// Proof: `PaymentStreams::UsersWithoutFunds` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1001 w:1001) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Providers::TotalBspsCapacity` (r:1 w:0) + /// Proof: `Providers::TotalBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Providers::UsedBspsCapacity` (r:1 w:0) + /// Proof: `Providers::UsedBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::FixedRatePaymentStreams` (r:999 w:999) + /// Proof: `PaymentStreams::FixedRatePaymentStreams` (`max_values`: None, `max_size`: Some(125), added: 2600, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::DynamicRatePaymentStreams` (r:999 w:999) + /// Proof: `PaymentStreams::DynamicRatePaymentStreams` (`max_values`: None, `max_size`: Some(129), added: 2604, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::PrivilegedProviders` (r:999 w:0) + /// Proof: `PaymentStreams::PrivilegedProviders` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::LastChargeableInfo` (r:999 w:0) + /// Proof: `PaymentStreams::LastChargeableInfo` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Parameters::Parameters` (r:4 w:0) + /// Proof: `Parameters::Parameters` (`max_values`: None, `max_size`: Some(381), added: 2856, mode: `MaxEncodedLen`) + /// Storage: `Providers::BackupStorageProviders` (r:999 w:0) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::RegisteredUsers` (r:1 w:1) + /// Proof: `PaymentStreams::RegisteredUsers` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 1000]`. + fn pay_outstanding_debt(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `1422 + n * (644 ±0)` + // Estimated: `12414 + n * (3634 ±0)` + // Minimum execution time: 376_066_000 picoseconds. + Weight::from_parts(378_172_000, 12414) + // Standard Error: 147_940 + .saturating_add(Weight::from_parts(283_749_757, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(11_u64)) + .saturating_add(T::DbWeight::get().reads((6_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes(4_u64)) + .saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 3634).saturating_mul(n.into())) + } + /// Storage: `PaymentStreams::UsersWithoutFunds` (r:1 w:1) + /// Proof: `PaymentStreams::UsersWithoutFunds` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::OnPollTicker` (r:1 w:0) + /// Proof: `PaymentStreams::OnPollTicker` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::RegisteredUsers` (r:1 w:0) + /// Proof: `PaymentStreams::RegisteredUsers` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + fn clear_insolvent_flag() -> Weight { + // Proof Size summary in bytes: + // Measured: `231` + // Estimated: `3505` + // Minimum execution time: 22_472_000 picoseconds. + Weight::from_parts(23_180_000, 3505) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `PaymentStreams::CurrentPricePerGigaUnitPerTick` (r:1 w:0) + /// Proof: `PaymentStreams::CurrentPricePerGigaUnitPerTick` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::AccumulatedPriceIndex` (r:1 w:1) + /// Proof: `PaymentStreams::AccumulatedPriceIndex` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + fn price_index_update() -> Weight { + // Proof Size summary in bytes: + // Measured: `116` + // Estimated: `1501` + // Minimum execution time: 5_847_000 picoseconds. + Weight::from_parts(6_187_000, 1501) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `PaymentStreams::OnPollTicker` (r:1 w:1) + /// Proof: `PaymentStreams::OnPollTicker` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + fn tick_update() -> Weight { + // Proof Size summary in bytes: + // Measured: `114` + // Estimated: `1489` + // Minimum execution time: 3_884_000 picoseconds. + Weight::from_parts(4_063_000, 1489) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `ProofsDealer::ChallengesTicker` (r:1 w:0) + /// Proof: `ProofsDealer::ChallengesTicker` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::LastSubmittersTickRegistered` (r:1 w:1) + /// Proof: `PaymentStreams::LastSubmittersTickRegistered` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::ValidProofSubmittersLastTicks` (r:1 w:0) + /// Proof: `ProofsDealer::ValidProofSubmittersLastTicks` (`max_values`: None, `max_size`: Some(7830), added: 10305, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::AccumulatedPriceIndex` (r:1 w:0) + /// Proof: `PaymentStreams::AccumulatedPriceIndex` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::LastChargeableInfo` (r:244 w:244) + /// Proof: `PaymentStreams::LastChargeableInfo` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// The range of component `n` is `[0, 244]`. + fn update_providers_last_chargeable_info(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `270 + n * (32 ±0)` + // Estimated: `11295 + n * (2543 ±0)` + // Minimum execution time: 12_468_000 picoseconds. + Weight::from_parts(9_805_506, 11295) + // Standard Error: 5_017 + .saturating_add(Weight::from_parts(6_952_512, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes(1_u64)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 2543).saturating_mul(n.into())) + } +} diff --git a/operator/runtime/mainnet/src/weights/pallet_proofs_dealer.rs b/operator/runtime/mainnet/src/weights/pallet_proofs_dealer.rs new file mode 100644 index 00000000..1d9541c8 --- /dev/null +++ b/operator/runtime/mainnet/src/weights/pallet_proofs_dealer.rs @@ -0,0 +1,326 @@ +// Copyright 2025 DataHaven +// This file is part of DataHaven. + +// DataHaven is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// DataHaven is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with DataHaven. If not, see . + + +//! Autogenerated weights for `pallet_proofs_dealer` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 51.0.0 +//! DATE: 2026-01-29, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ip-10-0-0-176`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` +//! WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --runtime +// target/production/wbuild/datahaven-mainnet-runtime/datahaven_mainnet_runtime.compact.compressed.wasm +// --pallet +// pallet_proofs_dealer +// --extrinsic +// +// --header +// ../file_header.txt +// --template +// benchmarking/frame-weight-template.hbs +// --output +// runtime/mainnet/src/weights/pallet_proofs_dealer.rs +// --steps +// 50 +// --repeat +// 20 + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use sp_std::marker::PhantomData; + +/// Weights for `pallet_proofs_dealer`. +pub struct WeightInfo(PhantomData); +impl pallet_proofs_dealer::weights::WeightInfo for WeightInfo { + /// Storage: `ProofsDealer::ChallengesQueue` (r:1 w:1) + /// Proof: `ProofsDealer::ChallengesQueue` (`max_values`: Some(1), `max_size`: Some(3202), added: 3697, mode: `MaxEncodedLen`) + fn challenge() -> Weight { + // Proof Size summary in bytes: + // Measured: `41` + // Estimated: `4687` + // Minimum execution time: 11_710_000 picoseconds. + Weight::from_parts(12_273_000, 4687) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Providers::AccountIdToBackupStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToBackupStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::BackupStorageProviders` (r:1 w:1) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::ProviderToProofSubmissionRecord` (r:1 w:1) + /// Proof: `ProofsDealer::ProviderToProofSubmissionRecord` (`max_values`: None, `max_size`: Some(56), added: 2531, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:2 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::ChallengesTicker` (r:1 w:0) + /// Proof: `ProofsDealer::ChallengesTicker` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::TickToChallengesSeed` (r:1 w:0) + /// Proof: `ProofsDealer::TickToChallengesSeed` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::LastCheckpointTick` (r:1 w:0) + /// Proof: `ProofsDealer::LastCheckpointTick` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::TickToCheckpointChallenges` (r:1 w:0) + /// Proof: `ProofsDealer::TickToCheckpointChallenges` (`max_values`: None, `max_size`: Some(681), added: 3156, mode: `MaxEncodedLen`) + /// Storage: `Providers::MainStorageProviders` (r:1 w:0) + /// Proof: `Providers::MainStorageProviders` (`max_values`: None, `max_size`: Some(1143), added: 3618, mode: `MaxEncodedLen`) + /// Storage: `Providers::UsedBspsCapacity` (r:1 w:1) + /// Proof: `Providers::UsedBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::UsersWithoutFunds` (r:1 w:0) + /// Proof: `PaymentStreams::UsersWithoutFunds` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::DynamicRatePaymentStreams` (r:1 w:1) + /// Proof: `PaymentStreams::DynamicRatePaymentStreams` (`max_values`: None, `max_size`: Some(129), added: 2604, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:2 w:0) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `Providers::AwaitingTopUpFromProviders` (r:2 w:0) + /// Proof: `Providers::AwaitingTopUpFromProviders` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::FixedRatePaymentStreams` (r:1 w:0) + /// Proof: `PaymentStreams::FixedRatePaymentStreams` (`max_values`: None, `max_size`: Some(125), added: 2600, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::PrivilegedProviders` (r:1 w:0) + /// Proof: `PaymentStreams::PrivilegedProviders` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::LastChargeableInfo` (r:1 w:0) + /// Proof: `PaymentStreams::LastChargeableInfo` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:2 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Providers::TotalBspsCapacity` (r:1 w:0) + /// Proof: `Providers::TotalBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Parameters::Parameters` (r:5 w:0) + /// Proof: `Parameters::Parameters` (`max_values`: None, `max_size`: Some(381), added: 2856, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::CurrentPricePerGigaUnitPerTick` (r:1 w:0) + /// Proof: `PaymentStreams::CurrentPricePerGigaUnitPerTick` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::ValidProofSubmittersLastTicks` (r:1 w:1) + /// Proof: `ProofsDealer::ValidProofSubmittersLastTicks` (`max_values`: None, `max_size`: Some(7830), added: 10305, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::TickToProvidersDeadlines` (r:0 w:2) + /// Proof: `ProofsDealer::TickToProvidersDeadlines` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 20]`. + fn submit_proof_no_checkpoint_challenges_key_proofs(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `2070` + // Estimated: `15270` + // Minimum execution time: 2_180_337_000 picoseconds. + Weight::from_parts(2_068_089_120, 15270) + // Standard Error: 256_975 + .saturating_add(Weight::from_parts(139_273_283, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(30_u64)) + .saturating_add(T::DbWeight::get().writes(9_u64)) + } + /// Storage: `Providers::AccountIdToBackupStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToBackupStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::BackupStorageProviders` (r:1 w:0) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::ProviderToProofSubmissionRecord` (r:1 w:1) + /// Proof: `ProofsDealer::ProviderToProofSubmissionRecord` (`max_values`: None, `max_size`: Some(56), added: 2531, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:0) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::ChallengesTicker` (r:1 w:0) + /// Proof: `ProofsDealer::ChallengesTicker` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::TickToChallengesSeed` (r:1 w:0) + /// Proof: `ProofsDealer::TickToChallengesSeed` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::LastCheckpointTick` (r:1 w:0) + /// Proof: `ProofsDealer::LastCheckpointTick` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::TickToCheckpointChallenges` (r:1 w:0) + /// Proof: `ProofsDealer::TickToCheckpointChallenges` (`max_values`: None, `max_size`: Some(681), added: 3156, mode: `MaxEncodedLen`) + /// Storage: `Parameters::Parameters` (r:1 w:0) + /// Proof: `Parameters::Parameters` (`max_values`: None, `max_size`: Some(381), added: 2856, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::ValidProofSubmittersLastTicks` (r:1 w:1) + /// Proof: `ProofsDealer::ValidProofSubmittersLastTicks` (`max_values`: None, `max_size`: Some(7830), added: 10305, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::TickToProvidersDeadlines` (r:0 w:2) + /// Proof: `ProofsDealer::TickToProvidersDeadlines` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::MainStorageProviders` (r:1 w:0) + /// Proof: `Providers::MainStorageProviders` (`max_values`: None, `max_size`: Some(1143), added: 3618, mode: `MaxEncodedLen`) + /// Storage: `Providers::UsedBspsCapacity` (r:1 w:1) + /// Proof: `Providers::UsedBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::UsersWithoutFunds` (r:1 w:0) + /// Proof: `PaymentStreams::UsersWithoutFunds` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::DynamicRatePaymentStreams` (r:1 w:1) + /// Proof: `PaymentStreams::DynamicRatePaymentStreams` (`max_values`: None, `max_size`: Some(129), added: 2604, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:2 w:0) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `Providers::AwaitingTopUpFromProviders` (r:2 w:0) + /// Proof: `Providers::AwaitingTopUpFromProviders` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::FixedRatePaymentStreams` (r:1 w:0) + /// Proof: `PaymentStreams::FixedRatePaymentStreams` (`max_values`: None, `max_size`: Some(125), added: 2600, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::PrivilegedProviders` (r:1 w:0) + /// Proof: `PaymentStreams::PrivilegedProviders` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::LastChargeableInfo` (r:1 w:0) + /// Proof: `PaymentStreams::LastChargeableInfo` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:2 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Providers::TotalBspsCapacity` (r:1 w:0) + /// Proof: `Providers::TotalBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::CurrentPricePerGigaUnitPerTick` (r:1 w:0) + /// Proof: `PaymentStreams::CurrentPricePerGigaUnitPerTick` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// The range of component `n` is `[21, 40]`. + fn submit_proof_with_checkpoint_challenges_key_proofs(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `2070` + // Estimated: `20676` + // Minimum execution time: 4_705_521_000 picoseconds. + Weight::from_parts(4_096_774_230, 20676) + // Standard Error: 968_637 + .saturating_add(Weight::from_parts(38_494_397, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(39_u64)) + .saturating_add(T::DbWeight::get().writes(11_u64)) + } + /// Storage: `ProofsDealer::ChallengesTicker` (r:1 w:1) + /// Proof: `ProofsDealer::ChallengesTicker` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Randomness::LatestParentBlockRandomness` (r:1 w:0) + /// Proof: `Randomness::LatestParentBlockRandomness` (`max_values`: Some(1), `max_size`: Some(36), added: 531, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::LastCheckpointTick` (r:1 w:0) + /// Proof: `ProofsDealer::LastCheckpointTick` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::TickToCheckpointChallenges` (r:1 w:0) + /// Proof: `ProofsDealer::TickToCheckpointChallenges` (`max_values`: None, `max_size`: Some(681), added: 3156, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::TickToCheckForSlashableProviders` (r:1 w:1) + /// Proof: `ProofsDealer::TickToCheckForSlashableProviders` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::TickToProvidersDeadlines` (r:1001 w:2000) + /// Proof: `ProofsDealer::TickToProvidersDeadlines` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::ProviderToProofSubmissionRecord` (r:1000 w:1000) + /// Proof: `ProofsDealer::ProviderToProofSubmissionRecord` (`max_values`: None, `max_size`: Some(56), added: 2531, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::SlashableProviders` (r:1000 w:1000) + /// Proof: `ProofsDealer::SlashableProviders` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + /// Storage: `Providers::BackupStorageProviders` (r:1000 w:0) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1000 w:0) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `Parameters::Parameters` (r:1 w:0) + /// Proof: `Parameters::Parameters` (`max_values`: None, `max_size`: Some(381), added: 2856, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::TickToChallengesSeed` (r:0 w:1) + /// Proof: `ProofsDealer::TickToChallengesSeed` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + /// The range of component `n` is `[0, 1000]`. + fn new_challenges_round(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `1155 + n * (271 ±0)` + // Estimated: `6172 + n * (3634 ±0)` + // Minimum execution time: 29_450_000 picoseconds. + Weight::from_parts(30_176_000, 6172) + // Standard Error: 45_927 + .saturating_add(Weight::from_parts(40_350_233, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().reads((5_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(T::DbWeight::get().writes((4_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 3634).saturating_mul(n.into())) + } + /// Storage: `ProofsDealer::PriorityChallengesQueue` (r:1 w:1) + /// Proof: `ProofsDealer::PriorityChallengesQueue` (`max_values`: Some(1), `max_size`: Some(3302), added: 3797, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::ChallengesQueue` (r:1 w:1) + /// Proof: `ProofsDealer::ChallengesQueue` (`max_values`: Some(1), `max_size`: Some(3202), added: 3697, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::LastCheckpointTick` (r:1 w:1) + /// Proof: `ProofsDealer::LastCheckpointTick` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::TickToCheckpointChallenges` (r:0 w:2) + /// Proof: `ProofsDealer::TickToCheckpointChallenges` (`max_values`: None, `max_size`: Some(681), added: 3156, mode: `MaxEncodedLen`) + /// The range of component `n` is `[0, 20]`. + fn new_checkpoint_challenge_round(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `65 + n * (32 ±0)` + // Estimated: `4787` + // Minimum execution time: 14_001_000 picoseconds. + Weight::from_parts(15_995_280, 4787) + // Standard Error: 3_445 + .saturating_add(Weight::from_parts(449_577, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } + /// Storage: `ProofsDealer::PastBlocksStatus` (r:1 w:1) + /// Proof: `ProofsDealer::PastBlocksStatus` (`max_values`: Some(1), `max_size`: Some(51), added: 546, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::PastBlocksWeight` (r:1 w:0) + /// Proof: `ProofsDealer::PastBlocksWeight` (`max_values`: None, `max_size`: Some(36), added: 2511, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::ChallengesTicker` (r:1 w:0) + /// Proof: `ProofsDealer::ChallengesTicker` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::ChallengesTickerPaused` (r:0 w:1) + /// Proof: `ProofsDealer::ChallengesTickerPaused` (`max_values`: Some(1), `max_size`: Some(0), added: 495, mode: `MaxEncodedLen`) + fn check_spamming_condition() -> Weight { + // Proof Size summary in bytes: + // Measured: `248` + // Estimated: `3501` + // Minimum execution time: 14_141_000 picoseconds. + Weight::from_parts(14_450_000, 3501) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: `ProofsDealer::LastDeletedTick` (r:1 w:0) + /// Proof: `ProofsDealer::LastDeletedTick` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::ChallengesTicker` (r:1 w:0) + /// Proof: `ProofsDealer::ChallengesTicker` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + fn trim_valid_proof_submitters_last_ticks_constant_execution() -> Weight { + // Proof Size summary in bytes: + // Measured: `41` + // Estimated: `1489` + // Minimum execution time: 4_433_000 picoseconds. + Weight::from_parts(4_657_000, 1489) + .saturating_add(T::DbWeight::get().reads(2_u64)) + } + /// Storage: `ProofsDealer::LastDeletedTick` (r:0 w:1) + /// Proof: `ProofsDealer::LastDeletedTick` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::ValidProofSubmittersLastTicks` (r:0 w:1) + /// Proof: `ProofsDealer::ValidProofSubmittersLastTicks` (`max_values`: None, `max_size`: Some(7830), added: 10305, mode: `MaxEncodedLen`) + fn trim_valid_proof_submitters_last_ticks_loop() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 2_533_000 picoseconds. + Weight::from_parts(2_701_000, 0) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: `ProofsDealer::PastBlocksWeight` (r:0 w:2) + /// Proof: `ProofsDealer::PastBlocksWeight` (`max_values`: None, `max_size`: Some(36), added: 2511, mode: `MaxEncodedLen`) + fn on_finalize() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 4_812_000 picoseconds. + Weight::from_parts(5_079_000, 0) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: `Providers::BackupStorageProviders` (r:1 w:0) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:0) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::ProviderToProofSubmissionRecord` (r:1 w:1) + /// Proof: `ProofsDealer::ProviderToProofSubmissionRecord` (`max_values`: None, `max_size`: Some(56), added: 2531, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::ChallengesTicker` (r:1 w:0) + /// Proof: `ProofsDealer::ChallengesTicker` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Parameters::Parameters` (r:1 w:0) + /// Proof: `Parameters::Parameters` (`max_values`: None, `max_size`: Some(381), added: 2856, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::TickToProvidersDeadlines` (r:0 w:1) + /// Proof: `ProofsDealer::TickToProvidersDeadlines` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + fn force_initialise_challenge_cycle() -> Weight { + // Proof Size summary in bytes: + // Measured: `552` + // Estimated: `4624` + // Minimum execution time: 44_569_000 picoseconds. + Weight::from_parts(46_326_000, 4624) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: `ProofsDealer::ChallengesTickerPaused` (r:0 w:1) + /// Proof: `ProofsDealer::ChallengesTickerPaused` (`max_values`: Some(1), `max_size`: Some(0), added: 495, mode: `MaxEncodedLen`) + fn set_paused() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 7_440_000 picoseconds. + Weight::from_parts(7_760_000, 0) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } +} diff --git a/operator/runtime/mainnet/src/weights/pallet_session.rs b/operator/runtime/mainnet/src/weights/pallet_session.rs new file mode 100644 index 00000000..19df1fa9 --- /dev/null +++ b/operator/runtime/mainnet/src/weights/pallet_session.rs @@ -0,0 +1,84 @@ +// Copyright 2025 DataHaven +// This file is part of DataHaven. + +// DataHaven is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// DataHaven is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with DataHaven. If not, see . + + +//! Autogenerated weights for `pallet_session` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 51.0.0 +//! DATE: 2026-01-29, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ip-10-0-0-176`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` +//! WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --runtime +// target/production/wbuild/datahaven-mainnet-runtime/datahaven_mainnet_runtime.compact.compressed.wasm +// --pallet +// pallet_session +// --extrinsic +// +// --header +// ../file_header.txt +// --template +// benchmarking/frame-weight-template.hbs +// --output +// runtime/mainnet/src/weights/pallet_session.rs +// --steps +// 50 +// --repeat +// 20 + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use sp_std::marker::PhantomData; + +/// Weights for `pallet_session`. +pub struct WeightInfo(PhantomData); +impl pallet_session::WeightInfo for WeightInfo { + /// Storage: `Session::NextKeys` (r:1 w:1) + /// Proof: `Session::NextKeys` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Session::KeyOwner` (r:4 w:4) + /// Proof: `Session::KeyOwner` (`max_values`: None, `max_size`: None, mode: `Measured`) + fn set_keys() -> Weight { + // Proof Size summary in bytes: + // Measured: `350` + // Estimated: `11240` + // Minimum execution time: 36_482_000 picoseconds. + Weight::from_parts(37_467_000, 11240) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } + /// Storage: `Session::NextKeys` (r:1 w:1) + /// Proof: `Session::NextKeys` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Session::KeyOwner` (r:0 w:4) + /// Proof: `Session::KeyOwner` (`max_values`: None, `max_size`: None, mode: `Measured`) + fn purge_keys() -> Weight { + // Proof Size summary in bytes: + // Measured: `328` + // Estimated: `3793` + // Minimum execution time: 21_767_000 picoseconds. + Weight::from_parts(22_530_000, 3793) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } +} diff --git a/operator/runtime/mainnet/src/weights/pallet_storage_providers.rs b/operator/runtime/mainnet/src/weights/pallet_storage_providers.rs new file mode 100644 index 00000000..7ec61ac9 --- /dev/null +++ b/operator/runtime/mainnet/src/weights/pallet_storage_providers.rs @@ -0,0 +1,630 @@ +// Copyright 2025 DataHaven +// This file is part of DataHaven. + +// DataHaven is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// DataHaven is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with DataHaven. If not, see . + + +//! Autogenerated weights for `pallet_storage_providers` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 51.0.0 +//! DATE: 2026-01-29, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ip-10-0-0-176`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` +//! WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --runtime +// target/production/wbuild/datahaven-mainnet-runtime/datahaven_mainnet_runtime.compact.compressed.wasm +// --pallet +// pallet_storage_providers +// --extrinsic +// +// --header +// ../file_header.txt +// --template +// benchmarking/frame-weight-template.hbs +// --output +// runtime/mainnet/src/weights/pallet_storage_providers.rs +// --steps +// 50 +// --repeat +// 20 + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use sp_std::marker::PhantomData; + +/// Weights for `pallet_storage_providers`. +pub struct WeightInfo(PhantomData); +impl pallet_storage_providers::weights::WeightInfo for WeightInfo { + /// Storage: `Providers::SignUpRequests` (r:1 w:1) + /// Proof: `Providers::SignUpRequests` (`max_values`: None, `max_size`: Some(2163), added: 4638, mode: `MaxEncodedLen`) + /// Storage: `Providers::AccountIdToMainStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToMainStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::AccountIdToBackupStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToBackupStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + fn request_msp_sign_up() -> Weight { + // Proof Size summary in bytes: + // Measured: `270` + // Estimated: `5628` + // Minimum execution time: 87_582_000 picoseconds. + Weight::from_parts(89_898_000, 5628) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: `Providers::SignUpRequests` (r:1 w:1) + /// Proof: `Providers::SignUpRequests` (`max_values`: None, `max_size`: Some(2163), added: 4638, mode: `MaxEncodedLen`) + /// Storage: `Providers::AccountIdToMainStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToMainStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::AccountIdToBackupStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToBackupStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + fn request_bsp_sign_up() -> Weight { + // Proof Size summary in bytes: + // Measured: `270` + // Estimated: `5628` + // Minimum execution time: 88_155_000 picoseconds. + Weight::from_parts(90_220_000, 5628) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: `Providers::SignUpRequests` (r:1 w:1) + /// Proof: `Providers::SignUpRequests` (`max_values`: None, `max_size`: Some(2163), added: 4638, mode: `MaxEncodedLen`) + /// Storage: `Randomness::LatestOneEpochAgoRandomness` (r:1 w:0) + /// Proof: `Randomness::LatestOneEpochAgoRandomness` (`max_values`: Some(1), `max_size`: Some(36), added: 531, mode: `MaxEncodedLen`) + /// Storage: `Providers::TotalBspsCapacity` (r:1 w:1) + /// Proof: `Providers::TotalBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Providers::BspCount` (r:1 w:1) + /// Proof: `Providers::BspCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Providers::GlobalBspsReputationWeight` (r:1 w:1) + /// Proof: `Providers::GlobalBspsReputationWeight` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Providers::AccountIdToBackupStorageProviderId` (r:0 w:1) + /// Proof: `Providers::AccountIdToBackupStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::BackupStorageProviders` (r:0 w:1) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + fn confirm_sign_up_bsp() -> Weight { + // Proof Size summary in bytes: + // Measured: `474` + // Estimated: `5628` + // Minimum execution time: 38_210_000 picoseconds. + Weight::from_parts(39_338_000, 5628) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(6_u64)) + } + /// Storage: `Providers::SignUpRequests` (r:1 w:1) + /// Proof: `Providers::SignUpRequests` (`max_values`: None, `max_size`: Some(2163), added: 4638, mode: `MaxEncodedLen`) + /// Storage: `Randomness::LatestOneEpochAgoRandomness` (r:1 w:0) + /// Proof: `Randomness::LatestOneEpochAgoRandomness` (`max_values`: Some(1), `max_size`: Some(36), added: 531, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:1 w:0) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `Providers::MainStorageProviderIdsToValuePropositions` (r:1 w:1) + /// Proof: `Providers::MainStorageProviderIdsToValuePropositions` (`max_values`: None, `max_size`: Some(1123), added: 3598, mode: `MaxEncodedLen`) + /// Storage: `Providers::MspCount` (r:1 w:1) + /// Proof: `Providers::MspCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Providers::AccountIdToMainStorageProviderId` (r:0 w:1) + /// Proof: `Providers::AccountIdToMainStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::MainStorageProviders` (r:0 w:1) + /// Proof: `Providers::MainStorageProviders` (`max_values`: None, `max_size`: Some(1143), added: 3618, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::PrivilegedProviders` (r:0 w:1) + /// Proof: `PaymentStreams::PrivilegedProviders` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + fn confirm_sign_up_msp() -> Weight { + // Proof Size summary in bytes: + // Measured: `487` + // Estimated: `5628` + // Minimum execution time: 54_698_000 picoseconds. + Weight::from_parts(55_937_000, 5628) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(6_u64)) + } + /// Storage: `Providers::SignUpRequests` (r:1 w:1) + /// Proof: `Providers::SignUpRequests` (`max_values`: None, `max_size`: Some(2163), added: 4638, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + fn cancel_sign_up() -> Weight { + // Proof Size summary in bytes: + // Measured: `507` + // Estimated: `5628` + // Minimum execution time: 65_127_000 picoseconds. + Weight::from_parts(65_875_000, 5628) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: `Providers::AccountIdToMainStorageProviderId` (r:1 w:1) + /// Proof: `Providers::AccountIdToMainStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::MainStorageProviders` (r:1 w:1) + /// Proof: `Providers::MainStorageProviders` (`max_values`: None, `max_size`: Some(1143), added: 3618, mode: `MaxEncodedLen`) + /// Storage: `Providers::MainStorageProviderIdsToValuePropositions` (r:102 w:101) + /// Proof: `Providers::MainStorageProviderIdsToValuePropositions` (`max_values`: None, `max_size`: Some(1123), added: 3598, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Providers::MspCount` (r:1 w:1) + /// Proof: `Providers::MspCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::PrivilegedProviders` (r:0 w:1) + /// Proof: `PaymentStreams::PrivilegedProviders` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// The range of component `n` is `[0, 100]`. + fn msp_sign_off(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `775 + n * (83 ±0)` + // Estimated: `8186 + n * (3598 ±0)` + // Minimum execution time: 91_582_000 picoseconds. + Weight::from_parts(91_148_393, 8186) + // Standard Error: 9_568 + .saturating_add(Weight::from_parts(6_388_975, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(7_u64)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes(7_u64)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 3598).saturating_mul(n.into())) + } + /// Storage: `Providers::AccountIdToBackupStorageProviderId` (r:1 w:1) + /// Proof: `Providers::AccountIdToBackupStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::BackupStorageProviders` (r:1 w:1) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::ProviderToProofSubmissionRecord` (r:1 w:0) + /// Proof: `ProofsDealer::ProviderToProofSubmissionRecord` (`max_values`: None, `max_size`: Some(56), added: 2531, mode: `MaxEncodedLen`) + /// Storage: `Providers::TotalBspsCapacity` (r:1 w:1) + /// Proof: `Providers::TotalBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Providers::BspCount` (r:1 w:1) + /// Proof: `Providers::BspCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Providers::GlobalBspsReputationWeight` (r:1 w:1) + /// Proof: `Providers::GlobalBspsReputationWeight` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + fn bsp_sign_off() -> Weight { + // Proof Size summary in bytes: + // Measured: `720` + // Estimated: `4624` + // Minimum execution time: 92_255_000 picoseconds. + Weight::from_parts(93_446_000, 4624) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().writes(7_u64)) + } + /// Storage: `Providers::AccountIdToMainStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToMainStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::AccountIdToBackupStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToBackupStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:1 w:0) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `Providers::BackupStorageProviders` (r:1 w:1) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Providers::TotalBspsCapacity` (r:1 w:1) + /// Proof: `Providers::TotalBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + fn change_capacity_bsp_less_deposit() -> Weight { + // Proof Size summary in bytes: + // Measured: `679` + // Estimated: `4624` + // Minimum execution time: 82_856_000 picoseconds. + Weight::from_parts(85_018_000, 4624) + .saturating_add(T::DbWeight::get().reads(7_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) + } + /// Storage: `Providers::AccountIdToMainStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToMainStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::AccountIdToBackupStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToBackupStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:1 w:0) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `Providers::BackupStorageProviders` (r:1 w:1) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Providers::TotalBspsCapacity` (r:1 w:1) + /// Proof: `Providers::TotalBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + fn change_capacity_bsp_more_deposit() -> Weight { + // Proof Size summary in bytes: + // Measured: `679` + // Estimated: `4624` + // Minimum execution time: 102_474_000 picoseconds. + Weight::from_parts(104_618_000, 4624) + .saturating_add(T::DbWeight::get().reads(7_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) + } + /// Storage: `Providers::AccountIdToMainStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToMainStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:1 w:0) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `Providers::MainStorageProviders` (r:1 w:1) + /// Proof: `Providers::MainStorageProviders` (`max_values`: None, `max_size`: Some(1143), added: 3618, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + fn change_capacity_msp_less_deposit() -> Weight { + // Proof Size summary in bytes: + // Measured: `649` + // Estimated: `4608` + // Minimum execution time: 78_146_000 picoseconds. + Weight::from_parts(80_013_000, 4608) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: `Providers::AccountIdToMainStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToMainStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:1 w:0) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `Providers::MainStorageProviders` (r:1 w:1) + /// Proof: `Providers::MainStorageProviders` (`max_values`: None, `max_size`: Some(1143), added: 3618, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + fn change_capacity_msp_more_deposit() -> Weight { + // Proof Size summary in bytes: + // Measured: `649` + // Estimated: `4608` + // Minimum execution time: 97_535_000 picoseconds. + Weight::from_parts(99_407_000, 4608) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: `Providers::AccountIdToMainStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToMainStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:1 w:0) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `Providers::MainStorageProviderIdsToValuePropositions` (r:1 w:1) + /// Proof: `Providers::MainStorageProviderIdsToValuePropositions` (`max_values`: None, `max_size`: Some(1123), added: 3598, mode: `MaxEncodedLen`) + /// Storage: `Providers::MainStorageProviders` (r:1 w:1) + /// Proof: `Providers::MainStorageProviders` (`max_values`: None, `max_size`: Some(1143), added: 3618, mode: `MaxEncodedLen`) + fn add_value_prop() -> Weight { + // Proof Size summary in bytes: + // Measured: `591` + // Estimated: `4608` + // Minimum execution time: 45_319_000 picoseconds. + Weight::from_parts(46_335_000, 4608) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: `Providers::AccountIdToMainStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToMainStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::MainStorageProviders` (r:1 w:0) + /// Proof: `Providers::MainStorageProviders` (`max_values`: None, `max_size`: Some(1143), added: 3618, mode: `MaxEncodedLen`) + /// Storage: `Providers::MainStorageProviderIdsToValuePropositions` (r:1 w:1) + /// Proof: `Providers::MainStorageProviderIdsToValuePropositions` (`max_values`: None, `max_size`: Some(1123), added: 3598, mode: `MaxEncodedLen`) + fn make_value_prop_unavailable() -> Weight { + // Proof Size summary in bytes: + // Measured: `631` + // Estimated: `4608` + // Minimum execution time: 32_867_000 picoseconds. + Weight::from_parts(33_943_000, 4608) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Providers::AccountIdToMainStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToMainStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::AccountIdToBackupStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToBackupStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:1 w:0) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `Providers::BackupStorageProviders` (r:1 w:1) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + fn add_multiaddress() -> Weight { + // Proof Size summary in bytes: + // Measured: `508` + // Estimated: `4624` + // Minimum execution time: 34_149_000 picoseconds. + Weight::from_parts(35_552_000, 4624) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Providers::AccountIdToMainStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToMainStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::AccountIdToBackupStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToBackupStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::BackupStorageProviders` (r:1 w:1) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + fn remove_multiaddress() -> Weight { + // Proof Size summary in bytes: + // Measured: `1316` + // Estimated: `4624` + // Minimum execution time: 32_650_000 picoseconds. + Weight::from_parts(33_556_000, 4624) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Providers::SignUpRequests` (r:1 w:1) + /// Proof: `Providers::SignUpRequests` (`max_values`: None, `max_size`: Some(2163), added: 4638, mode: `MaxEncodedLen`) + /// Storage: `Providers::AccountIdToMainStorageProviderId` (r:1 w:1) + /// Proof: `Providers::AccountIdToMainStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::AccountIdToBackupStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToBackupStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:1 w:0) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `Providers::MainStorageProviderIdsToValuePropositions` (r:1 w:1) + /// Proof: `Providers::MainStorageProviderIdsToValuePropositions` (`max_values`: None, `max_size`: Some(1123), added: 3598, mode: `MaxEncodedLen`) + /// Storage: `Providers::MspCount` (r:1 w:1) + /// Proof: `Providers::MspCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Providers::MainStorageProviders` (r:0 w:1) + /// Proof: `Providers::MainStorageProviders` (`max_values`: None, `max_size`: Some(1143), added: 3618, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::PrivilegedProviders` (r:0 w:1) + /// Proof: `PaymentStreams::PrivilegedProviders` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + fn force_msp_sign_up() -> Weight { + // Proof Size summary in bytes: + // Measured: `270` + // Estimated: `5628` + // Minimum execution time: 126_083_000 picoseconds. + Weight::from_parts(127_714_000, 5628) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().writes(8_u64)) + } + /// Storage: `Providers::SignUpRequests` (r:1 w:1) + /// Proof: `Providers::SignUpRequests` (`max_values`: None, `max_size`: Some(2163), added: 4638, mode: `MaxEncodedLen`) + /// Storage: `Providers::AccountIdToMainStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToMainStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::AccountIdToBackupStorageProviderId` (r:1 w:1) + /// Proof: `Providers::AccountIdToBackupStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `Providers::TotalBspsCapacity` (r:1 w:1) + /// Proof: `Providers::TotalBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Providers::BspCount` (r:1 w:1) + /// Proof: `Providers::BspCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Providers::GlobalBspsReputationWeight` (r:1 w:1) + /// Proof: `Providers::GlobalBspsReputationWeight` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Providers::BackupStorageProviders` (r:0 w:1) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + fn force_bsp_sign_up() -> Weight { + // Proof Size summary in bytes: + // Measured: `270` + // Estimated: `5628` + // Minimum execution time: 104_033_000 picoseconds. + Weight::from_parts(106_787_000, 5628) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().writes(8_u64)) + } + /// Storage: `Providers::MainStorageProviders` (r:1 w:0) + /// Proof: `Providers::MainStorageProviders` (`max_values`: None, `max_size`: Some(1143), added: 3618, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:1 w:0) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `Providers::BackupStorageProviders` (r:1 w:1) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::SlashableProviders` (r:1 w:1) + /// Proof: `ProofsDealer::SlashableProviders` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + /// Storage: `Parameters::Parameters` (r:1 w:0) + /// Proof: `Parameters::Parameters` (`max_values`: None, `max_size`: Some(381), added: 2856, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:2 w:2) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `Providers::AwaitingTopUpFromProviders` (r:1 w:0) + /// Proof: `Providers::AwaitingTopUpFromProviders` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + fn slash_without_awaiting_top_up() -> Weight { + // Proof Size summary in bytes: + // Measured: `871` + // Estimated: `6172` + // Minimum execution time: 159_588_000 picoseconds. + Weight::from_parts(161_719_000, 6172) + .saturating_add(T::DbWeight::get().reads(9_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } + /// Storage: `Providers::MainStorageProviders` (r:1 w:0) + /// Proof: `Providers::MainStorageProviders` (`max_values`: None, `max_size`: Some(1143), added: 3618, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:1 w:0) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `Providers::BackupStorageProviders` (r:1 w:1) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::SlashableProviders` (r:1 w:1) + /// Proof: `ProofsDealer::SlashableProviders` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + /// Storage: `Parameters::Parameters` (r:2 w:0) + /// Proof: `Parameters::Parameters` (`max_values`: None, `max_size`: Some(381), added: 2856, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:2 w:2) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `Providers::AwaitingTopUpFromProviders` (r:1 w:1) + /// Proof: `Providers::AwaitingTopUpFromProviders` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::ChallengesTicker` (r:1 w:0) + /// Proof: `ProofsDealer::ChallengesTicker` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Providers::NextAvailableProviderTopUpExpirationShTick` (r:1 w:1) + /// Proof: `Providers::NextAvailableProviderTopUpExpirationShTick` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Providers::ProviderTopUpExpirations` (r:1 w:1) + /// Proof: `Providers::ProviderTopUpExpirations` (`max_values`: None, `max_size`: Some(3322), added: 5797, mode: `MaxEncodedLen`) + fn slash_with_awaiting_top_up() -> Weight { + // Proof Size summary in bytes: + // Measured: `871` + // Estimated: `6787` + // Minimum execution time: 126_797_000 picoseconds. + Weight::from_parts(129_937_000, 6787) + .saturating_add(T::DbWeight::get().reads(13_u64)) + .saturating_add(T::DbWeight::get().writes(8_u64)) + } + /// Storage: `Providers::AccountIdToMainStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToMainStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::AccountIdToBackupStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToBackupStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::MainStorageProviders` (r:1 w:0) + /// Proof: `Providers::MainStorageProviders` (`max_values`: None, `max_size`: Some(1143), added: 3618, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:1 w:0) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `Providers::BackupStorageProviders` (r:1 w:1) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Providers::AwaitingTopUpFromProviders` (r:1 w:1) + /// Proof: `Providers::AwaitingTopUpFromProviders` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Providers::ProviderTopUpExpirations` (r:0 w:1) + /// Proof: `Providers::ProviderTopUpExpirations` (`max_values`: None, `max_size`: Some(3322), added: 5797, mode: `MaxEncodedLen`) + fn top_up_deposit() -> Weight { + // Proof Size summary in bytes: + // Measured: `758` + // Estimated: `4624` + // Minimum execution time: 111_138_000 picoseconds. + Weight::from_parts(113_128_000, 4624) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } + /// Storage: `Providers::InsolventProviders` (r:2 w:1) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::FixedRatePaymentStreams` (r:1 w:0) + /// Proof: `PaymentStreams::FixedRatePaymentStreams` (`max_values`: None, `max_size`: Some(125), added: 2600, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::DynamicRatePaymentStreams` (r:1 w:0) + /// Proof: `PaymentStreams::DynamicRatePaymentStreams` (`max_values`: None, `max_size`: Some(129), added: 2604, mode: `MaxEncodedLen`) + /// Storage: `Providers::MainStorageProviders` (r:1 w:0) + /// Proof: `Providers::MainStorageProviders` (`max_values`: None, `max_size`: Some(1143), added: 3618, mode: `MaxEncodedLen`) + /// Storage: `Providers::BackupStorageProviders` (r:1 w:1) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `Providers::AccountIdToBackupStorageProviderId` (r:1 w:1) + /// Proof: `Providers::AccountIdToBackupStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::ProviderToProofSubmissionRecord` (r:1 w:1) + /// Proof: `ProofsDealer::ProviderToProofSubmissionRecord` (`max_values`: None, `max_size`: Some(56), added: 2531, mode: `MaxEncodedLen`) + /// Storage: `Providers::BspCount` (r:1 w:1) + /// Proof: `Providers::BspCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Providers::TotalBspsCapacity` (r:1 w:1) + /// Proof: `Providers::TotalBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Providers::UsedBspsCapacity` (r:1 w:1) + /// Proof: `Providers::UsedBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Providers::GlobalBspsReputationWeight` (r:1 w:1) + /// Proof: `Providers::GlobalBspsReputationWeight` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::TickToProvidersDeadlines` (r:0 w:1) + /// Proof: `ProofsDealer::TickToProvidersDeadlines` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + fn delete_provider_bsp() -> Weight { + // Proof Size summary in bytes: + // Measured: `853` + // Estimated: `6038` + // Minimum execution time: 80_884_000 picoseconds. + Weight::from_parts(82_175_000, 6038) + .saturating_add(T::DbWeight::get().reads(12_u64)) + .saturating_add(T::DbWeight::get().writes(9_u64)) + } + /// Storage: `Providers::InsolventProviders` (r:1 w:1) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::FixedRatePaymentStreams` (r:1 w:0) + /// Proof: `PaymentStreams::FixedRatePaymentStreams` (`max_values`: None, `max_size`: Some(125), added: 2600, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::DynamicRatePaymentStreams` (r:1 w:0) + /// Proof: `PaymentStreams::DynamicRatePaymentStreams` (`max_values`: None, `max_size`: Some(129), added: 2604, mode: `MaxEncodedLen`) + /// Storage: `Providers::MainStorageProviders` (r:1 w:1) + /// Proof: `Providers::MainStorageProviders` (`max_values`: None, `max_size`: Some(1143), added: 3618, mode: `MaxEncodedLen`) + /// Storage: `Providers::MainStorageProviderIdsToValuePropositions` (r:22 w:21) + /// Proof: `Providers::MainStorageProviderIdsToValuePropositions` (`max_values`: None, `max_size`: Some(1123), added: 3598, mode: `MaxEncodedLen`) + /// Storage: `Providers::MainStorageProviderIdsToBuckets` (r:21 w:20) + /// Proof: `Providers::MainStorageProviderIdsToBuckets` (`max_values`: None, `max_size`: Some(96), added: 2571, mode: `MaxEncodedLen`) + /// Storage: `Providers::MspCount` (r:1 w:1) + /// Proof: `Providers::MspCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Providers::AccountIdToMainStorageProviderId` (r:0 w:1) + /// Proof: `Providers::AccountIdToMainStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// The range of component `n` is `[0, 20]`. + /// The range of component `m` is `[0, 20]`. + fn delete_provider_msp(n: u32, m: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `1845 + m * (54 ±0) + n * (83 ±0)` + // Estimated: `8186 + m * (2571 ±0) + n * (3598 ±0)` + // Minimum execution time: 184_840_000 picoseconds. + Weight::from_parts(79_815_534, 8186) + // Standard Error: 30_345 + .saturating_add(Weight::from_parts(6_847_952, 0).saturating_mul(n.into())) + // Standard Error: 30_345 + .saturating_add(Weight::from_parts(5_652_904, 0).saturating_mul(m.into())) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(m.into()))) + .saturating_add(T::DbWeight::get().writes(5_u64)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(m.into()))) + .saturating_add(Weight::from_parts(0, 2571).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 3598).saturating_mul(n.into())) + } + /// Storage: `Providers::AccountIdToBackupStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToBackupStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::BackupStorageProviders` (r:1 w:0) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::ProviderToProofSubmissionRecord` (r:1 w:0) + /// Proof: `ProofsDealer::ProviderToProofSubmissionRecord` (`max_values`: None, `max_size`: Some(56), added: 2531, mode: `MaxEncodedLen`) + fn stop_all_cycles() -> Weight { + // Proof Size summary in bytes: + // Measured: `549` + // Estimated: `4624` + // Minimum execution time: 27_400_000 picoseconds. + Weight::from_parts(27_944_000, 4624) + .saturating_add(T::DbWeight::get().reads(3_u64)) + } + /// Storage: `Providers::AwaitingTopUpFromProviders` (r:1 w:1) + /// Proof: `Providers::AwaitingTopUpFromProviders` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Providers::BackupStorageProviders` (r:1 w:0) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:2 w:2) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Providers::AccountIdToBackupStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToBackupStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::ProviderToProofSubmissionRecord` (r:1 w:1) + /// Proof: `ProofsDealer::ProviderToProofSubmissionRecord` (`max_values`: None, `max_size`: Some(56), added: 2531, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:0 w:1) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::TickToProvidersDeadlines` (r:0 w:1) + /// Proof: `ProofsDealer::TickToProvidersDeadlines` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + fn process_expired_provider_top_up_bsp() -> Weight { + // Proof Size summary in bytes: + // Measured: `1038` + // Estimated: `6172` + // Minimum execution time: 103_682_000 picoseconds. + Weight::from_parts(105_525_000, 6172) + .saturating_add(T::DbWeight::get().reads(7_u64)) + .saturating_add(T::DbWeight::get().writes(7_u64)) + } + /// Storage: `Providers::AwaitingTopUpFromProviders` (r:1 w:1) + /// Proof: `Providers::AwaitingTopUpFromProviders` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Providers::BackupStorageProviders` (r:1 w:0) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `Providers::MainStorageProviders` (r:1 w:0) + /// Proof: `Providers::MainStorageProviders` (`max_values`: None, `max_size`: Some(1143), added: 3618, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:2 w:2) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:0 w:1) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + fn process_expired_provider_top_up_msp() -> Weight { + // Proof Size summary in bytes: + // Measured: `775` + // Estimated: `6172` + // Minimum execution time: 83_347_000 picoseconds. + Weight::from_parts(84_976_000, 6172) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } +} diff --git a/operator/runtime/stagenet/Cargo.toml b/operator/runtime/stagenet/Cargo.toml index 131083a9..c1b33c46 100644 --- a/operator/runtime/stagenet/Cargo.toml +++ b/operator/runtime/stagenet/Cargo.toml @@ -86,6 +86,7 @@ polkadot-runtime-common = { workspace = true } precompile-utils = { workspace = true } scale-info = { workspace = true, features = ["derive", "serde"] } serde = { workspace = true, features = ["derive"] } +k256 = { workspace = true, optional = true } serde_json = { workspace = true, default-features = false, features = [ "alloc", ] } @@ -361,6 +362,13 @@ runtime-benchmarks = [ "snowbridge-pallet-system/runtime-benchmarks", "pallet-outbound-commitment-store/runtime-benchmarks", "pallet-datahaven-native-transfer/runtime-benchmarks", + # StorageHub pallets + "pallet-nfts/runtime-benchmarks", + "pallet-file-system/runtime-benchmarks", + "pallet-proofs-dealer/runtime-benchmarks", + "pallet-payment-streams/runtime-benchmarks", + "pallet-storage-providers/runtime-benchmarks", + "dep:k256", ] try-runtime = [ diff --git a/operator/runtime/stagenet/src/benchmarks.rs b/operator/runtime/stagenet/src/benchmarks.rs index 51f38f33..bfbaa347 100644 --- a/operator/runtime/stagenet/src/benchmarks.rs +++ b/operator/runtime/stagenet/src/benchmarks.rs @@ -27,6 +27,7 @@ frame_benchmarking::define_benchmarks!( // Substrate pallets [pallet_balances, Balances] + [pallet_session, pallet_session_benchmarking::Pallet::] // FIXME: benchmarking identity fail // [pallet_identity, Identity] [pallet_im_online, ImOnline] @@ -44,6 +45,13 @@ frame_benchmarking::define_benchmarks!( [pallet_safe_mode, SafeMode] [pallet_tx_pause, TxPause] + // StorageHub pallets + [pallet_nfts, Nfts] + [pallet_file_system, FileSystem] + [pallet_proofs_dealer, ProofsDealer] + [pallet_payment_streams, PaymentStreams] + [pallet_storage_providers, Providers] + // Governance pallets [pallet_collective_technical_committee, TechnicalCommittee] [pallet_collective_treasury_council, TreasuryCouncil] diff --git a/operator/runtime/stagenet/src/configs/mod.rs b/operator/runtime/stagenet/src/configs/mod.rs index 07cb0ab2..25be93a7 100644 --- a/operator/runtime/stagenet/src/configs/mod.rs +++ b/operator/runtime/stagenet/src/configs/mod.rs @@ -91,7 +91,6 @@ use datahaven_runtime_common::{ }, time::{EpochDurationInBlocks, SessionsPerEra, DAYS, MILLISECS_PER_BLOCK}, }; -use dhp_bridge::{EigenLayerMessageProcessor, NativeTokenTransferMessageProcessor}; use frame_support::{ derive_impl, dispatch::DispatchClass, @@ -126,7 +125,7 @@ use snowbridge_core::{gwei, meth, AgentIdOf, PricingParameters, Rewards, TokenId use snowbridge_inbound_queue_primitives::RewardLedger; use snowbridge_outbound_queue_primitives::{ v1::{Fee, Message, SendMessage}, - v2::{Command, ConstantGasMeter}, + v2::ConstantGasMeter, SendError, SendMessageFeeProvider, }; use snowbridge_pallet_outbound_queue_v2::OnNewCommitment; @@ -387,7 +386,7 @@ impl pallet_session::Config for Runtime { >; type SessionHandler = ::KeyTypeIdProviders; type Keys = SessionKeys; - type WeightInfo = pallet_session::weights::SubstrateWeight; + type WeightInfo = stagenet_weights::pallet_session::WeightInfo; } parameter_types! { @@ -1105,47 +1104,13 @@ impl snowbridge_pallet_system_v2::Config for Runtime { type Helper = (); } -// Fork versions for runtime benchmarks - must match the fixtures for BLS verification to work -// The fixtures are generated with standard testnet fork versions -#[cfg(feature = "runtime-benchmarks")] -parameter_types! { - pub const ChainForkVersions: ForkVersions = ForkVersions { - genesis: Fork { - version: hex_literal::hex!("00000000"), - epoch: 0, - }, - altair: Fork { - version: hex_literal::hex!("01000000"), - epoch: 0, - }, - bellatrix: Fork { - version: hex_literal::hex!("02000000"), - epoch: 0, - }, - capella: Fork { - version: hex_literal::hex!("03000000"), - epoch: 0, - }, - deneb: Fork { - version: hex_literal::hex!("04000000"), - epoch: 0, - }, - electra: Fork { - version: hex_literal::hex!("05000000"), - epoch: 80000000000, - }, - fulu: Fork { - version: hex_literal::hex!("06000000"), - epoch: 90000000000, - }, - }; -} - // For tests, fast-runtime and std configurations we use the mocked fork versions // These match the fork versions used by the local Ethereum network in E2E tests -#[cfg(all( - any(feature = "std", feature = "fast-runtime", test), - not(feature = "runtime-benchmarks") +#[cfg(any( + feature = "std", + feature = "fast-runtime", + feature = "runtime-benchmarks", + test ))] parameter_types! { pub const ChainForkVersions: ForkVersions = ForkVersions { @@ -1275,8 +1240,8 @@ impl snowbridge_pallet_inbound_queue_v2::Config for Runtime { type GatewayAddress = runtime_params::dynamic_params::runtime_config::EthereumGatewayAddress; #[cfg(not(feature = "runtime-benchmarks"))] type MessageProcessor = ( - EigenLayerMessageProcessor, - NativeTokenTransferMessageProcessor, + dhp_bridge::EigenLayerMessageProcessor, + dhp_bridge::NativeTokenTransferMessageProcessor, ); #[cfg(feature = "runtime-benchmarks")] type MessageProcessor = NoOpMessageProcessor; @@ -1746,6 +1711,7 @@ mod tests { use snowbridge_inbound_queue_primitives::v2::{ EthereumAsset, Message as SnowbridgeMessage, MessageProcessor, Payload as SnowPayload, }; + use snowbridge_outbound_queue_primitives::v2::Command; use sp_core::H160; use sp_io::TestExternalities; use xcm_builder::GlobalConsensusConvertsFor; diff --git a/operator/runtime/stagenet/src/configs/storagehub/mod.rs b/operator/runtime/stagenet/src/configs/storagehub/mod.rs index ca2f1d30..79a71b14 100644 --- a/operator/runtime/stagenet/src/configs/storagehub/mod.rs +++ b/operator/runtime/stagenet/src/configs/storagehub/mod.rs @@ -14,9 +14,13 @@ // You should have received a copy of the GNU General Public License // along with DataHaven. If not, see . +#[cfg(not(feature = "runtime-benchmarks"))] +use super::HAVE; +#[cfg(feature = "runtime-benchmarks")] +use super::MICROHAVE; use super::{ AccountId, Balance, Balances, BlockNumber, Hash, RuntimeEvent, RuntimeHoldReason, - TreasuryAccount, HAVE, + TreasuryAccount, }; use crate::configs::runtime_params::dynamic_params::runtime_config; use crate::{ @@ -24,6 +28,8 @@ use crate::{ HOURS, }; use core::marker::PhantomData; +#[cfg(feature = "runtime-benchmarks")] +use datahaven_runtime_common::benchmarking::StorageHubBenchmarking; use datahaven_runtime_common::time::{DAYS, MINUTES}; use frame_support::pallet_prelude::DispatchClass; use frame_support::traits::AsEnsureOriginWithArg; @@ -33,7 +39,7 @@ use frame_support::{ weights::Weight, }; use frame_system::pallet_prelude::BlockNumberFor; -use frame_system::{EnsureRoot, EnsureSigned}; +use frame_system::EnsureSigned; use num_bigint::BigUint; use pallet_nfts::PalletFeatures; use polkadot_runtime_common::prod_or_fast; @@ -68,6 +74,7 @@ pub type StorageProofsMerkleTrieLayout = LayoutV1; pub type Hashing = BlakeTwo256; /****** NFTs pallet ******/ +#[cfg(not(feature = "runtime-benchmarks"))] parameter_types! { pub const CollectionDeposit: Balance = 100 * HAVE; pub const ItemDeposit: Balance = 1 * HAVE; @@ -80,6 +87,19 @@ parameter_types! { pub const MaxAttributesPerCall: u32 = 10; pub Features: PalletFeatures = PalletFeatures::all_enabled(); } +#[cfg(feature = "runtime-benchmarks")] +parameter_types! { + pub const CollectionDeposit: Balance = 100 * MICROHAVE; + pub const ItemDeposit: Balance = 1 * MICROHAVE; + pub const MetadataDepositBase: Balance = 10 * MICROHAVE; + pub const MetadataDepositPerByte: Balance = 1 * MICROHAVE; + pub const ApprovalsLimit: u32 = 20; + pub const ItemAttributesApprovalsLimit: u32 = 20; + pub const MaxTips: u32 = 10; + pub const MaxDeadlineDuration: BlockNumber = 12 * 30 * DAYS; + pub const MaxAttributesPerCall: u32 = 10; + pub Features: PalletFeatures = PalletFeatures::all_enabled(); +} impl pallet_nfts::Config for Runtime { type RuntimeEvent = RuntimeEvent; @@ -104,11 +124,66 @@ impl pallet_nfts::Config for Runtime { type Features = Features; type OffchainSignature = Signature; type OffchainPublic = ::Signer; - type WeightInfo = pallet_nfts::weights::SubstrateWeight; + type WeightInfo = crate::weights::pallet_nfts::WeightInfo; type Locker = (); + #[cfg(feature = "runtime-benchmarks")] + type Helper = benchmark_helpers::NftHelper; } /****** ****** ****** ******/ +#[cfg(feature = "runtime-benchmarks")] +pub mod benchmark_helpers { + use crate::{AccountId, Signature}; + use k256::ecdsa::SigningKey; + use sp_runtime::traits::{IdentifyAccount, Verify}; + use sp_runtime::MultiSignature; + + const BENCH_SIGNING_KEY: [u8; 32] = [1u8; 32]; + + fn bench_signing_key() -> SigningKey { + SigningKey::from_bytes(&BENCH_SIGNING_KEY.into()) + .expect("benchmark signing key is valid; qed") + } + + /// Benchmark helper for NFTs pallet + pub struct NftHelper; + + impl pallet_nfts::BenchmarkHelper::Signer, AccountId, Signature> + for NftHelper + { + fn collection(i: u16) -> u32 { + i.into() + } + + fn item(i: u16) -> u32 { + i.into() + } + + fn signer() -> (::Signer, AccountId) { + let signing_key = bench_signing_key(); + let verifying_key = signing_key.verifying_key(); + let encoded = verifying_key.to_encoded_point(true); + let public = + sp_core::ecdsa::Public::from_full(encoded.as_bytes()).expect("valid key; qed"); + let public_key: ::Signer = public.into(); + let account: AccountId = public_key.clone().into_account(); + (public_key, account) + } + + fn sign(_public: &::Signer, message: &[u8]) -> Signature { + let digest = sp_io::hashing::keccak_256(message); + let (sig, recovery_id) = bench_signing_key() + .sign_prehash_recoverable(&digest) + .expect("signing with fixed key never fails; qed"); + let mut sig_bytes = [0u8; 65]; + sig_bytes[..64].copy_from_slice(&sig.to_bytes()); + sig_bytes[64] = recovery_id.to_byte(); + let sig = sp_core::ecdsa::Signature::from_raw(sig_bytes); + Signature::from(MultiSignature::Ecdsa(sig)) + } + } +} + /****** Relay Randomness pallet ******/ impl pallet_randomness::Config for Runtime { type RuntimeEvent = RuntimeEvent; @@ -151,6 +226,7 @@ impl sp_runtime::traits::BlockNumberProvider for BlockNumberGetter { /****** ****** ****** ******/ /****** Storage Providers pallet ******/ +#[cfg(not(feature = "runtime-benchmarks"))] parameter_types! { pub const SpMinDeposit: Balance = 100 * HAVE; pub const BucketDeposit: Balance = 100 * HAVE; @@ -159,10 +235,47 @@ parameter_types! { // TODO: If the next line is uncommented (which should be eventually, replacing the line above), compilation breaks (most likely because of mismatched dependency issues) // pub const MaxBlocksForRandomness: BlockNumber = prod_or_fast!(2 * runtime_constants::time::EPOCH_DURATION_IN_SLOTS, 2 * MINUTES); } +#[cfg(feature = "runtime-benchmarks")] +parameter_types! { + pub const SpMinDeposit: Balance = StorageHubBenchmarking::SP_MIN_DEPOSIT; + pub const BucketDeposit: Balance = StorageHubBenchmarking::BUCKET_DEPOSIT; + pub const BspSignUpLockPeriod: BlockNumber = 90 * DAYS; // ~3 months + pub const MaxBlocksForRandomness: BlockNumber = prod_or_fast!(2 * HOURS, 2 * MINUTES); + // TODO: If the next line is uncommented (which should be eventually, replacing the line above), compilation breaks (most likely because of mismatched dependency issues) + // pub const MaxBlocksForRandomness: BlockNumber = prod_or_fast!(2 * runtime_constants::time::EPOCH_DURATION_IN_SLOTS, 2 * MINUTES); +} + +#[cfg(feature = "runtime-benchmarks")] +pub struct StorageHubTreasuryAccount; +#[cfg(feature = "runtime-benchmarks")] +impl Get for StorageHubTreasuryAccount { + fn get() -> AccountId { + let account = TreasuryAccount::get(); + StorageHubBenchmarking::ensure_treasury_account::(account) + } +} + +// Benchmark helpers for Storage Providers pallet. +#[cfg(feature = "runtime-benchmarks")] +pub struct ProvidersBenchmarkHelpers; +#[cfg(feature = "runtime-benchmarks")] +impl pallet_storage_providers::benchmarking::BenchmarkHelpers + for ProvidersBenchmarkHelpers +{ + type ProviderId = ::ProviderId; + + fn set_accrued_failed_proofs(provider_id: Self::ProviderId, value: u32) { + pallet_proofs_dealer::SlashableProviders::::insert(provider_id, value); + } + + fn get_accrued_failed_proofs(provider_id: Self::ProviderId) -> u32 { + pallet_proofs_dealer::SlashableProviders::::get(provider_id).unwrap_or(0) + } +} impl pallet_storage_providers::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type WeightInfo = pallet_storage_providers::weights::SubstrateWeight; + type WeightInfo = crate::weights::pallet_storage_providers::WeightInfo; type ProvidersRandomness = pallet_randomness::RandomnessFromOneEpochAgo; type PaymentStreams = PaymentStreams; type ProofDealer = ProofsDealer; @@ -188,7 +301,10 @@ impl pallet_storage_providers::Config for Runtime { type ProvidersProofSubmitters = ProofsDealer; type ReputationWeightType = u32; type StorageHubTickGetter = ProofsDealer; + #[cfg(not(feature = "runtime-benchmarks"))] type Treasury = TreasuryAccount; + #[cfg(feature = "runtime-benchmarks")] + type Treasury = StorageHubTreasuryAccount; type SpMinDeposit = SpMinDeposit; type SpMinCapacity = ConstU64<2>; type DepositPerData = ConstU128<2>; @@ -208,6 +324,8 @@ impl pallet_storage_providers::Config for Runtime { type ZeroSizeBucketFixedRate = runtime_config::ZeroSizeBucketFixedRate; type ProviderTopUpTtl = runtime_config::ProviderTopUpTtl; type MaxExpiredItemsInBlock = ConstU32<100>; + #[cfg(feature = "runtime-benchmarks")] + type BenchmarkHelpers = ProvidersBenchmarkHelpers; } pub struct StorageDataUnitAndBalanceConverter; @@ -240,7 +358,7 @@ parameter_types! { impl pallet_payment_streams::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type WeightInfo = pallet_payment_streams::weights::SubstrateWeight; + type WeightInfo = crate::weights::pallet_payment_streams::WeightInfo; type NativeBalance = Balances; type ProvidersPallet = Providers; type RuntimeHoldReason = RuntimeHoldReason; @@ -250,7 +368,10 @@ impl pallet_payment_streams::Config for Runtime { type BlockNumberToBalance = BlockNumberToBalance; type ProvidersProofSubmitters = ProofsDealer; type TreasuryCutCalculator = LinearThenPowerOfTwoTreasuryCutCalculator; + #[cfg(not(feature = "runtime-benchmarks"))] type TreasuryAccount = TreasuryAccount; + #[cfg(feature = "runtime-benchmarks")] + type TreasuryAccount = StorageHubTreasuryAccount; type MaxUsersToCharge = ConstU32<10>; type BaseDeposit = ConstU128<10>; } @@ -279,6 +400,14 @@ const MAX_CUSTOM_CHALLENGES_PER_BLOCK: u32 = 10; const TOTAL_MAX_CHALLENGES_PER_BLOCK: u32 = RANDOM_CHALLENGES_PER_BLOCK + MAX_CUSTOM_CHALLENGES_PER_BLOCK; +#[cfg(feature = "runtime-benchmarks")] +parameter_types! { + pub const BenchmarkStakeToChallengePeriod: Balance = + StorageHubBenchmarking::STAKE_TO_CHALLENGE_PERIOD; + pub const BenchmarkCheckpointChallengePeriod: BlockNumber = + StorageHubBenchmarking::CHECKPOINT_CHALLENGE_PERIOD; +} + parameter_types! { pub const RandomChallengesPerBlock: u32 = RANDOM_CHALLENGES_PER_BLOCK; pub const MaxCustomChallengesPerBlock: u32 = MAX_CUSTOM_CHALLENGES_PER_BLOCK; @@ -293,7 +422,7 @@ parameter_types! { impl pallet_proofs_dealer::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type WeightInfo = pallet_proofs_dealer::weights::SubstrateWeight; + type WeightInfo = crate::weights::pallet_proofs_dealer::WeightInfo; type ProvidersPallet = Providers; type NativeBalance = Balances; type MerkleTrieHash = Hash; @@ -306,29 +435,50 @@ impl pallet_proofs_dealer::Config for Runtime { { shp_constants::FILE_SIZE_TO_CHALLENGES }, >; type StakeToBlockNumber = SaturatingBalanceToBlockNumber; + #[cfg(feature = "runtime-benchmarks")] + type RandomChallengesPerBlock = ConstU32<0>; + #[cfg(not(feature = "runtime-benchmarks"))] type RandomChallengesPerBlock = RandomChallengesPerBlock; + #[cfg(feature = "runtime-benchmarks")] + type MaxCustomChallengesPerBlock = TotalMaxChallengesPerBlock; + #[cfg(not(feature = "runtime-benchmarks"))] type MaxCustomChallengesPerBlock = MaxCustomChallengesPerBlock; type MaxSubmittersPerTick = MaxSubmittersPerTick; type TargetTicksStorageOfSubmitters = TargetTicksStorageOfSubmitters; type ChallengeHistoryLength = ChallengeHistoryLength; type ChallengesQueueLength = ChallengesQueueLength; + #[cfg(not(feature = "runtime-benchmarks"))] type CheckpointChallengePeriod = runtime_config::CheckpointChallengePeriod; + #[cfg(feature = "runtime-benchmarks")] + type CheckpointChallengePeriod = BenchmarkCheckpointChallengePeriod; type ChallengesFee = ChallengesFee; type PriorityChallengesFee = PriorityChallengesFee; + #[cfg(not(feature = "runtime-benchmarks"))] type Treasury = TreasuryAccount; + #[cfg(feature = "runtime-benchmarks")] + type Treasury = StorageHubTreasuryAccount; // TODO: Once the client logic to keep track of CR randomness deadlines and execute their submissions is implemented // AND after the chain has been live for enough time to have enough providers to avoid the commit-reveal randomness being // gameable, the randomness provider should be CrRandomness type RandomnessProvider = pallet_randomness::ParentBlockRandomness; + #[cfg(not(feature = "runtime-benchmarks"))] type StakeToChallengePeriod = runtime_config::StakeToChallengePeriod; + #[cfg(feature = "runtime-benchmarks")] + type StakeToChallengePeriod = BenchmarkStakeToChallengePeriod; type MinChallengePeriod = runtime_config::MinChallengePeriod; type ChallengeTicksTolerance = ChallengeTicksTolerance; type BlockFullnessPeriod = ChallengeTicksTolerance; // We purposely set this to `ChallengeTicksTolerance` so that spamming of the chain is evaluated for the same blocks as the tolerance BSPs are given. type BlockFullnessHeadroom = BlockFullnessHeadroom; type MinNotFullBlocksRatio = MinNotFullBlocksRatio; type MaxSlashableProvidersPerTick = MaxSlashableProvidersPerTick; - type ChallengeOrigin = EnsureRoot; - type PriorityChallengeOrigin = EnsureRoot; + #[cfg(not(feature = "runtime-benchmarks"))] + type ChallengeOrigin = frame_system::EnsureRoot; + #[cfg(feature = "runtime-benchmarks")] + type ChallengeOrigin = EnsureSigned; + #[cfg(not(feature = "runtime-benchmarks"))] + type PriorityChallengeOrigin = frame_system::EnsureRoot; + #[cfg(feature = "runtime-benchmarks")] + type PriorityChallengeOrigin = EnsureSigned; } // Converter from the Balance type to the BlockNumber type for math. @@ -452,12 +602,24 @@ impl Get for MaxSlashableProvidersPerTick { type ThresholdType = u32; pub type ReplicationTargetType = u32; +#[cfg(not(feature = "runtime-benchmarks"))] parameter_types! { pub const BaseStorageRequestCreationDeposit: Balance = 1 * HAVE; pub const FileDeletionRequestCreationDeposit: Balance = 1 * HAVE; pub const FileSystemStorageRequestCreationHoldReason: RuntimeHoldReason = RuntimeHoldReason::FileSystem(pallet_file_system::HoldReason::StorageRequestCreationHold); pub const FileSystemFileDeletionRequestHoldReason: RuntimeHoldReason = RuntimeHoldReason::FileSystem(pallet_file_system::HoldReason::FileDeletionRequestHold); } +#[cfg(feature = "runtime-benchmarks")] +parameter_types! { + pub const BaseStorageRequestCreationDeposit: Balance = 1 * MICROHAVE; + pub const FileDeletionRequestCreationDeposit: Balance = 1 * MICROHAVE; + pub const FileSystemStorageRequestCreationHoldReason: RuntimeHoldReason = RuntimeHoldReason::FileSystem(pallet_file_system::HoldReason::StorageRequestCreationHold); + pub const FileSystemFileDeletionRequestHoldReason: RuntimeHoldReason = RuntimeHoldReason::FileSystem(pallet_file_system::HoldReason::FileDeletionRequestHold); +} +#[cfg(feature = "runtime-benchmarks")] +parameter_types! { + pub const BenchmarkBspStopStoringFilePenalty: Balance = 1 * MICROHAVE; +} // Converts a given signed message in a EIP-191 compliant message bytes to verify. /// EIP-191: https://eips.ethereum.org/EIPS/eip-191 @@ -480,7 +642,7 @@ impl shp_traits::MessageAdapter for Eip191Adapter { impl pallet_file_system::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type WeightInfo = pallet_file_system::weights::SubstrateWeight; + type WeightInfo = crate::weights::pallet_file_system::WeightInfo; type Providers = Providers; type ProofDealer = ProofsDealer; type PaymentStreams = PaymentStreams; @@ -500,8 +662,14 @@ impl pallet_file_system::Config for Runtime { type RuntimeHoldReason = RuntimeHoldReason; type Nfts = Nfts; type CollectionInspector = BucketNfts; + #[cfg(not(feature = "runtime-benchmarks"))] type BspStopStoringFilePenalty = runtime_config::BspStopStoringFilePenalty; + #[cfg(feature = "runtime-benchmarks")] + type BspStopStoringFilePenalty = BenchmarkBspStopStoringFilePenalty; + #[cfg(not(feature = "runtime-benchmarks"))] type TreasuryAccount = TreasuryAccount; + #[cfg(feature = "runtime-benchmarks")] + type TreasuryAccount = StorageHubTreasuryAccount; type MaxBatchConfirmStorageRequests = ConstU32<100>; type MaxFilePathSize = ConstU32<512u32>; type MaxPeerIdSize = ConstU32<100>; diff --git a/operator/runtime/stagenet/src/lib.rs b/operator/runtime/stagenet/src/lib.rs index 1f9da4c1..072d5a1b 100644 --- a/operator/runtime/stagenet/src/lib.rs +++ b/operator/runtime/stagenet/src/lib.rs @@ -203,7 +203,7 @@ parameter_types! { parameter_types! { // TODO: Change ED to 1 after upgrade to Polkadot SDK stable2503 // cfr. https://github.com/paritytech/polkadot-sdk/pull/7379 - pub const ExistentialDeposit: Balance = 100; + pub const ExistentialDeposit: Balance = 1; } /// The version information used to identify this runtime when compiled natively. @@ -974,6 +974,7 @@ impl_runtime_apis! { use frame_system_benchmarking::Pallet as SystemBench; impl frame_system_benchmarking::Config for Runtime {} + impl pallet_session_benchmarking::Config for Runtime {} impl baseline::Config for Runtime {} use frame_support::traits::WhitelistedStorageKeys; diff --git a/operator/runtime/stagenet/src/weights/mod.rs b/operator/runtime/stagenet/src/weights/mod.rs index 25a54307..354a9cbd 100644 --- a/operator/runtime/stagenet/src/weights/mod.rs +++ b/operator/runtime/stagenet/src/weights/mod.rs @@ -35,8 +35,13 @@ pub mod pallet_babe; pub mod pallet_balances; pub mod pallet_beefy_mmr; pub mod pallet_evm; +pub mod pallet_file_system; pub mod pallet_grandpa; +pub mod pallet_nfts; +pub mod pallet_payment_streams; +pub mod pallet_proofs_dealer; pub mod pallet_randomness; +pub mod pallet_storage_providers; // pub mod pallet_identity; pub mod pallet_im_online; pub mod pallet_message_queue; @@ -48,6 +53,7 @@ pub mod pallet_preimage; pub mod pallet_proxy; pub mod pallet_safe_mode; pub mod pallet_scheduler; +pub mod pallet_session; pub mod pallet_sudo; pub mod pallet_timestamp; pub mod pallet_transaction_payment; diff --git a/operator/runtime/stagenet/src/weights/pallet_file_system.rs b/operator/runtime/stagenet/src/weights/pallet_file_system.rs new file mode 100644 index 00000000..4a2a2050 --- /dev/null +++ b/operator/runtime/stagenet/src/weights/pallet_file_system.rs @@ -0,0 +1,5 @@ +//! Weights for `pallet_file_system`. +//! +//! Generated weights should overwrite this file. + +pub use pallet_file_system::weights::SubstrateWeight as WeightInfo; diff --git a/operator/runtime/stagenet/src/weights/pallet_nfts.rs b/operator/runtime/stagenet/src/weights/pallet_nfts.rs new file mode 100644 index 00000000..852419ff --- /dev/null +++ b/operator/runtime/stagenet/src/weights/pallet_nfts.rs @@ -0,0 +1,728 @@ + + +//! Autogenerated weights for `pallet_nfts` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 51.0.0 +//! DATE: 2025-11-14, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ip-10-0-0-176`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` +//! WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --runtime +// target/production/wbuild/datahaven-stagenet-runtime/datahaven_stagenet_runtime.compact.compressed.wasm +// --pallet +// pallet_nfts +// --extrinsic +// +// --template +// benchmarking/frame-weight-template.hbs +// --output +// runtime/stagenet/src/weights/pallet_nfts.rs +// --steps +// 50 +// --repeat +// 20 + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use sp_std::marker::PhantomData; + +/// Weights for `pallet_nfts`. +pub struct WeightInfo(PhantomData); +impl pallet_nfts::WeightInfo for WeightInfo { + /// Storage: `Nfts::NextCollectionId` (r:1 w:1) + /// Proof: `Nfts::NextCollectionId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Collection` (r:1 w:1) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionRoleOf` (r:0 w:1) + /// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionConfigOf` (r:0 w:1) + /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionAccount` (r:0 w:1) + /// Proof: `Nfts::CollectionAccount` (`max_values`: None, `max_size`: Some(56), added: 2531, mode: `MaxEncodedLen`) + fn create() -> Weight { + // Proof Size summary in bytes: + // Measured: `271` + // Estimated: `3537` + // Minimum execution time: 47_279_000 picoseconds. + Weight::from_parts(48_666_000, 3537) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } + /// Storage: `Nfts::NextCollectionId` (r:1 w:1) + /// Proof: `Nfts::NextCollectionId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Collection` (r:1 w:1) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionRoleOf` (r:0 w:1) + /// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionConfigOf` (r:0 w:1) + /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionAccount` (r:0 w:1) + /// Proof: `Nfts::CollectionAccount` (`max_values`: None, `max_size`: Some(56), added: 2531, mode: `MaxEncodedLen`) + fn force_create() -> Weight { + // Proof Size summary in bytes: + // Measured: `76` + // Estimated: `3537` + // Minimum execution time: 25_473_000 picoseconds. + Weight::from_parts(26_241_000, 3537) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } + /// Storage: `Nfts::Collection` (r:1 w:1) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemMetadataOf` (r:1 w:0) + /// Proof: `Nfts::ItemMetadataOf` (`max_values`: None, `max_size`: Some(335), added: 2810, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionRoleOf` (r:1 w:1) + /// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Attribute` (r:1001 w:1000) + /// Proof: `Nfts::Attribute` (`max_values`: None, `max_size`: Some(455), added: 2930, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemConfigOf` (r:1000 w:1000) + /// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionMetadataOf` (r:0 w:1) + /// Proof: `Nfts::CollectionMetadataOf` (`max_values`: None, `max_size`: Some(294), added: 2769, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionConfigOf` (r:0 w:1) + /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionAccount` (r:0 w:1) + /// Proof: `Nfts::CollectionAccount` (`max_values`: None, `max_size`: Some(56), added: 2531, mode: `MaxEncodedLen`) + /// The range of component `m` is `[0, 1000]`. + /// The range of component `c` is `[0, 1000]`. + /// The range of component `a` is `[0, 1000]`. + fn destroy(m: u32, c: u32, a: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `32179 + a * (366 ±0)` + // Estimated: `2523990 + a * (2930 ±0)` + // Minimum execution time: 1_381_577_000 picoseconds. + Weight::from_parts(756_122_428, 2523990) + // Standard Error: 12_048 + .saturating_add(Weight::from_parts(476_790, 0).saturating_mul(m.into())) + // Standard Error: 12_048 + .saturating_add(Weight::from_parts(51_253, 0).saturating_mul(c.into())) + // Standard Error: 12_048 + .saturating_add(Weight::from_parts(8_131_406, 0).saturating_mul(a.into())) + .saturating_add(T::DbWeight::get().reads(1004_u64)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(a.into()))) + .saturating_add(T::DbWeight::get().writes(1005_u64)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(a.into()))) + .saturating_add(Weight::from_parts(0, 2930).saturating_mul(a.into())) + } + /// Storage: `Nfts::CollectionConfigOf` (r:1 w:0) + /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Item` (r:1 w:1) + /// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(597), added: 3072, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Collection` (r:1 w:1) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionRoleOf` (r:1 w:0) + /// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemConfigOf` (r:1 w:1) + /// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Account` (r:0 w:1) + /// Proof: `Nfts::Account` (`max_values`: None, `max_size`: Some(76), added: 2551, mode: `MaxEncodedLen`) + fn mint() -> Weight { + // Proof Size summary in bytes: + // Measured: `418` + // Estimated: `4062` + // Minimum execution time: 67_882_000 picoseconds. + Weight::from_parts(69_718_000, 4062) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) + } + /// Storage: `Nfts::CollectionRoleOf` (r:1 w:0) + /// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Item` (r:1 w:1) + /// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(597), added: 3072, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Collection` (r:1 w:1) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionConfigOf` (r:1 w:0) + /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemConfigOf` (r:1 w:1) + /// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Account` (r:0 w:1) + /// Proof: `Nfts::Account` (`max_values`: None, `max_size`: Some(76), added: 2551, mode: `MaxEncodedLen`) + fn force_mint() -> Weight { + // Proof Size summary in bytes: + // Measured: `418` + // Estimated: `4062` + // Minimum execution time: 65_679_000 picoseconds. + Weight::from_parts(66_549_000, 4062) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) + } + /// Storage: `Nfts::Attribute` (r:1 w:0) + /// Proof: `Nfts::Attribute` (`max_values`: None, `max_size`: Some(455), added: 2930, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemConfigOf` (r:1 w:1) + /// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Collection` (r:1 w:1) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Item` (r:1 w:1) + /// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(597), added: 3072, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemMetadataOf` (r:1 w:0) + /// Proof: `Nfts::ItemMetadataOf` (`max_values`: None, `max_size`: Some(335), added: 2810, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Account` (r:0 w:1) + /// Proof: `Nfts::Account` (`max_values`: None, `max_size`: Some(76), added: 2551, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemPriceOf` (r:0 w:1) + /// Proof: `Nfts::ItemPriceOf` (`max_values`: None, `max_size`: Some(77), added: 2552, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemAttributesApprovalsOf` (r:0 w:1) + /// Proof: `Nfts::ItemAttributesApprovalsOf` (`max_values`: None, `max_size`: Some(441), added: 2916, mode: `MaxEncodedLen`) + /// Storage: `Nfts::PendingSwapOf` (r:0 w:1) + /// Proof: `Nfts::PendingSwapOf` (`max_values`: None, `max_size`: Some(71), added: 2546, mode: `MaxEncodedLen`) + fn burn() -> Weight { + // Proof Size summary in bytes: + // Measured: `526` + // Estimated: `4062` + // Minimum execution time: 73_580_000 picoseconds. + Weight::from_parts(75_125_000, 4062) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(7_u64)) + } + /// Storage: `Nfts::Collection` (r:1 w:0) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Attribute` (r:1 w:0) + /// Proof: `Nfts::Attribute` (`max_values`: None, `max_size`: Some(455), added: 2930, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionConfigOf` (r:1 w:0) + /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemConfigOf` (r:1 w:0) + /// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Item` (r:1 w:1) + /// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(597), added: 3072, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Account` (r:0 w:2) + /// Proof: `Nfts::Account` (`max_values`: None, `max_size`: Some(76), added: 2551, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemPriceOf` (r:0 w:1) + /// Proof: `Nfts::ItemPriceOf` (`max_values`: None, `max_size`: Some(77), added: 2552, mode: `MaxEncodedLen`) + /// Storage: `Nfts::PendingSwapOf` (r:0 w:1) + /// Proof: `Nfts::PendingSwapOf` (`max_values`: None, `max_size`: Some(71), added: 2546, mode: `MaxEncodedLen`) + fn transfer() -> Weight { + // Proof Size summary in bytes: + // Measured: `555` + // Estimated: `4062` + // Minimum execution time: 56_312_000 picoseconds. + Weight::from_parts(58_020_000, 4062) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } + /// Storage: `Nfts::Collection` (r:1 w:0) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionConfigOf` (r:1 w:0) + /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Item` (r:5000 w:5000) + /// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(597), added: 3072, mode: `MaxEncodedLen`) + /// The range of component `i` is `[0, 5000]`. + fn redeposit(i: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `750 + i * (83 ±0)` + // Estimated: `3538 + i * (3072 ±0)` + // Minimum execution time: 19_062_000 picoseconds. + Weight::from_parts(19_305_000, 3538) + // Standard Error: 24_093 + .saturating_add(Weight::from_parts(25_028_153, 0).saturating_mul(i.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(i.into()))) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) + .saturating_add(Weight::from_parts(0, 3072).saturating_mul(i.into())) + } + /// Storage: `Nfts::CollectionRoleOf` (r:1 w:0) + /// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemConfigOf` (r:1 w:1) + /// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + fn lock_item_transfer() -> Weight { + // Proof Size summary in bytes: + // Measured: `423` + // Estimated: `3522` + // Minimum execution time: 24_311_000 picoseconds. + Weight::from_parts(24_973_000, 3522) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Nfts::CollectionRoleOf` (r:1 w:0) + /// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemConfigOf` (r:1 w:1) + /// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + fn unlock_item_transfer() -> Weight { + // Proof Size summary in bytes: + // Measured: `423` + // Estimated: `3522` + // Minimum execution time: 24_194_000 picoseconds. + Weight::from_parts(24_755_000, 3522) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Nfts::Collection` (r:1 w:0) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionConfigOf` (r:1 w:1) + /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + fn lock_collection() -> Weight { + // Proof Size summary in bytes: + // Measured: `327` + // Estimated: `3538` + // Minimum execution time: 19_916_000 picoseconds. + Weight::from_parts(20_550_000, 3538) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Nfts::OwnershipAcceptance` (r:1 w:1) + /// Proof: `Nfts::OwnershipAcceptance` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Collection` (r:1 w:1) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionAccount` (r:0 w:2) + /// Proof: `Nfts::CollectionAccount` (`max_values`: None, `max_size`: Some(56), added: 2531, mode: `MaxEncodedLen`) + fn transfer_ownership() -> Weight { + // Proof Size summary in bytes: + // Measured: `524` + // Estimated: `3581` + // Minimum execution time: 35_006_000 picoseconds. + Weight::from_parts(35_968_000, 3581) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } + /// Storage: `Nfts::Collection` (r:1 w:1) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionRoleOf` (r:2 w:4) + /// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + fn set_team() -> Weight { + // Proof Size summary in bytes: + // Measured: `344` + // Estimated: `6054` + // Minimum execution time: 49_456_000 picoseconds. + Weight::from_parts(50_590_000, 6054) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } + /// Storage: `Nfts::Collection` (r:1 w:1) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionAccount` (r:0 w:2) + /// Proof: `Nfts::CollectionAccount` (`max_values`: None, `max_size`: Some(56), added: 2531, mode: `MaxEncodedLen`) + fn force_collection_owner() -> Weight { + // Proof Size summary in bytes: + // Measured: `298` + // Estimated: `3537` + // Minimum execution time: 20_463_000 picoseconds. + Weight::from_parts(20_872_000, 3537) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: `Nfts::Collection` (r:1 w:0) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionConfigOf` (r:0 w:1) + /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + fn force_collection_config() -> Weight { + // Proof Size summary in bytes: + // Measured: `276` + // Estimated: `3537` + // Minimum execution time: 16_403_000 picoseconds. + Weight::from_parts(17_022_000, 3537) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Nfts::CollectionRoleOf` (r:1 w:0) + /// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemConfigOf` (r:1 w:1) + /// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + fn lock_item_properties() -> Weight { + // Proof Size summary in bytes: + // Measured: `423` + // Estimated: `3522` + // Minimum execution time: 22_791_000 picoseconds. + Weight::from_parts(23_182_000, 3522) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Nfts::Collection` (r:1 w:1) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionRoleOf` (r:1 w:0) + /// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionConfigOf` (r:1 w:0) + /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemConfigOf` (r:1 w:0) + /// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Attribute` (r:1 w:1) + /// Proof: `Nfts::Attribute` (`max_values`: None, `max_size`: Some(455), added: 2930, mode: `MaxEncodedLen`) + fn set_attribute() -> Weight { + // Proof Size summary in bytes: + // Measured: `514` + // Estimated: `3920` + // Minimum execution time: 68_893_000 picoseconds. + Weight::from_parts(70_418_000, 3920) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: `Nfts::Collection` (r:1 w:1) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Attribute` (r:1 w:1) + /// Proof: `Nfts::Attribute` (`max_values`: None, `max_size`: Some(455), added: 2930, mode: `MaxEncodedLen`) + fn force_set_attribute() -> Weight { + // Proof Size summary in bytes: + // Measured: `331` + // Estimated: `3920` + // Minimum execution time: 33_040_000 picoseconds. + Weight::from_parts(33_469_000, 3920) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: `Nfts::Attribute` (r:1 w:1) + /// Proof: `Nfts::Attribute` (`max_values`: None, `max_size`: Some(455), added: 2930, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionRoleOf` (r:1 w:0) + /// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemConfigOf` (r:1 w:0) + /// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Collection` (r:1 w:1) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + fn clear_attribute() -> Weight { + // Proof Size summary in bytes: + // Measured: `958` + // Estimated: `3920` + // Minimum execution time: 62_760_000 picoseconds. + Weight::from_parts(64_137_000, 3920) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: `Nfts::Item` (r:1 w:0) + /// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(597), added: 3072, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemAttributesApprovalsOf` (r:1 w:1) + /// Proof: `Nfts::ItemAttributesApprovalsOf` (`max_values`: None, `max_size`: Some(441), added: 2916, mode: `MaxEncodedLen`) + fn approve_item_attributes() -> Weight { + // Proof Size summary in bytes: + // Measured: `356` + // Estimated: `4062` + // Minimum execution time: 20_851_000 picoseconds. + Weight::from_parts(21_234_000, 4062) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Nfts::Item` (r:1 w:0) + /// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(597), added: 3072, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemAttributesApprovalsOf` (r:1 w:1) + /// Proof: `Nfts::ItemAttributesApprovalsOf` (`max_values`: None, `max_size`: Some(441), added: 2916, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Attribute` (r:1001 w:1000) + /// Proof: `Nfts::Attribute` (`max_values`: None, `max_size`: Some(455), added: 2930, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// The range of component `n` is `[0, 1000]`. + fn cancel_item_attributes_approval(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `769 + n * (386 ±0)` + // Estimated: `4062 + n * (2930 ±0)` + // Minimum execution time: 32_914_000 picoseconds. + Weight::from_parts(33_415_000, 4062) + // Standard Error: 7_498 + .saturating_add(Weight::from_parts(7_720_860, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes(2_u64)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 2930).saturating_mul(n.into())) + } + /// Storage: `Nfts::CollectionRoleOf` (r:1 w:0) + /// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Collection` (r:1 w:1) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemConfigOf` (r:1 w:0) + /// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionConfigOf` (r:1 w:0) + /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemMetadataOf` (r:1 w:1) + /// Proof: `Nfts::ItemMetadataOf` (`max_values`: None, `max_size`: Some(335), added: 2810, mode: `MaxEncodedLen`) + fn set_metadata() -> Weight { + // Proof Size summary in bytes: + // Measured: `514` + // Estimated: `3800` + // Minimum execution time: 56_827_000 picoseconds. + Weight::from_parts(57_851_000, 3800) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: `Nfts::CollectionRoleOf` (r:1 w:0) + /// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemMetadataOf` (r:1 w:1) + /// Proof: `Nfts::ItemMetadataOf` (`max_values`: None, `max_size`: Some(335), added: 2810, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Collection` (r:1 w:1) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemConfigOf` (r:1 w:0) + /// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + fn clear_metadata() -> Weight { + // Proof Size summary in bytes: + // Measured: `824` + // Estimated: `3800` + // Minimum execution time: 53_669_000 picoseconds. + Weight::from_parts(54_640_000, 3800) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: `Nfts::CollectionRoleOf` (r:1 w:0) + /// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionConfigOf` (r:1 w:0) + /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Collection` (r:1 w:1) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionMetadataOf` (r:1 w:1) + /// Proof: `Nfts::CollectionMetadataOf` (`max_values`: None, `max_size`: Some(294), added: 2769, mode: `MaxEncodedLen`) + fn set_collection_metadata() -> Weight { + // Proof Size summary in bytes: + // Measured: `373` + // Estimated: `3759` + // Minimum execution time: 51_403_000 picoseconds. + Weight::from_parts(52_206_000, 3759) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: `Nfts::CollectionRoleOf` (r:1 w:0) + /// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Collection` (r:1 w:1) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionConfigOf` (r:1 w:0) + /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionMetadataOf` (r:1 w:1) + /// Proof: `Nfts::CollectionMetadataOf` (`max_values`: None, `max_size`: Some(294), added: 2769, mode: `MaxEncodedLen`) + fn clear_collection_metadata() -> Weight { + // Proof Size summary in bytes: + // Measured: `691` + // Estimated: `3759` + // Minimum execution time: 50_720_000 picoseconds. + Weight::from_parts(51_692_000, 3759) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: `Nfts::Item` (r:1 w:1) + /// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(597), added: 3072, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionConfigOf` (r:1 w:0) + /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + fn approve_transfer() -> Weight { + // Proof Size summary in bytes: + // Measured: `385` + // Estimated: `4062` + // Minimum execution time: 24_116_000 picoseconds. + Weight::from_parts(25_104_000, 4062) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Nfts::Item` (r:1 w:1) + /// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(597), added: 3072, mode: `MaxEncodedLen`) + fn cancel_approval() -> Weight { + // Proof Size summary in bytes: + // Measured: `382` + // Estimated: `4062` + // Minimum execution time: 20_907_000 picoseconds. + Weight::from_parts(21_484_000, 4062) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Nfts::Item` (r:1 w:1) + /// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(597), added: 3072, mode: `MaxEncodedLen`) + fn clear_all_transfer_approvals() -> Weight { + // Proof Size summary in bytes: + // Measured: `382` + // Estimated: `4062` + // Minimum execution time: 19_916_000 picoseconds. + Weight::from_parts(20_689_000, 4062) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Nfts::OwnershipAcceptance` (r:1 w:1) + /// Proof: `Nfts::OwnershipAcceptance` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + fn set_accept_ownership() -> Weight { + // Proof Size summary in bytes: + // Measured: `76` + // Estimated: `3505` + // Minimum execution time: 17_199_000 picoseconds. + Weight::from_parts(17_750_000, 3505) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Nfts::CollectionConfigOf` (r:1 w:1) + /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Collection` (r:1 w:0) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + fn set_collection_max_supply() -> Weight { + // Proof Size summary in bytes: + // Measured: `327` + // Estimated: `3538` + // Minimum execution time: 22_256_000 picoseconds. + Weight::from_parts(22_786_000, 3538) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Nfts::CollectionRoleOf` (r:1 w:0) + /// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionConfigOf` (r:1 w:1) + /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + fn update_mint_settings() -> Weight { + // Proof Size summary in bytes: + // Measured: `311` + // Estimated: `3538` + // Minimum execution time: 21_133_000 picoseconds. + Weight::from_parts(21_821_000, 3538) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Nfts::Item` (r:1 w:0) + /// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(597), added: 3072, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionConfigOf` (r:1 w:0) + /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemConfigOf` (r:1 w:0) + /// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemPriceOf` (r:0 w:1) + /// Proof: `Nfts::ItemPriceOf` (`max_values`: None, `max_size`: Some(77), added: 2552, mode: `MaxEncodedLen`) + fn set_price() -> Weight { + // Proof Size summary in bytes: + // Measured: `493` + // Estimated: `4062` + // Minimum execution time: 30_502_000 picoseconds. + Weight::from_parts(31_519_000, 4062) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Nfts::Item` (r:1 w:1) + /// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(597), added: 3072, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemPriceOf` (r:1 w:1) + /// Proof: `Nfts::ItemPriceOf` (`max_values`: None, `max_size`: Some(77), added: 2552, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Collection` (r:1 w:0) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Attribute` (r:1 w:0) + /// Proof: `Nfts::Attribute` (`max_values`: None, `max_size`: Some(455), added: 2930, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionConfigOf` (r:1 w:0) + /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemConfigOf` (r:1 w:0) + /// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Account` (r:0 w:2) + /// Proof: `Nfts::Account` (`max_values`: None, `max_size`: Some(76), added: 2551, mode: `MaxEncodedLen`) + /// Storage: `Nfts::PendingSwapOf` (r:0 w:1) + /// Proof: `Nfts::PendingSwapOf` (`max_values`: None, `max_size`: Some(71), added: 2546, mode: `MaxEncodedLen`) + fn buy_item() -> Weight { + // Proof Size summary in bytes: + // Measured: `655` + // Estimated: `4062` + // Minimum execution time: 66_549_000 picoseconds. + Weight::from_parts(67_947_000, 4062) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } + /// The range of component `n` is `[0, 10]`. + fn pay_tips(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 3_265_000 picoseconds. + Weight::from_parts(4_739_944, 0) + // Standard Error: 7_976 + .saturating_add(Weight::from_parts(2_546_489, 0).saturating_mul(n.into())) + } + /// Storage: `Nfts::Item` (r:2 w:0) + /// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(597), added: 3072, mode: `MaxEncodedLen`) + /// Storage: `Nfts::PendingSwapOf` (r:0 w:1) + /// Proof: `Nfts::PendingSwapOf` (`max_values`: None, `max_size`: Some(71), added: 2546, mode: `MaxEncodedLen`) + fn create_swap() -> Weight { + // Proof Size summary in bytes: + // Measured: `444` + // Estimated: `7134` + // Minimum execution time: 26_741_000 picoseconds. + Weight::from_parts(27_648_000, 7134) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Nfts::PendingSwapOf` (r:1 w:1) + /// Proof: `Nfts::PendingSwapOf` (`max_values`: None, `max_size`: Some(71), added: 2546, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Item` (r:1 w:0) + /// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(597), added: 3072, mode: `MaxEncodedLen`) + fn cancel_swap() -> Weight { + // Proof Size summary in bytes: + // Measured: `488` + // Estimated: `4062` + // Minimum execution time: 27_430_000 picoseconds. + Weight::from_parts(28_020_000, 4062) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Nfts::Item` (r:2 w:2) + /// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(597), added: 3072, mode: `MaxEncodedLen`) + /// Storage: `Nfts::PendingSwapOf` (r:1 w:2) + /// Proof: `Nfts::PendingSwapOf` (`max_values`: None, `max_size`: Some(71), added: 2546, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Collection` (r:1 w:0) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Attribute` (r:2 w:0) + /// Proof: `Nfts::Attribute` (`max_values`: None, `max_size`: Some(455), added: 2930, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionConfigOf` (r:1 w:0) + /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemConfigOf` (r:2 w:0) + /// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Account` (r:0 w:4) + /// Proof: `Nfts::Account` (`max_values`: None, `max_size`: Some(76), added: 2551, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemPriceOf` (r:0 w:2) + /// Proof: `Nfts::ItemPriceOf` (`max_values`: None, `max_size`: Some(77), added: 2552, mode: `MaxEncodedLen`) + fn claim_swap() -> Weight { + // Proof Size summary in bytes: + // Measured: `771` + // Estimated: `7134` + // Minimum execution time: 109_567_000 picoseconds. + Weight::from_parts(111_480_000, 7134) + .saturating_add(T::DbWeight::get().reads(9_u64)) + .saturating_add(T::DbWeight::get().writes(10_u64)) + } + /// Storage: `Nfts::CollectionRoleOf` (r:2 w:0) + /// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionConfigOf` (r:1 w:0) + /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Item` (r:1 w:1) + /// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(597), added: 3072, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Collection` (r:1 w:1) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemConfigOf` (r:1 w:1) + /// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Attribute` (r:10 w:10) + /// Proof: `Nfts::Attribute` (`max_values`: None, `max_size`: Some(455), added: 2930, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemMetadataOf` (r:1 w:1) + /// Proof: `Nfts::ItemMetadataOf` (`max_values`: None, `max_size`: Some(335), added: 2810, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Account` (r:0 w:1) + /// Proof: `Nfts::Account` (`max_values`: None, `max_size`: Some(76), added: 2551, mode: `MaxEncodedLen`) + /// The range of component `n` is `[0, 10]`. + fn mint_pre_signed(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `580` + // Estimated: `6054 + n * (2930 ±0)` + // Minimum execution time: 159_539_000 picoseconds. + Weight::from_parts(165_962_526, 6054) + // Standard Error: 69_524 + .saturating_add(Weight::from_parts(43_681_845, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes(6_u64)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 2930).saturating_mul(n.into())) + } + /// Storage: `Nfts::Item` (r:1 w:0) + /// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(597), added: 3072, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemAttributesApprovalsOf` (r:1 w:1) + /// Proof: `Nfts::ItemAttributesApprovalsOf` (`max_values`: None, `max_size`: Some(441), added: 2916, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionConfigOf` (r:1 w:0) + /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Collection` (r:1 w:1) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Attribute` (r:10 w:10) + /// Proof: `Nfts::Attribute` (`max_values`: None, `max_size`: Some(455), added: 2930, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// The range of component `n` is `[0, 10]`. + fn set_attributes_pre_signed(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `575` + // Estimated: `4062 + n * (2930 ±0)` + // Minimum execution time: 75_482_000 picoseconds. + Weight::from_parts(89_133_467, 4062) + // Standard Error: 95_313 + .saturating_add(Weight::from_parts(42_327_087, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes(2_u64)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 2930).saturating_mul(n.into())) + } +} diff --git a/operator/runtime/stagenet/src/weights/pallet_payment_streams.rs b/operator/runtime/stagenet/src/weights/pallet_payment_streams.rs new file mode 100644 index 00000000..3ac0c1d5 --- /dev/null +++ b/operator/runtime/stagenet/src/weights/pallet_payment_streams.rs @@ -0,0 +1,449 @@ +// Copyright 2025 DataHaven +// This file is part of DataHaven. + +// DataHaven is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// DataHaven is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with DataHaven. If not, see . + + +//! Autogenerated weights for `pallet_payment_streams` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 51.0.0 +//! DATE: 2026-01-29, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ip-10-0-0-176`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` +//! WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --runtime +// target/production/wbuild/datahaven-stagenet-runtime/datahaven_stagenet_runtime.compact.compressed.wasm +// --pallet +// pallet_payment_streams +// --extrinsic +// +// --header +// ../file_header.txt +// --template +// benchmarking/frame-weight-template.hbs +// --output +// runtime/stagenet/src/weights/pallet_payment_streams.rs +// --steps +// 50 +// --repeat +// 20 + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use sp_std::marker::PhantomData; + +/// Weights for `pallet_payment_streams`. +pub struct WeightInfo(PhantomData); +impl pallet_payment_streams::weights::WeightInfo for WeightInfo { + /// Storage: `Providers::BackupStorageProviders` (r:1 w:0) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:2 w:0) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `Providers::AwaitingTopUpFromProviders` (r:2 w:0) + /// Proof: `Providers::AwaitingTopUpFromProviders` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::FixedRatePaymentStreams` (r:1 w:1) + /// Proof: `PaymentStreams::FixedRatePaymentStreams` (`max_values`: None, `max_size`: Some(125), added: 2600, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::UsersWithoutFunds` (r:1 w:0) + /// Proof: `PaymentStreams::UsersWithoutFunds` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::RegisteredUsers` (r:1 w:1) + /// Proof: `PaymentStreams::RegisteredUsers` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::OnPollTicker` (r:1 w:0) + /// Proof: `PaymentStreams::OnPollTicker` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + fn create_fixed_rate_payment_stream() -> Weight { + // Proof Size summary in bytes: + // Measured: `523` + // Estimated: `6054` + // Minimum execution time: 109_755_000 picoseconds. + Weight::from_parts(111_256_000, 6054) + .saturating_add(T::DbWeight::get().reads(11_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) + } + /// Storage: `Providers::BackupStorageProviders` (r:1 w:0) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::FixedRatePaymentStreams` (r:1 w:1) + /// Proof: `PaymentStreams::FixedRatePaymentStreams` (`max_values`: None, `max_size`: Some(125), added: 2600, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::UsersWithoutFunds` (r:1 w:0) + /// Proof: `PaymentStreams::UsersWithoutFunds` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:2 w:0) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `Providers::AwaitingTopUpFromProviders` (r:2 w:0) + /// Proof: `Providers::AwaitingTopUpFromProviders` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::DynamicRatePaymentStreams` (r:1 w:1) + /// Proof: `PaymentStreams::DynamicRatePaymentStreams` (`max_values`: None, `max_size`: Some(129), added: 2604, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::PrivilegedProviders` (r:1 w:0) + /// Proof: `PaymentStreams::PrivilegedProviders` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::LastChargeableInfo` (r:1 w:0) + /// Proof: `PaymentStreams::LastChargeableInfo` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:3 w:3) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Providers::TotalBspsCapacity` (r:1 w:0) + /// Proof: `Providers::TotalBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Providers::UsedBspsCapacity` (r:1 w:0) + /// Proof: `Providers::UsedBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Parameters::Parameters` (r:4 w:0) + /// Proof: `Parameters::Parameters` (`max_values`: None, `max_size`: Some(381), added: 2856, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::OnPollTicker` (r:1 w:0) + /// Proof: `PaymentStreams::OnPollTicker` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + fn update_fixed_rate_payment_stream() -> Weight { + // Proof Size summary in bytes: + // Measured: `1427` + // Estimated: `12414` + // Minimum execution time: 410_091_000 picoseconds. + Weight::from_parts(423_942_000, 12414) + .saturating_add(T::DbWeight::get().reads(21_u64)) + .saturating_add(T::DbWeight::get().writes(6_u64)) + } + /// Storage: `Providers::BackupStorageProviders` (r:1 w:0) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::FixedRatePaymentStreams` (r:1 w:1) + /// Proof: `PaymentStreams::FixedRatePaymentStreams` (`max_values`: None, `max_size`: Some(125), added: 2600, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:2 w:0) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `Providers::AwaitingTopUpFromProviders` (r:2 w:0) + /// Proof: `Providers::AwaitingTopUpFromProviders` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::DynamicRatePaymentStreams` (r:1 w:0) + /// Proof: `PaymentStreams::DynamicRatePaymentStreams` (`max_values`: None, `max_size`: Some(129), added: 2604, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::PrivilegedProviders` (r:1 w:0) + /// Proof: `PaymentStreams::PrivilegedProviders` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::LastChargeableInfo` (r:1 w:0) + /// Proof: `PaymentStreams::LastChargeableInfo` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::UsersWithoutFunds` (r:1 w:0) + /// Proof: `PaymentStreams::UsersWithoutFunds` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:3 w:3) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Providers::TotalBspsCapacity` (r:1 w:0) + /// Proof: `Providers::TotalBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Providers::UsedBspsCapacity` (r:1 w:0) + /// Proof: `Providers::UsedBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Parameters::Parameters` (r:4 w:0) + /// Proof: `Parameters::Parameters` (`max_values`: None, `max_size`: Some(381), added: 2856, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::OnPollTicker` (r:1 w:0) + /// Proof: `PaymentStreams::OnPollTicker` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::RegisteredUsers` (r:1 w:1) + /// Proof: `PaymentStreams::RegisteredUsers` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + fn delete_fixed_rate_payment_stream() -> Weight { + // Proof Size summary in bytes: + // Measured: `1304` + // Estimated: `12414` + // Minimum execution time: 299_884_000 picoseconds. + Weight::from_parts(304_140_000, 12414) + .saturating_add(T::DbWeight::get().reads(22_u64)) + .saturating_add(T::DbWeight::get().writes(6_u64)) + } + /// Storage: `Providers::BackupStorageProviders` (r:1 w:0) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:2 w:0) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `Providers::AwaitingTopUpFromProviders` (r:2 w:0) + /// Proof: `Providers::AwaitingTopUpFromProviders` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::DynamicRatePaymentStreams` (r:1 w:1) + /// Proof: `PaymentStreams::DynamicRatePaymentStreams` (`max_values`: None, `max_size`: Some(129), added: 2604, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::UsersWithoutFunds` (r:1 w:0) + /// Proof: `PaymentStreams::UsersWithoutFunds` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::CurrentPricePerGigaUnitPerTick` (r:1 w:0) + /// Proof: `PaymentStreams::CurrentPricePerGigaUnitPerTick` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::RegisteredUsers` (r:1 w:1) + /// Proof: `PaymentStreams::RegisteredUsers` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::AccumulatedPriceIndex` (r:1 w:0) + /// Proof: `PaymentStreams::AccumulatedPriceIndex` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + fn create_dynamic_rate_payment_stream() -> Weight { + // Proof Size summary in bytes: + // Measured: `525` + // Estimated: `6054` + // Minimum execution time: 111_177_000 picoseconds. + Weight::from_parts(113_406_000, 6054) + .saturating_add(T::DbWeight::get().reads(12_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) + } + /// Storage: `Providers::BackupStorageProviders` (r:1 w:0) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::DynamicRatePaymentStreams` (r:1 w:1) + /// Proof: `PaymentStreams::DynamicRatePaymentStreams` (`max_values`: None, `max_size`: Some(129), added: 2604, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::UsersWithoutFunds` (r:1 w:0) + /// Proof: `PaymentStreams::UsersWithoutFunds` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:2 w:0) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `Providers::AwaitingTopUpFromProviders` (r:2 w:0) + /// Proof: `Providers::AwaitingTopUpFromProviders` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::FixedRatePaymentStreams` (r:1 w:1) + /// Proof: `PaymentStreams::FixedRatePaymentStreams` (`max_values`: None, `max_size`: Some(125), added: 2600, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::PrivilegedProviders` (r:1 w:0) + /// Proof: `PaymentStreams::PrivilegedProviders` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::LastChargeableInfo` (r:1 w:0) + /// Proof: `PaymentStreams::LastChargeableInfo` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:3 w:3) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Providers::TotalBspsCapacity` (r:1 w:0) + /// Proof: `Providers::TotalBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Providers::UsedBspsCapacity` (r:1 w:0) + /// Proof: `Providers::UsedBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Parameters::Parameters` (r:4 w:0) + /// Proof: `Parameters::Parameters` (`max_values`: None, `max_size`: Some(381), added: 2856, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::OnPollTicker` (r:1 w:0) + /// Proof: `PaymentStreams::OnPollTicker` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::CurrentPricePerGigaUnitPerTick` (r:1 w:0) + /// Proof: `PaymentStreams::CurrentPricePerGigaUnitPerTick` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + fn update_dynamic_rate_payment_stream() -> Weight { + // Proof Size summary in bytes: + // Measured: `1387` + // Estimated: `12414` + // Minimum execution time: 367_704_000 picoseconds. + Weight::from_parts(372_410_000, 12414) + .saturating_add(T::DbWeight::get().reads(21_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } + /// Storage: `Providers::BackupStorageProviders` (r:1 w:0) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::DynamicRatePaymentStreams` (r:1 w:1) + /// Proof: `PaymentStreams::DynamicRatePaymentStreams` (`max_values`: None, `max_size`: Some(129), added: 2604, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:2 w:0) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `Providers::AwaitingTopUpFromProviders` (r:2 w:0) + /// Proof: `Providers::AwaitingTopUpFromProviders` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::FixedRatePaymentStreams` (r:1 w:1) + /// Proof: `PaymentStreams::FixedRatePaymentStreams` (`max_values`: None, `max_size`: Some(125), added: 2600, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::PrivilegedProviders` (r:1 w:0) + /// Proof: `PaymentStreams::PrivilegedProviders` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::LastChargeableInfo` (r:1 w:0) + /// Proof: `PaymentStreams::LastChargeableInfo` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::UsersWithoutFunds` (r:1 w:0) + /// Proof: `PaymentStreams::UsersWithoutFunds` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:3 w:3) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Providers::TotalBspsCapacity` (r:1 w:0) + /// Proof: `Providers::TotalBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Providers::UsedBspsCapacity` (r:1 w:0) + /// Proof: `Providers::UsedBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Parameters::Parameters` (r:4 w:0) + /// Proof: `Parameters::Parameters` (`max_values`: None, `max_size`: Some(381), added: 2856, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::OnPollTicker` (r:1 w:0) + /// Proof: `PaymentStreams::OnPollTicker` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::RegisteredUsers` (r:1 w:1) + /// Proof: `PaymentStreams::RegisteredUsers` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + fn delete_dynamic_rate_payment_stream() -> Weight { + // Proof Size summary in bytes: + // Measured: `1455` + // Estimated: `12414` + // Minimum execution time: 408_008_000 picoseconds. + Weight::from_parts(420_144_000, 12414) + .saturating_add(T::DbWeight::get().reads(22_u64)) + .saturating_add(T::DbWeight::get().writes(7_u64)) + } + /// Storage: `Providers::AccountIdToBackupStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToBackupStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:2 w:0) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `Providers::AwaitingTopUpFromProviders` (r:2 w:0) + /// Proof: `Providers::AwaitingTopUpFromProviders` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Providers::BackupStorageProviders` (r:1 w:0) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::FixedRatePaymentStreams` (r:1 w:1) + /// Proof: `PaymentStreams::FixedRatePaymentStreams` (`max_values`: None, `max_size`: Some(125), added: 2600, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::DynamicRatePaymentStreams` (r:1 w:1) + /// Proof: `PaymentStreams::DynamicRatePaymentStreams` (`max_values`: None, `max_size`: Some(129), added: 2604, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::PrivilegedProviders` (r:1 w:0) + /// Proof: `PaymentStreams::PrivilegedProviders` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::LastChargeableInfo` (r:1 w:0) + /// Proof: `PaymentStreams::LastChargeableInfo` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::UsersWithoutFunds` (r:1 w:0) + /// Proof: `PaymentStreams::UsersWithoutFunds` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:3 w:3) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Providers::TotalBspsCapacity` (r:1 w:0) + /// Proof: `Providers::TotalBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Providers::UsedBspsCapacity` (r:1 w:0) + /// Proof: `Providers::UsedBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Parameters::Parameters` (r:4 w:0) + /// Proof: `Parameters::Parameters` (`max_values`: None, `max_size`: Some(381), added: 2856, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::OnPollTicker` (r:1 w:0) + /// Proof: `PaymentStreams::OnPollTicker` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + fn charge_payment_streams() -> Weight { + // Proof Size summary in bytes: + // Measured: `1441` + // Estimated: `12414` + // Minimum execution time: 341_010_000 picoseconds. + Weight::from_parts(353_585_000, 12414) + .saturating_add(T::DbWeight::get().reads(21_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } + /// Storage: `Providers::AccountIdToBackupStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToBackupStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::OnPollTicker` (r:1 w:0) + /// Proof: `PaymentStreams::OnPollTicker` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:2 w:0) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `Providers::AwaitingTopUpFromProviders` (r:2 w:0) + /// Proof: `Providers::AwaitingTopUpFromProviders` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Providers::BackupStorageProviders` (r:1 w:0) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::FixedRatePaymentStreams` (r:10 w:10) + /// Proof: `PaymentStreams::FixedRatePaymentStreams` (`max_values`: None, `max_size`: Some(125), added: 2600, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::DynamicRatePaymentStreams` (r:10 w:10) + /// Proof: `PaymentStreams::DynamicRatePaymentStreams` (`max_values`: None, `max_size`: Some(129), added: 2604, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::PrivilegedProviders` (r:1 w:0) + /// Proof: `PaymentStreams::PrivilegedProviders` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::LastChargeableInfo` (r:1 w:0) + /// Proof: `PaymentStreams::LastChargeableInfo` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::UsersWithoutFunds` (r:10 w:0) + /// Proof: `PaymentStreams::UsersWithoutFunds` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:12 w:12) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Providers::TotalBspsCapacity` (r:1 w:0) + /// Proof: `Providers::TotalBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Providers::UsedBspsCapacity` (r:1 w:0) + /// Proof: `Providers::UsedBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Parameters::Parameters` (r:4 w:0) + /// Proof: `Parameters::Parameters` (`max_values`: None, `max_size`: Some(381), added: 2856, mode: `MaxEncodedLen`) + /// The range of component `n` is `[0, 10]`. + fn charge_multiple_users_payment_streams(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `1122 + n * (331 ±0)` + // Estimated: `12414 + n * (2604 ±0)` + // Minimum execution time: 20_290_000 picoseconds. + Weight::from_parts(44_658_677, 12414) + // Standard Error: 159_356 + .saturating_add(Weight::from_parts(299_090_828, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(12_u64)) + .saturating_add(T::DbWeight::get().reads((5_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes(1_u64)) + .saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 2604).saturating_mul(n.into())) + } + /// Storage: `PaymentStreams::UsersWithoutFunds` (r:1 w:0) + /// Proof: `PaymentStreams::UsersWithoutFunds` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1001 w:1001) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Providers::TotalBspsCapacity` (r:1 w:0) + /// Proof: `Providers::TotalBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Providers::UsedBspsCapacity` (r:1 w:0) + /// Proof: `Providers::UsedBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::FixedRatePaymentStreams` (r:999 w:999) + /// Proof: `PaymentStreams::FixedRatePaymentStreams` (`max_values`: None, `max_size`: Some(125), added: 2600, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::DynamicRatePaymentStreams` (r:999 w:999) + /// Proof: `PaymentStreams::DynamicRatePaymentStreams` (`max_values`: None, `max_size`: Some(129), added: 2604, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::PrivilegedProviders` (r:999 w:0) + /// Proof: `PaymentStreams::PrivilegedProviders` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::LastChargeableInfo` (r:999 w:0) + /// Proof: `PaymentStreams::LastChargeableInfo` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Parameters::Parameters` (r:4 w:0) + /// Proof: `Parameters::Parameters` (`max_values`: None, `max_size`: Some(381), added: 2856, mode: `MaxEncodedLen`) + /// Storage: `Providers::BackupStorageProviders` (r:999 w:0) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::RegisteredUsers` (r:1 w:1) + /// Proof: `PaymentStreams::RegisteredUsers` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 1000]`. + fn pay_outstanding_debt(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `1422 + n * (644 ±0)` + // Estimated: `12414 + n * (3634 ±0)` + // Minimum execution time: 382_387_000 picoseconds. + Weight::from_parts(386_938_000, 12414) + // Standard Error: 160_843 + .saturating_add(Weight::from_parts(288_094_697, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(11_u64)) + .saturating_add(T::DbWeight::get().reads((6_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes(4_u64)) + .saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 3634).saturating_mul(n.into())) + } + /// Storage: `PaymentStreams::UsersWithoutFunds` (r:1 w:1) + /// Proof: `PaymentStreams::UsersWithoutFunds` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::OnPollTicker` (r:1 w:0) + /// Proof: `PaymentStreams::OnPollTicker` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::RegisteredUsers` (r:1 w:0) + /// Proof: `PaymentStreams::RegisteredUsers` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + fn clear_insolvent_flag() -> Weight { + // Proof Size summary in bytes: + // Measured: `231` + // Estimated: `3505` + // Minimum execution time: 22_156_000 picoseconds. + Weight::from_parts(23_278_000, 3505) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `PaymentStreams::CurrentPricePerGigaUnitPerTick` (r:1 w:0) + /// Proof: `PaymentStreams::CurrentPricePerGigaUnitPerTick` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::AccumulatedPriceIndex` (r:1 w:1) + /// Proof: `PaymentStreams::AccumulatedPriceIndex` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + fn price_index_update() -> Weight { + // Proof Size summary in bytes: + // Measured: `116` + // Estimated: `1501` + // Minimum execution time: 5_701_000 picoseconds. + Weight::from_parts(6_021_000, 1501) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `PaymentStreams::OnPollTicker` (r:1 w:1) + /// Proof: `PaymentStreams::OnPollTicker` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + fn tick_update() -> Weight { + // Proof Size summary in bytes: + // Measured: `114` + // Estimated: `1489` + // Minimum execution time: 3_827_000 picoseconds. + Weight::from_parts(4_161_000, 1489) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `ProofsDealer::ChallengesTicker` (r:1 w:0) + /// Proof: `ProofsDealer::ChallengesTicker` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::LastSubmittersTickRegistered` (r:1 w:1) + /// Proof: `PaymentStreams::LastSubmittersTickRegistered` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::ValidProofSubmittersLastTicks` (r:1 w:0) + /// Proof: `ProofsDealer::ValidProofSubmittersLastTicks` (`max_values`: None, `max_size`: Some(7830), added: 10305, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::AccumulatedPriceIndex` (r:1 w:0) + /// Proof: `PaymentStreams::AccumulatedPriceIndex` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::LastChargeableInfo` (r:244 w:244) + /// Proof: `PaymentStreams::LastChargeableInfo` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// The range of component `n` is `[0, 244]`. + fn update_providers_last_chargeable_info(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `270 + n * (32 ±0)` + // Estimated: `11295 + n * (2543 ±0)` + // Minimum execution time: 12_555_000 picoseconds. + Weight::from_parts(10_548_186, 11295) + // Standard Error: 4_805 + .saturating_add(Weight::from_parts(7_024_412, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes(1_u64)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 2543).saturating_mul(n.into())) + } +} diff --git a/operator/runtime/stagenet/src/weights/pallet_proofs_dealer.rs b/operator/runtime/stagenet/src/weights/pallet_proofs_dealer.rs new file mode 100644 index 00000000..8fb40c96 --- /dev/null +++ b/operator/runtime/stagenet/src/weights/pallet_proofs_dealer.rs @@ -0,0 +1,326 @@ +// Copyright 2025 DataHaven +// This file is part of DataHaven. + +// DataHaven is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// DataHaven is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with DataHaven. If not, see . + + +//! Autogenerated weights for `pallet_proofs_dealer` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 51.0.0 +//! DATE: 2026-01-29, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ip-10-0-0-176`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` +//! WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --runtime +// target/production/wbuild/datahaven-stagenet-runtime/datahaven_stagenet_runtime.compact.compressed.wasm +// --pallet +// pallet_proofs_dealer +// --extrinsic +// +// --header +// ../file_header.txt +// --template +// benchmarking/frame-weight-template.hbs +// --output +// runtime/stagenet/src/weights/pallet_proofs_dealer.rs +// --steps +// 50 +// --repeat +// 20 + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use sp_std::marker::PhantomData; + +/// Weights for `pallet_proofs_dealer`. +pub struct WeightInfo(PhantomData); +impl pallet_proofs_dealer::weights::WeightInfo for WeightInfo { + /// Storage: `ProofsDealer::ChallengesQueue` (r:1 w:1) + /// Proof: `ProofsDealer::ChallengesQueue` (`max_values`: Some(1), `max_size`: Some(3202), added: 3697, mode: `MaxEncodedLen`) + fn challenge() -> Weight { + // Proof Size summary in bytes: + // Measured: `41` + // Estimated: `4687` + // Minimum execution time: 11_702_000 picoseconds. + Weight::from_parts(12_152_000, 4687) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Providers::AccountIdToBackupStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToBackupStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::BackupStorageProviders` (r:1 w:1) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::ProviderToProofSubmissionRecord` (r:1 w:1) + /// Proof: `ProofsDealer::ProviderToProofSubmissionRecord` (`max_values`: None, `max_size`: Some(56), added: 2531, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:2 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::ChallengesTicker` (r:1 w:0) + /// Proof: `ProofsDealer::ChallengesTicker` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::TickToChallengesSeed` (r:1 w:0) + /// Proof: `ProofsDealer::TickToChallengesSeed` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::LastCheckpointTick` (r:1 w:0) + /// Proof: `ProofsDealer::LastCheckpointTick` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::TickToCheckpointChallenges` (r:1 w:0) + /// Proof: `ProofsDealer::TickToCheckpointChallenges` (`max_values`: None, `max_size`: Some(681), added: 3156, mode: `MaxEncodedLen`) + /// Storage: `Providers::MainStorageProviders` (r:1 w:0) + /// Proof: `Providers::MainStorageProviders` (`max_values`: None, `max_size`: Some(1143), added: 3618, mode: `MaxEncodedLen`) + /// Storage: `Providers::UsedBspsCapacity` (r:1 w:1) + /// Proof: `Providers::UsedBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::UsersWithoutFunds` (r:1 w:0) + /// Proof: `PaymentStreams::UsersWithoutFunds` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::DynamicRatePaymentStreams` (r:1 w:1) + /// Proof: `PaymentStreams::DynamicRatePaymentStreams` (`max_values`: None, `max_size`: Some(129), added: 2604, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:2 w:0) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `Providers::AwaitingTopUpFromProviders` (r:2 w:0) + /// Proof: `Providers::AwaitingTopUpFromProviders` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::FixedRatePaymentStreams` (r:1 w:0) + /// Proof: `PaymentStreams::FixedRatePaymentStreams` (`max_values`: None, `max_size`: Some(125), added: 2600, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::PrivilegedProviders` (r:1 w:0) + /// Proof: `PaymentStreams::PrivilegedProviders` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::LastChargeableInfo` (r:1 w:0) + /// Proof: `PaymentStreams::LastChargeableInfo` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:2 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Providers::TotalBspsCapacity` (r:1 w:0) + /// Proof: `Providers::TotalBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Parameters::Parameters` (r:5 w:0) + /// Proof: `Parameters::Parameters` (`max_values`: None, `max_size`: Some(381), added: 2856, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::CurrentPricePerGigaUnitPerTick` (r:1 w:0) + /// Proof: `PaymentStreams::CurrentPricePerGigaUnitPerTick` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::ValidProofSubmittersLastTicks` (r:1 w:1) + /// Proof: `ProofsDealer::ValidProofSubmittersLastTicks` (`max_values`: None, `max_size`: Some(7830), added: 10305, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::TickToProvidersDeadlines` (r:0 w:2) + /// Proof: `ProofsDealer::TickToProvidersDeadlines` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 20]`. + fn submit_proof_no_checkpoint_challenges_key_proofs(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `2070` + // Estimated: `15270` + // Minimum execution time: 2_158_744_000 picoseconds. + Weight::from_parts(2_068_488_029, 15270) + // Standard Error: 330_919 + .saturating_add(Weight::from_parts(133_424_014, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(30_u64)) + .saturating_add(T::DbWeight::get().writes(9_u64)) + } + /// Storage: `Providers::AccountIdToBackupStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToBackupStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::BackupStorageProviders` (r:1 w:0) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::ProviderToProofSubmissionRecord` (r:1 w:1) + /// Proof: `ProofsDealer::ProviderToProofSubmissionRecord` (`max_values`: None, `max_size`: Some(56), added: 2531, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:0) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::ChallengesTicker` (r:1 w:0) + /// Proof: `ProofsDealer::ChallengesTicker` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::TickToChallengesSeed` (r:1 w:0) + /// Proof: `ProofsDealer::TickToChallengesSeed` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::LastCheckpointTick` (r:1 w:0) + /// Proof: `ProofsDealer::LastCheckpointTick` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::TickToCheckpointChallenges` (r:1 w:0) + /// Proof: `ProofsDealer::TickToCheckpointChallenges` (`max_values`: None, `max_size`: Some(681), added: 3156, mode: `MaxEncodedLen`) + /// Storage: `Parameters::Parameters` (r:1 w:0) + /// Proof: `Parameters::Parameters` (`max_values`: None, `max_size`: Some(381), added: 2856, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::ValidProofSubmittersLastTicks` (r:1 w:1) + /// Proof: `ProofsDealer::ValidProofSubmittersLastTicks` (`max_values`: None, `max_size`: Some(7830), added: 10305, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::TickToProvidersDeadlines` (r:0 w:2) + /// Proof: `ProofsDealer::TickToProvidersDeadlines` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::MainStorageProviders` (r:1 w:0) + /// Proof: `Providers::MainStorageProviders` (`max_values`: None, `max_size`: Some(1143), added: 3618, mode: `MaxEncodedLen`) + /// Storage: `Providers::UsedBspsCapacity` (r:1 w:1) + /// Proof: `Providers::UsedBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::UsersWithoutFunds` (r:1 w:0) + /// Proof: `PaymentStreams::UsersWithoutFunds` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::DynamicRatePaymentStreams` (r:1 w:1) + /// Proof: `PaymentStreams::DynamicRatePaymentStreams` (`max_values`: None, `max_size`: Some(129), added: 2604, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:2 w:0) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `Providers::AwaitingTopUpFromProviders` (r:2 w:0) + /// Proof: `Providers::AwaitingTopUpFromProviders` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::FixedRatePaymentStreams` (r:1 w:0) + /// Proof: `PaymentStreams::FixedRatePaymentStreams` (`max_values`: None, `max_size`: Some(125), added: 2600, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::PrivilegedProviders` (r:1 w:0) + /// Proof: `PaymentStreams::PrivilegedProviders` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::LastChargeableInfo` (r:1 w:0) + /// Proof: `PaymentStreams::LastChargeableInfo` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:2 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Providers::TotalBspsCapacity` (r:1 w:0) + /// Proof: `Providers::TotalBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::CurrentPricePerGigaUnitPerTick` (r:1 w:0) + /// Proof: `PaymentStreams::CurrentPricePerGigaUnitPerTick` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// The range of component `n` is `[21, 40]`. + fn submit_proof_with_checkpoint_challenges_key_proofs(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `2070` + // Estimated: `20676` + // Minimum execution time: 4_534_427_000 picoseconds. + Weight::from_parts(3_936_459_939, 20676) + // Standard Error: 918_274 + .saturating_add(Weight::from_parts(38_816_629, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(39_u64)) + .saturating_add(T::DbWeight::get().writes(11_u64)) + } + /// Storage: `ProofsDealer::ChallengesTicker` (r:1 w:1) + /// Proof: `ProofsDealer::ChallengesTicker` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Randomness::LatestParentBlockRandomness` (r:1 w:0) + /// Proof: `Randomness::LatestParentBlockRandomness` (`max_values`: Some(1), `max_size`: Some(36), added: 531, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::LastCheckpointTick` (r:1 w:0) + /// Proof: `ProofsDealer::LastCheckpointTick` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::TickToCheckpointChallenges` (r:1 w:0) + /// Proof: `ProofsDealer::TickToCheckpointChallenges` (`max_values`: None, `max_size`: Some(681), added: 3156, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::TickToCheckForSlashableProviders` (r:1 w:1) + /// Proof: `ProofsDealer::TickToCheckForSlashableProviders` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::TickToProvidersDeadlines` (r:1001 w:2000) + /// Proof: `ProofsDealer::TickToProvidersDeadlines` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::ProviderToProofSubmissionRecord` (r:1000 w:1000) + /// Proof: `ProofsDealer::ProviderToProofSubmissionRecord` (`max_values`: None, `max_size`: Some(56), added: 2531, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::SlashableProviders` (r:1000 w:1000) + /// Proof: `ProofsDealer::SlashableProviders` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + /// Storage: `Providers::BackupStorageProviders` (r:1000 w:0) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1000 w:0) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `Parameters::Parameters` (r:1 w:0) + /// Proof: `Parameters::Parameters` (`max_values`: None, `max_size`: Some(381), added: 2856, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::TickToChallengesSeed` (r:0 w:1) + /// Proof: `ProofsDealer::TickToChallengesSeed` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + /// The range of component `n` is `[0, 1000]`. + fn new_challenges_round(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `1155 + n * (271 ±0)` + // Estimated: `6172 + n * (3634 ±0)` + // Minimum execution time: 29_919_000 picoseconds. + Weight::from_parts(30_247_000, 6172) + // Standard Error: 50_330 + .saturating_add(Weight::from_parts(40_561_686, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().reads((5_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(T::DbWeight::get().writes((4_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 3634).saturating_mul(n.into())) + } + /// Storage: `ProofsDealer::PriorityChallengesQueue` (r:1 w:1) + /// Proof: `ProofsDealer::PriorityChallengesQueue` (`max_values`: Some(1), `max_size`: Some(3302), added: 3797, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::ChallengesQueue` (r:1 w:1) + /// Proof: `ProofsDealer::ChallengesQueue` (`max_values`: Some(1), `max_size`: Some(3202), added: 3697, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::LastCheckpointTick` (r:1 w:1) + /// Proof: `ProofsDealer::LastCheckpointTick` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::TickToCheckpointChallenges` (r:0 w:2) + /// Proof: `ProofsDealer::TickToCheckpointChallenges` (`max_values`: None, `max_size`: Some(681), added: 3156, mode: `MaxEncodedLen`) + /// The range of component `n` is `[0, 20]`. + fn new_checkpoint_challenge_round(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `65 + n * (32 ±0)` + // Estimated: `4787` + // Minimum execution time: 14_102_000 picoseconds. + Weight::from_parts(16_065_088, 4787) + // Standard Error: 3_474 + .saturating_add(Weight::from_parts(431_594, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } + /// Storage: `ProofsDealer::PastBlocksStatus` (r:1 w:1) + /// Proof: `ProofsDealer::PastBlocksStatus` (`max_values`: Some(1), `max_size`: Some(51), added: 546, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::PastBlocksWeight` (r:1 w:0) + /// Proof: `ProofsDealer::PastBlocksWeight` (`max_values`: None, `max_size`: Some(36), added: 2511, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::ChallengesTicker` (r:1 w:0) + /// Proof: `ProofsDealer::ChallengesTicker` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::ChallengesTickerPaused` (r:0 w:1) + /// Proof: `ProofsDealer::ChallengesTickerPaused` (`max_values`: Some(1), `max_size`: Some(0), added: 495, mode: `MaxEncodedLen`) + fn check_spamming_condition() -> Weight { + // Proof Size summary in bytes: + // Measured: `248` + // Estimated: `3501` + // Minimum execution time: 14_156_000 picoseconds. + Weight::from_parts(14_699_000, 3501) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: `ProofsDealer::LastDeletedTick` (r:1 w:0) + /// Proof: `ProofsDealer::LastDeletedTick` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::ChallengesTicker` (r:1 w:0) + /// Proof: `ProofsDealer::ChallengesTicker` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + fn trim_valid_proof_submitters_last_ticks_constant_execution() -> Weight { + // Proof Size summary in bytes: + // Measured: `41` + // Estimated: `1489` + // Minimum execution time: 4_462_000 picoseconds. + Weight::from_parts(4_676_000, 1489) + .saturating_add(T::DbWeight::get().reads(2_u64)) + } + /// Storage: `ProofsDealer::LastDeletedTick` (r:0 w:1) + /// Proof: `ProofsDealer::LastDeletedTick` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::ValidProofSubmittersLastTicks` (r:0 w:1) + /// Proof: `ProofsDealer::ValidProofSubmittersLastTicks` (`max_values`: None, `max_size`: Some(7830), added: 10305, mode: `MaxEncodedLen`) + fn trim_valid_proof_submitters_last_ticks_loop() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 2_654_000 picoseconds. + Weight::from_parts(2_799_000, 0) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: `ProofsDealer::PastBlocksWeight` (r:0 w:2) + /// Proof: `ProofsDealer::PastBlocksWeight` (`max_values`: None, `max_size`: Some(36), added: 2511, mode: `MaxEncodedLen`) + fn on_finalize() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 4_988_000 picoseconds. + Weight::from_parts(5_139_000, 0) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: `Providers::BackupStorageProviders` (r:1 w:0) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:0) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::ProviderToProofSubmissionRecord` (r:1 w:1) + /// Proof: `ProofsDealer::ProviderToProofSubmissionRecord` (`max_values`: None, `max_size`: Some(56), added: 2531, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::ChallengesTicker` (r:1 w:0) + /// Proof: `ProofsDealer::ChallengesTicker` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Parameters::Parameters` (r:1 w:0) + /// Proof: `Parameters::Parameters` (`max_values`: None, `max_size`: Some(381), added: 2856, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::TickToProvidersDeadlines` (r:0 w:1) + /// Proof: `ProofsDealer::TickToProvidersDeadlines` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + fn force_initialise_challenge_cycle() -> Weight { + // Proof Size summary in bytes: + // Measured: `552` + // Estimated: `4624` + // Minimum execution time: 45_404_000 picoseconds. + Weight::from_parts(46_675_000, 4624) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: `ProofsDealer::ChallengesTickerPaused` (r:0 w:1) + /// Proof: `ProofsDealer::ChallengesTickerPaused` (`max_values`: Some(1), `max_size`: Some(0), added: 495, mode: `MaxEncodedLen`) + fn set_paused() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 7_538_000 picoseconds. + Weight::from_parts(7_804_000, 0) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } +} diff --git a/operator/runtime/stagenet/src/weights/pallet_session.rs b/operator/runtime/stagenet/src/weights/pallet_session.rs new file mode 100644 index 00000000..9c65f513 --- /dev/null +++ b/operator/runtime/stagenet/src/weights/pallet_session.rs @@ -0,0 +1,84 @@ +// Copyright 2025 DataHaven +// This file is part of DataHaven. + +// DataHaven is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// DataHaven is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with DataHaven. If not, see . + + +//! Autogenerated weights for `pallet_session` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 51.0.0 +//! DATE: 2026-01-29, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ip-10-0-0-176`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` +//! WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --runtime +// target/production/wbuild/datahaven-stagenet-runtime/datahaven_stagenet_runtime.compact.compressed.wasm +// --pallet +// pallet_session +// --extrinsic +// +// --header +// ../file_header.txt +// --template +// benchmarking/frame-weight-template.hbs +// --output +// runtime/stagenet/src/weights/pallet_session.rs +// --steps +// 50 +// --repeat +// 20 + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use sp_std::marker::PhantomData; + +/// Weights for `pallet_session`. +pub struct WeightInfo(PhantomData); +impl pallet_session::WeightInfo for WeightInfo { + /// Storage: `Session::NextKeys` (r:1 w:1) + /// Proof: `Session::NextKeys` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Session::KeyOwner` (r:4 w:4) + /// Proof: `Session::KeyOwner` (`max_values`: None, `max_size`: None, mode: `Measured`) + fn set_keys() -> Weight { + // Proof Size summary in bytes: + // Measured: `350` + // Estimated: `11240` + // Minimum execution time: 37_322_000 picoseconds. + Weight::from_parts(38_272_000, 11240) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } + /// Storage: `Session::NextKeys` (r:1 w:1) + /// Proof: `Session::NextKeys` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Session::KeyOwner` (r:0 w:4) + /// Proof: `Session::KeyOwner` (`max_values`: None, `max_size`: None, mode: `Measured`) + fn purge_keys() -> Weight { + // Proof Size summary in bytes: + // Measured: `328` + // Estimated: `3793` + // Minimum execution time: 21_685_000 picoseconds. + Weight::from_parts(22_489_000, 3793) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } +} diff --git a/operator/runtime/stagenet/src/weights/pallet_storage_providers.rs b/operator/runtime/stagenet/src/weights/pallet_storage_providers.rs new file mode 100644 index 00000000..005a1700 --- /dev/null +++ b/operator/runtime/stagenet/src/weights/pallet_storage_providers.rs @@ -0,0 +1,630 @@ +// Copyright 2025 DataHaven +// This file is part of DataHaven. + +// DataHaven is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// DataHaven is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with DataHaven. If not, see . + + +//! Autogenerated weights for `pallet_storage_providers` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 51.0.0 +//! DATE: 2026-01-29, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ip-10-0-0-176`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` +//! WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --runtime +// target/production/wbuild/datahaven-stagenet-runtime/datahaven_stagenet_runtime.compact.compressed.wasm +// --pallet +// pallet_storage_providers +// --extrinsic +// +// --header +// ../file_header.txt +// --template +// benchmarking/frame-weight-template.hbs +// --output +// runtime/stagenet/src/weights/pallet_storage_providers.rs +// --steps +// 50 +// --repeat +// 20 + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use sp_std::marker::PhantomData; + +/// Weights for `pallet_storage_providers`. +pub struct WeightInfo(PhantomData); +impl pallet_storage_providers::weights::WeightInfo for WeightInfo { + /// Storage: `Providers::SignUpRequests` (r:1 w:1) + /// Proof: `Providers::SignUpRequests` (`max_values`: None, `max_size`: Some(2163), added: 4638, mode: `MaxEncodedLen`) + /// Storage: `Providers::AccountIdToMainStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToMainStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::AccountIdToBackupStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToBackupStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + fn request_msp_sign_up() -> Weight { + // Proof Size summary in bytes: + // Measured: `270` + // Estimated: `5628` + // Minimum execution time: 90_021_000 picoseconds. + Weight::from_parts(92_670_000, 5628) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: `Providers::SignUpRequests` (r:1 w:1) + /// Proof: `Providers::SignUpRequests` (`max_values`: None, `max_size`: Some(2163), added: 4638, mode: `MaxEncodedLen`) + /// Storage: `Providers::AccountIdToMainStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToMainStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::AccountIdToBackupStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToBackupStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + fn request_bsp_sign_up() -> Weight { + // Proof Size summary in bytes: + // Measured: `270` + // Estimated: `5628` + // Minimum execution time: 91_611_000 picoseconds. + Weight::from_parts(93_053_000, 5628) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: `Providers::SignUpRequests` (r:1 w:1) + /// Proof: `Providers::SignUpRequests` (`max_values`: None, `max_size`: Some(2163), added: 4638, mode: `MaxEncodedLen`) + /// Storage: `Randomness::LatestOneEpochAgoRandomness` (r:1 w:0) + /// Proof: `Randomness::LatestOneEpochAgoRandomness` (`max_values`: Some(1), `max_size`: Some(36), added: 531, mode: `MaxEncodedLen`) + /// Storage: `Providers::TotalBspsCapacity` (r:1 w:1) + /// Proof: `Providers::TotalBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Providers::BspCount` (r:1 w:1) + /// Proof: `Providers::BspCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Providers::GlobalBspsReputationWeight` (r:1 w:1) + /// Proof: `Providers::GlobalBspsReputationWeight` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Providers::AccountIdToBackupStorageProviderId` (r:0 w:1) + /// Proof: `Providers::AccountIdToBackupStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::BackupStorageProviders` (r:0 w:1) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + fn confirm_sign_up_bsp() -> Weight { + // Proof Size summary in bytes: + // Measured: `474` + // Estimated: `5628` + // Minimum execution time: 38_428_000 picoseconds. + Weight::from_parts(39_861_000, 5628) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(6_u64)) + } + /// Storage: `Providers::SignUpRequests` (r:1 w:1) + /// Proof: `Providers::SignUpRequests` (`max_values`: None, `max_size`: Some(2163), added: 4638, mode: `MaxEncodedLen`) + /// Storage: `Randomness::LatestOneEpochAgoRandomness` (r:1 w:0) + /// Proof: `Randomness::LatestOneEpochAgoRandomness` (`max_values`: Some(1), `max_size`: Some(36), added: 531, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:1 w:0) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `Providers::MainStorageProviderIdsToValuePropositions` (r:1 w:1) + /// Proof: `Providers::MainStorageProviderIdsToValuePropositions` (`max_values`: None, `max_size`: Some(1123), added: 3598, mode: `MaxEncodedLen`) + /// Storage: `Providers::MspCount` (r:1 w:1) + /// Proof: `Providers::MspCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Providers::AccountIdToMainStorageProviderId` (r:0 w:1) + /// Proof: `Providers::AccountIdToMainStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::MainStorageProviders` (r:0 w:1) + /// Proof: `Providers::MainStorageProviders` (`max_values`: None, `max_size`: Some(1143), added: 3618, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::PrivilegedProviders` (r:0 w:1) + /// Proof: `PaymentStreams::PrivilegedProviders` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + fn confirm_sign_up_msp() -> Weight { + // Proof Size summary in bytes: + // Measured: `487` + // Estimated: `5628` + // Minimum execution time: 54_665_000 picoseconds. + Weight::from_parts(56_343_000, 5628) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(6_u64)) + } + /// Storage: `Providers::SignUpRequests` (r:1 w:1) + /// Proof: `Providers::SignUpRequests` (`max_values`: None, `max_size`: Some(2163), added: 4638, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + fn cancel_sign_up() -> Weight { + // Proof Size summary in bytes: + // Measured: `507` + // Estimated: `5628` + // Minimum execution time: 65_055_000 picoseconds. + Weight::from_parts(67_002_000, 5628) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: `Providers::AccountIdToMainStorageProviderId` (r:1 w:1) + /// Proof: `Providers::AccountIdToMainStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::MainStorageProviders` (r:1 w:1) + /// Proof: `Providers::MainStorageProviders` (`max_values`: None, `max_size`: Some(1143), added: 3618, mode: `MaxEncodedLen`) + /// Storage: `Providers::MainStorageProviderIdsToValuePropositions` (r:102 w:101) + /// Proof: `Providers::MainStorageProviderIdsToValuePropositions` (`max_values`: None, `max_size`: Some(1123), added: 3598, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Providers::MspCount` (r:1 w:1) + /// Proof: `Providers::MspCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::PrivilegedProviders` (r:0 w:1) + /// Proof: `PaymentStreams::PrivilegedProviders` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// The range of component `n` is `[0, 100]`. + fn msp_sign_off(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `775 + n * (83 ±0)` + // Estimated: `8186 + n * (3598 ±0)` + // Minimum execution time: 92_437_000 picoseconds. + Weight::from_parts(92_181_442, 8186) + // Standard Error: 9_739 + .saturating_add(Weight::from_parts(6_392_076, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(7_u64)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes(7_u64)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 3598).saturating_mul(n.into())) + } + /// Storage: `Providers::AccountIdToBackupStorageProviderId` (r:1 w:1) + /// Proof: `Providers::AccountIdToBackupStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::BackupStorageProviders` (r:1 w:1) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::ProviderToProofSubmissionRecord` (r:1 w:0) + /// Proof: `ProofsDealer::ProviderToProofSubmissionRecord` (`max_values`: None, `max_size`: Some(56), added: 2531, mode: `MaxEncodedLen`) + /// Storage: `Providers::TotalBspsCapacity` (r:1 w:1) + /// Proof: `Providers::TotalBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Providers::BspCount` (r:1 w:1) + /// Proof: `Providers::BspCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Providers::GlobalBspsReputationWeight` (r:1 w:1) + /// Proof: `Providers::GlobalBspsReputationWeight` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + fn bsp_sign_off() -> Weight { + // Proof Size summary in bytes: + // Measured: `720` + // Estimated: `4624` + // Minimum execution time: 93_925_000 picoseconds. + Weight::from_parts(95_582_000, 4624) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().writes(7_u64)) + } + /// Storage: `Providers::AccountIdToMainStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToMainStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::AccountIdToBackupStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToBackupStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:1 w:0) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `Providers::BackupStorageProviders` (r:1 w:1) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Providers::TotalBspsCapacity` (r:1 w:1) + /// Proof: `Providers::TotalBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + fn change_capacity_bsp_less_deposit() -> Weight { + // Proof Size summary in bytes: + // Measured: `679` + // Estimated: `4624` + // Minimum execution time: 84_814_000 picoseconds. + Weight::from_parts(86_666_000, 4624) + .saturating_add(T::DbWeight::get().reads(7_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) + } + /// Storage: `Providers::AccountIdToMainStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToMainStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::AccountIdToBackupStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToBackupStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:1 w:0) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `Providers::BackupStorageProviders` (r:1 w:1) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Providers::TotalBspsCapacity` (r:1 w:1) + /// Proof: `Providers::TotalBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + fn change_capacity_bsp_more_deposit() -> Weight { + // Proof Size summary in bytes: + // Measured: `679` + // Estimated: `4624` + // Minimum execution time: 105_285_000 picoseconds. + Weight::from_parts(106_175_000, 4624) + .saturating_add(T::DbWeight::get().reads(7_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) + } + /// Storage: `Providers::AccountIdToMainStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToMainStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:1 w:0) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `Providers::MainStorageProviders` (r:1 w:1) + /// Proof: `Providers::MainStorageProviders` (`max_values`: None, `max_size`: Some(1143), added: 3618, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + fn change_capacity_msp_less_deposit() -> Weight { + // Proof Size summary in bytes: + // Measured: `649` + // Estimated: `4608` + // Minimum execution time: 79_570_000 picoseconds. + Weight::from_parts(80_600_000, 4608) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: `Providers::AccountIdToMainStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToMainStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:1 w:0) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `Providers::MainStorageProviders` (r:1 w:1) + /// Proof: `Providers::MainStorageProviders` (`max_values`: None, `max_size`: Some(1143), added: 3618, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + fn change_capacity_msp_more_deposit() -> Weight { + // Proof Size summary in bytes: + // Measured: `649` + // Estimated: `4608` + // Minimum execution time: 99_554_000 picoseconds. + Weight::from_parts(100_542_000, 4608) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: `Providers::AccountIdToMainStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToMainStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:1 w:0) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `Providers::MainStorageProviderIdsToValuePropositions` (r:1 w:1) + /// Proof: `Providers::MainStorageProviderIdsToValuePropositions` (`max_values`: None, `max_size`: Some(1123), added: 3598, mode: `MaxEncodedLen`) + /// Storage: `Providers::MainStorageProviders` (r:1 w:1) + /// Proof: `Providers::MainStorageProviders` (`max_values`: None, `max_size`: Some(1143), added: 3618, mode: `MaxEncodedLen`) + fn add_value_prop() -> Weight { + // Proof Size summary in bytes: + // Measured: `591` + // Estimated: `4608` + // Minimum execution time: 45_279_000 picoseconds. + Weight::from_parts(45_906_000, 4608) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: `Providers::AccountIdToMainStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToMainStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::MainStorageProviders` (r:1 w:0) + /// Proof: `Providers::MainStorageProviders` (`max_values`: None, `max_size`: Some(1143), added: 3618, mode: `MaxEncodedLen`) + /// Storage: `Providers::MainStorageProviderIdsToValuePropositions` (r:1 w:1) + /// Proof: `Providers::MainStorageProviderIdsToValuePropositions` (`max_values`: None, `max_size`: Some(1123), added: 3598, mode: `MaxEncodedLen`) + fn make_value_prop_unavailable() -> Weight { + // Proof Size summary in bytes: + // Measured: `631` + // Estimated: `4608` + // Minimum execution time: 33_017_000 picoseconds. + Weight::from_parts(33_762_000, 4608) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Providers::AccountIdToMainStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToMainStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::AccountIdToBackupStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToBackupStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:1 w:0) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `Providers::BackupStorageProviders` (r:1 w:1) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + fn add_multiaddress() -> Weight { + // Proof Size summary in bytes: + // Measured: `508` + // Estimated: `4624` + // Minimum execution time: 34_075_000 picoseconds. + Weight::from_parts(35_656_000, 4624) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Providers::AccountIdToMainStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToMainStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::AccountIdToBackupStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToBackupStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::BackupStorageProviders` (r:1 w:1) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + fn remove_multiaddress() -> Weight { + // Proof Size summary in bytes: + // Measured: `1316` + // Estimated: `4624` + // Minimum execution time: 32_962_000 picoseconds. + Weight::from_parts(33_729_000, 4624) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Providers::SignUpRequests` (r:1 w:1) + /// Proof: `Providers::SignUpRequests` (`max_values`: None, `max_size`: Some(2163), added: 4638, mode: `MaxEncodedLen`) + /// Storage: `Providers::AccountIdToMainStorageProviderId` (r:1 w:1) + /// Proof: `Providers::AccountIdToMainStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::AccountIdToBackupStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToBackupStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:1 w:0) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `Providers::MainStorageProviderIdsToValuePropositions` (r:1 w:1) + /// Proof: `Providers::MainStorageProviderIdsToValuePropositions` (`max_values`: None, `max_size`: Some(1123), added: 3598, mode: `MaxEncodedLen`) + /// Storage: `Providers::MspCount` (r:1 w:1) + /// Proof: `Providers::MspCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Providers::MainStorageProviders` (r:0 w:1) + /// Proof: `Providers::MainStorageProviders` (`max_values`: None, `max_size`: Some(1143), added: 3618, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::PrivilegedProviders` (r:0 w:1) + /// Proof: `PaymentStreams::PrivilegedProviders` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + fn force_msp_sign_up() -> Weight { + // Proof Size summary in bytes: + // Measured: `270` + // Estimated: `5628` + // Minimum execution time: 126_394_000 picoseconds. + Weight::from_parts(129_027_000, 5628) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().writes(8_u64)) + } + /// Storage: `Providers::SignUpRequests` (r:1 w:1) + /// Proof: `Providers::SignUpRequests` (`max_values`: None, `max_size`: Some(2163), added: 4638, mode: `MaxEncodedLen`) + /// Storage: `Providers::AccountIdToMainStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToMainStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::AccountIdToBackupStorageProviderId` (r:1 w:1) + /// Proof: `Providers::AccountIdToBackupStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `Providers::TotalBspsCapacity` (r:1 w:1) + /// Proof: `Providers::TotalBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Providers::BspCount` (r:1 w:1) + /// Proof: `Providers::BspCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Providers::GlobalBspsReputationWeight` (r:1 w:1) + /// Proof: `Providers::GlobalBspsReputationWeight` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Providers::BackupStorageProviders` (r:0 w:1) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + fn force_bsp_sign_up() -> Weight { + // Proof Size summary in bytes: + // Measured: `270` + // Estimated: `5628` + // Minimum execution time: 106_273_000 picoseconds. + Weight::from_parts(108_690_000, 5628) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().writes(8_u64)) + } + /// Storage: `Providers::MainStorageProviders` (r:1 w:0) + /// Proof: `Providers::MainStorageProviders` (`max_values`: None, `max_size`: Some(1143), added: 3618, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:1 w:0) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `Providers::BackupStorageProviders` (r:1 w:1) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::SlashableProviders` (r:1 w:1) + /// Proof: `ProofsDealer::SlashableProviders` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + /// Storage: `Parameters::Parameters` (r:1 w:0) + /// Proof: `Parameters::Parameters` (`max_values`: None, `max_size`: Some(381), added: 2856, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:2 w:2) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `Providers::AwaitingTopUpFromProviders` (r:1 w:0) + /// Proof: `Providers::AwaitingTopUpFromProviders` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + fn slash_without_awaiting_top_up() -> Weight { + // Proof Size summary in bytes: + // Measured: `871` + // Estimated: `6172` + // Minimum execution time: 160_594_000 picoseconds. + Weight::from_parts(163_915_000, 6172) + .saturating_add(T::DbWeight::get().reads(9_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } + /// Storage: `Providers::MainStorageProviders` (r:1 w:0) + /// Proof: `Providers::MainStorageProviders` (`max_values`: None, `max_size`: Some(1143), added: 3618, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:1 w:0) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `Providers::BackupStorageProviders` (r:1 w:1) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::SlashableProviders` (r:1 w:1) + /// Proof: `ProofsDealer::SlashableProviders` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + /// Storage: `Parameters::Parameters` (r:2 w:0) + /// Proof: `Parameters::Parameters` (`max_values`: None, `max_size`: Some(381), added: 2856, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:2 w:2) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `Providers::AwaitingTopUpFromProviders` (r:1 w:1) + /// Proof: `Providers::AwaitingTopUpFromProviders` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::ChallengesTicker` (r:1 w:0) + /// Proof: `ProofsDealer::ChallengesTicker` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Providers::NextAvailableProviderTopUpExpirationShTick` (r:1 w:1) + /// Proof: `Providers::NextAvailableProviderTopUpExpirationShTick` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Providers::ProviderTopUpExpirations` (r:1 w:1) + /// Proof: `Providers::ProviderTopUpExpirations` (`max_values`: None, `max_size`: Some(3322), added: 5797, mode: `MaxEncodedLen`) + fn slash_with_awaiting_top_up() -> Weight { + // Proof Size summary in bytes: + // Measured: `871` + // Estimated: `6787` + // Minimum execution time: 128_483_000 picoseconds. + Weight::from_parts(129_763_000, 6787) + .saturating_add(T::DbWeight::get().reads(13_u64)) + .saturating_add(T::DbWeight::get().writes(8_u64)) + } + /// Storage: `Providers::AccountIdToMainStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToMainStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::AccountIdToBackupStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToBackupStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::MainStorageProviders` (r:1 w:0) + /// Proof: `Providers::MainStorageProviders` (`max_values`: None, `max_size`: Some(1143), added: 3618, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:1 w:0) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `Providers::BackupStorageProviders` (r:1 w:1) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Providers::AwaitingTopUpFromProviders` (r:1 w:1) + /// Proof: `Providers::AwaitingTopUpFromProviders` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Providers::ProviderTopUpExpirations` (r:0 w:1) + /// Proof: `Providers::ProviderTopUpExpirations` (`max_values`: None, `max_size`: Some(3322), added: 5797, mode: `MaxEncodedLen`) + fn top_up_deposit() -> Weight { + // Proof Size summary in bytes: + // Measured: `758` + // Estimated: `4624` + // Minimum execution time: 115_081_000 picoseconds. + Weight::from_parts(116_579_000, 4624) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } + /// Storage: `Providers::InsolventProviders` (r:2 w:1) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::FixedRatePaymentStreams` (r:1 w:0) + /// Proof: `PaymentStreams::FixedRatePaymentStreams` (`max_values`: None, `max_size`: Some(125), added: 2600, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::DynamicRatePaymentStreams` (r:1 w:0) + /// Proof: `PaymentStreams::DynamicRatePaymentStreams` (`max_values`: None, `max_size`: Some(129), added: 2604, mode: `MaxEncodedLen`) + /// Storage: `Providers::MainStorageProviders` (r:1 w:0) + /// Proof: `Providers::MainStorageProviders` (`max_values`: None, `max_size`: Some(1143), added: 3618, mode: `MaxEncodedLen`) + /// Storage: `Providers::BackupStorageProviders` (r:1 w:1) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `Providers::AccountIdToBackupStorageProviderId` (r:1 w:1) + /// Proof: `Providers::AccountIdToBackupStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::ProviderToProofSubmissionRecord` (r:1 w:1) + /// Proof: `ProofsDealer::ProviderToProofSubmissionRecord` (`max_values`: None, `max_size`: Some(56), added: 2531, mode: `MaxEncodedLen`) + /// Storage: `Providers::BspCount` (r:1 w:1) + /// Proof: `Providers::BspCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Providers::TotalBspsCapacity` (r:1 w:1) + /// Proof: `Providers::TotalBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Providers::UsedBspsCapacity` (r:1 w:1) + /// Proof: `Providers::UsedBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Providers::GlobalBspsReputationWeight` (r:1 w:1) + /// Proof: `Providers::GlobalBspsReputationWeight` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::TickToProvidersDeadlines` (r:0 w:1) + /// Proof: `ProofsDealer::TickToProvidersDeadlines` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + fn delete_provider_bsp() -> Weight { + // Proof Size summary in bytes: + // Measured: `853` + // Estimated: `6038` + // Minimum execution time: 80_980_000 picoseconds. + Weight::from_parts(82_589_000, 6038) + .saturating_add(T::DbWeight::get().reads(12_u64)) + .saturating_add(T::DbWeight::get().writes(9_u64)) + } + /// Storage: `Providers::InsolventProviders` (r:1 w:1) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::FixedRatePaymentStreams` (r:1 w:0) + /// Proof: `PaymentStreams::FixedRatePaymentStreams` (`max_values`: None, `max_size`: Some(125), added: 2600, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::DynamicRatePaymentStreams` (r:1 w:0) + /// Proof: `PaymentStreams::DynamicRatePaymentStreams` (`max_values`: None, `max_size`: Some(129), added: 2604, mode: `MaxEncodedLen`) + /// Storage: `Providers::MainStorageProviders` (r:1 w:1) + /// Proof: `Providers::MainStorageProviders` (`max_values`: None, `max_size`: Some(1143), added: 3618, mode: `MaxEncodedLen`) + /// Storage: `Providers::MainStorageProviderIdsToValuePropositions` (r:22 w:21) + /// Proof: `Providers::MainStorageProviderIdsToValuePropositions` (`max_values`: None, `max_size`: Some(1123), added: 3598, mode: `MaxEncodedLen`) + /// Storage: `Providers::MainStorageProviderIdsToBuckets` (r:21 w:20) + /// Proof: `Providers::MainStorageProviderIdsToBuckets` (`max_values`: None, `max_size`: Some(96), added: 2571, mode: `MaxEncodedLen`) + /// Storage: `Providers::MspCount` (r:1 w:1) + /// Proof: `Providers::MspCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Providers::AccountIdToMainStorageProviderId` (r:0 w:1) + /// Proof: `Providers::AccountIdToMainStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// The range of component `n` is `[0, 20]`. + /// The range of component `m` is `[0, 20]`. + fn delete_provider_msp(n: u32, m: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `1845 + m * (54 ±0) + n * (83 ±0)` + // Estimated: `8186 + m * (2571 ±0) + n * (3598 ±0)` + // Minimum execution time: 184_369_000 picoseconds. + Weight::from_parts(77_759_231, 8186) + // Standard Error: 28_443 + .saturating_add(Weight::from_parts(6_795_099, 0).saturating_mul(n.into())) + // Standard Error: 28_443 + .saturating_add(Weight::from_parts(5_705_653, 0).saturating_mul(m.into())) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(m.into()))) + .saturating_add(T::DbWeight::get().writes(5_u64)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(m.into()))) + .saturating_add(Weight::from_parts(0, 2571).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 3598).saturating_mul(n.into())) + } + /// Storage: `Providers::AccountIdToBackupStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToBackupStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::BackupStorageProviders` (r:1 w:0) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::ProviderToProofSubmissionRecord` (r:1 w:0) + /// Proof: `ProofsDealer::ProviderToProofSubmissionRecord` (`max_values`: None, `max_size`: Some(56), added: 2531, mode: `MaxEncodedLen`) + fn stop_all_cycles() -> Weight { + // Proof Size summary in bytes: + // Measured: `549` + // Estimated: `4624` + // Minimum execution time: 27_473_000 picoseconds. + Weight::from_parts(28_240_000, 4624) + .saturating_add(T::DbWeight::get().reads(3_u64)) + } + /// Storage: `Providers::AwaitingTopUpFromProviders` (r:1 w:1) + /// Proof: `Providers::AwaitingTopUpFromProviders` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Providers::BackupStorageProviders` (r:1 w:0) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:2 w:2) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Providers::AccountIdToBackupStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToBackupStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::ProviderToProofSubmissionRecord` (r:1 w:1) + /// Proof: `ProofsDealer::ProviderToProofSubmissionRecord` (`max_values`: None, `max_size`: Some(56), added: 2531, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:0 w:1) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::TickToProvidersDeadlines` (r:0 w:1) + /// Proof: `ProofsDealer::TickToProvidersDeadlines` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + fn process_expired_provider_top_up_bsp() -> Weight { + // Proof Size summary in bytes: + // Measured: `1038` + // Estimated: `6172` + // Minimum execution time: 102_791_000 picoseconds. + Weight::from_parts(105_581_000, 6172) + .saturating_add(T::DbWeight::get().reads(7_u64)) + .saturating_add(T::DbWeight::get().writes(7_u64)) + } + /// Storage: `Providers::AwaitingTopUpFromProviders` (r:1 w:1) + /// Proof: `Providers::AwaitingTopUpFromProviders` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Providers::BackupStorageProviders` (r:1 w:0) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `Providers::MainStorageProviders` (r:1 w:0) + /// Proof: `Providers::MainStorageProviders` (`max_values`: None, `max_size`: Some(1143), added: 3618, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:2 w:2) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:0 w:1) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + fn process_expired_provider_top_up_msp() -> Weight { + // Proof Size summary in bytes: + // Measured: `775` + // Estimated: `6172` + // Minimum execution time: 83_518_000 picoseconds. + Weight::from_parts(84_579_000, 6172) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } +} diff --git a/operator/runtime/testnet/Cargo.toml b/operator/runtime/testnet/Cargo.toml index 2c40f671..ad02e6dd 100644 --- a/operator/runtime/testnet/Cargo.toml +++ b/operator/runtime/testnet/Cargo.toml @@ -84,6 +84,7 @@ pallet-utility = { workspace = true } pallet-whitelist = { workspace = true } polkadot-primitives = { workspace = true } polkadot-runtime-common = { workspace = true } +k256 = { workspace = true, optional = true } precompile-utils = { workspace = true } scale-info = { workspace = true, features = ["derive", "serde"] } serde = { workspace = true, features = ["derive"] } @@ -360,6 +361,13 @@ runtime-benchmarks = [ "pallet-external-validators-rewards/runtime-benchmarks", "pallet-external-validator-slashes/runtime-benchmarks", "pallet-datahaven-native-transfer/runtime-benchmarks", + # StorageHub pallets + "pallet-nfts/runtime-benchmarks", + "pallet-file-system/runtime-benchmarks", + "pallet-proofs-dealer/runtime-benchmarks", + "pallet-payment-streams/runtime-benchmarks", + "pallet-storage-providers/runtime-benchmarks", + "dep:k256", ] try-runtime = [ diff --git a/operator/runtime/testnet/src/benchmarks.rs b/operator/runtime/testnet/src/benchmarks.rs index 3e59c56f..63b8116c 100644 --- a/operator/runtime/testnet/src/benchmarks.rs +++ b/operator/runtime/testnet/src/benchmarks.rs @@ -27,6 +27,7 @@ frame_benchmarking::define_benchmarks!( // Substrate pallets [pallet_balances, Balances] + [pallet_session, pallet_session_benchmarking::Pallet::] [pallet_identity, Identity] [pallet_im_online, ImOnline] [pallet_multisig, Multisig] @@ -46,6 +47,13 @@ frame_benchmarking::define_benchmarks!( // EVM pallets [pallet_evm, EVM] + // StorageHub pallets + [pallet_nfts, Nfts] + [pallet_file_system, FileSystem] + [pallet_proofs_dealer, ProofsDealer] + [pallet_payment_streams, PaymentStreams] + [pallet_storage_providers, Providers] + // Governance pallets [pallet_collective_technical_committee, TechnicalCommittee] [pallet_collective_treasury_council, TreasuryCouncil] diff --git a/operator/runtime/testnet/src/configs/mod.rs b/operator/runtime/testnet/src/configs/mod.rs index 4b256a25..826e00cc 100644 --- a/operator/runtime/testnet/src/configs/mod.rs +++ b/operator/runtime/testnet/src/configs/mod.rs @@ -91,7 +91,6 @@ use datahaven_runtime_common::{ }, time::{EpochDurationInBlocks, SessionsPerEra, DAYS, MILLISECS_PER_BLOCK}, }; -use dhp_bridge::{EigenLayerMessageProcessor, NativeTokenTransferMessageProcessor}; use frame_support::{ derive_impl, dispatch::DispatchClass, @@ -126,7 +125,7 @@ use snowbridge_core::{gwei, meth, AgentIdOf, PricingParameters, Rewards, TokenId use snowbridge_inbound_queue_primitives::RewardLedger; use snowbridge_outbound_queue_primitives::{ v1::{Fee, Message, SendMessage}, - v2::{Command, ConstantGasMeter}, + v2::ConstantGasMeter, SendError, SendMessageFeeProvider, }; use snowbridge_pallet_outbound_queue_v2::OnNewCommitment; @@ -387,7 +386,7 @@ impl pallet_session::Config for Runtime { >; type SessionHandler = ::KeyTypeIdProviders; type Keys = SessionKeys; - type WeightInfo = pallet_session::weights::SubstrateWeight; + type WeightInfo = testnet_weights::pallet_session::WeightInfo; } parameter_types! { @@ -629,7 +628,7 @@ impl pallet_identity::Config for Runtime { type PendingUsernameExpiration = PendingUsernameExpiration; type MaxSuffixLength = MaxSuffixLength; type MaxUsernameLength = MaxUsernameLength; - type WeightInfo = pallet_identity::weights::SubstrateWeight; + type WeightInfo = testnet_weights::pallet_identity::WeightInfo; type UsernameDeposit = UsernameDeposit; type UsernameGracePeriod = UsernameGracePeriod; @@ -1108,47 +1107,13 @@ impl snowbridge_pallet_system_v2::Config for Runtime { type Helper = (); } -// Fork versions for runtime benchmarks - must match the fixtures for BLS verification to work -// The fixtures are generated with standard testnet fork versions -#[cfg(feature = "runtime-benchmarks")] -parameter_types! { - pub const ChainForkVersions: ForkVersions = ForkVersions { - genesis: Fork { - version: hex_literal::hex!("00000000"), - epoch: 0, - }, - altair: Fork { - version: hex_literal::hex!("01000000"), - epoch: 0, - }, - bellatrix: Fork { - version: hex_literal::hex!("02000000"), - epoch: 0, - }, - capella: Fork { - version: hex_literal::hex!("03000000"), - epoch: 0, - }, - deneb: Fork { - version: hex_literal::hex!("04000000"), - epoch: 0, - }, - electra: Fork { - version: hex_literal::hex!("05000000"), - epoch: 80000000000, - }, - fulu: Fork { - version: hex_literal::hex!("06000000"), - epoch: 90000000000, - }, - }; -} - // For tests, fast-runtime and std configurations we use the mocked fork versions // These match the fork versions used by the local Ethereum network in E2E tests -#[cfg(all( - any(feature = "std", feature = "fast-runtime", test), - not(feature = "runtime-benchmarks") +#[cfg(any( + feature = "std", + feature = "fast-runtime", + feature = "runtime-benchmarks", + test ))] parameter_types! { pub const ChainForkVersions: ForkVersions = ForkVersions { @@ -1278,8 +1243,8 @@ impl snowbridge_pallet_inbound_queue_v2::Config for Runtime { type GatewayAddress = runtime_params::dynamic_params::runtime_config::EthereumGatewayAddress; #[cfg(not(feature = "runtime-benchmarks"))] type MessageProcessor = ( - EigenLayerMessageProcessor, - NativeTokenTransferMessageProcessor, + dhp_bridge::EigenLayerMessageProcessor, + dhp_bridge::NativeTokenTransferMessageProcessor, ); #[cfg(feature = "runtime-benchmarks")] type MessageProcessor = NoOpMessageProcessor; @@ -1749,6 +1714,7 @@ mod tests { use snowbridge_inbound_queue_primitives::v2::{ EthereumAsset, Message as SnowbridgeMessage, MessageProcessor, Payload as SnowPayload, }; + use snowbridge_outbound_queue_primitives::v2::Command; use sp_core::H160; use sp_io::TestExternalities; use xcm_builder::GlobalConsensusConvertsFor; diff --git a/operator/runtime/testnet/src/configs/storagehub/mod.rs b/operator/runtime/testnet/src/configs/storagehub/mod.rs index ca2f1d30..7717475c 100644 --- a/operator/runtime/testnet/src/configs/storagehub/mod.rs +++ b/operator/runtime/testnet/src/configs/storagehub/mod.rs @@ -14,9 +14,13 @@ // You should have received a copy of the GNU General Public License // along with DataHaven. If not, see . +#[cfg(not(feature = "runtime-benchmarks"))] +use super::HAVE; +#[cfg(feature = "runtime-benchmarks")] +use super::MICROHAVE; use super::{ AccountId, Balance, Balances, BlockNumber, Hash, RuntimeEvent, RuntimeHoldReason, - TreasuryAccount, HAVE, + TreasuryAccount, }; use crate::configs::runtime_params::dynamic_params::runtime_config; use crate::{ @@ -24,6 +28,8 @@ use crate::{ HOURS, }; use core::marker::PhantomData; +#[cfg(feature = "runtime-benchmarks")] +use datahaven_runtime_common::benchmarking::StorageHubBenchmarking; use datahaven_runtime_common::time::{DAYS, MINUTES}; use frame_support::pallet_prelude::DispatchClass; use frame_support::traits::AsEnsureOriginWithArg; @@ -33,7 +39,7 @@ use frame_support::{ weights::Weight, }; use frame_system::pallet_prelude::BlockNumberFor; -use frame_system::{EnsureRoot, EnsureSigned}; +use frame_system::EnsureSigned; use num_bigint::BigUint; use pallet_nfts::PalletFeatures; use polkadot_runtime_common::prod_or_fast; @@ -68,6 +74,7 @@ pub type StorageProofsMerkleTrieLayout = LayoutV1; pub type Hashing = BlakeTwo256; /****** NFTs pallet ******/ +#[cfg(not(feature = "runtime-benchmarks"))] parameter_types! { pub const CollectionDeposit: Balance = 100 * HAVE; pub const ItemDeposit: Balance = 1 * HAVE; @@ -80,6 +87,19 @@ parameter_types! { pub const MaxAttributesPerCall: u32 = 10; pub Features: PalletFeatures = PalletFeatures::all_enabled(); } +#[cfg(feature = "runtime-benchmarks")] +parameter_types! { + pub const CollectionDeposit: Balance = 100 * MICROHAVE; + pub const ItemDeposit: Balance = 1 * MICROHAVE; + pub const MetadataDepositBase: Balance = 10 * MICROHAVE; + pub const MetadataDepositPerByte: Balance = 1 * MICROHAVE; + pub const ApprovalsLimit: u32 = 20; + pub const ItemAttributesApprovalsLimit: u32 = 20; + pub const MaxTips: u32 = 10; + pub const MaxDeadlineDuration: BlockNumber = 12 * 30 * DAYS; + pub const MaxAttributesPerCall: u32 = 10; + pub Features: PalletFeatures = PalletFeatures::all_enabled(); +} impl pallet_nfts::Config for Runtime { type RuntimeEvent = RuntimeEvent; @@ -104,11 +124,67 @@ impl pallet_nfts::Config for Runtime { type Features = Features; type OffchainSignature = Signature; type OffchainPublic = ::Signer; - type WeightInfo = pallet_nfts::weights::SubstrateWeight; + type WeightInfo = crate::weights::pallet_nfts::WeightInfo; type Locker = (); + #[cfg(feature = "runtime-benchmarks")] + type Helper = benchmark_helpers::NftHelper; } /****** ****** ****** ******/ +#[cfg(feature = "runtime-benchmarks")] +pub mod benchmark_helpers { + use crate::{AccountId, Signature}; + use k256::ecdsa::SigningKey; + use sp_runtime::traits::{IdentifyAccount, Verify}; + use sp_runtime::MultiSignature; + + const BENCH_SIGNING_KEY: [u8; 32] = [1u8; 32]; + + fn bench_signing_key() -> SigningKey { + SigningKey::from_bytes(&BENCH_SIGNING_KEY.into()) + .expect("benchmark signing key is valid; qed") + } + + /// Benchmark helper for NFTs pallet + pub struct NftHelper; + + impl pallet_nfts::BenchmarkHelper::Signer, AccountId, Signature> + for NftHelper + { + fn collection(i: u16) -> u32 { + i.into() + } + + fn item(i: u16) -> u32 { + i.into() + } + + fn signer() -> (::Signer, AccountId) { + let signing_key = bench_signing_key(); + let verifying_key = signing_key.verifying_key(); + let encoded = verifying_key.to_encoded_point(true); + let public = sp_core::ecdsa::Public::from_full(encoded.as_bytes()) + .expect("encoded point is a valid compressed secp256k1 key; qed"); + let public_key: ::Signer = public.into(); + let account: AccountId = public_key.clone().into_account(); + (public_key, account) + } + + fn sign(_public: &::Signer, message: &[u8]) -> Signature { + // Sign using Ethereum-style secp256k1 over keccak256(message). + let digest = sp_io::hashing::keccak_256(message); + let (sig, recovery_id) = bench_signing_key() + .sign_prehash_recoverable(&digest) + .expect("signing with fixed secret key never fails; qed"); + let mut sig_bytes = [0u8; 65]; + sig_bytes[..64].copy_from_slice(&sig.to_bytes()); + sig_bytes[64] = recovery_id.to_byte(); + let sig = sp_core::ecdsa::Signature::from_raw(sig_bytes); + Signature::from(MultiSignature::Ecdsa(sig)) + } + } +} + /****** Relay Randomness pallet ******/ impl pallet_randomness::Config for Runtime { type RuntimeEvent = RuntimeEvent; @@ -151,6 +227,7 @@ impl sp_runtime::traits::BlockNumberProvider for BlockNumberGetter { /****** ****** ****** ******/ /****** Storage Providers pallet ******/ +#[cfg(not(feature = "runtime-benchmarks"))] parameter_types! { pub const SpMinDeposit: Balance = 100 * HAVE; pub const BucketDeposit: Balance = 100 * HAVE; @@ -159,10 +236,47 @@ parameter_types! { // TODO: If the next line is uncommented (which should be eventually, replacing the line above), compilation breaks (most likely because of mismatched dependency issues) // pub const MaxBlocksForRandomness: BlockNumber = prod_or_fast!(2 * runtime_constants::time::EPOCH_DURATION_IN_SLOTS, 2 * MINUTES); } +#[cfg(feature = "runtime-benchmarks")] +parameter_types! { + pub const SpMinDeposit: Balance = StorageHubBenchmarking::SP_MIN_DEPOSIT; + pub const BucketDeposit: Balance = StorageHubBenchmarking::BUCKET_DEPOSIT; + pub const BspSignUpLockPeriod: BlockNumber = 90 * DAYS; // ~3 months + pub const MaxBlocksForRandomness: BlockNumber = prod_or_fast!(2 * HOURS, 2 * MINUTES); + // TODO: If the next line is uncommented (which should be eventually, replacing the line above), compilation breaks (most likely because of mismatched dependency issues) + // pub const MaxBlocksForRandomness: BlockNumber = prod_or_fast!(2 * runtime_constants::time::EPOCH_DURATION_IN_SLOTS, 2 * MINUTES); +} + +#[cfg(feature = "runtime-benchmarks")] +pub struct StorageHubTreasuryAccount; +#[cfg(feature = "runtime-benchmarks")] +impl Get for StorageHubTreasuryAccount { + fn get() -> AccountId { + let account = TreasuryAccount::get(); + StorageHubBenchmarking::ensure_treasury_account::(account) + } +} + +// Benchmark helpers for Storage Providers pallet. +#[cfg(feature = "runtime-benchmarks")] +pub struct ProvidersBenchmarkHelpers; +#[cfg(feature = "runtime-benchmarks")] +impl pallet_storage_providers::benchmarking::BenchmarkHelpers + for ProvidersBenchmarkHelpers +{ + type ProviderId = ::ProviderId; + + fn set_accrued_failed_proofs(provider_id: Self::ProviderId, value: u32) { + pallet_proofs_dealer::SlashableProviders::::insert(provider_id, value); + } + + fn get_accrued_failed_proofs(provider_id: Self::ProviderId) -> u32 { + pallet_proofs_dealer::SlashableProviders::::get(provider_id).unwrap_or(0) + } +} impl pallet_storage_providers::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type WeightInfo = pallet_storage_providers::weights::SubstrateWeight; + type WeightInfo = crate::weights::pallet_storage_providers::WeightInfo; type ProvidersRandomness = pallet_randomness::RandomnessFromOneEpochAgo; type PaymentStreams = PaymentStreams; type ProofDealer = ProofsDealer; @@ -188,7 +302,10 @@ impl pallet_storage_providers::Config for Runtime { type ProvidersProofSubmitters = ProofsDealer; type ReputationWeightType = u32; type StorageHubTickGetter = ProofsDealer; + #[cfg(not(feature = "runtime-benchmarks"))] type Treasury = TreasuryAccount; + #[cfg(feature = "runtime-benchmarks")] + type Treasury = StorageHubTreasuryAccount; type SpMinDeposit = SpMinDeposit; type SpMinCapacity = ConstU64<2>; type DepositPerData = ConstU128<2>; @@ -208,6 +325,8 @@ impl pallet_storage_providers::Config for Runtime { type ZeroSizeBucketFixedRate = runtime_config::ZeroSizeBucketFixedRate; type ProviderTopUpTtl = runtime_config::ProviderTopUpTtl; type MaxExpiredItemsInBlock = ConstU32<100>; + #[cfg(feature = "runtime-benchmarks")] + type BenchmarkHelpers = ProvidersBenchmarkHelpers; } pub struct StorageDataUnitAndBalanceConverter; @@ -240,7 +359,7 @@ parameter_types! { impl pallet_payment_streams::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type WeightInfo = pallet_payment_streams::weights::SubstrateWeight; + type WeightInfo = crate::weights::pallet_payment_streams::WeightInfo; type NativeBalance = Balances; type ProvidersPallet = Providers; type RuntimeHoldReason = RuntimeHoldReason; @@ -250,7 +369,10 @@ impl pallet_payment_streams::Config for Runtime { type BlockNumberToBalance = BlockNumberToBalance; type ProvidersProofSubmitters = ProofsDealer; type TreasuryCutCalculator = LinearThenPowerOfTwoTreasuryCutCalculator; + #[cfg(not(feature = "runtime-benchmarks"))] type TreasuryAccount = TreasuryAccount; + #[cfg(feature = "runtime-benchmarks")] + type TreasuryAccount = StorageHubTreasuryAccount; type MaxUsersToCharge = ConstU32<10>; type BaseDeposit = ConstU128<10>; } @@ -279,6 +401,14 @@ const MAX_CUSTOM_CHALLENGES_PER_BLOCK: u32 = 10; const TOTAL_MAX_CHALLENGES_PER_BLOCK: u32 = RANDOM_CHALLENGES_PER_BLOCK + MAX_CUSTOM_CHALLENGES_PER_BLOCK; +#[cfg(feature = "runtime-benchmarks")] +parameter_types! { + pub const BenchmarkStakeToChallengePeriod: Balance = + StorageHubBenchmarking::STAKE_TO_CHALLENGE_PERIOD; + pub const BenchmarkCheckpointChallengePeriod: BlockNumber = + StorageHubBenchmarking::CHECKPOINT_CHALLENGE_PERIOD; +} + parameter_types! { pub const RandomChallengesPerBlock: u32 = RANDOM_CHALLENGES_PER_BLOCK; pub const MaxCustomChallengesPerBlock: u32 = MAX_CUSTOM_CHALLENGES_PER_BLOCK; @@ -293,7 +423,7 @@ parameter_types! { impl pallet_proofs_dealer::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type WeightInfo = pallet_proofs_dealer::weights::SubstrateWeight; + type WeightInfo = crate::weights::pallet_proofs_dealer::WeightInfo; type ProvidersPallet = Providers; type NativeBalance = Balances; type MerkleTrieHash = Hash; @@ -306,29 +436,50 @@ impl pallet_proofs_dealer::Config for Runtime { { shp_constants::FILE_SIZE_TO_CHALLENGES }, >; type StakeToBlockNumber = SaturatingBalanceToBlockNumber; + #[cfg(feature = "runtime-benchmarks")] + type RandomChallengesPerBlock = ConstU32<0>; + #[cfg(not(feature = "runtime-benchmarks"))] type RandomChallengesPerBlock = RandomChallengesPerBlock; + #[cfg(feature = "runtime-benchmarks")] + type MaxCustomChallengesPerBlock = TotalMaxChallengesPerBlock; + #[cfg(not(feature = "runtime-benchmarks"))] type MaxCustomChallengesPerBlock = MaxCustomChallengesPerBlock; type MaxSubmittersPerTick = MaxSubmittersPerTick; type TargetTicksStorageOfSubmitters = TargetTicksStorageOfSubmitters; type ChallengeHistoryLength = ChallengeHistoryLength; type ChallengesQueueLength = ChallengesQueueLength; + #[cfg(not(feature = "runtime-benchmarks"))] type CheckpointChallengePeriod = runtime_config::CheckpointChallengePeriod; + #[cfg(feature = "runtime-benchmarks")] + type CheckpointChallengePeriod = BenchmarkCheckpointChallengePeriod; type ChallengesFee = ChallengesFee; type PriorityChallengesFee = PriorityChallengesFee; + #[cfg(not(feature = "runtime-benchmarks"))] type Treasury = TreasuryAccount; + #[cfg(feature = "runtime-benchmarks")] + type Treasury = StorageHubTreasuryAccount; // TODO: Once the client logic to keep track of CR randomness deadlines and execute their submissions is implemented // AND after the chain has been live for enough time to have enough providers to avoid the commit-reveal randomness being // gameable, the randomness provider should be CrRandomness type RandomnessProvider = pallet_randomness::ParentBlockRandomness; + #[cfg(not(feature = "runtime-benchmarks"))] type StakeToChallengePeriod = runtime_config::StakeToChallengePeriod; + #[cfg(feature = "runtime-benchmarks")] + type StakeToChallengePeriod = BenchmarkStakeToChallengePeriod; type MinChallengePeriod = runtime_config::MinChallengePeriod; type ChallengeTicksTolerance = ChallengeTicksTolerance; type BlockFullnessPeriod = ChallengeTicksTolerance; // We purposely set this to `ChallengeTicksTolerance` so that spamming of the chain is evaluated for the same blocks as the tolerance BSPs are given. type BlockFullnessHeadroom = BlockFullnessHeadroom; type MinNotFullBlocksRatio = MinNotFullBlocksRatio; type MaxSlashableProvidersPerTick = MaxSlashableProvidersPerTick; - type ChallengeOrigin = EnsureRoot; - type PriorityChallengeOrigin = EnsureRoot; + #[cfg(not(feature = "runtime-benchmarks"))] + type ChallengeOrigin = frame_system::EnsureRoot; + #[cfg(feature = "runtime-benchmarks")] + type ChallengeOrigin = EnsureSigned; + #[cfg(not(feature = "runtime-benchmarks"))] + type PriorityChallengeOrigin = frame_system::EnsureRoot; + #[cfg(feature = "runtime-benchmarks")] + type PriorityChallengeOrigin = EnsureSigned; } // Converter from the Balance type to the BlockNumber type for math. @@ -452,12 +603,24 @@ impl Get for MaxSlashableProvidersPerTick { type ThresholdType = u32; pub type ReplicationTargetType = u32; +#[cfg(not(feature = "runtime-benchmarks"))] parameter_types! { pub const BaseStorageRequestCreationDeposit: Balance = 1 * HAVE; pub const FileDeletionRequestCreationDeposit: Balance = 1 * HAVE; pub const FileSystemStorageRequestCreationHoldReason: RuntimeHoldReason = RuntimeHoldReason::FileSystem(pallet_file_system::HoldReason::StorageRequestCreationHold); pub const FileSystemFileDeletionRequestHoldReason: RuntimeHoldReason = RuntimeHoldReason::FileSystem(pallet_file_system::HoldReason::FileDeletionRequestHold); } +#[cfg(feature = "runtime-benchmarks")] +parameter_types! { + pub const BaseStorageRequestCreationDeposit: Balance = 1 * MICROHAVE; + pub const FileDeletionRequestCreationDeposit: Balance = 1 * MICROHAVE; + pub const FileSystemStorageRequestCreationHoldReason: RuntimeHoldReason = RuntimeHoldReason::FileSystem(pallet_file_system::HoldReason::StorageRequestCreationHold); + pub const FileSystemFileDeletionRequestHoldReason: RuntimeHoldReason = RuntimeHoldReason::FileSystem(pallet_file_system::HoldReason::FileDeletionRequestHold); +} +#[cfg(feature = "runtime-benchmarks")] +parameter_types! { + pub const BenchmarkBspStopStoringFilePenalty: Balance = 1 * MICROHAVE; +} // Converts a given signed message in a EIP-191 compliant message bytes to verify. /// EIP-191: https://eips.ethereum.org/EIPS/eip-191 @@ -480,7 +643,7 @@ impl shp_traits::MessageAdapter for Eip191Adapter { impl pallet_file_system::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type WeightInfo = pallet_file_system::weights::SubstrateWeight; + type WeightInfo = crate::weights::pallet_file_system::WeightInfo; type Providers = Providers; type ProofDealer = ProofsDealer; type PaymentStreams = PaymentStreams; @@ -500,8 +663,14 @@ impl pallet_file_system::Config for Runtime { type RuntimeHoldReason = RuntimeHoldReason; type Nfts = Nfts; type CollectionInspector = BucketNfts; + #[cfg(not(feature = "runtime-benchmarks"))] type BspStopStoringFilePenalty = runtime_config::BspStopStoringFilePenalty; + #[cfg(feature = "runtime-benchmarks")] + type BspStopStoringFilePenalty = BenchmarkBspStopStoringFilePenalty; + #[cfg(not(feature = "runtime-benchmarks"))] type TreasuryAccount = TreasuryAccount; + #[cfg(feature = "runtime-benchmarks")] + type TreasuryAccount = StorageHubTreasuryAccount; type MaxBatchConfirmStorageRequests = ConstU32<100>; type MaxFilePathSize = ConstU32<512u32>; type MaxPeerIdSize = ConstU32<100>; diff --git a/operator/runtime/testnet/src/lib.rs b/operator/runtime/testnet/src/lib.rs index 07878c17..ec43d783 100644 --- a/operator/runtime/testnet/src/lib.rs +++ b/operator/runtime/testnet/src/lib.rs @@ -201,7 +201,7 @@ parameter_types! { parameter_types! { // TODO: Change ED to 1 after upgrade to Polkadot SDK stable2503 // cfr. https://github.com/paritytech/polkadot-sdk/pull/7379 - pub const ExistentialDeposit: Balance = 100; + pub const ExistentialDeposit: Balance = 1; } /// The version information used to identify this runtime when compiled natively. @@ -972,6 +972,7 @@ impl_runtime_apis! { use frame_system_benchmarking::Pallet as SystemBench; impl frame_system_benchmarking::Config for Runtime {} + impl pallet_session_benchmarking::Config for Runtime {} impl baseline::Config for Runtime {} use frame_support::traits::WhitelistedStorageKeys; diff --git a/operator/runtime/testnet/src/weights/mod.rs b/operator/runtime/testnet/src/weights/mod.rs index f1d772a1..979467af 100644 --- a/operator/runtime/testnet/src/weights/mod.rs +++ b/operator/runtime/testnet/src/weights/mod.rs @@ -35,19 +35,25 @@ pub mod pallet_babe; pub mod pallet_balances; pub mod pallet_beefy_mmr; pub mod pallet_evm; +pub mod pallet_file_system; pub mod pallet_grandpa; -pub mod pallet_randomness; -//pub mod pallet_identity; +pub mod pallet_identity; pub mod pallet_im_online; pub mod pallet_message_queue; pub mod pallet_migrations; pub mod pallet_mmr; pub mod pallet_multisig; +pub mod pallet_nfts; pub mod pallet_parameters; +pub mod pallet_payment_streams; pub mod pallet_preimage; +pub mod pallet_proofs_dealer; pub mod pallet_proxy; +pub mod pallet_randomness; pub mod pallet_safe_mode; pub mod pallet_scheduler; +pub mod pallet_session; +pub mod pallet_storage_providers; pub mod pallet_sudo; pub mod pallet_timestamp; pub mod pallet_transaction_payment; diff --git a/operator/runtime/testnet/src/weights/pallet_file_system.rs b/operator/runtime/testnet/src/weights/pallet_file_system.rs new file mode 100644 index 00000000..4a2a2050 --- /dev/null +++ b/operator/runtime/testnet/src/weights/pallet_file_system.rs @@ -0,0 +1,5 @@ +//! Weights for `pallet_file_system`. +//! +//! Generated weights should overwrite this file. + +pub use pallet_file_system::weights::SubstrateWeight as WeightInfo; diff --git a/operator/runtime/testnet/src/weights/pallet_nfts.rs b/operator/runtime/testnet/src/weights/pallet_nfts.rs new file mode 100644 index 00000000..2e594b5b --- /dev/null +++ b/operator/runtime/testnet/src/weights/pallet_nfts.rs @@ -0,0 +1,724 @@ + + +//! Autogenerated weights for `pallet_nfts` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 51.0.0 +//! DATE: 2025-11-14, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ip-10-0-0-176`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` +//! WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --runtime +// target/production/wbuild/datahaven-testnet-runtime/datahaven_testnet_runtime.compact.compressed.wasm +// --pallet +// pallet_nfts +// --extrinsic +// +// --template +// benchmarking/frame-weight-template.hbs +// --output +// runtime/testnet/src/weights/pallet_nfts.rs +// --steps +// 50 +// --repeat +// 20 + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use sp_std::marker::PhantomData; + +/// Weights for `pallet_nfts`. +pub struct WeightInfo(PhantomData); +impl pallet_nfts::WeightInfo for WeightInfo { + /// Storage: `Nfts::NextCollectionId` (r:1 w:1) + /// Proof: `Nfts::NextCollectionId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Collection` (r:1 w:1) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionRoleOf` (r:0 w:1) + /// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionConfigOf` (r:0 w:1) + /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionAccount` (r:0 w:1) + /// Proof: `Nfts::CollectionAccount` (`max_values`: None, `max_size`: Some(56), added: 2531, mode: `MaxEncodedLen`) + fn create() -> Weight { + // Proof Size summary in bytes: + // Measured: `271` + // Estimated: `3537` + // Minimum execution time: 47_561_000 picoseconds. + Weight::from_parts(48_583_000, 3537) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } + /// Storage: `Nfts::NextCollectionId` (r:1 w:1) + /// Proof: `Nfts::NextCollectionId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Collection` (r:1 w:1) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionRoleOf` (r:0 w:1) + /// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionConfigOf` (r:0 w:1) + /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionAccount` (r:0 w:1) + /// Proof: `Nfts::CollectionAccount` (`max_values`: None, `max_size`: Some(56), added: 2531, mode: `MaxEncodedLen`) + fn force_create() -> Weight { + // Proof Size summary in bytes: + // Measured: `76` + // Estimated: `3537` + // Minimum execution time: 25_742_000 picoseconds. + Weight::from_parts(26_196_000, 3537) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } + /// Storage: `Nfts::Collection` (r:1 w:1) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemMetadataOf` (r:1 w:0) + /// Proof: `Nfts::ItemMetadataOf` (`max_values`: None, `max_size`: Some(335), added: 2810, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionRoleOf` (r:1 w:1) + /// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Attribute` (r:1001 w:1000) + /// Proof: `Nfts::Attribute` (`max_values`: None, `max_size`: Some(455), added: 2930, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemConfigOf` (r:1000 w:1000) + /// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionMetadataOf` (r:0 w:1) + /// Proof: `Nfts::CollectionMetadataOf` (`max_values`: None, `max_size`: Some(294), added: 2769, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionConfigOf` (r:0 w:1) + /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionAccount` (r:0 w:1) + /// Proof: `Nfts::CollectionAccount` (`max_values`: None, `max_size`: Some(56), added: 2531, mode: `MaxEncodedLen`) + /// The range of component `m` is `[0, 1000]`. + /// The range of component `c` is `[0, 1000]`. + /// The range of component `a` is `[0, 1000]`. + fn destroy(_m: u32, _c: u32, a: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `32179 + a * (366 ±0)` + // Estimated: `2523990 + a * (2930 ±0)` + // Minimum execution time: 1_304_607_000 picoseconds. + Weight::from_parts(3_891_413_864, 2523990) + // Standard Error: 30_112 + .saturating_add(Weight::from_parts(7_300_422, 0).saturating_mul(a.into())) + .saturating_add(T::DbWeight::get().reads(1004_u64)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(a.into()))) + .saturating_add(T::DbWeight::get().writes(1005_u64)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(a.into()))) + .saturating_add(Weight::from_parts(0, 2930).saturating_mul(a.into())) + } + /// Storage: `Nfts::CollectionConfigOf` (r:1 w:0) + /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Item` (r:1 w:1) + /// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(597), added: 3072, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Collection` (r:1 w:1) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionRoleOf` (r:1 w:0) + /// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemConfigOf` (r:1 w:1) + /// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Account` (r:0 w:1) + /// Proof: `Nfts::Account` (`max_values`: None, `max_size`: Some(76), added: 2551, mode: `MaxEncodedLen`) + fn mint() -> Weight { + // Proof Size summary in bytes: + // Measured: `418` + // Estimated: `4062` + // Minimum execution time: 68_983_000 picoseconds. + Weight::from_parts(69_802_000, 4062) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) + } + /// Storage: `Nfts::CollectionRoleOf` (r:1 w:0) + /// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Item` (r:1 w:1) + /// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(597), added: 3072, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Collection` (r:1 w:1) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionConfigOf` (r:1 w:0) + /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemConfigOf` (r:1 w:1) + /// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Account` (r:0 w:1) + /// Proof: `Nfts::Account` (`max_values`: None, `max_size`: Some(76), added: 2551, mode: `MaxEncodedLen`) + fn force_mint() -> Weight { + // Proof Size summary in bytes: + // Measured: `418` + // Estimated: `4062` + // Minimum execution time: 65_803_000 picoseconds. + Weight::from_parts(67_191_000, 4062) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) + } + /// Storage: `Nfts::Attribute` (r:1 w:0) + /// Proof: `Nfts::Attribute` (`max_values`: None, `max_size`: Some(455), added: 2930, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemConfigOf` (r:1 w:1) + /// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Collection` (r:1 w:1) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Item` (r:1 w:1) + /// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(597), added: 3072, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemMetadataOf` (r:1 w:0) + /// Proof: `Nfts::ItemMetadataOf` (`max_values`: None, `max_size`: Some(335), added: 2810, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Account` (r:0 w:1) + /// Proof: `Nfts::Account` (`max_values`: None, `max_size`: Some(76), added: 2551, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemPriceOf` (r:0 w:1) + /// Proof: `Nfts::ItemPriceOf` (`max_values`: None, `max_size`: Some(77), added: 2552, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemAttributesApprovalsOf` (r:0 w:1) + /// Proof: `Nfts::ItemAttributesApprovalsOf` (`max_values`: None, `max_size`: Some(441), added: 2916, mode: `MaxEncodedLen`) + /// Storage: `Nfts::PendingSwapOf` (r:0 w:1) + /// Proof: `Nfts::PendingSwapOf` (`max_values`: None, `max_size`: Some(71), added: 2546, mode: `MaxEncodedLen`) + fn burn() -> Weight { + // Proof Size summary in bytes: + // Measured: `526` + // Estimated: `4062` + // Minimum execution time: 74_085_000 picoseconds. + Weight::from_parts(75_919_000, 4062) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(7_u64)) + } + /// Storage: `Nfts::Collection` (r:1 w:0) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Attribute` (r:1 w:0) + /// Proof: `Nfts::Attribute` (`max_values`: None, `max_size`: Some(455), added: 2930, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionConfigOf` (r:1 w:0) + /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemConfigOf` (r:1 w:0) + /// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Item` (r:1 w:1) + /// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(597), added: 3072, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Account` (r:0 w:2) + /// Proof: `Nfts::Account` (`max_values`: None, `max_size`: Some(76), added: 2551, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemPriceOf` (r:0 w:1) + /// Proof: `Nfts::ItemPriceOf` (`max_values`: None, `max_size`: Some(77), added: 2552, mode: `MaxEncodedLen`) + /// Storage: `Nfts::PendingSwapOf` (r:0 w:1) + /// Proof: `Nfts::PendingSwapOf` (`max_values`: None, `max_size`: Some(71), added: 2546, mode: `MaxEncodedLen`) + fn transfer() -> Weight { + // Proof Size summary in bytes: + // Measured: `555` + // Estimated: `4062` + // Minimum execution time: 56_531_000 picoseconds. + Weight::from_parts(57_676_000, 4062) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } + /// Storage: `Nfts::Collection` (r:1 w:0) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionConfigOf` (r:1 w:0) + /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Item` (r:5000 w:5000) + /// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(597), added: 3072, mode: `MaxEncodedLen`) + /// The range of component `i` is `[0, 5000]`. + fn redeposit(i: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `750 + i * (83 ±0)` + // Estimated: `3538 + i * (3072 ±0)` + // Minimum execution time: 18_545_000 picoseconds. + Weight::from_parts(18_987_000, 3538) + // Standard Error: 11_750 + .saturating_add(Weight::from_parts(23_672_529, 0).saturating_mul(i.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(i.into()))) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) + .saturating_add(Weight::from_parts(0, 3072).saturating_mul(i.into())) + } + /// Storage: `Nfts::CollectionRoleOf` (r:1 w:0) + /// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemConfigOf` (r:1 w:1) + /// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + fn lock_item_transfer() -> Weight { + // Proof Size summary in bytes: + // Measured: `423` + // Estimated: `3522` + // Minimum execution time: 24_040_000 picoseconds. + Weight::from_parts(24_947_000, 3522) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Nfts::CollectionRoleOf` (r:1 w:0) + /// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemConfigOf` (r:1 w:1) + /// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + fn unlock_item_transfer() -> Weight { + // Proof Size summary in bytes: + // Measured: `423` + // Estimated: `3522` + // Minimum execution time: 23_941_000 picoseconds. + Weight::from_parts(24_858_000, 3522) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Nfts::Collection` (r:1 w:0) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionConfigOf` (r:1 w:1) + /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + fn lock_collection() -> Weight { + // Proof Size summary in bytes: + // Measured: `327` + // Estimated: `3538` + // Minimum execution time: 19_598_000 picoseconds. + Weight::from_parts(20_471_000, 3538) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Nfts::OwnershipAcceptance` (r:1 w:1) + /// Proof: `Nfts::OwnershipAcceptance` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Collection` (r:1 w:1) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionAccount` (r:0 w:2) + /// Proof: `Nfts::CollectionAccount` (`max_values`: None, `max_size`: Some(56), added: 2531, mode: `MaxEncodedLen`) + fn transfer_ownership() -> Weight { + // Proof Size summary in bytes: + // Measured: `524` + // Estimated: `3581` + // Minimum execution time: 35_013_000 picoseconds. + Weight::from_parts(36_104_000, 3581) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } + /// Storage: `Nfts::Collection` (r:1 w:1) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionRoleOf` (r:2 w:4) + /// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + fn set_team() -> Weight { + // Proof Size summary in bytes: + // Measured: `344` + // Estimated: `6054` + // Minimum execution time: 48_777_000 picoseconds. + Weight::from_parts(50_672_000, 6054) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } + /// Storage: `Nfts::Collection` (r:1 w:1) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionAccount` (r:0 w:2) + /// Proof: `Nfts::CollectionAccount` (`max_values`: None, `max_size`: Some(56), added: 2531, mode: `MaxEncodedLen`) + fn force_collection_owner() -> Weight { + // Proof Size summary in bytes: + // Measured: `298` + // Estimated: `3537` + // Minimum execution time: 20_455_000 picoseconds. + Weight::from_parts(21_229_000, 3537) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: `Nfts::Collection` (r:1 w:0) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionConfigOf` (r:0 w:1) + /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + fn force_collection_config() -> Weight { + // Proof Size summary in bytes: + // Measured: `276` + // Estimated: `3537` + // Minimum execution time: 16_326_000 picoseconds. + Weight::from_parts(16_897_000, 3537) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Nfts::CollectionRoleOf` (r:1 w:0) + /// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemConfigOf` (r:1 w:1) + /// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + fn lock_item_properties() -> Weight { + // Proof Size summary in bytes: + // Measured: `423` + // Estimated: `3522` + // Minimum execution time: 22_519_000 picoseconds. + Weight::from_parts(23_274_000, 3522) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Nfts::Collection` (r:1 w:1) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionRoleOf` (r:1 w:0) + /// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionConfigOf` (r:1 w:0) + /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemConfigOf` (r:1 w:0) + /// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Attribute` (r:1 w:1) + /// Proof: `Nfts::Attribute` (`max_values`: None, `max_size`: Some(455), added: 2930, mode: `MaxEncodedLen`) + fn set_attribute() -> Weight { + // Proof Size summary in bytes: + // Measured: `514` + // Estimated: `3920` + // Minimum execution time: 69_247_000 picoseconds. + Weight::from_parts(70_996_000, 3920) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: `Nfts::Collection` (r:1 w:1) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Attribute` (r:1 w:1) + /// Proof: `Nfts::Attribute` (`max_values`: None, `max_size`: Some(455), added: 2930, mode: `MaxEncodedLen`) + fn force_set_attribute() -> Weight { + // Proof Size summary in bytes: + // Measured: `331` + // Estimated: `3920` + // Minimum execution time: 33_077_000 picoseconds. + Weight::from_parts(33_810_000, 3920) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: `Nfts::Attribute` (r:1 w:1) + /// Proof: `Nfts::Attribute` (`max_values`: None, `max_size`: Some(455), added: 2930, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionRoleOf` (r:1 w:0) + /// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemConfigOf` (r:1 w:0) + /// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Collection` (r:1 w:1) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + fn clear_attribute() -> Weight { + // Proof Size summary in bytes: + // Measured: `958` + // Estimated: `3920` + // Minimum execution time: 63_523_000 picoseconds. + Weight::from_parts(64_779_000, 3920) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: `Nfts::Item` (r:1 w:0) + /// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(597), added: 3072, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemAttributesApprovalsOf` (r:1 w:1) + /// Proof: `Nfts::ItemAttributesApprovalsOf` (`max_values`: None, `max_size`: Some(441), added: 2916, mode: `MaxEncodedLen`) + fn approve_item_attributes() -> Weight { + // Proof Size summary in bytes: + // Measured: `356` + // Estimated: `4062` + // Minimum execution time: 20_686_000 picoseconds. + Weight::from_parts(21_511_000, 4062) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Nfts::Item` (r:1 w:0) + /// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(597), added: 3072, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemAttributesApprovalsOf` (r:1 w:1) + /// Proof: `Nfts::ItemAttributesApprovalsOf` (`max_values`: None, `max_size`: Some(441), added: 2916, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Attribute` (r:1001 w:1000) + /// Proof: `Nfts::Attribute` (`max_values`: None, `max_size`: Some(455), added: 2930, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// The range of component `n` is `[0, 1000]`. + fn cancel_item_attributes_approval(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `769 + n * (386 ±0)` + // Estimated: `4062 + n * (2930 ±0)` + // Minimum execution time: 33_029_000 picoseconds. + Weight::from_parts(33_938_000, 4062) + // Standard Error: 3_029 + .saturating_add(Weight::from_parts(7_579_917, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes(2_u64)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 2930).saturating_mul(n.into())) + } + /// Storage: `Nfts::CollectionRoleOf` (r:1 w:0) + /// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Collection` (r:1 w:1) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemConfigOf` (r:1 w:0) + /// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionConfigOf` (r:1 w:0) + /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemMetadataOf` (r:1 w:1) + /// Proof: `Nfts::ItemMetadataOf` (`max_values`: None, `max_size`: Some(335), added: 2810, mode: `MaxEncodedLen`) + fn set_metadata() -> Weight { + // Proof Size summary in bytes: + // Measured: `514` + // Estimated: `3800` + // Minimum execution time: 56_219_000 picoseconds. + Weight::from_parts(57_548_000, 3800) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: `Nfts::CollectionRoleOf` (r:1 w:0) + /// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemMetadataOf` (r:1 w:1) + /// Proof: `Nfts::ItemMetadataOf` (`max_values`: None, `max_size`: Some(335), added: 2810, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Collection` (r:1 w:1) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemConfigOf` (r:1 w:0) + /// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + fn clear_metadata() -> Weight { + // Proof Size summary in bytes: + // Measured: `824` + // Estimated: `3800` + // Minimum execution time: 53_360_000 picoseconds. + Weight::from_parts(54_827_000, 3800) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: `Nfts::CollectionRoleOf` (r:1 w:0) + /// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionConfigOf` (r:1 w:0) + /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Collection` (r:1 w:1) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionMetadataOf` (r:1 w:1) + /// Proof: `Nfts::CollectionMetadataOf` (`max_values`: None, `max_size`: Some(294), added: 2769, mode: `MaxEncodedLen`) + fn set_collection_metadata() -> Weight { + // Proof Size summary in bytes: + // Measured: `373` + // Estimated: `3759` + // Minimum execution time: 50_851_000 picoseconds. + Weight::from_parts(52_322_000, 3759) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: `Nfts::CollectionRoleOf` (r:1 w:0) + /// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Collection` (r:1 w:1) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionConfigOf` (r:1 w:0) + /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionMetadataOf` (r:1 w:1) + /// Proof: `Nfts::CollectionMetadataOf` (`max_values`: None, `max_size`: Some(294), added: 2769, mode: `MaxEncodedLen`) + fn clear_collection_metadata() -> Weight { + // Proof Size summary in bytes: + // Measured: `691` + // Estimated: `3759` + // Minimum execution time: 50_304_000 picoseconds. + Weight::from_parts(51_259_000, 3759) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: `Nfts::Item` (r:1 w:1) + /// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(597), added: 3072, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionConfigOf` (r:1 w:0) + /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + fn approve_transfer() -> Weight { + // Proof Size summary in bytes: + // Measured: `385` + // Estimated: `4062` + // Minimum execution time: 24_516_000 picoseconds. + Weight::from_parts(25_110_000, 4062) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Nfts::Item` (r:1 w:1) + /// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(597), added: 3072, mode: `MaxEncodedLen`) + fn cancel_approval() -> Weight { + // Proof Size summary in bytes: + // Measured: `382` + // Estimated: `4062` + // Minimum execution time: 20_404_000 picoseconds. + Weight::from_parts(21_281_000, 4062) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Nfts::Item` (r:1 w:1) + /// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(597), added: 3072, mode: `MaxEncodedLen`) + fn clear_all_transfer_approvals() -> Weight { + // Proof Size summary in bytes: + // Measured: `382` + // Estimated: `4062` + // Minimum execution time: 19_568_000 picoseconds. + Weight::from_parts(20_376_000, 4062) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Nfts::OwnershipAcceptance` (r:1 w:1) + /// Proof: `Nfts::OwnershipAcceptance` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + fn set_accept_ownership() -> Weight { + // Proof Size summary in bytes: + // Measured: `76` + // Estimated: `3505` + // Minimum execution time: 17_232_000 picoseconds. + Weight::from_parts(17_555_000, 3505) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Nfts::CollectionConfigOf` (r:1 w:1) + /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Collection` (r:1 w:0) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + fn set_collection_max_supply() -> Weight { + // Proof Size summary in bytes: + // Measured: `327` + // Estimated: `3538` + // Minimum execution time: 22_353_000 picoseconds. + Weight::from_parts(22_864_000, 3538) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Nfts::CollectionRoleOf` (r:1 w:0) + /// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionConfigOf` (r:1 w:1) + /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + fn update_mint_settings() -> Weight { + // Proof Size summary in bytes: + // Measured: `311` + // Estimated: `3538` + // Minimum execution time: 21_008_000 picoseconds. + Weight::from_parts(21_821_000, 3538) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Nfts::Item` (r:1 w:0) + /// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(597), added: 3072, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionConfigOf` (r:1 w:0) + /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemConfigOf` (r:1 w:0) + /// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemPriceOf` (r:0 w:1) + /// Proof: `Nfts::ItemPriceOf` (`max_values`: None, `max_size`: Some(77), added: 2552, mode: `MaxEncodedLen`) + fn set_price() -> Weight { + // Proof Size summary in bytes: + // Measured: `493` + // Estimated: `4062` + // Minimum execution time: 30_820_000 picoseconds. + Weight::from_parts(31_676_000, 4062) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Nfts::Item` (r:1 w:1) + /// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(597), added: 3072, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemPriceOf` (r:1 w:1) + /// Proof: `Nfts::ItemPriceOf` (`max_values`: None, `max_size`: Some(77), added: 2552, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Collection` (r:1 w:0) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Attribute` (r:1 w:0) + /// Proof: `Nfts::Attribute` (`max_values`: None, `max_size`: Some(455), added: 2930, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionConfigOf` (r:1 w:0) + /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemConfigOf` (r:1 w:0) + /// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Account` (r:0 w:2) + /// Proof: `Nfts::Account` (`max_values`: None, `max_size`: Some(76), added: 2551, mode: `MaxEncodedLen`) + /// Storage: `Nfts::PendingSwapOf` (r:0 w:1) + /// Proof: `Nfts::PendingSwapOf` (`max_values`: None, `max_size`: Some(71), added: 2546, mode: `MaxEncodedLen`) + fn buy_item() -> Weight { + // Proof Size summary in bytes: + // Measured: `655` + // Estimated: `4062` + // Minimum execution time: 67_391_000 picoseconds. + Weight::from_parts(69_020_000, 4062) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } + /// The range of component `n` is `[0, 10]`. + fn pay_tips(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 3_194_000 picoseconds. + Weight::from_parts(4_693_046, 0) + // Standard Error: 8_482 + .saturating_add(Weight::from_parts(2_570_624, 0).saturating_mul(n.into())) + } + /// Storage: `Nfts::Item` (r:2 w:0) + /// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(597), added: 3072, mode: `MaxEncodedLen`) + /// Storage: `Nfts::PendingSwapOf` (r:0 w:1) + /// Proof: `Nfts::PendingSwapOf` (`max_values`: None, `max_size`: Some(71), added: 2546, mode: `MaxEncodedLen`) + fn create_swap() -> Weight { + // Proof Size summary in bytes: + // Measured: `444` + // Estimated: `7134` + // Minimum execution time: 26_668_000 picoseconds. + Weight::from_parts(27_700_000, 7134) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Nfts::PendingSwapOf` (r:1 w:1) + /// Proof: `Nfts::PendingSwapOf` (`max_values`: None, `max_size`: Some(71), added: 2546, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Item` (r:1 w:0) + /// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(597), added: 3072, mode: `MaxEncodedLen`) + fn cancel_swap() -> Weight { + // Proof Size summary in bytes: + // Measured: `488` + // Estimated: `4062` + // Minimum execution time: 27_612_000 picoseconds. + Weight::from_parts(28_523_000, 4062) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Nfts::Item` (r:2 w:2) + /// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(597), added: 3072, mode: `MaxEncodedLen`) + /// Storage: `Nfts::PendingSwapOf` (r:1 w:2) + /// Proof: `Nfts::PendingSwapOf` (`max_values`: None, `max_size`: Some(71), added: 2546, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Collection` (r:1 w:0) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Attribute` (r:2 w:0) + /// Proof: `Nfts::Attribute` (`max_values`: None, `max_size`: Some(455), added: 2930, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionConfigOf` (r:1 w:0) + /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemConfigOf` (r:2 w:0) + /// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Account` (r:0 w:4) + /// Proof: `Nfts::Account` (`max_values`: None, `max_size`: Some(76), added: 2551, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemPriceOf` (r:0 w:2) + /// Proof: `Nfts::ItemPriceOf` (`max_values`: None, `max_size`: Some(77), added: 2552, mode: `MaxEncodedLen`) + fn claim_swap() -> Weight { + // Proof Size summary in bytes: + // Measured: `771` + // Estimated: `7134` + // Minimum execution time: 109_691_000 picoseconds. + Weight::from_parts(111_678_000, 7134) + .saturating_add(T::DbWeight::get().reads(9_u64)) + .saturating_add(T::DbWeight::get().writes(10_u64)) + } + /// Storage: `Nfts::CollectionRoleOf` (r:2 w:0) + /// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionConfigOf` (r:1 w:0) + /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Item` (r:1 w:1) + /// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(597), added: 3072, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Collection` (r:1 w:1) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemConfigOf` (r:1 w:1) + /// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Attribute` (r:10 w:10) + /// Proof: `Nfts::Attribute` (`max_values`: None, `max_size`: Some(455), added: 2930, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemMetadataOf` (r:1 w:1) + /// Proof: `Nfts::ItemMetadataOf` (`max_values`: None, `max_size`: Some(335), added: 2810, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Account` (r:0 w:1) + /// Proof: `Nfts::Account` (`max_values`: None, `max_size`: Some(76), added: 2551, mode: `MaxEncodedLen`) + /// The range of component `n` is `[0, 10]`. + fn mint_pre_signed(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `580` + // Estimated: `6054 + n * (2930 ±0)` + // Minimum execution time: 158_638_000 picoseconds. + Weight::from_parts(165_550_686, 6054) + // Standard Error: 65_710 + .saturating_add(Weight::from_parts(43_677_181, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes(6_u64)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 2930).saturating_mul(n.into())) + } + /// Storage: `Nfts::Item` (r:1 w:0) + /// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(597), added: 3072, mode: `MaxEncodedLen`) + /// Storage: `Nfts::ItemAttributesApprovalsOf` (r:1 w:1) + /// Proof: `Nfts::ItemAttributesApprovalsOf` (`max_values`: None, `max_size`: Some(441), added: 2916, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionConfigOf` (r:1 w:0) + /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Collection` (r:1 w:1) + /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Nfts::Attribute` (r:10 w:10) + /// Proof: `Nfts::Attribute` (`max_values`: None, `max_size`: Some(455), added: 2930, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// The range of component `n` is `[0, 10]`. + fn set_attributes_pre_signed(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `575` + // Estimated: `4062 + n * (2930 ±0)` + // Minimum execution time: 75_427_000 picoseconds. + Weight::from_parts(88_971_257, 4062) + // Standard Error: 91_158 + .saturating_add(Weight::from_parts(42_253_239, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes(2_u64)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 2930).saturating_mul(n.into())) + } +} diff --git a/operator/runtime/testnet/src/weights/pallet_payment_streams.rs b/operator/runtime/testnet/src/weights/pallet_payment_streams.rs new file mode 100644 index 00000000..d094d81d --- /dev/null +++ b/operator/runtime/testnet/src/weights/pallet_payment_streams.rs @@ -0,0 +1,449 @@ +// Copyright 2025 DataHaven +// This file is part of DataHaven. + +// DataHaven is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// DataHaven is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with DataHaven. If not, see . + + +//! Autogenerated weights for `pallet_payment_streams` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 51.0.0 +//! DATE: 2026-01-29, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ip-10-0-0-176`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` +//! WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --runtime +// target/production/wbuild/datahaven-testnet-runtime/datahaven_testnet_runtime.compact.compressed.wasm +// --pallet +// pallet_payment_streams +// --extrinsic +// +// --header +// ../file_header.txt +// --template +// benchmarking/frame-weight-template.hbs +// --output +// runtime/testnet/src/weights/pallet_payment_streams.rs +// --steps +// 50 +// --repeat +// 20 + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use sp_std::marker::PhantomData; + +/// Weights for `pallet_payment_streams`. +pub struct WeightInfo(PhantomData); +impl pallet_payment_streams::weights::WeightInfo for WeightInfo { + /// Storage: `Providers::BackupStorageProviders` (r:1 w:0) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:2 w:0) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `Providers::AwaitingTopUpFromProviders` (r:2 w:0) + /// Proof: `Providers::AwaitingTopUpFromProviders` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::FixedRatePaymentStreams` (r:1 w:1) + /// Proof: `PaymentStreams::FixedRatePaymentStreams` (`max_values`: None, `max_size`: Some(125), added: 2600, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::UsersWithoutFunds` (r:1 w:0) + /// Proof: `PaymentStreams::UsersWithoutFunds` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::RegisteredUsers` (r:1 w:1) + /// Proof: `PaymentStreams::RegisteredUsers` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::OnPollTicker` (r:1 w:0) + /// Proof: `PaymentStreams::OnPollTicker` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + fn create_fixed_rate_payment_stream() -> Weight { + // Proof Size summary in bytes: + // Measured: `523` + // Estimated: `6054` + // Minimum execution time: 108_671_000 picoseconds. + Weight::from_parts(110_483_000, 6054) + .saturating_add(T::DbWeight::get().reads(11_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) + } + /// Storage: `Providers::BackupStorageProviders` (r:1 w:0) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::FixedRatePaymentStreams` (r:1 w:1) + /// Proof: `PaymentStreams::FixedRatePaymentStreams` (`max_values`: None, `max_size`: Some(125), added: 2600, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::UsersWithoutFunds` (r:1 w:0) + /// Proof: `PaymentStreams::UsersWithoutFunds` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:2 w:0) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `Providers::AwaitingTopUpFromProviders` (r:2 w:0) + /// Proof: `Providers::AwaitingTopUpFromProviders` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::DynamicRatePaymentStreams` (r:1 w:1) + /// Proof: `PaymentStreams::DynamicRatePaymentStreams` (`max_values`: None, `max_size`: Some(129), added: 2604, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::PrivilegedProviders` (r:1 w:0) + /// Proof: `PaymentStreams::PrivilegedProviders` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::LastChargeableInfo` (r:1 w:0) + /// Proof: `PaymentStreams::LastChargeableInfo` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:3 w:3) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Providers::TotalBspsCapacity` (r:1 w:0) + /// Proof: `Providers::TotalBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Providers::UsedBspsCapacity` (r:1 w:0) + /// Proof: `Providers::UsedBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Parameters::Parameters` (r:4 w:0) + /// Proof: `Parameters::Parameters` (`max_values`: None, `max_size`: Some(381), added: 2856, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::OnPollTicker` (r:1 w:0) + /// Proof: `PaymentStreams::OnPollTicker` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + fn update_fixed_rate_payment_stream() -> Weight { + // Proof Size summary in bytes: + // Measured: `1427` + // Estimated: `12414` + // Minimum execution time: 406_731_000 picoseconds. + Weight::from_parts(416_205_000, 12414) + .saturating_add(T::DbWeight::get().reads(21_u64)) + .saturating_add(T::DbWeight::get().writes(6_u64)) + } + /// Storage: `Providers::BackupStorageProviders` (r:1 w:0) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::FixedRatePaymentStreams` (r:1 w:1) + /// Proof: `PaymentStreams::FixedRatePaymentStreams` (`max_values`: None, `max_size`: Some(125), added: 2600, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:2 w:0) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `Providers::AwaitingTopUpFromProviders` (r:2 w:0) + /// Proof: `Providers::AwaitingTopUpFromProviders` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::DynamicRatePaymentStreams` (r:1 w:0) + /// Proof: `PaymentStreams::DynamicRatePaymentStreams` (`max_values`: None, `max_size`: Some(129), added: 2604, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::PrivilegedProviders` (r:1 w:0) + /// Proof: `PaymentStreams::PrivilegedProviders` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::LastChargeableInfo` (r:1 w:0) + /// Proof: `PaymentStreams::LastChargeableInfo` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::UsersWithoutFunds` (r:1 w:0) + /// Proof: `PaymentStreams::UsersWithoutFunds` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:3 w:3) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Providers::TotalBspsCapacity` (r:1 w:0) + /// Proof: `Providers::TotalBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Providers::UsedBspsCapacity` (r:1 w:0) + /// Proof: `Providers::UsedBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Parameters::Parameters` (r:4 w:0) + /// Proof: `Parameters::Parameters` (`max_values`: None, `max_size`: Some(381), added: 2856, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::OnPollTicker` (r:1 w:0) + /// Proof: `PaymentStreams::OnPollTicker` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::RegisteredUsers` (r:1 w:1) + /// Proof: `PaymentStreams::RegisteredUsers` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + fn delete_fixed_rate_payment_stream() -> Weight { + // Proof Size summary in bytes: + // Measured: `1304` + // Estimated: `12414` + // Minimum execution time: 294_818_000 picoseconds. + Weight::from_parts(298_194_000, 12414) + .saturating_add(T::DbWeight::get().reads(22_u64)) + .saturating_add(T::DbWeight::get().writes(6_u64)) + } + /// Storage: `Providers::BackupStorageProviders` (r:1 w:0) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:2 w:0) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `Providers::AwaitingTopUpFromProviders` (r:2 w:0) + /// Proof: `Providers::AwaitingTopUpFromProviders` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::DynamicRatePaymentStreams` (r:1 w:1) + /// Proof: `PaymentStreams::DynamicRatePaymentStreams` (`max_values`: None, `max_size`: Some(129), added: 2604, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::UsersWithoutFunds` (r:1 w:0) + /// Proof: `PaymentStreams::UsersWithoutFunds` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::CurrentPricePerGigaUnitPerTick` (r:1 w:0) + /// Proof: `PaymentStreams::CurrentPricePerGigaUnitPerTick` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::RegisteredUsers` (r:1 w:1) + /// Proof: `PaymentStreams::RegisteredUsers` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::AccumulatedPriceIndex` (r:1 w:0) + /// Proof: `PaymentStreams::AccumulatedPriceIndex` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + fn create_dynamic_rate_payment_stream() -> Weight { + // Proof Size summary in bytes: + // Measured: `525` + // Estimated: `6054` + // Minimum execution time: 110_206_000 picoseconds. + Weight::from_parts(112_480_000, 6054) + .saturating_add(T::DbWeight::get().reads(12_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) + } + /// Storage: `Providers::BackupStorageProviders` (r:1 w:0) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::DynamicRatePaymentStreams` (r:1 w:1) + /// Proof: `PaymentStreams::DynamicRatePaymentStreams` (`max_values`: None, `max_size`: Some(129), added: 2604, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::UsersWithoutFunds` (r:1 w:0) + /// Proof: `PaymentStreams::UsersWithoutFunds` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:2 w:0) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `Providers::AwaitingTopUpFromProviders` (r:2 w:0) + /// Proof: `Providers::AwaitingTopUpFromProviders` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::FixedRatePaymentStreams` (r:1 w:1) + /// Proof: `PaymentStreams::FixedRatePaymentStreams` (`max_values`: None, `max_size`: Some(125), added: 2600, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::PrivilegedProviders` (r:1 w:0) + /// Proof: `PaymentStreams::PrivilegedProviders` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::LastChargeableInfo` (r:1 w:0) + /// Proof: `PaymentStreams::LastChargeableInfo` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:3 w:3) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Providers::TotalBspsCapacity` (r:1 w:0) + /// Proof: `Providers::TotalBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Providers::UsedBspsCapacity` (r:1 w:0) + /// Proof: `Providers::UsedBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Parameters::Parameters` (r:4 w:0) + /// Proof: `Parameters::Parameters` (`max_values`: None, `max_size`: Some(381), added: 2856, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::OnPollTicker` (r:1 w:0) + /// Proof: `PaymentStreams::OnPollTicker` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::CurrentPricePerGigaUnitPerTick` (r:1 w:0) + /// Proof: `PaymentStreams::CurrentPricePerGigaUnitPerTick` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + fn update_dynamic_rate_payment_stream() -> Weight { + // Proof Size summary in bytes: + // Measured: `1387` + // Estimated: `12414` + // Minimum execution time: 350_407_000 picoseconds. + Weight::from_parts(353_687_000, 12414) + .saturating_add(T::DbWeight::get().reads(21_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } + /// Storage: `Providers::BackupStorageProviders` (r:1 w:0) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::DynamicRatePaymentStreams` (r:1 w:1) + /// Proof: `PaymentStreams::DynamicRatePaymentStreams` (`max_values`: None, `max_size`: Some(129), added: 2604, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:2 w:0) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `Providers::AwaitingTopUpFromProviders` (r:2 w:0) + /// Proof: `Providers::AwaitingTopUpFromProviders` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::FixedRatePaymentStreams` (r:1 w:1) + /// Proof: `PaymentStreams::FixedRatePaymentStreams` (`max_values`: None, `max_size`: Some(125), added: 2600, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::PrivilegedProviders` (r:1 w:0) + /// Proof: `PaymentStreams::PrivilegedProviders` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::LastChargeableInfo` (r:1 w:0) + /// Proof: `PaymentStreams::LastChargeableInfo` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::UsersWithoutFunds` (r:1 w:0) + /// Proof: `PaymentStreams::UsersWithoutFunds` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:3 w:3) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Providers::TotalBspsCapacity` (r:1 w:0) + /// Proof: `Providers::TotalBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Providers::UsedBspsCapacity` (r:1 w:0) + /// Proof: `Providers::UsedBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Parameters::Parameters` (r:4 w:0) + /// Proof: `Parameters::Parameters` (`max_values`: None, `max_size`: Some(381), added: 2856, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::OnPollTicker` (r:1 w:0) + /// Proof: `PaymentStreams::OnPollTicker` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::RegisteredUsers` (r:1 w:1) + /// Proof: `PaymentStreams::RegisteredUsers` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + fn delete_dynamic_rate_payment_stream() -> Weight { + // Proof Size summary in bytes: + // Measured: `1455` + // Estimated: `12414` + // Minimum execution time: 407_867_000 picoseconds. + Weight::from_parts(423_394_000, 12414) + .saturating_add(T::DbWeight::get().reads(22_u64)) + .saturating_add(T::DbWeight::get().writes(7_u64)) + } + /// Storage: `Providers::AccountIdToBackupStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToBackupStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:2 w:0) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `Providers::AwaitingTopUpFromProviders` (r:2 w:0) + /// Proof: `Providers::AwaitingTopUpFromProviders` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Providers::BackupStorageProviders` (r:1 w:0) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::FixedRatePaymentStreams` (r:1 w:1) + /// Proof: `PaymentStreams::FixedRatePaymentStreams` (`max_values`: None, `max_size`: Some(125), added: 2600, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::DynamicRatePaymentStreams` (r:1 w:1) + /// Proof: `PaymentStreams::DynamicRatePaymentStreams` (`max_values`: None, `max_size`: Some(129), added: 2604, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::PrivilegedProviders` (r:1 w:0) + /// Proof: `PaymentStreams::PrivilegedProviders` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::LastChargeableInfo` (r:1 w:0) + /// Proof: `PaymentStreams::LastChargeableInfo` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::UsersWithoutFunds` (r:1 w:0) + /// Proof: `PaymentStreams::UsersWithoutFunds` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:3 w:3) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Providers::TotalBspsCapacity` (r:1 w:0) + /// Proof: `Providers::TotalBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Providers::UsedBspsCapacity` (r:1 w:0) + /// Proof: `Providers::UsedBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Parameters::Parameters` (r:4 w:0) + /// Proof: `Parameters::Parameters` (`max_values`: None, `max_size`: Some(381), added: 2856, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::OnPollTicker` (r:1 w:0) + /// Proof: `PaymentStreams::OnPollTicker` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + fn charge_payment_streams() -> Weight { + // Proof Size summary in bytes: + // Measured: `1441` + // Estimated: `12414` + // Minimum execution time: 337_670_000 picoseconds. + Weight::from_parts(343_494_000, 12414) + .saturating_add(T::DbWeight::get().reads(21_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } + /// Storage: `Providers::AccountIdToBackupStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToBackupStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::OnPollTicker` (r:1 w:0) + /// Proof: `PaymentStreams::OnPollTicker` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:2 w:0) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `Providers::AwaitingTopUpFromProviders` (r:2 w:0) + /// Proof: `Providers::AwaitingTopUpFromProviders` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Providers::BackupStorageProviders` (r:1 w:0) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::FixedRatePaymentStreams` (r:10 w:10) + /// Proof: `PaymentStreams::FixedRatePaymentStreams` (`max_values`: None, `max_size`: Some(125), added: 2600, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::DynamicRatePaymentStreams` (r:10 w:10) + /// Proof: `PaymentStreams::DynamicRatePaymentStreams` (`max_values`: None, `max_size`: Some(129), added: 2604, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::PrivilegedProviders` (r:1 w:0) + /// Proof: `PaymentStreams::PrivilegedProviders` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::LastChargeableInfo` (r:1 w:0) + /// Proof: `PaymentStreams::LastChargeableInfo` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::UsersWithoutFunds` (r:10 w:0) + /// Proof: `PaymentStreams::UsersWithoutFunds` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:12 w:12) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Providers::TotalBspsCapacity` (r:1 w:0) + /// Proof: `Providers::TotalBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Providers::UsedBspsCapacity` (r:1 w:0) + /// Proof: `Providers::UsedBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Parameters::Parameters` (r:4 w:0) + /// Proof: `Parameters::Parameters` (`max_values`: None, `max_size`: Some(381), added: 2856, mode: `MaxEncodedLen`) + /// The range of component `n` is `[0, 10]`. + fn charge_multiple_users_payment_streams(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `1122 + n * (331 ±0)` + // Estimated: `12414 + n * (2604 ±0)` + // Minimum execution time: 20_398_000 picoseconds. + Weight::from_parts(45_361_517, 12414) + // Standard Error: 164_730 + .saturating_add(Weight::from_parts(296_339_119, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(12_u64)) + .saturating_add(T::DbWeight::get().reads((5_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes(1_u64)) + .saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 2604).saturating_mul(n.into())) + } + /// Storage: `PaymentStreams::UsersWithoutFunds` (r:1 w:0) + /// Proof: `PaymentStreams::UsersWithoutFunds` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1001 w:1001) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Providers::TotalBspsCapacity` (r:1 w:0) + /// Proof: `Providers::TotalBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Providers::UsedBspsCapacity` (r:1 w:0) + /// Proof: `Providers::UsedBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::FixedRatePaymentStreams` (r:999 w:999) + /// Proof: `PaymentStreams::FixedRatePaymentStreams` (`max_values`: None, `max_size`: Some(125), added: 2600, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::DynamicRatePaymentStreams` (r:999 w:999) + /// Proof: `PaymentStreams::DynamicRatePaymentStreams` (`max_values`: None, `max_size`: Some(129), added: 2604, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::PrivilegedProviders` (r:999 w:0) + /// Proof: `PaymentStreams::PrivilegedProviders` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::LastChargeableInfo` (r:999 w:0) + /// Proof: `PaymentStreams::LastChargeableInfo` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Parameters::Parameters` (r:4 w:0) + /// Proof: `Parameters::Parameters` (`max_values`: None, `max_size`: Some(381), added: 2856, mode: `MaxEncodedLen`) + /// Storage: `Providers::BackupStorageProviders` (r:999 w:0) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::RegisteredUsers` (r:1 w:1) + /// Proof: `PaymentStreams::RegisteredUsers` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 1000]`. + fn pay_outstanding_debt(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `1422 + n * (644 ±0)` + // Estimated: `12414 + n * (3634 ±0)` + // Minimum execution time: 379_144_000 picoseconds. + Weight::from_parts(384_440_000, 12414) + // Standard Error: 164_472 + .saturating_add(Weight::from_parts(287_945_137, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(11_u64)) + .saturating_add(T::DbWeight::get().reads((6_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes(4_u64)) + .saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 3634).saturating_mul(n.into())) + } + /// Storage: `PaymentStreams::UsersWithoutFunds` (r:1 w:1) + /// Proof: `PaymentStreams::UsersWithoutFunds` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::OnPollTicker` (r:1 w:0) + /// Proof: `PaymentStreams::OnPollTicker` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::RegisteredUsers` (r:1 w:0) + /// Proof: `PaymentStreams::RegisteredUsers` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + fn clear_insolvent_flag() -> Weight { + // Proof Size summary in bytes: + // Measured: `231` + // Estimated: `3505` + // Minimum execution time: 22_622_000 picoseconds. + Weight::from_parts(23_508_000, 3505) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `PaymentStreams::CurrentPricePerGigaUnitPerTick` (r:1 w:0) + /// Proof: `PaymentStreams::CurrentPricePerGigaUnitPerTick` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::AccumulatedPriceIndex` (r:1 w:1) + /// Proof: `PaymentStreams::AccumulatedPriceIndex` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + fn price_index_update() -> Weight { + // Proof Size summary in bytes: + // Measured: `116` + // Estimated: `1501` + // Minimum execution time: 5_924_000 picoseconds. + Weight::from_parts(6_148_000, 1501) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `PaymentStreams::OnPollTicker` (r:1 w:1) + /// Proof: `PaymentStreams::OnPollTicker` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + fn tick_update() -> Weight { + // Proof Size summary in bytes: + // Measured: `114` + // Estimated: `1489` + // Minimum execution time: 4_037_000 picoseconds. + Weight::from_parts(4_180_000, 1489) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `ProofsDealer::ChallengesTicker` (r:1 w:0) + /// Proof: `ProofsDealer::ChallengesTicker` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::LastSubmittersTickRegistered` (r:1 w:1) + /// Proof: `PaymentStreams::LastSubmittersTickRegistered` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::ValidProofSubmittersLastTicks` (r:1 w:0) + /// Proof: `ProofsDealer::ValidProofSubmittersLastTicks` (`max_values`: None, `max_size`: Some(7830), added: 10305, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::AccumulatedPriceIndex` (r:1 w:0) + /// Proof: `PaymentStreams::AccumulatedPriceIndex` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::LastChargeableInfo` (r:244 w:244) + /// Proof: `PaymentStreams::LastChargeableInfo` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// The range of component `n` is `[0, 244]`. + fn update_providers_last_chargeable_info(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `270 + n * (32 ±0)` + // Estimated: `11295 + n * (2543 ±0)` + // Minimum execution time: 12_833_000 picoseconds. + Weight::from_parts(14_336_361, 11295) + // Standard Error: 5_031 + .saturating_add(Weight::from_parts(6_893_894, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes(1_u64)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 2543).saturating_mul(n.into())) + } +} diff --git a/operator/runtime/testnet/src/weights/pallet_proofs_dealer.rs b/operator/runtime/testnet/src/weights/pallet_proofs_dealer.rs new file mode 100644 index 00000000..7ad738bf --- /dev/null +++ b/operator/runtime/testnet/src/weights/pallet_proofs_dealer.rs @@ -0,0 +1,326 @@ +// Copyright 2025 DataHaven +// This file is part of DataHaven. + +// DataHaven is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// DataHaven is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with DataHaven. If not, see . + + +//! Autogenerated weights for `pallet_proofs_dealer` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 51.0.0 +//! DATE: 2026-01-29, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ip-10-0-0-176`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` +//! WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --runtime +// target/production/wbuild/datahaven-testnet-runtime/datahaven_testnet_runtime.compact.compressed.wasm +// --pallet +// pallet_proofs_dealer +// --extrinsic +// +// --header +// ../file_header.txt +// --template +// benchmarking/frame-weight-template.hbs +// --output +// runtime/testnet/src/weights/pallet_proofs_dealer.rs +// --steps +// 50 +// --repeat +// 20 + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use sp_std::marker::PhantomData; + +/// Weights for `pallet_proofs_dealer`. +pub struct WeightInfo(PhantomData); +impl pallet_proofs_dealer::weights::WeightInfo for WeightInfo { + /// Storage: `ProofsDealer::ChallengesQueue` (r:1 w:1) + /// Proof: `ProofsDealer::ChallengesQueue` (`max_values`: Some(1), `max_size`: Some(3202), added: 3697, mode: `MaxEncodedLen`) + fn challenge() -> Weight { + // Proof Size summary in bytes: + // Measured: `41` + // Estimated: `4687` + // Minimum execution time: 11_486_000 picoseconds. + Weight::from_parts(11_900_000, 4687) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Providers::AccountIdToBackupStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToBackupStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::BackupStorageProviders` (r:1 w:1) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::ProviderToProofSubmissionRecord` (r:1 w:1) + /// Proof: `ProofsDealer::ProviderToProofSubmissionRecord` (`max_values`: None, `max_size`: Some(56), added: 2531, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:2 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::ChallengesTicker` (r:1 w:0) + /// Proof: `ProofsDealer::ChallengesTicker` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::TickToChallengesSeed` (r:1 w:0) + /// Proof: `ProofsDealer::TickToChallengesSeed` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::LastCheckpointTick` (r:1 w:0) + /// Proof: `ProofsDealer::LastCheckpointTick` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::TickToCheckpointChallenges` (r:1 w:0) + /// Proof: `ProofsDealer::TickToCheckpointChallenges` (`max_values`: None, `max_size`: Some(681), added: 3156, mode: `MaxEncodedLen`) + /// Storage: `Providers::MainStorageProviders` (r:1 w:0) + /// Proof: `Providers::MainStorageProviders` (`max_values`: None, `max_size`: Some(1143), added: 3618, mode: `MaxEncodedLen`) + /// Storage: `Providers::UsedBspsCapacity` (r:1 w:1) + /// Proof: `Providers::UsedBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::UsersWithoutFunds` (r:1 w:0) + /// Proof: `PaymentStreams::UsersWithoutFunds` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::DynamicRatePaymentStreams` (r:1 w:1) + /// Proof: `PaymentStreams::DynamicRatePaymentStreams` (`max_values`: None, `max_size`: Some(129), added: 2604, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:2 w:0) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `Providers::AwaitingTopUpFromProviders` (r:2 w:0) + /// Proof: `Providers::AwaitingTopUpFromProviders` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::FixedRatePaymentStreams` (r:1 w:0) + /// Proof: `PaymentStreams::FixedRatePaymentStreams` (`max_values`: None, `max_size`: Some(125), added: 2600, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::PrivilegedProviders` (r:1 w:0) + /// Proof: `PaymentStreams::PrivilegedProviders` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::LastChargeableInfo` (r:1 w:0) + /// Proof: `PaymentStreams::LastChargeableInfo` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:2 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Providers::TotalBspsCapacity` (r:1 w:0) + /// Proof: `Providers::TotalBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Parameters::Parameters` (r:5 w:0) + /// Proof: `Parameters::Parameters` (`max_values`: None, `max_size`: Some(381), added: 2856, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::CurrentPricePerGigaUnitPerTick` (r:1 w:0) + /// Proof: `PaymentStreams::CurrentPricePerGigaUnitPerTick` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::ValidProofSubmittersLastTicks` (r:1 w:1) + /// Proof: `ProofsDealer::ValidProofSubmittersLastTicks` (`max_values`: None, `max_size`: Some(7830), added: 10305, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::TickToProvidersDeadlines` (r:0 w:2) + /// Proof: `ProofsDealer::TickToProvidersDeadlines` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 20]`. + fn submit_proof_no_checkpoint_challenges_key_proofs(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `2070` + // Estimated: `15270` + // Minimum execution time: 2_174_837_000 picoseconds. + Weight::from_parts(2_059_384_726, 15270) + // Standard Error: 314_390 + .saturating_add(Weight::from_parts(135_797_182, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(30_u64)) + .saturating_add(T::DbWeight::get().writes(9_u64)) + } + /// Storage: `Providers::AccountIdToBackupStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToBackupStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::BackupStorageProviders` (r:1 w:0) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::ProviderToProofSubmissionRecord` (r:1 w:1) + /// Proof: `ProofsDealer::ProviderToProofSubmissionRecord` (`max_values`: None, `max_size`: Some(56), added: 2531, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:0) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::ChallengesTicker` (r:1 w:0) + /// Proof: `ProofsDealer::ChallengesTicker` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::TickToChallengesSeed` (r:1 w:0) + /// Proof: `ProofsDealer::TickToChallengesSeed` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::LastCheckpointTick` (r:1 w:0) + /// Proof: `ProofsDealer::LastCheckpointTick` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::TickToCheckpointChallenges` (r:1 w:0) + /// Proof: `ProofsDealer::TickToCheckpointChallenges` (`max_values`: None, `max_size`: Some(681), added: 3156, mode: `MaxEncodedLen`) + /// Storage: `Parameters::Parameters` (r:1 w:0) + /// Proof: `Parameters::Parameters` (`max_values`: None, `max_size`: Some(381), added: 2856, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::ValidProofSubmittersLastTicks` (r:1 w:1) + /// Proof: `ProofsDealer::ValidProofSubmittersLastTicks` (`max_values`: None, `max_size`: Some(7830), added: 10305, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::TickToProvidersDeadlines` (r:0 w:2) + /// Proof: `ProofsDealer::TickToProvidersDeadlines` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::MainStorageProviders` (r:1 w:0) + /// Proof: `Providers::MainStorageProviders` (`max_values`: None, `max_size`: Some(1143), added: 3618, mode: `MaxEncodedLen`) + /// Storage: `Providers::UsedBspsCapacity` (r:1 w:1) + /// Proof: `Providers::UsedBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::UsersWithoutFunds` (r:1 w:0) + /// Proof: `PaymentStreams::UsersWithoutFunds` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::DynamicRatePaymentStreams` (r:1 w:1) + /// Proof: `PaymentStreams::DynamicRatePaymentStreams` (`max_values`: None, `max_size`: Some(129), added: 2604, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:2 w:0) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `Providers::AwaitingTopUpFromProviders` (r:2 w:0) + /// Proof: `Providers::AwaitingTopUpFromProviders` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::FixedRatePaymentStreams` (r:1 w:0) + /// Proof: `PaymentStreams::FixedRatePaymentStreams` (`max_values`: None, `max_size`: Some(125), added: 2600, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::PrivilegedProviders` (r:1 w:0) + /// Proof: `PaymentStreams::PrivilegedProviders` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::LastChargeableInfo` (r:1 w:0) + /// Proof: `PaymentStreams::LastChargeableInfo` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:2 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Providers::TotalBspsCapacity` (r:1 w:0) + /// Proof: `Providers::TotalBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::CurrentPricePerGigaUnitPerTick` (r:1 w:0) + /// Proof: `PaymentStreams::CurrentPricePerGigaUnitPerTick` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// The range of component `n` is `[21, 40]`. + fn submit_proof_with_checkpoint_challenges_key_proofs(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `2070` + // Estimated: `20676` + // Minimum execution time: 4_570_889_000 picoseconds. + Weight::from_parts(4_000_730_198, 20676) + // Standard Error: 951_176 + .saturating_add(Weight::from_parts(35_912_979, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(39_u64)) + .saturating_add(T::DbWeight::get().writes(11_u64)) + } + /// Storage: `ProofsDealer::ChallengesTicker` (r:1 w:1) + /// Proof: `ProofsDealer::ChallengesTicker` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Randomness::LatestParentBlockRandomness` (r:1 w:0) + /// Proof: `Randomness::LatestParentBlockRandomness` (`max_values`: Some(1), `max_size`: Some(36), added: 531, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::LastCheckpointTick` (r:1 w:0) + /// Proof: `ProofsDealer::LastCheckpointTick` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::TickToCheckpointChallenges` (r:1 w:0) + /// Proof: `ProofsDealer::TickToCheckpointChallenges` (`max_values`: None, `max_size`: Some(681), added: 3156, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::TickToCheckForSlashableProviders` (r:1 w:1) + /// Proof: `ProofsDealer::TickToCheckForSlashableProviders` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::TickToProvidersDeadlines` (r:1001 w:2000) + /// Proof: `ProofsDealer::TickToProvidersDeadlines` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::ProviderToProofSubmissionRecord` (r:1000 w:1000) + /// Proof: `ProofsDealer::ProviderToProofSubmissionRecord` (`max_values`: None, `max_size`: Some(56), added: 2531, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::SlashableProviders` (r:1000 w:1000) + /// Proof: `ProofsDealer::SlashableProviders` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + /// Storage: `Providers::BackupStorageProviders` (r:1000 w:0) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1000 w:0) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `Parameters::Parameters` (r:1 w:0) + /// Proof: `Parameters::Parameters` (`max_values`: None, `max_size`: Some(381), added: 2856, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::TickToChallengesSeed` (r:0 w:1) + /// Proof: `ProofsDealer::TickToChallengesSeed` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + /// The range of component `n` is `[0, 1000]`. + fn new_challenges_round(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `1155 + n * (271 ±0)` + // Estimated: `6172 + n * (3634 ±0)` + // Minimum execution time: 29_687_000 picoseconds. + Weight::from_parts(30_010_000, 6172) + // Standard Error: 49_079 + .saturating_add(Weight::from_parts(40_156_766, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().reads((5_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(T::DbWeight::get().writes((4_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 3634).saturating_mul(n.into())) + } + /// Storage: `ProofsDealer::PriorityChallengesQueue` (r:1 w:1) + /// Proof: `ProofsDealer::PriorityChallengesQueue` (`max_values`: Some(1), `max_size`: Some(3302), added: 3797, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::ChallengesQueue` (r:1 w:1) + /// Proof: `ProofsDealer::ChallengesQueue` (`max_values`: Some(1), `max_size`: Some(3202), added: 3697, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::LastCheckpointTick` (r:1 w:1) + /// Proof: `ProofsDealer::LastCheckpointTick` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::TickToCheckpointChallenges` (r:0 w:2) + /// Proof: `ProofsDealer::TickToCheckpointChallenges` (`max_values`: None, `max_size`: Some(681), added: 3156, mode: `MaxEncodedLen`) + /// The range of component `n` is `[0, 20]`. + fn new_checkpoint_challenge_round(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `65 + n * (32 ±0)` + // Estimated: `4787` + // Minimum execution time: 14_023_000 picoseconds. + Weight::from_parts(16_003_551, 4787) + // Standard Error: 3_466 + .saturating_add(Weight::from_parts(429_621, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } + /// Storage: `ProofsDealer::PastBlocksStatus` (r:1 w:1) + /// Proof: `ProofsDealer::PastBlocksStatus` (`max_values`: Some(1), `max_size`: Some(51), added: 546, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::PastBlocksWeight` (r:1 w:0) + /// Proof: `ProofsDealer::PastBlocksWeight` (`max_values`: None, `max_size`: Some(36), added: 2511, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::ChallengesTicker` (r:1 w:0) + /// Proof: `ProofsDealer::ChallengesTicker` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::ChallengesTickerPaused` (r:0 w:1) + /// Proof: `ProofsDealer::ChallengesTickerPaused` (`max_values`: Some(1), `max_size`: Some(0), added: 495, mode: `MaxEncodedLen`) + fn check_spamming_condition() -> Weight { + // Proof Size summary in bytes: + // Measured: `248` + // Estimated: `3501` + // Minimum execution time: 13_925_000 picoseconds. + Weight::from_parts(14_476_000, 3501) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: `ProofsDealer::LastDeletedTick` (r:1 w:0) + /// Proof: `ProofsDealer::LastDeletedTick` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::ChallengesTicker` (r:1 w:0) + /// Proof: `ProofsDealer::ChallengesTicker` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + fn trim_valid_proof_submitters_last_ticks_constant_execution() -> Weight { + // Proof Size summary in bytes: + // Measured: `41` + // Estimated: `1489` + // Minimum execution time: 4_422_000 picoseconds. + Weight::from_parts(4_638_000, 1489) + .saturating_add(T::DbWeight::get().reads(2_u64)) + } + /// Storage: `ProofsDealer::LastDeletedTick` (r:0 w:1) + /// Proof: `ProofsDealer::LastDeletedTick` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::ValidProofSubmittersLastTicks` (r:0 w:1) + /// Proof: `ProofsDealer::ValidProofSubmittersLastTicks` (`max_values`: None, `max_size`: Some(7830), added: 10305, mode: `MaxEncodedLen`) + fn trim_valid_proof_submitters_last_ticks_loop() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 2_453_000 picoseconds. + Weight::from_parts(2_608_000, 0) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: `ProofsDealer::PastBlocksWeight` (r:0 w:2) + /// Proof: `ProofsDealer::PastBlocksWeight` (`max_values`: None, `max_size`: Some(36), added: 2511, mode: `MaxEncodedLen`) + fn on_finalize() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 4_835_000 picoseconds. + Weight::from_parts(5_018_000, 0) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: `Providers::BackupStorageProviders` (r:1 w:0) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:0) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::ProviderToProofSubmissionRecord` (r:1 w:1) + /// Proof: `ProofsDealer::ProviderToProofSubmissionRecord` (`max_values`: None, `max_size`: Some(56), added: 2531, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::ChallengesTicker` (r:1 w:0) + /// Proof: `ProofsDealer::ChallengesTicker` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Parameters::Parameters` (r:1 w:0) + /// Proof: `Parameters::Parameters` (`max_values`: None, `max_size`: Some(381), added: 2856, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::TickToProvidersDeadlines` (r:0 w:1) + /// Proof: `ProofsDealer::TickToProvidersDeadlines` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + fn force_initialise_challenge_cycle() -> Weight { + // Proof Size summary in bytes: + // Measured: `552` + // Estimated: `4624` + // Minimum execution time: 44_075_000 picoseconds. + Weight::from_parts(45_401_000, 4624) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: `ProofsDealer::ChallengesTickerPaused` (r:0 w:1) + /// Proof: `ProofsDealer::ChallengesTickerPaused` (`max_values`: Some(1), `max_size`: Some(0), added: 495, mode: `MaxEncodedLen`) + fn set_paused() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 7_190_000 picoseconds. + Weight::from_parts(7_572_000, 0) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } +} diff --git a/operator/runtime/testnet/src/weights/pallet_session.rs b/operator/runtime/testnet/src/weights/pallet_session.rs new file mode 100644 index 00000000..154c1a57 --- /dev/null +++ b/operator/runtime/testnet/src/weights/pallet_session.rs @@ -0,0 +1,84 @@ +// Copyright 2025 DataHaven +// This file is part of DataHaven. + +// DataHaven is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// DataHaven is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with DataHaven. If not, see . + + +//! Autogenerated weights for `pallet_session` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 51.0.0 +//! DATE: 2026-01-29, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ip-10-0-0-176`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` +//! WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --runtime +// target/production/wbuild/datahaven-testnet-runtime/datahaven_testnet_runtime.compact.compressed.wasm +// --pallet +// pallet_session +// --extrinsic +// +// --header +// ../file_header.txt +// --template +// benchmarking/frame-weight-template.hbs +// --output +// runtime/testnet/src/weights/pallet_session.rs +// --steps +// 50 +// --repeat +// 20 + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use sp_std::marker::PhantomData; + +/// Weights for `pallet_session`. +pub struct WeightInfo(PhantomData); +impl pallet_session::WeightInfo for WeightInfo { + /// Storage: `Session::NextKeys` (r:1 w:1) + /// Proof: `Session::NextKeys` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Session::KeyOwner` (r:4 w:4) + /// Proof: `Session::KeyOwner` (`max_values`: None, `max_size`: None, mode: `Measured`) + fn set_keys() -> Weight { + // Proof Size summary in bytes: + // Measured: `350` + // Estimated: `11240` + // Minimum execution time: 37_208_000 picoseconds. + Weight::from_parts(38_300_000, 11240) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } + /// Storage: `Session::NextKeys` (r:1 w:1) + /// Proof: `Session::NextKeys` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Session::KeyOwner` (r:0 w:4) + /// Proof: `Session::KeyOwner` (`max_values`: None, `max_size`: None, mode: `Measured`) + fn purge_keys() -> Weight { + // Proof Size summary in bytes: + // Measured: `328` + // Estimated: `3793` + // Minimum execution time: 21_720_000 picoseconds. + Weight::from_parts(22_535_000, 3793) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } +} diff --git a/operator/runtime/testnet/src/weights/pallet_storage_providers.rs b/operator/runtime/testnet/src/weights/pallet_storage_providers.rs new file mode 100644 index 00000000..663eb999 --- /dev/null +++ b/operator/runtime/testnet/src/weights/pallet_storage_providers.rs @@ -0,0 +1,630 @@ +// Copyright 2025 DataHaven +// This file is part of DataHaven. + +// DataHaven is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// DataHaven is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with DataHaven. If not, see . + + +//! Autogenerated weights for `pallet_storage_providers` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 51.0.0 +//! DATE: 2026-01-29, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ip-10-0-0-176`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` +//! WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --runtime +// target/production/wbuild/datahaven-testnet-runtime/datahaven_testnet_runtime.compact.compressed.wasm +// --pallet +// pallet_storage_providers +// --extrinsic +// +// --header +// ../file_header.txt +// --template +// benchmarking/frame-weight-template.hbs +// --output +// runtime/testnet/src/weights/pallet_storage_providers.rs +// --steps +// 50 +// --repeat +// 20 + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use sp_std::marker::PhantomData; + +/// Weights for `pallet_storage_providers`. +pub struct WeightInfo(PhantomData); +impl pallet_storage_providers::weights::WeightInfo for WeightInfo { + /// Storage: `Providers::SignUpRequests` (r:1 w:1) + /// Proof: `Providers::SignUpRequests` (`max_values`: None, `max_size`: Some(2163), added: 4638, mode: `MaxEncodedLen`) + /// Storage: `Providers::AccountIdToMainStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToMainStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::AccountIdToBackupStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToBackupStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + fn request_msp_sign_up() -> Weight { + // Proof Size summary in bytes: + // Measured: `270` + // Estimated: `5628` + // Minimum execution time: 89_826_000 picoseconds. + Weight::from_parts(90_994_000, 5628) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: `Providers::SignUpRequests` (r:1 w:1) + /// Proof: `Providers::SignUpRequests` (`max_values`: None, `max_size`: Some(2163), added: 4638, mode: `MaxEncodedLen`) + /// Storage: `Providers::AccountIdToMainStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToMainStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::AccountIdToBackupStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToBackupStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + fn request_bsp_sign_up() -> Weight { + // Proof Size summary in bytes: + // Measured: `270` + // Estimated: `5628` + // Minimum execution time: 89_741_000 picoseconds. + Weight::from_parts(91_222_000, 5628) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: `Providers::SignUpRequests` (r:1 w:1) + /// Proof: `Providers::SignUpRequests` (`max_values`: None, `max_size`: Some(2163), added: 4638, mode: `MaxEncodedLen`) + /// Storage: `Randomness::LatestOneEpochAgoRandomness` (r:1 w:0) + /// Proof: `Randomness::LatestOneEpochAgoRandomness` (`max_values`: Some(1), `max_size`: Some(36), added: 531, mode: `MaxEncodedLen`) + /// Storage: `Providers::TotalBspsCapacity` (r:1 w:1) + /// Proof: `Providers::TotalBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Providers::BspCount` (r:1 w:1) + /// Proof: `Providers::BspCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Providers::GlobalBspsReputationWeight` (r:1 w:1) + /// Proof: `Providers::GlobalBspsReputationWeight` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Providers::AccountIdToBackupStorageProviderId` (r:0 w:1) + /// Proof: `Providers::AccountIdToBackupStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::BackupStorageProviders` (r:0 w:1) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + fn confirm_sign_up_bsp() -> Weight { + // Proof Size summary in bytes: + // Measured: `474` + // Estimated: `5628` + // Minimum execution time: 38_182_000 picoseconds. + Weight::from_parts(39_713_000, 5628) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(6_u64)) + } + /// Storage: `Providers::SignUpRequests` (r:1 w:1) + /// Proof: `Providers::SignUpRequests` (`max_values`: None, `max_size`: Some(2163), added: 4638, mode: `MaxEncodedLen`) + /// Storage: `Randomness::LatestOneEpochAgoRandomness` (r:1 w:0) + /// Proof: `Randomness::LatestOneEpochAgoRandomness` (`max_values`: Some(1), `max_size`: Some(36), added: 531, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:1 w:0) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `Providers::MainStorageProviderIdsToValuePropositions` (r:1 w:1) + /// Proof: `Providers::MainStorageProviderIdsToValuePropositions` (`max_values`: None, `max_size`: Some(1123), added: 3598, mode: `MaxEncodedLen`) + /// Storage: `Providers::MspCount` (r:1 w:1) + /// Proof: `Providers::MspCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Providers::AccountIdToMainStorageProviderId` (r:0 w:1) + /// Proof: `Providers::AccountIdToMainStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::MainStorageProviders` (r:0 w:1) + /// Proof: `Providers::MainStorageProviders` (`max_values`: None, `max_size`: Some(1143), added: 3618, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::PrivilegedProviders` (r:0 w:1) + /// Proof: `PaymentStreams::PrivilegedProviders` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + fn confirm_sign_up_msp() -> Weight { + // Proof Size summary in bytes: + // Measured: `487` + // Estimated: `5628` + // Minimum execution time: 54_783_000 picoseconds. + Weight::from_parts(56_744_000, 5628) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(6_u64)) + } + /// Storage: `Providers::SignUpRequests` (r:1 w:1) + /// Proof: `Providers::SignUpRequests` (`max_values`: None, `max_size`: Some(2163), added: 4638, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + fn cancel_sign_up() -> Weight { + // Proof Size summary in bytes: + // Measured: `507` + // Estimated: `5628` + // Minimum execution time: 65_446_000 picoseconds. + Weight::from_parts(66_906_000, 5628) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: `Providers::AccountIdToMainStorageProviderId` (r:1 w:1) + /// Proof: `Providers::AccountIdToMainStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::MainStorageProviders` (r:1 w:1) + /// Proof: `Providers::MainStorageProviders` (`max_values`: None, `max_size`: Some(1143), added: 3618, mode: `MaxEncodedLen`) + /// Storage: `Providers::MainStorageProviderIdsToValuePropositions` (r:102 w:101) + /// Proof: `Providers::MainStorageProviderIdsToValuePropositions` (`max_values`: None, `max_size`: Some(1123), added: 3598, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Providers::MspCount` (r:1 w:1) + /// Proof: `Providers::MspCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::PrivilegedProviders` (r:0 w:1) + /// Proof: `PaymentStreams::PrivilegedProviders` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// The range of component `n` is `[0, 100]`. + fn msp_sign_off(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `775 + n * (83 ±0)` + // Estimated: `8186 + n * (3598 ±0)` + // Minimum execution time: 93_251_000 picoseconds. + Weight::from_parts(91_955_675, 8186) + // Standard Error: 9_290 + .saturating_add(Weight::from_parts(6_491_321, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(7_u64)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes(7_u64)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 3598).saturating_mul(n.into())) + } + /// Storage: `Providers::AccountIdToBackupStorageProviderId` (r:1 w:1) + /// Proof: `Providers::AccountIdToBackupStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::BackupStorageProviders` (r:1 w:1) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::ProviderToProofSubmissionRecord` (r:1 w:0) + /// Proof: `ProofsDealer::ProviderToProofSubmissionRecord` (`max_values`: None, `max_size`: Some(56), added: 2531, mode: `MaxEncodedLen`) + /// Storage: `Providers::TotalBspsCapacity` (r:1 w:1) + /// Proof: `Providers::TotalBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Providers::BspCount` (r:1 w:1) + /// Proof: `Providers::BspCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Providers::GlobalBspsReputationWeight` (r:1 w:1) + /// Proof: `Providers::GlobalBspsReputationWeight` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + fn bsp_sign_off() -> Weight { + // Proof Size summary in bytes: + // Measured: `720` + // Estimated: `4624` + // Minimum execution time: 93_040_000 picoseconds. + Weight::from_parts(95_240_000, 4624) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().writes(7_u64)) + } + /// Storage: `Providers::AccountIdToMainStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToMainStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::AccountIdToBackupStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToBackupStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:1 w:0) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `Providers::BackupStorageProviders` (r:1 w:1) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Providers::TotalBspsCapacity` (r:1 w:1) + /// Proof: `Providers::TotalBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + fn change_capacity_bsp_less_deposit() -> Weight { + // Proof Size summary in bytes: + // Measured: `679` + // Estimated: `4624` + // Minimum execution time: 83_405_000 picoseconds. + Weight::from_parts(85_132_000, 4624) + .saturating_add(T::DbWeight::get().reads(7_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) + } + /// Storage: `Providers::AccountIdToMainStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToMainStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::AccountIdToBackupStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToBackupStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:1 w:0) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `Providers::BackupStorageProviders` (r:1 w:1) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Providers::TotalBspsCapacity` (r:1 w:1) + /// Proof: `Providers::TotalBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + fn change_capacity_bsp_more_deposit() -> Weight { + // Proof Size summary in bytes: + // Measured: `679` + // Estimated: `4624` + // Minimum execution time: 105_733_000 picoseconds. + Weight::from_parts(106_832_000, 4624) + .saturating_add(T::DbWeight::get().reads(7_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) + } + /// Storage: `Providers::AccountIdToMainStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToMainStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:1 w:0) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `Providers::MainStorageProviders` (r:1 w:1) + /// Proof: `Providers::MainStorageProviders` (`max_values`: None, `max_size`: Some(1143), added: 3618, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + fn change_capacity_msp_less_deposit() -> Weight { + // Proof Size summary in bytes: + // Measured: `649` + // Estimated: `4608` + // Minimum execution time: 79_140_000 picoseconds. + Weight::from_parts(80_429_000, 4608) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: `Providers::AccountIdToMainStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToMainStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:1 w:0) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `Providers::MainStorageProviders` (r:1 w:1) + /// Proof: `Providers::MainStorageProviders` (`max_values`: None, `max_size`: Some(1143), added: 3618, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + fn change_capacity_msp_more_deposit() -> Weight { + // Proof Size summary in bytes: + // Measured: `649` + // Estimated: `4608` + // Minimum execution time: 98_935_000 picoseconds. + Weight::from_parts(100_250_000, 4608) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: `Providers::AccountIdToMainStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToMainStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:1 w:0) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `Providers::MainStorageProviderIdsToValuePropositions` (r:1 w:1) + /// Proof: `Providers::MainStorageProviderIdsToValuePropositions` (`max_values`: None, `max_size`: Some(1123), added: 3598, mode: `MaxEncodedLen`) + /// Storage: `Providers::MainStorageProviders` (r:1 w:1) + /// Proof: `Providers::MainStorageProviders` (`max_values`: None, `max_size`: Some(1143), added: 3618, mode: `MaxEncodedLen`) + fn add_value_prop() -> Weight { + // Proof Size summary in bytes: + // Measured: `591` + // Estimated: `4608` + // Minimum execution time: 44_674_000 picoseconds. + Weight::from_parts(46_159_000, 4608) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: `Providers::AccountIdToMainStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToMainStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::MainStorageProviders` (r:1 w:0) + /// Proof: `Providers::MainStorageProviders` (`max_values`: None, `max_size`: Some(1143), added: 3618, mode: `MaxEncodedLen`) + /// Storage: `Providers::MainStorageProviderIdsToValuePropositions` (r:1 w:1) + /// Proof: `Providers::MainStorageProviderIdsToValuePropositions` (`max_values`: None, `max_size`: Some(1123), added: 3598, mode: `MaxEncodedLen`) + fn make_value_prop_unavailable() -> Weight { + // Proof Size summary in bytes: + // Measured: `631` + // Estimated: `4608` + // Minimum execution time: 32_741_000 picoseconds. + Weight::from_parts(34_206_000, 4608) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Providers::AccountIdToMainStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToMainStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::AccountIdToBackupStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToBackupStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:1 w:0) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `Providers::BackupStorageProviders` (r:1 w:1) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + fn add_multiaddress() -> Weight { + // Proof Size summary in bytes: + // Measured: `508` + // Estimated: `4624` + // Minimum execution time: 34_779_000 picoseconds. + Weight::from_parts(35_785_000, 4624) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Providers::AccountIdToMainStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToMainStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::AccountIdToBackupStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToBackupStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::BackupStorageProviders` (r:1 w:1) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + fn remove_multiaddress() -> Weight { + // Proof Size summary in bytes: + // Measured: `1316` + // Estimated: `4624` + // Minimum execution time: 32_789_000 picoseconds. + Weight::from_parts(33_844_000, 4624) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Providers::SignUpRequests` (r:1 w:1) + /// Proof: `Providers::SignUpRequests` (`max_values`: None, `max_size`: Some(2163), added: 4638, mode: `MaxEncodedLen`) + /// Storage: `Providers::AccountIdToMainStorageProviderId` (r:1 w:1) + /// Proof: `Providers::AccountIdToMainStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::AccountIdToBackupStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToBackupStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:1 w:0) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `Providers::MainStorageProviderIdsToValuePropositions` (r:1 w:1) + /// Proof: `Providers::MainStorageProviderIdsToValuePropositions` (`max_values`: None, `max_size`: Some(1123), added: 3598, mode: `MaxEncodedLen`) + /// Storage: `Providers::MspCount` (r:1 w:1) + /// Proof: `Providers::MspCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Providers::MainStorageProviders` (r:0 w:1) + /// Proof: `Providers::MainStorageProviders` (`max_values`: None, `max_size`: Some(1143), added: 3618, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::PrivilegedProviders` (r:0 w:1) + /// Proof: `PaymentStreams::PrivilegedProviders` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + fn force_msp_sign_up() -> Weight { + // Proof Size summary in bytes: + // Measured: `270` + // Estimated: `5628` + // Minimum execution time: 126_228_000 picoseconds. + Weight::from_parts(130_217_000, 5628) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().writes(8_u64)) + } + /// Storage: `Providers::SignUpRequests` (r:1 w:1) + /// Proof: `Providers::SignUpRequests` (`max_values`: None, `max_size`: Some(2163), added: 4638, mode: `MaxEncodedLen`) + /// Storage: `Providers::AccountIdToMainStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToMainStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::AccountIdToBackupStorageProviderId` (r:1 w:1) + /// Proof: `Providers::AccountIdToBackupStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `Providers::TotalBspsCapacity` (r:1 w:1) + /// Proof: `Providers::TotalBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Providers::BspCount` (r:1 w:1) + /// Proof: `Providers::BspCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Providers::GlobalBspsReputationWeight` (r:1 w:1) + /// Proof: `Providers::GlobalBspsReputationWeight` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Providers::BackupStorageProviders` (r:0 w:1) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + fn force_bsp_sign_up() -> Weight { + // Proof Size summary in bytes: + // Measured: `270` + // Estimated: `5628` + // Minimum execution time: 106_118_000 picoseconds. + Weight::from_parts(107_693_000, 5628) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().writes(8_u64)) + } + /// Storage: `Providers::MainStorageProviders` (r:1 w:0) + /// Proof: `Providers::MainStorageProviders` (`max_values`: None, `max_size`: Some(1143), added: 3618, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:1 w:0) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `Providers::BackupStorageProviders` (r:1 w:1) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::SlashableProviders` (r:1 w:1) + /// Proof: `ProofsDealer::SlashableProviders` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + /// Storage: `Parameters::Parameters` (r:1 w:0) + /// Proof: `Parameters::Parameters` (`max_values`: None, `max_size`: Some(381), added: 2856, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:2 w:2) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `Providers::AwaitingTopUpFromProviders` (r:1 w:0) + /// Proof: `Providers::AwaitingTopUpFromProviders` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + fn slash_without_awaiting_top_up() -> Weight { + // Proof Size summary in bytes: + // Measured: `871` + // Estimated: `6172` + // Minimum execution time: 162_133_000 picoseconds. + Weight::from_parts(164_580_000, 6172) + .saturating_add(T::DbWeight::get().reads(9_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } + /// Storage: `Providers::MainStorageProviders` (r:1 w:0) + /// Proof: `Providers::MainStorageProviders` (`max_values`: None, `max_size`: Some(1143), added: 3618, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:1 w:0) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `Providers::BackupStorageProviders` (r:1 w:1) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::SlashableProviders` (r:1 w:1) + /// Proof: `ProofsDealer::SlashableProviders` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + /// Storage: `Parameters::Parameters` (r:2 w:0) + /// Proof: `Parameters::Parameters` (`max_values`: None, `max_size`: Some(381), added: 2856, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:2 w:2) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `Providers::AwaitingTopUpFromProviders` (r:1 w:1) + /// Proof: `Providers::AwaitingTopUpFromProviders` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::ChallengesTicker` (r:1 w:0) + /// Proof: `ProofsDealer::ChallengesTicker` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Providers::NextAvailableProviderTopUpExpirationShTick` (r:1 w:1) + /// Proof: `Providers::NextAvailableProviderTopUpExpirationShTick` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Providers::ProviderTopUpExpirations` (r:1 w:1) + /// Proof: `Providers::ProviderTopUpExpirations` (`max_values`: None, `max_size`: Some(3322), added: 5797, mode: `MaxEncodedLen`) + fn slash_with_awaiting_top_up() -> Weight { + // Proof Size summary in bytes: + // Measured: `871` + // Estimated: `6787` + // Minimum execution time: 128_623_000 picoseconds. + Weight::from_parts(130_891_000, 6787) + .saturating_add(T::DbWeight::get().reads(13_u64)) + .saturating_add(T::DbWeight::get().writes(8_u64)) + } + /// Storage: `Providers::AccountIdToMainStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToMainStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::AccountIdToBackupStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToBackupStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::MainStorageProviders` (r:1 w:0) + /// Proof: `Providers::MainStorageProviders` (`max_values`: None, `max_size`: Some(1143), added: 3618, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:1 w:0) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `Providers::BackupStorageProviders` (r:1 w:1) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Providers::AwaitingTopUpFromProviders` (r:1 w:1) + /// Proof: `Providers::AwaitingTopUpFromProviders` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Providers::ProviderTopUpExpirations` (r:0 w:1) + /// Proof: `Providers::ProviderTopUpExpirations` (`max_values`: None, `max_size`: Some(3322), added: 5797, mode: `MaxEncodedLen`) + fn top_up_deposit() -> Weight { + // Proof Size summary in bytes: + // Measured: `758` + // Estimated: `4624` + // Minimum execution time: 113_271_000 picoseconds. + Weight::from_parts(115_045_000, 4624) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } + /// Storage: `Providers::InsolventProviders` (r:2 w:1) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::FixedRatePaymentStreams` (r:1 w:0) + /// Proof: `PaymentStreams::FixedRatePaymentStreams` (`max_values`: None, `max_size`: Some(125), added: 2600, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::DynamicRatePaymentStreams` (r:1 w:0) + /// Proof: `PaymentStreams::DynamicRatePaymentStreams` (`max_values`: None, `max_size`: Some(129), added: 2604, mode: `MaxEncodedLen`) + /// Storage: `Providers::MainStorageProviders` (r:1 w:0) + /// Proof: `Providers::MainStorageProviders` (`max_values`: None, `max_size`: Some(1143), added: 3618, mode: `MaxEncodedLen`) + /// Storage: `Providers::BackupStorageProviders` (r:1 w:1) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `Providers::AccountIdToBackupStorageProviderId` (r:1 w:1) + /// Proof: `Providers::AccountIdToBackupStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::ProviderToProofSubmissionRecord` (r:1 w:1) + /// Proof: `ProofsDealer::ProviderToProofSubmissionRecord` (`max_values`: None, `max_size`: Some(56), added: 2531, mode: `MaxEncodedLen`) + /// Storage: `Providers::BspCount` (r:1 w:1) + /// Proof: `Providers::BspCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Providers::TotalBspsCapacity` (r:1 w:1) + /// Proof: `Providers::TotalBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Providers::UsedBspsCapacity` (r:1 w:1) + /// Proof: `Providers::UsedBspsCapacity` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Providers::GlobalBspsReputationWeight` (r:1 w:1) + /// Proof: `Providers::GlobalBspsReputationWeight` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::TickToProvidersDeadlines` (r:0 w:1) + /// Proof: `ProofsDealer::TickToProvidersDeadlines` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + fn delete_provider_bsp() -> Weight { + // Proof Size summary in bytes: + // Measured: `853` + // Estimated: `6038` + // Minimum execution time: 81_453_000 picoseconds. + Weight::from_parts(84_499_000, 6038) + .saturating_add(T::DbWeight::get().reads(12_u64)) + .saturating_add(T::DbWeight::get().writes(9_u64)) + } + /// Storage: `Providers::InsolventProviders` (r:1 w:1) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::FixedRatePaymentStreams` (r:1 w:0) + /// Proof: `PaymentStreams::FixedRatePaymentStreams` (`max_values`: None, `max_size`: Some(125), added: 2600, mode: `MaxEncodedLen`) + /// Storage: `PaymentStreams::DynamicRatePaymentStreams` (r:1 w:0) + /// Proof: `PaymentStreams::DynamicRatePaymentStreams` (`max_values`: None, `max_size`: Some(129), added: 2604, mode: `MaxEncodedLen`) + /// Storage: `Providers::MainStorageProviders` (r:1 w:1) + /// Proof: `Providers::MainStorageProviders` (`max_values`: None, `max_size`: Some(1143), added: 3618, mode: `MaxEncodedLen`) + /// Storage: `Providers::MainStorageProviderIdsToValuePropositions` (r:22 w:21) + /// Proof: `Providers::MainStorageProviderIdsToValuePropositions` (`max_values`: None, `max_size`: Some(1123), added: 3598, mode: `MaxEncodedLen`) + /// Storage: `Providers::MainStorageProviderIdsToBuckets` (r:21 w:20) + /// Proof: `Providers::MainStorageProviderIdsToBuckets` (`max_values`: None, `max_size`: Some(96), added: 2571, mode: `MaxEncodedLen`) + /// Storage: `Providers::MspCount` (r:1 w:1) + /// Proof: `Providers::MspCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Providers::AccountIdToMainStorageProviderId` (r:0 w:1) + /// Proof: `Providers::AccountIdToMainStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// The range of component `n` is `[0, 20]`. + /// The range of component `m` is `[0, 20]`. + fn delete_provider_msp(n: u32, m: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `1845 + m * (54 ±0) + n * (83 ±0)` + // Estimated: `8186 + m * (2571 ±0) + n * (3598 ±0)` + // Minimum execution time: 186_516_000 picoseconds. + Weight::from_parts(80_100_317, 8186) + // Standard Error: 31_923 + .saturating_add(Weight::from_parts(6_927_784, 0).saturating_mul(n.into())) + // Standard Error: 31_923 + .saturating_add(Weight::from_parts(5_691_747, 0).saturating_mul(m.into())) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(m.into()))) + .saturating_add(T::DbWeight::get().writes(5_u64)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(m.into()))) + .saturating_add(Weight::from_parts(0, 2571).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 3598).saturating_mul(n.into())) + } + /// Storage: `Providers::AccountIdToBackupStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToBackupStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `Providers::BackupStorageProviders` (r:1 w:0) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::ProviderToProofSubmissionRecord` (r:1 w:0) + /// Proof: `ProofsDealer::ProviderToProofSubmissionRecord` (`max_values`: None, `max_size`: Some(56), added: 2531, mode: `MaxEncodedLen`) + fn stop_all_cycles() -> Weight { + // Proof Size summary in bytes: + // Measured: `549` + // Estimated: `4624` + // Minimum execution time: 27_371_000 picoseconds. + Weight::from_parts(28_106_000, 4624) + .saturating_add(T::DbWeight::get().reads(3_u64)) + } + /// Storage: `Providers::AwaitingTopUpFromProviders` (r:1 w:1) + /// Proof: `Providers::AwaitingTopUpFromProviders` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Providers::BackupStorageProviders` (r:1 w:0) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:2 w:2) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Providers::AccountIdToBackupStorageProviderId` (r:1 w:0) + /// Proof: `Providers::AccountIdToBackupStorageProviderId` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::ProviderToProofSubmissionRecord` (r:1 w:1) + /// Proof: `ProofsDealer::ProviderToProofSubmissionRecord` (`max_values`: None, `max_size`: Some(56), added: 2531, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:0 w:1) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `ProofsDealer::TickToProvidersDeadlines` (r:0 w:1) + /// Proof: `ProofsDealer::TickToProvidersDeadlines` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) + fn process_expired_provider_top_up_bsp() -> Weight { + // Proof Size summary in bytes: + // Measured: `1038` + // Estimated: `6172` + // Minimum execution time: 103_589_000 picoseconds. + Weight::from_parts(106_013_000, 6172) + .saturating_add(T::DbWeight::get().reads(7_u64)) + .saturating_add(T::DbWeight::get().writes(7_u64)) + } + /// Storage: `Providers::AwaitingTopUpFromProviders` (r:1 w:1) + /// Proof: `Providers::AwaitingTopUpFromProviders` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Providers::BackupStorageProviders` (r:1 w:0) + /// Proof: `Providers::BackupStorageProviders` (`max_values`: None, `max_size`: Some(1159), added: 3634, mode: `MaxEncodedLen`) + /// Storage: `Providers::MainStorageProviders` (r:1 w:0) + /// Proof: `Providers::MainStorageProviders` (`max_values`: None, `max_size`: Some(1143), added: 3618, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(289), added: 2764, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:2 w:2) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Providers::InsolventProviders` (r:0 w:1) + /// Proof: `Providers::InsolventProviders` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + fn process_expired_provider_top_up_msp() -> Weight { + // Proof Size summary in bytes: + // Measured: `775` + // Estimated: `6172` + // Minimum execution time: 83_393_000 picoseconds. + Weight::from_parts(84_682_000, 6172) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } +} From 0623e320f6e3af5236531b8608e515e0e2d5c1fa Mon Sep 17 00:00:00 2001 From: Steve Degosserie <723552+stiiifff@users.noreply.github.com> Date: Tue, 3 Feb 2026 21:36:54 +0100 Subject: [PATCH 5/5] feat(node): add MMR gadget for offchain leaf indexing (#430) ## Summary - Add the `mmr-gadget` to the DataHaven client for proper MMR leaf indexing in offchain storage - Gate the gadget on `offchain_worker.indexing_enabled` to avoid running when indexing is disabled - Enable efficient MMR proof queries by block number via the MMR RPC ## Problem The DataHaven client was missing the `mmr-gadget`, which prevented MMR leaves from being correctly indexed in the offchain database. Without it: - MMR proofs could only be queried by block hash, not block number - Light clients and bridge relayers could not efficiently verify finality - The `mmr_generateProof` RPC had degraded functionality ## Changes | File | Change | |------|--------| | `operator/Cargo.toml` | Add workspace deps for `mmr-gadget`, `sp-mmr-primitives` | | `operator/node/Cargo.toml` | Add node deps for `mmr-gadget`, `sp-mmr-primitives` | | `operator/node/src/service.rs` | Add import and spawn `MmrGadget` after BEEFY gadget | ## Test plan - [x] Build passes: `cd operator && cargo build --release --features fast-runtime` - [x] Run node with debug logging: `--log mmr-gadget=debug` - [x] Verify `mmr-gadget` task starts in logs - [x] Test MMR RPC by block number works: ```bash curl -H "Content-Type: application/json" \ -d '{"id":1,"jsonrpc":"2.0","method":"mmr_generateProof","params":[[1], null, null]}' \ http://localhost:9944 ``` Co-authored-by: Claude Opus 4.5 --- operator/Cargo.lock | 85 ++++++++++++++---------------------- operator/Cargo.toml | 2 + operator/node/Cargo.toml | 2 + operator/node/src/service.rs | 22 +++++++++- 4 files changed, 58 insertions(+), 53 deletions(-) diff --git a/operator/Cargo.lock b/operator/Cargo.lock index a109b8ea..1289c252 100644 --- a/operator/Cargo.lock +++ b/operator/Cargo.lock @@ -1176,7 +1176,7 @@ dependencies = [ "bitflags 2.9.4", "cexpr", "clang-sys", - "itertools 0.11.0", + "itertools 0.13.0", "proc-macro2", "quote", "regex", @@ -2791,6 +2791,7 @@ dependencies = [ "hex-literal 0.3.4", "jsonrpsee 0.24.9", "log", + "mmr-gadget", "mmr-rpc", "openssl-sys", "pallet-beefy-mmr", @@ -2860,6 +2861,7 @@ dependencies = [ "sp-io", "sp-keyring", "sp-keystore", + "sp-mmr-primitives", "sp-offchain", "sp-runtime", "sp-session", @@ -3867,7 +3869,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys 0.61.2", ] [[package]] @@ -5769,7 +5771,7 @@ dependencies = [ "js-sys", "log", "wasm-bindgen", - "windows-core 0.62.2", + "windows-core 0.61.2", ] [[package]] @@ -6218,15 +6220,6 @@ dependencies = [ "either", ] -[[package]] -name = "itertools" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" -dependencies = [ - "either", -] - [[package]] name = "itoa" version = "1.0.15" @@ -7725,6 +7718,25 @@ dependencies = [ "zeroize", ] +[[package]] +name = "mmr-gadget" +version = "43.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?tag=polkadot-stable2412-6#bbc435c7667d3283ba280a8fec44676357392753" +dependencies = [ + "futures", + "log", + "parity-scale-codec", + "sc-client-api", + "sc-offchain", + "sp-api", + "sp-blockchain", + "sp-consensus", + "sp-consensus-beefy", + "sp-core", + "sp-mmr-primitives", + "sp-runtime", +] + [[package]] name = "mmr-rpc" version = "39.0.0" @@ -8262,7 +8274,7 @@ version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77e878c846a8abae00dd069496dbe8751b16ac1c3d6bd2a7283a938e8228f90d" dependencies = [ - "proc-macro-crate 1.1.3", + "proc-macro-crate 3.4.0", "proc-macro2", "quote", "syn 2.0.106", @@ -11110,7 +11122,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22505a5c94da8e3b7c2996394d1c933236c4d743e81a410bcca4e6989fc066a4" dependencies = [ "bytes", - "heck 0.4.1", + "heck 0.5.0", "itertools 0.12.1", "log", "multimap", @@ -11130,8 +11142,8 @@ version = "0.13.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be769465445e8c1474e9c5dac2018218498557af32d9ed057325ec9a41ae81bf" dependencies = [ - "heck 0.4.1", - "itertools 0.14.0", + "heck 0.5.0", + "itertools 0.13.0", "log", "multimap", "once_cell", @@ -11164,7 +11176,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a56d757972c98b346a9b766e3f02746cde6dd1cd1d1d563472929fdd74bec4d" dependencies = [ "anyhow", - "itertools 0.14.0", + "itertools 0.13.0", "proc-macro2", "quote", "syn 2.0.106", @@ -11924,7 +11936,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys 0.11.0", - "windows-sys 0.52.0", + "windows-sys 0.61.2", ] [[package]] @@ -16816,7 +16828,7 @@ dependencies = [ "getrandom 0.3.3", "once_cell", "rustix 1.1.2", - "windows-sys 0.52.0", + "windows-sys 0.61.2", ] [[package]] @@ -18422,7 +18434,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.61.2", ] [[package]] @@ -18483,20 +18495,7 @@ dependencies = [ "windows-interface", "windows-link 0.1.3", "windows-result 0.3.4", - "windows-strings 0.4.2", -] - -[[package]] -name = "windows-core" -version = "0.62.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" -dependencies = [ - "windows-implement", - "windows-interface", - "windows-link 0.2.1", - "windows-result 0.4.1", - "windows-strings 0.5.1", + "windows-strings", ] [[package]] @@ -18572,15 +18571,6 @@ dependencies = [ "windows-link 0.1.3", ] -[[package]] -name = "windows-result" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" -dependencies = [ - "windows-link 0.2.1", -] - [[package]] name = "windows-strings" version = "0.4.2" @@ -18590,15 +18580,6 @@ dependencies = [ "windows-link 0.1.3", ] -[[package]] -name = "windows-strings" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" -dependencies = [ - "windows-link 0.2.1", -] - [[package]] name = "windows-sys" version = "0.45.0" diff --git a/operator/Cargo.toml b/operator/Cargo.toml index 2e155446..0299bb3b 100644 --- a/operator/Cargo.toml +++ b/operator/Cargo.toml @@ -118,6 +118,7 @@ frame-system = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polk frame-system-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-6", default-features = false } frame-system-rpc-runtime-api = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-6", default-features = false } frame-try-runtime = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-6", default-features = false } +mmr-gadget = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-6", default-features = false } mmr-rpc = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-6", default-features = false } pallet-assets = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-6", default-features = false } pallet-authorship = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-6", default-features = false } @@ -195,6 +196,7 @@ sp-inherents = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polk sp-io = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-6", default-features = false } sp-keyring = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-6", default-features = false } sp-keystore = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-6", default-features = false } +sp-mmr-primitives = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-6", default-features = false } sp-offchain = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-6", default-features = false } sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-6", default-features = false } sp-runtime-interface = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-6", default-features = false } diff --git a/operator/node/Cargo.toml b/operator/node/Cargo.toml index 00bf7da0..8c6df8ed 100644 --- a/operator/node/Cargo.toml +++ b/operator/node/Cargo.toml @@ -35,9 +35,11 @@ serde_json = { workspace = true, default-features = true } url = { workspace = true } #MMR +mmr-gadget = { workspace = true, default-features = true } mmr-rpc = { workspace = true, default-features = true } pallet-beefy-mmr = { workspace = true, default-features = true } pallet-mmr = { workspace = true, default-features = true } +sp-mmr-primitives = { workspace = true, default-features = true } # Polkadot SDK frame-benchmarking-cli = { workspace = true, default-features = true, optional = true } diff --git a/operator/node/src/service.rs b/operator/node/src/service.rs index fe92dbfd..11c6a247 100644 --- a/operator/node/src/service.rs +++ b/operator/node/src/service.rs @@ -72,6 +72,7 @@ use sp_api::ProvideRuntimeApi; use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata}; use sp_consensus_beefy::ecdsa_crypto::AuthorityId as BeefyId; use sp_keystore::KeystorePtr; +use sp_mmr_primitives::INDEXING_PREFIX; use sp_runtime::traits::BlakeTwo256; use sp_runtime::SaturatedConversion; use std::path::PathBuf; @@ -452,6 +453,9 @@ where StorageHubBuilder: StorageLayerBuilder + Buildable<(R, S), Runtime>, StorageHubHandler<(R, S), Runtime>: RunnableTasks, { + let enable_offchain_worker = config.offchain_worker.enabled; + let is_offchain_indexing_enabled = config.offchain_worker.indexing_enabled; + let role = config.role; let mut sealing = match sealing { Some(_) if !matches!(config.chain_spec.chain_type(), ChainType::Development) => { @@ -582,7 +586,7 @@ where metrics, })?; - if config.offchain_worker.enabled { + if enable_offchain_worker { task_manager.spawn_handle().spawn( "offchain-workers-runner", "offchain-worker", @@ -948,6 +952,22 @@ where .spawn_essential_handle() .spawn_blocking("beefy-gadget", None, gadget); } + + // Spawn MMR gadget for offchain MMR leaf indexing. + // This gadget monitors finality and canonicalizes MMR data in offchain storage, + // enabling efficient MMR proof queries by block number via the MMR RPC. + // Only run when offchain indexing is enabled, as the gadget writes to offchain storage. + if is_offchain_indexing_enabled { + task_manager.spawn_essential_handle().spawn_blocking( + "mmr-gadget", + None, + mmr_gadget::MmrGadget::start( + client.clone(), + backend.clone(), + INDEXING_PREFIX.to_vec(), + ), + ); + } } if let Some(_) = role_options {