Merge branch 'main' into fix/dont-pop-slash-on-failure

This commit is contained in:
Steve Degosserie 2026-02-24 12:10:25 +02:00 committed by GitHub
commit 1186b33b51
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
189 changed files with 19608 additions and 1530 deletions

View file

@ -44,6 +44,8 @@ jobs:
uses: ./.github/workflows/task-rust-tests.yml
contract-tests:
uses: ./.github/workflows/task-foundry-tests.yml
storage-layout:
uses: ./.github/workflows/task-storage-layout.yml
rust-lint:
needs: [warm-sccache]
uses: ./.github/workflows/task-rust-lint.yml

View file

@ -118,23 +118,6 @@ jobs:
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }}
restore-keys: |
${{ runner.os }}-bun-
- name: Cache Foundry libraries
uses: actions/cache/restore@v4
with:
path: ../contracts/lib
key: ${{ runner.os }}-foundry-libs-${{ hashFiles('.gitmodules') }}
restore-keys: |
${{ runner.os }}-foundry-libs-
- name: Cache Foundry build artifacts
uses: actions/cache/restore@v4
with:
path: |
../contracts/out
../contracts/cache
key: ${{ runner.os }}-foundry-build-${{ hashFiles('contracts/foundry.toml', 'contracts/**/*.sol') }}
restore-keys: |
${{ runner.os }}-foundry-build-
- uses: docker/login-action@v3
with:
registry: ghcr.io

View file

@ -38,16 +38,6 @@ jobs:
with:
version: v1.4.3
- name: Cache Foundry build artifacts
uses: actions/cache@v4
with:
path: |
contracts/out
contracts/cache
key: ${{ runner.os }}-foundry-build-${{ hashFiles('contracts/foundry.toml', 'contracts/**/*.sol') }}
restore-keys: |
${{ runner.os }}-foundry-build-
- run: forge --version
- run: forge fmt --check
- run: forge build --sizes

View file

@ -0,0 +1,51 @@
# Storage Layout Check: Validates storage layout for upgradeable contracts
#
# Overview:
# 1. Compares current storage layout against committed snapshot
# 2. Runs upgrade simulation tests to verify state preservation
name: Storage Layout Check
on:
workflow_dispatch:
workflow_call:
# Explicit minimal permissions
permissions:
contents: read
env:
FOUNDRY_PROFILE: ci
jobs:
check:
name: Storage Layout
runs-on: ubuntu-latest
defaults:
run:
working-directory: contracts
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: v1.4.3
- name: Build contracts
run: forge build --extra-output storageLayout
- name: Negative check storage layout (should fail)
run: |
chmod +x scripts/check-storage-layout-negative.sh
./scripts/check-storage-layout-negative.sh
- name: Check storage layout
run: |
chmod +x scripts/check-storage-layout.sh
./scripts/check-storage-layout.sh
- name: Run upgrade simulation tests
run: forge test --match-contract StorageLayoutTest -vvv

View file

@ -8,6 +8,7 @@
"**/*.yml",
"**/*.md",
"!node_modules/*",
"!**/moonwall/**/*",
"!target/*",
"!**/tmp/*",
"!**/*.spec.json",

View file

@ -1,6 +1,6 @@
# DataHaven AVS Smart Contracts
Implements the Actively Validated Service (AVS) logic for DataHaven, secured by EigenLayer. These contracts manage operator registration, handle cross-chain rewards via Snowbridge, and enforce slashing with a veto period.
Implements the Actively Validated Service (AVS) logic for DataHaven, secured by EigenLayer. These contracts manage operator registration, handle cross-chain rewards via Snowbridge, and enforce slashing.
## Project Structure
@ -65,6 +65,6 @@ Supported networks: `hoodi` (no mainnet config yet). Artifacts → `contracts/de
1. **Registration**: Validators register with EigenLayer via `DataHavenServiceManager`.
2. **Performance Tracking**: DataHaven computes reward points and sends a Merkle root to `RewardsRegistry` on Ethereum via Snowbridge.
3. **Rewards Claims**: Validators claim rewards on Ethereum from `RewardsRegistry` using Merkle proofs.
4. **Slashing**: Misbehavior triggers slashing (subject to veto period).
4. **Slashing**: Misbehavior triggers slashing.
See `test/README.md` for full network integration tests.

View file

@ -21,14 +21,13 @@
"rewardsCoordinatorInitPausedStatus": 0,
"allocationManagerInitPausedStatus": 0,
"deallocationDelay": 50,
"allocationConfigurationDelay": 75,
"allocationConfigurationDelay": 0,
"beaconChainGenesisTimestamp": 1695902400
},
"avs": {
"avsOwner": "0x976EA74026E726554dB657fA54763abd0C3a0aa9",
"rewardsInitiator": "0x14dC79964da2C08b23698B3D3cc7Ca32193d9955",
"vetoCommitteeMember": "0x23618e81E3f5cdF7f54C3d65f7FBc0aBf5B21E8f",
"vetoWindowBlocks": 100,
"validatorSetSubmitter": "0x976EA74026E726554dB657fA54763abd0C3a0aa9",
"validatorsStrategies": []
},
"snowbridge": {
@ -37,10 +36,12 @@
"minNumRequiredSignatures": 2,
"startBlock": 1,
"rewardsMessageOrigin": "0x0000000000000000000000000000000000000000000000000000000000000000",
"initialValidatorSetId": 0,
"initialValidatorHashes": [
"0xaeb47a269393297f4b0a3c9c9cfd00c7a4195255274cf39d83dabc2fcc9ff3d7",
"0xf68aec7304bf37f340dae2ea20fb5271ee28a3128812b84a615da4789e458bde"
],
"nextValidatorSetId": 1,
"nextValidatorHashes": [
"0xaeb47a269393297f4b0a3c9c9cfd00c7a4195255274cf39d83dabc2fcc9ff3d7",
"0xf68aec7304bf37f340dae2ea20fb5271ee28a3128812b84a615da4789e458bde"

View file

@ -69,12 +69,20 @@
/// This is for the EigenLayer rewards distribution way, using the RewardsCoordinator.
/// But for now, we're not using it, and instead sending the rewards directly.
"rewardsInitiator": "0x14dC79964da2C08b23698B3D3cc7Ca32193d9955",
/// The address of the account that is a member of the Veto Committee for vetoing slashing.
"vetoCommitteeMember": "0x23618e81E3f5cdF7f54C3d65f7FBc0aBf5B21E8f",
/// 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 +94,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"

View file

@ -0,0 +1,52 @@
{
"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",
"validatorsStrategies": [
"0xbeaC0eeEeeeeEEeEeEEEEeeEEeEeeeEeeEEBEaC0",
"0x93c4b944D05dfe6df7645A86cd2206016c51564D",
"0x1BeE69b7dFFfA4E2d53C2a2Df135C388AD25dCD2",
"0x54945180dB7943c0ed0FEE7EdaB2Bd24620256bc"
]
},
"snowbridge": {
"randaoCommitDelay": 4,
"randaoCommitExpiration": 24,
"minNumRequiredSignatures": 16,
"startBlock": 1,
"rewardsMessageOrigin": "0x0000000000000000000000000000000000000000000000000000000000000000",
"initialValidatorSetId": 0,
"initialValidatorHashes": [],
"nextValidatorSetId": 1,
"nextValidatorHashes": []
}
}

View file

@ -27,29 +27,37 @@
"eigenPodManager": "0xcd1442415Fc5C29Aa848A49d2e232720BE07976c",
"avsDirectory": "0xD58f6844f79eB1fbd9f7091d05f7cb30d3363926",
"rewardsCoordinator": "0x29e8572678e0c272350aa0b4B8f304E47EBcd5e7",
"allocationManager": "0x95a7431400F362F3647a69535C5666cA0133CAA0",
"allocationManager": "0x95a7431400F362F3647a69535C5666cA0133CAA0",
"permissionController": "0xdcCF401fD121d8C542E96BC1d0078884422aFAD2"
},
"avs": {
"avsOwner": "0xe30a38ac89ffE5A86D5389Bfbf70C7EC766FbB6e",
"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": 1303065,
"rewardsMessageOrigin": "0x56490bd3f367447bfaf57bb18e7a45e1b2db7d538fe42098e87d2aa106c6afdd",
"initialValidatorSetId": 2186,
"initialValidatorHashes": [
"0xaeb47a269393297f4b0a3c9c9cfd00c7a4195255274cf39d83dabc2fcc9ff3d7",
"0xf68aec7304bf37f340dae2ea20fb5271ee28a3128812b84a615da4789e458bde"
"0x07ce4f2cd558f4d4b529a3362b6ff7d616ca0893b53252dc62829b8218ea5c10",
"0xaea5344f086d3be7c94cf3a47436bcbb98de23cf1ee773a9180cfecab0453a50",
"0xcd3a33755b27fe810dfb780b3f1df1c25efa1bb826ca618e41022fa900876087",
"0x4f4ce8cad711a4b33d15095091f8a98eaf9bfd1b39a9159e605cf5d6783cc667"
],
"nextValidatorSetId": 2187,
"nextValidatorHashes": [
"0xaeb47a269393297f4b0a3c9c9cfd00c7a4195255274cf39d83dabc2fcc9ff3d7",
"0xf68aec7304bf37f340dae2ea20fb5271ee28a3128812b84a615da4789e458bde"
"0x07ce4f2cd558f4d4b529a3362b6ff7d616ca0893b53252dc62829b8218ea5c10",
"0xaea5344f086d3be7c94cf3a47436bcbb98de23cf1ee773a9180cfecab0453a50",
"0xcd3a33755b27fe810dfb780b3f1df1c25efa1bb826ca618e41022fa900876087",
"0x4f4ce8cad711a4b33d15095091f8a98eaf9bfd1b39a9159e605cf5d6783cc667"
]
}
}
}

View file

@ -0,0 +1,69 @@
{
"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",
"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"
]
}
}

View file

@ -0,0 +1 @@
{"RewardsAgent": "0x2E039a88838241d1Ac738cf2e3C5763ba12571e7","RewardsAgentOrigin": "0x56490bd3f367447bfaf57bb18e7a45e1b2db7d538fe42098e87d2aa106c6afdd"}

View file

@ -0,0 +1 @@
{"network": "stagenet-hoodi","BeefyClient": "0xE65dc4eCA2Fd428361076e1f204731224CeB4292","AgentExecutor": "0x35d3FdCB19A246a1763421168dF69dA3dE207063","Gateway": "0xE9352f1488F12bFEd722c133C129ca5F467463d1","ServiceManager": "0xED73cCaF067cebC706B2B3a6cf2b9af2c696c6d3","ServiceManagerImplementation": "0x5E1DA2eE025Dac2F8c391Ac86ebA20bd34c32465","RewardsAgent": "0x2E039a88838241d1Ac738cf2e3C5763ba12571e7","DelegationManager": "0x867837a9722C512e0862d8c2E15b8bE220E8b87d","StrategyManager": "0xeE45e76ddbEDdA2918b8C7E3035cd37Eab3b5D41","AVSDirectory": "0xD58f6844f79eB1fbd9f7091d05f7cb30d3363926","RewardsCoordinator": "0x29e8572678e0c272350aa0b4B8f304E47EBcd5e7","AllocationManager": "0x95a7431400F362F3647a69535C5666cA0133CAA0","PermissionController": "0xdcCF401fD121d8C542E96BC1d0078884422aFAD2"}

View file

@ -1 +1 @@
711490494719593c219c35ca496cd28b86d9f54a
9c861e3e1d290888127bc6d772fb1a3422bdf8b3

File diff suppressed because one or more lines are too long

11
contracts/foundry.lock Normal file
View file

@ -0,0 +1,11 @@
{
"lib/eigenlayer-contracts": {
"rev": "7ecc83c7b180850531bc5b8b953a7340adeecd43"
},
"lib/forge-std": {
"rev": "9530d9ec702df1b27b7f8f50c0a63a11b1b5fba9"
},
"lib/snowbridge": {
"rev": "13263fefa29a3f4af50e5650dcd93fe3afac44db"
}
}

View file

@ -8,7 +8,9 @@ contract Config {
uint256 randaoCommitExpiration;
uint256 minNumRequiredSignatures;
uint64 startBlock;
uint128 initialValidatorSetId;
bytes32[] initialValidatorHashes;
uint128 nextValidatorSetId;
bytes32[] nextValidatorHashes;
bytes32 rewardsMessageOrigin;
}
@ -17,9 +19,8 @@ contract Config {
struct AVSConfig {
address avsOwner;
address rewardsInitiator;
address vetoCommitteeMember;
uint32 vetoWindowBlocks;
address[] validatorsStrategies;
address validatorSetSubmitter;
}
// EigenLayer parameters

View file

@ -32,6 +32,10 @@ import {
} from "eigenlayer-contracts/src/contracts/permissions/PermissionController.sol";
import {EigenPodManager} from "eigenlayer-contracts/src/contracts/pods/EigenPodManager.sol";
import {IETHPOSDeposit} from "eigenlayer-contracts/src/contracts/interfaces/IETHPOSDeposit.sol";
import {IStrategy} from "eigenlayer-contracts/src/contracts/interfaces/IStrategy.sol";
import {
IRewardsCoordinatorTypes
} from "eigenlayer-contracts/src/contracts/interfaces/IRewardsCoordinator.sol";
// DataHaven imports
import {DataHavenServiceManager} from "../../src/DataHavenServiceManager.sol";
@ -41,8 +45,9 @@ import {ValidatorsUtils} from "../../script/utils/ValidatorsUtils.sol";
struct ServiceManagerInitParams {
address avsOwner;
address rewardsInitiator;
address[] validatorsStrategies;
IRewardsCoordinatorTypes.StrategyAndMultiplier[] validatorsStrategiesAndMultipliers;
address gateway;
address validatorSetSubmitter;
}
// Struct to store more detailed strategy information
@ -208,10 +213,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);
@ -243,12 +250,23 @@ abstract contract DeployBase is Script, DeployParams, Accounts {
"ServiceManager Implementation", address(serviceManagerImplementation)
);
// Build StrategyAndMultiplier[] from config addresses with default multiplier of 1.
// Multipliers can be updated post-deployment via setStrategiesAndMultipliers if needed.
IRewardsCoordinatorTypes.StrategyAndMultiplier[] memory strategiesAndMultipliers = new IRewardsCoordinatorTypes
.StrategyAndMultiplier[](avsConfig.validatorsStrategies.length);
for (uint256 i = 0; i < avsConfig.validatorsStrategies.length; i++) {
strategiesAndMultipliers[i] = IRewardsCoordinatorTypes.StrategyAndMultiplier({
strategy: IStrategy(avsConfig.validatorsStrategies[i]), multiplier: 1
});
}
// Create service manager initialisation parameters struct
ServiceManagerInitParams memory initParams = ServiceManagerInitParams({
avsOwner: avsConfig.avsOwner,
rewardsInitiator: avsConfig.rewardsInitiator,
validatorsStrategies: avsConfig.validatorsStrategies,
gateway: address(gateway)
validatorsStrategiesAndMultipliers: strategiesAndMultipliers,
gateway: address(gateway),
validatorSetSubmitter: avsConfig.validatorSetSubmitter
});
// Create the service manager proxy (different logic for local vs testnet)

View file

@ -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));
@ -119,8 +120,9 @@ contract DeployTestnet is DeployBase {
DataHavenServiceManager.initialize.selector,
params.avsOwner,
params.rewardsInitiator,
params.validatorsStrategies,
params.gateway
params.validatorsStrategiesAndMultipliers,
params.gateway,
params.validatorSetSubmitter
);
TransparentUpgradeableProxy proxy =
@ -186,7 +188,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 +211,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"
)
);
}
/**

View file

@ -206,8 +206,9 @@ contract DeployLocal is DeployBase {
DataHavenServiceManager.initialize.selector,
params.avsOwner,
params.rewardsInitiator,
params.validatorsStrategies,
params.gateway
params.validatorsStrategiesAndMultipliers,
params.gateway,
params.validatorSetSubmitter
);
TransparentUpgradeableProxy proxy =
@ -355,11 +356,15 @@ contract DeployLocal is DeployBase {
function _prepareStrategiesForServiceManager(
ServiceManagerInitParams memory params
) internal view {
if (params.validatorsStrategies.length == 0) {
params.validatorsStrategies = new address[](deployedStrategies.length);
if (params.validatorsStrategiesAndMultipliers.length == 0) {
IRewardsCoordinatorTypes.StrategyAndMultiplier[] memory sm =
new IRewardsCoordinatorTypes.StrategyAndMultiplier[](deployedStrategies.length);
for (uint256 i = 0; i < deployedStrategies.length; i++) {
params.validatorsStrategies[i] = deployedStrategies[i].address_;
sm[i] = IRewardsCoordinatorTypes.StrategyAndMultiplier({
strategy: IStrategy(deployedStrategies[i].address_), multiplier: 1
});
}
params.validatorsStrategiesAndMultipliers = sm;
}
}

View file

@ -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 =
@ -58,11 +76,15 @@ contract DeployParams is Script, Config {
config.avsOwner = vm.parseJsonAddress(configJson, ".avs.avsOwner");
}
config.rewardsInitiator = vm.parseJsonAddress(configJson, ".avs.rewardsInitiator");
config.vetoCommitteeMember = vm.parseJsonAddress(configJson, ".avs.vetoCommitteeMember");
config.vetoWindowBlocks = vm.parseJsonUint(configJson, ".avs.vetoWindowBlocks").toUint32();
config.validatorsStrategies =
vm.parseJsonAddressArray(configJson, ".avs.validatorsStrategies");
try vm.parseJsonAddress(configJson, ".avs.validatorSetSubmitter") returns (address addr) {
config.validatorSetSubmitter = addr;
} catch {
config.validatorSetSubmitter = address(0);
}
return config;
}

View file

@ -0,0 +1,32 @@
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.27;
import {OwnableUpgradeable} from "@openzeppelin-upgrades/contracts/access/OwnableUpgradeable.sol";
import {IGatewayV2} from "snowbridge/src/v2/IGateway.sol";
/// @notice Test-only fixture contract with intentionally broken storage layout.
/// @dev This contract is used to validate the snapshot-diff storage layout check fails as expected.
contract DataHavenServiceManagerBadLayout is OwnableUpgradeable {
// Deliberate layout shift: inserted before all original state vars
uint256 public layoutBreaker;
// Original variables (shifted by one slot)
address public rewardsInitiator;
mapping(address => bool) public validatorsAllowlist;
IGatewayV2 private _snowbridgeGateway;
mapping(address => address) public validatorEthAddressToSolochainAddress;
mapping(address => address) public validatorSolochainAddressToEthAddress;
// Keep the original gap size to mirror shape, despite the shift
uint256[45] private __GAP;
// Keep a compatible constructor signature for upgrade tests.
constructor(
address,
address
) {
_disableInitializers();
}
}

View file

@ -0,0 +1,61 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.27;
// EigenLayer imports
import {
IAllocationManagerTypes
} from "eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol";
import {OperatorSet} from "eigenlayer-contracts/src/contracts/libraries/OperatorSetLib.sol";
import {IStrategy} from "eigenlayer-contracts/src/contracts/interfaces/IStrategy.sol";
// Testing imports
import {Script} from "forge-std/Script.sol";
import {console} from "forge-std/console.sol";
import {Logging} from "../utils/Logging.sol";
import {ELScriptStorage} from "../utils/ELScriptStorage.s.sol";
import {DHScriptStorage} from "../utils/DHScriptStorage.s.sol";
import {Accounts} from "../utils/Accounts.sol";
/**
* @title AllocateOperatorStake
* @notice Allocates full magnitude to the validator operator set.
* Must be run AFTER SignUpValidator (needs at least 1 block gap
* for the allocation delay to initialize).
*/
contract AllocateOperatorStake is Script, ELScriptStorage, DHScriptStorage, Accounts {
function run() public {
string memory network = vm.envOr("NETWORK", string("anvil"));
Logging.logHeader("ALLOCATE OPERATOR STAKE");
console.log("| Network: %s", network);
Logging.logFooter();
_loadELContracts(network);
_loadDHContracts(network);
IStrategy[] memory strategies = new IStrategy[](deployedStrategies.length);
for (uint256 i = 0; i < deployedStrategies.length; i++) {
strategies[i] = IStrategy(address(deployedStrategies[i].strategy));
}
uint64[] memory newMagnitudes = new uint64[](strategies.length);
for (uint256 i = 0; i < strategies.length; i++) {
newMagnitudes[i] = 1e18;
}
IAllocationManagerTypes.AllocateParams[] memory allocParams =
new IAllocationManagerTypes.AllocateParams[](1);
allocParams[0] = IAllocationManagerTypes.AllocateParams({
operatorSet: OperatorSet({
avs: address(serviceManager), id: serviceManager.VALIDATORS_SET_ID()
}),
strategies: strategies,
newMagnitudes: newMagnitudes
});
vm.broadcast(_operatorPrivateKey);
allocationManager.modifyAllocations(_operator, allocParams);
Logging.logStep(
string.concat("Allocated full magnitude for operator: ", vm.toString(_operator))
);
}
}

View file

@ -0,0 +1,32 @@
#!/bin/bash
set -euo pipefail
# Negative check: ensure the snapshot-diff storage layout script fails when the layout is broken.
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR/.."
set +e
OUTPUT="$(
CONTRACT="DataHavenServiceManagerBadLayout" \
SNAPSHOT="storage-snapshots/DataHavenServiceManager.storage.json" \
./scripts/check-storage-layout.sh 2>&1
)"
EXIT_CODE=$?
set -e
if [ "$EXIT_CODE" -eq 0 ]; then
echo "ERROR: Expected storage layout check to fail for DataHavenServiceManagerBadLayout, but it succeeded."
exit 1
fi
if ! printf '%s\n' "$OUTPUT" | grep -qE "ERROR: (Storage layout has changed!|__GAP invariant violated!)"; then
echo "ERROR: Storage layout check failed, but not for the expected reason."
echo ""
echo "Output:"
echo "$OUTPUT"
exit 1
fi
echo "Negative check OK: storage layout check failed as expected for DataHavenServiceManagerBadLayout."

View file

@ -0,0 +1,84 @@
#!/bin/bash
set -e
# Storage Layout Check Script
# Compares current storage layout against committed snapshot to detect unintended changes.
CONTRACT="${CONTRACT:-DataHavenServiceManager}"
SNAPSHOT_DIR="${SNAPSHOT_DIR:-storage-snapshots}"
SNAPSHOT="${SNAPSHOT:-${SNAPSHOT_DIR}/${CONTRACT}.storage.json}"
# Ensure we're in the contracts directory
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR/.."
# Check if snapshot exists
if [ ! -f "$SNAPSHOT" ]; then
echo "ERROR: Snapshot file not found: $SNAPSHOT"
echo "Generate it with: mkdir -p $SNAPSHOT_DIR && forge inspect $CONTRACT storage --json > $SNAPSHOT"
exit 1
fi
# Generate current layout
echo "Generating current storage layout for $CONTRACT..."
forge inspect "$CONTRACT" storage --json > /tmp/current_layout.json
# Normalize both files for comparison:
# - Remove astId (changes with compiler runs)
# - Remove contract field (contains full path)
# - Remove types section (contains unstable AST IDs)
# - Sort by slot number
normalize_json() {
jq 'del(.types)
| .storage
| map(
del(.astId, .contract)
# Remove unstable AST IDs from type strings (e.g., t_contract(IGatewayV2)12345, nested mappings)
| .type |= gsub("\\)[0-9]+"; ")")
)
| sort_by(.slot | tonumber)' "$1"
}
echo "Comparing storage layouts..."
normalize_json "$SNAPSHOT" > /tmp/snap_normalized.json
normalize_json /tmp/current_layout.json > /tmp/curr_normalized.json
if ! diff -q /tmp/snap_normalized.json /tmp/curr_normalized.json > /dev/null 2>&1; then
echo ""
echo "=========================================="
echo "ERROR: Storage layout has changed!"
echo "=========================================="
echo ""
echo "Differences found:"
diff /tmp/snap_normalized.json /tmp/curr_normalized.json || true
echo ""
echo "If this change is intentional, update the snapshot:"
echo " forge inspect $CONTRACT storage --json > $SNAPSHOT"
echo ""
echo "WARNING: Unintended storage layout changes can corrupt state during upgrades!"
exit 1
fi
# Verify gap invariant: __GAP slot + array size must equal a fixed constant.
# This catches cases where a new variable is added but __GAP is not shrunk accordingly.
EXPECTED_GAP_TOTAL=151
GAP_SLOT=$(jq '.storage[] | select(.label == "__GAP") | .slot | tonumber' /tmp/current_layout.json)
GAP_SIZE=$(jq -r '.storage[] | select(.label == "__GAP") | .type' /tmp/current_layout.json \
| grep -oE '[0-9]+' | tail -1)
if [ -n "$GAP_SLOT" ] && [ -n "$GAP_SIZE" ]; then
GAP_TOTAL=$((GAP_SLOT + GAP_SIZE))
if [ "$GAP_TOTAL" -ne "$EXPECTED_GAP_TOTAL" ]; then
echo ""
echo "=========================================="
echo "ERROR: __GAP invariant violated!"
echo "=========================================="
echo ""
echo " slot($GAP_SLOT) + size($GAP_SIZE) = $GAP_TOTAL, expected $EXPECTED_GAP_TOTAL"
echo ""
echo "If you added a new state variable, shrink __GAP by the same number of slots."
exit 1
fi
fi
echo "Storage layout OK - no changes detected"

View file

@ -42,6 +42,9 @@ contract DataHavenServiceManager is OwnableUpgradeable, IAVSRegistrar, IDataHave
/// @notice The EigenLayer operator set ID for the Validators securing the DataHaven network.
uint32 public constant VALIDATORS_SET_ID = 0;
/// @notice Maximum number of active validators in the set
uint32 public constant MAX_ACTIVE_VALIDATORS = 32;
// ============ Immutables ============
/// @notice The EigenLayer AllocationManager contract
@ -64,9 +67,17 @@ contract DataHavenServiceManager is OwnableUpgradeable, IAVSRegistrar, IDataHave
/// @inheritdoc IDataHavenServiceManager
mapping(address => address) public validatorEthAddressToSolochainAddress;
mapping(address => address) public validatorSolochainAddressToEthAddress;
/// @inheritdoc IDataHavenServiceManager
address public validatorSetSubmitter;
/// @inheritdoc IDataHavenServiceManager
mapping(IStrategy => uint96) public strategiesAndMultipliers;
/// @notice Storage gap for upgradeability (must be at end of state variables)
// solhint-disable-next-line var-name-mixedcase
uint256[46] private __GAP;
uint256[43] private __GAP;
// ============ Modifiers ============
@ -88,6 +99,12 @@ contract DataHavenServiceManager is OwnableUpgradeable, IAVSRegistrar, IDataHave
_;
}
/// @notice Restricts function to the validator set submitter
modifier onlyValidatorSetSubmitter() {
_checkValidatorSetSubmitter();
_;
}
function _checkRewardsInitiator() internal view {
require(msg.sender == rewardsInitiator, OnlyRewardsInitiator());
}
@ -104,6 +121,10 @@ contract DataHavenServiceManager is OwnableUpgradeable, IAVSRegistrar, IDataHave
require(msg.sender == address(_ALLOCATION_MANAGER), OnlyAllocationManager());
}
function _checkValidatorSetSubmitter() internal view {
require(msg.sender == validatorSetSubmitter, OnlyValidatorSetSubmitter());
}
// ============ Constructor ============
/// @notice Sets the immutable EigenLayer contract references
@ -122,8 +143,9 @@ contract DataHavenServiceManager is OwnableUpgradeable, IAVSRegistrar, IDataHave
function initialize(
address initialOwner,
address _rewardsInitiator,
IStrategy[] memory validatorsStrategies,
address _snowbridgeGatewayAddress
IRewardsCoordinatorTypes.StrategyAndMultiplier[] memory validatorsStrategiesAndMultipliers,
address _snowbridgeGatewayAddress,
address _validatorSetSubmitter
) public virtual initializer {
require(initialOwner != address(0), ZeroAddress());
require(_rewardsInitiator != address(0), ZeroAddress());
@ -137,51 +159,133 @@ contract DataHavenServiceManager is OwnableUpgradeable, IAVSRegistrar, IDataHave
// Register the DataHaven service in the AllocationManager.
_ALLOCATION_MANAGER.updateAVSMetadataURI(address(this), DATAHAVEN_AVS_METADATA);
// Build the strategies array and populate multipliers atomically so that
// getStrategiesInOperatorSet and strategiesAndMultipliers are always consistent.
IStrategy[] memory strategies = new IStrategy[](validatorsStrategiesAndMultipliers.length);
for (uint256 i = 0; i < validatorsStrategiesAndMultipliers.length; i++) {
strategies[i] = validatorsStrategiesAndMultipliers[i].strategy;
strategiesAndMultipliers[validatorsStrategiesAndMultipliers[i].strategy] =
validatorsStrategiesAndMultipliers[i].multiplier;
}
// Create the operator set for the DataHaven service.
IAllocationManagerTypes.CreateSetParams[] memory operatorSets =
new IAllocationManagerTypes.CreateSetParams[](1);
operatorSets[0] = IAllocationManagerTypes.CreateSetParams({
operatorSetId: VALIDATORS_SET_ID, strategies: validatorsStrategies
operatorSetId: VALIDATORS_SET_ID, strategies: strategies
});
_ALLOCATION_MANAGER.createOperatorSets(address(this), operatorSets);
// Set the Snowbridge Gateway address.
_snowbridgeGateway = IGatewayV2(_snowbridgeGatewayAddress);
// Set the validator set submitter if provided.
if (_validatorSetSubmitter != address(0)) {
validatorSetSubmitter = _validatorSetSubmitter;
emit ValidatorSetSubmitterUpdated(address(0), _validatorSetSubmitter);
}
}
/// @inheritdoc IDataHavenServiceManager
function sendNewValidatorSet(
function setValidatorSetSubmitter(
address newSubmitter
) external onlyOwner {
require(newSubmitter != address(0), ZeroAddress());
address oldSubmitter = validatorSetSubmitter;
validatorSetSubmitter = newSubmitter;
emit ValidatorSetSubmitterUpdated(oldSubmitter, newSubmitter);
}
/// @inheritdoc IDataHavenServiceManager
function sendNewValidatorSetForEra(
uint64 targetEra,
uint128 executionFee,
uint128 relayerFee
) external payable onlyOwner {
bytes memory message = buildNewValidatorSetMessage();
) external payable onlyValidatorSetSubmitter {
bytes memory message = buildNewValidatorSetMessageForEra(targetEra);
_snowbridgeGateway.v2_sendMessage{value: msg.value}(
message, new bytes[](0), bytes(""), executionFee, relayerFee
);
emit ValidatorSetMessageSubmitted(targetEra, keccak256(message), msg.sender);
}
/// @inheritdoc IDataHavenServiceManager
function buildNewValidatorSetMessage() public view returns (bytes memory) {
function buildNewValidatorSetMessageForEra(
uint64 targetEra
) public view returns (bytes memory) {
OperatorSet memory operatorSet = OperatorSet({avs: address(this), id: VALIDATORS_SET_ID});
address[] memory currentValidatorSet = _ALLOCATION_MANAGER.getMembers(operatorSet);
address[] memory operators = _ALLOCATION_MANAGER.getMembers(operatorSet);
IStrategy[] memory strategies = _ALLOCATION_MANAGER.getStrategiesInOperatorSet(operatorSet);
// Allocate max size, then resize after filtering
address[] memory newValidatorSet = new address[](currentValidatorSet.length);
uint256 validCount = 0;
for (uint256 i = 0; i < currentValidatorSet.length; i++) {
address solochainAddr = validatorEthAddressToSolochainAddress[currentValidatorSet[i]];
if (solochainAddr != address(0)) {
newValidatorSet[validCount] = solochainAddr;
++validCount;
// Get allocated stake for all operators across all strategies
uint256[][] memory allocatedStake =
_ALLOCATION_MANAGER.getAllocatedStake(operatorSet, operators, strategies);
// Collect candidates: operators with solochain mapping and non-zero weighted stake
address[] memory candidateSolochain = new address[](operators.length);
uint256[] memory candidateStake = new uint256[](operators.length);
address[] memory candidateOperator = new address[](operators.length);
uint256 candidateCount = 0;
for (uint256 i = 0; i < operators.length; i++) {
address solochainAddr = validatorEthAddressToSolochainAddress[operators[i]];
if (solochainAddr == address(0)) continue;
// Compute weighted stake across all strategies:
// weightedStake = sum(allocatedStake[i][j] * multiplier[j])
uint256 weightedStake = 0;
for (uint256 j = 0; j < strategies.length; j++) {
weightedStake += allocatedStake[i][j]
* uint256(strategiesAndMultipliers[strategies[j]]);
}
if (weightedStake == 0) continue;
candidateSolochain[candidateCount] = solochainAddr;
candidateStake[candidateCount] = weightedStake;
candidateOperator[candidateCount] = operators[i];
candidateCount++;
}
require(candidateCount != 0, EmptyValidatorSet());
// Partial selection sort: pick top min(MAX_ACTIVE_VALIDATORS, candidateCount)
uint256 selectCount =
candidateCount < MAX_ACTIVE_VALIDATORS ? candidateCount : MAX_ACTIVE_VALIDATORS;
for (uint256 i = 0; i < selectCount; i++) {
uint256 bestIdx = i;
for (uint256 j = i + 1; j < candidateCount; j++) {
if (_isBetterCandidate(
candidateStake[j],
candidateOperator[j],
candidateStake[bestIdx],
candidateOperator[bestIdx]
)) {
bestIdx = j;
}
}
if (bestIdx != i) {
// Swap all parallel arrays
(candidateSolochain[i], candidateSolochain[bestIdx]) =
(candidateSolochain[bestIdx], candidateSolochain[i]);
(candidateStake[i], candidateStake[bestIdx]) =
(candidateStake[bestIdx], candidateStake[i]);
(candidateOperator[i], candidateOperator[bestIdx]) =
(candidateOperator[bestIdx], candidateOperator[i]);
}
}
// Resize array to actual count
assembly {
mstore(newValidatorSet, validCount)
// Build the final validator set from sorted solochain addresses
address[] memory newValidatorSet = new address[](selectCount);
for (uint256 i = 0; i < selectCount; i++) {
newValidatorSet[i] = candidateSolochain[i];
}
return DataHavenSnowbridgeMessages.scaleEncodeNewValidatorSetMessagePayload(
DataHavenSnowbridgeMessages.NewValidatorSetPayload({validators: newValidatorSet})
DataHavenSnowbridgeMessages.NewValidatorSetPayload({
validators: newValidatorSet, externalIndex: targetEra
})
);
}
@ -190,7 +294,20 @@ contract DataHavenServiceManager is OwnableUpgradeable, IAVSRegistrar, IDataHave
address solochainAddress
) external onlyValidator {
require(solochainAddress != address(0), ZeroAddress());
address existingEthOperator = validatorSolochainAddressToEthAddress[solochainAddress];
require(
existingEthOperator == address(0) || existingEthOperator == msg.sender,
SolochainAddressAlreadyAssigned()
);
address oldSolochainAddress = validatorEthAddressToSolochainAddress[msg.sender];
if (oldSolochainAddress != address(0) && oldSolochainAddress != solochainAddress) {
delete validatorSolochainAddressToEthAddress[oldSolochainAddress];
}
validatorEthAddressToSolochainAddress[msg.sender] = solochainAddress;
validatorSolochainAddressToEthAddress[solochainAddress] = msg.sender;
emit SolochainAddressUpdated(msg.sender, solochainAddress);
}
@ -221,7 +338,21 @@ contract DataHavenServiceManager is OwnableUpgradeable, IAVSRegistrar, IDataHave
require(operatorSetIds.length == 1, CantRegisterToMultipleOperatorSets());
require(operatorSetIds[0] == VALIDATORS_SET_ID, InvalidOperatorSetId());
require(validatorsAllowlist[operator], OperatorNotInAllowlist());
validatorEthAddressToSolochainAddress[operator] = _toAddress(data);
address solochainAddress = _toAddress(data);
address existingEthOperator = validatorSolochainAddressToEthAddress[solochainAddress];
require(
existingEthOperator == address(0) || existingEthOperator == operator,
SolochainAddressAlreadyAssigned()
);
address oldSolochainAddress = validatorEthAddressToSolochainAddress[operator];
if (oldSolochainAddress != address(0) && oldSolochainAddress != solochainAddress) {
delete validatorSolochainAddressToEthAddress[oldSolochainAddress];
}
validatorEthAddressToSolochainAddress[operator] = solochainAddress;
validatorSolochainAddressToEthAddress[solochainAddress] = operator;
emit OperatorRegistered(operator, operatorSetIds[0]);
}
@ -236,7 +367,11 @@ contract DataHavenServiceManager is OwnableUpgradeable, IAVSRegistrar, IDataHave
require(operatorSetIds.length == 1, CantDeregisterFromMultipleOperatorSets());
require(operatorSetIds[0] == VALIDATORS_SET_ID, InvalidOperatorSetId());
address oldSolochainAddress = validatorEthAddressToSolochainAddress[operator];
delete validatorEthAddressToSolochainAddress[operator];
if (oldSolochainAddress != address(0)) {
delete validatorSolochainAddressToEthAddress[oldSolochainAddress];
}
emit OperatorDeregistered(operator, operatorSetIds[0]);
}
@ -280,15 +415,71 @@ contract DataHavenServiceManager is OwnableUpgradeable, IAVSRegistrar, IDataHave
_ALLOCATION_MANAGER.removeStrategiesFromOperatorSet(
address(this), VALIDATORS_SET_ID, _strategies
);
for (uint256 i = 0; i < _strategies.length; i++) {
delete strategiesAndMultipliers[_strategies[i]];
}
}
/// @inheritdoc IDataHavenServiceManager
function addStrategiesToValidatorsSupportedStrategies(
IStrategy[] calldata _strategies
IRewardsCoordinatorTypes.StrategyAndMultiplier[] calldata _strategyMultipliers
) external onlyOwner {
_ALLOCATION_MANAGER.addStrategiesToOperatorSet(
address(this), VALIDATORS_SET_ID, _strategies
);
IStrategy[] memory strategies = new IStrategy[](_strategyMultipliers.length);
for (uint256 i = 0; i < _strategyMultipliers.length; i++) {
strategies[i] = _strategyMultipliers[i].strategy;
strategiesAndMultipliers[_strategyMultipliers[i].strategy] =
_strategyMultipliers[i].multiplier;
}
_ALLOCATION_MANAGER.addStrategiesToOperatorSet(address(this), VALIDATORS_SET_ID, strategies);
emit StrategiesAndMultipliersSet(_strategyMultipliers);
}
/// @inheritdoc IDataHavenServiceManager
function setStrategiesAndMultipliers(
IRewardsCoordinatorTypes.StrategyAndMultiplier[] calldata _strategyMultipliers
) external onlyOwner {
OperatorSet memory operatorSet = OperatorSet({avs: address(this), id: VALIDATORS_SET_ID});
IStrategy[] memory registered = _ALLOCATION_MANAGER.getStrategiesInOperatorSet(operatorSet);
for (uint256 i = 0; i < _strategyMultipliers.length; i++) {
bool found = false;
for (uint256 j = 0; j < registered.length; j++) {
if (registered[j] == _strategyMultipliers[i].strategy) {
found = true;
break;
}
}
require(found, StrategyNotInOperatorSet());
strategiesAndMultipliers[_strategyMultipliers[i].strategy] =
_strategyMultipliers[i].multiplier;
}
emit StrategiesAndMultipliersSet(_strategyMultipliers);
}
/// @inheritdoc IDataHavenServiceManager
function getStrategiesAndMultipliers()
external
view
returns (IRewardsCoordinatorTypes.StrategyAndMultiplier[] memory)
{
OperatorSet memory operatorSet = OperatorSet({avs: address(this), id: VALIDATORS_SET_ID});
IStrategy[] memory strategies = _ALLOCATION_MANAGER.getStrategiesInOperatorSet(operatorSet);
IRewardsCoordinatorTypes.StrategyAndMultiplier[] memory result =
new IRewardsCoordinatorTypes.StrategyAndMultiplier[](strategies.length);
for (uint256 i = 0; i < strategies.length; i++) {
result[i] = IRewardsCoordinatorTypes.StrategyAndMultiplier({
strategy: strategies[i], multiplier: strategiesAndMultipliers[strategies[i]]
});
}
return result;
}
// ============ Rewards Functions ============
@ -297,16 +488,22 @@ contract DataHavenServiceManager is OwnableUpgradeable, IAVSRegistrar, IDataHave
function submitRewards(
IRewardsCoordinatorTypes.OperatorDirectedRewardsSubmission calldata submission
) external override onlyRewardsInitiator {
IRewardsCoordinatorTypes.OperatorDirectedRewardsSubmission memory translatedSubmission =
submission;
uint256 totalAmount = 0;
for (uint256 i = 0; i < submission.operatorRewards.length; i++) {
totalAmount += submission.operatorRewards[i].amount;
for (uint256 i = 0; i < translatedSubmission.operatorRewards.length; i++) {
translatedSubmission.operatorRewards[i].operator =
_ethOperatorFromSolochain(translatedSubmission.operatorRewards[i].operator);
totalAmount += translatedSubmission.operatorRewards[i].amount;
}
_sortOperatorRewards(translatedSubmission.operatorRewards);
submission.token.safeIncreaseAllowance(address(_REWARDS_COORDINATOR), totalAmount);
IRewardsCoordinatorTypes.OperatorDirectedRewardsSubmission[] memory submissions =
new IRewardsCoordinatorTypes.OperatorDirectedRewardsSubmission[](1);
submissions[0] = submission;
submissions[0] = translatedSubmission;
OperatorSet memory operatorSet = OperatorSet({avs: address(this), id: VALIDATORS_SET_ID});
_REWARDS_COORDINATOR.createOperatorDirectedOperatorSetRewardsSubmission(
@ -357,9 +554,10 @@ contract DataHavenServiceManager is OwnableUpgradeable, IAVSRegistrar, IDataHave
SlashingRequest[] calldata slashings
) external onlyRewardsInitiator {
for (uint256 i = 0; i < slashings.length; i++) {
address ethOperator = _ethOperatorFromSolochain(slashings[i].operator);
IAllocationManagerTypes.SlashingParams memory slashingParams =
IAllocationManagerTypes.SlashingParams({
operator: slashings[i].operator,
operator: ethOperator,
operatorSetId: VALIDATORS_SET_ID,
strategies: slashings[i].strategies,
wadsToSlash: slashings[i].wadsToSlash,
@ -374,6 +572,26 @@ contract DataHavenServiceManager is OwnableUpgradeable, IAVSRegistrar, IDataHave
// ============ Internal Functions ============
/**
* @notice Sorts operator rewards array by operator address in ascending order using insertion sort
* @dev Insertion sort is optimal for small arrays (validator set capped at 32)
* @param rewards The operator rewards array to sort in-place
*/
function _sortOperatorRewards(
IRewardsCoordinatorTypes.OperatorReward[] memory rewards
) private pure {
uint256 len = rewards.length;
for (uint256 i = 1; i < len; i++) {
IRewardsCoordinatorTypes.OperatorReward memory key = rewards[i];
uint256 j = i;
while (j > 0 && rewards[j - 1].operator > key.operator) {
rewards[j] = rewards[j - 1];
j--;
}
rewards[j] = key;
}
}
/**
* @notice Safely converts a 20-byte array to an address
* @param data The bytes to convert (must be exactly 20 bytes)
@ -382,10 +600,43 @@ contract DataHavenServiceManager is OwnableUpgradeable, IAVSRegistrar, IDataHave
function _toAddress(
bytes memory data
) private pure returns (address result) {
require(data.length == 20, "Invalid address length");
require(data.length == 20, InvalidSolochainAddressLength());
assembly {
result := shr(96, mload(add(data, 32)))
}
require(result != address(0), ZeroAddress());
}
/**
* @notice Determines if candidate A ranks higher than candidate B
* @dev Higher stake wins; on tie, lower operator address wins
* @param stakeA Weighted stake of candidate A
* @param opA Operator address of candidate A
* @param stakeB Weighted stake of candidate B
* @param opB Operator address of candidate B
* @return True if candidate A ranks higher than candidate B
*/
function _isBetterCandidate(
uint256 stakeA,
address opA,
uint256 stakeB,
address opB
) private pure returns (bool) {
if (stakeA != stakeB) {
return stakeA > stakeB;
}
return opA < opB;
}
/**
* @notice Returns the EigenLayer operator address for a Solochain validator address
* @dev Reverts if the Solochain address has not been mapped to an operator
*/
function _ethOperatorFromSolochain(
address solochainAddress
) internal view returns (address) {
address ethOperator = validatorSolochainAddressToEthAddress[solochainAddress];
require(ethOperator != address(0), UnknownSolochainAddress());
return ethOperator;
}
}

View file

@ -32,6 +32,19 @@ interface IDataHavenServiceManagerErrors {
error ZeroAddress();
/// @notice Thrown when the solochain address data length is not 20 bytes
error InvalidSolochainAddressLength();
/// @notice Thrown when the caller is not the authorized validator set submitter
error OnlyValidatorSetSubmitter();
/// @notice Thrown when trying to submit a validator set message with zero validators
error EmptyValidatorSet();
/// @notice Thrown when a Solochain address has not been mapped to an EigenLayer operator
error UnknownSolochainAddress();
/// @notice Thrown when a Solochain address is already assigned to a different operator
error SolochainAddressAlreadyAssigned();
/// @notice Thrown when a strategy is not registered in the operator set
error StrategyNotInOperatorSet();
}
/**
@ -78,6 +91,23 @@ interface IDataHavenServiceManagerEvents {
/// @notice Emitted when a batch of slashing request is being successfully slashed
event SlashingComplete();
/// @notice Emitted when strategy multipliers are set or updated
/// @param strategyMultipliers Array of strategy-multiplier pairs that were set
event StrategiesAndMultipliersSet(IRewardsCoordinatorTypes
.StrategyAndMultiplier[] strategyMultipliers);
/// @notice Emitted when the validator set submitter address is updated
/// @param oldSubmitter The previous validator set submitter address
/// @param newSubmitter The new validator set submitter address
event ValidatorSetSubmitterUpdated(address indexed oldSubmitter, address indexed newSubmitter);
/// @notice Emitted when a validator set message is submitted for a target era
/// @param targetEra The target era for the validator set
/// @param payloadHash The keccak256 hash of the encoded message payload
/// @param submitter The address that submitted the validator set message
event ValidatorSetMessageSubmitted(
uint64 indexed targetEra, bytes32 payloadHash, address indexed submitter
);
}
/**
@ -117,38 +147,73 @@ interface IDataHavenServiceManager is
address validatorAddress
) external view returns (address);
/// @notice Returns the address authorized to submit validator set messages
/// @return The validator set submitter address
function validatorSetSubmitter() external view returns (address);
/**
* @notice Sets the address authorized to submit validator set messages
* @param newSubmitter The new validator set submitter address
* @dev Only callable by the owner
*/
function setValidatorSetSubmitter(
address newSubmitter
) external;
/**
* @notice Converts a Solochain validator address to the corresponding EigenLayer operator address
* @param solochainAddress The Solochain validator address to convert
* @return The corresponding EigenLayer operator address
*/
function validatorSolochainAddressToEthAddress(
address solochainAddress
) external view returns (address);
/**
* @notice Initializes the DataHaven Service Manager
* @param initialOwner Address of the initial owner
* @param rewardsInitiator Address authorized to initiate rewards
* @param validatorsStrategies Array of strategies supported by validators
* @param validatorsStrategiesAndMultipliers Array of strategy-multiplier pairs for the validators
* operator set. Each multiplier must be non-zero.
* @param _snowbridgeGatewayAddress Address of the Snowbridge Gateway
* @param _validatorSetSubmitter Address authorized to submit validator set messages
*/
function initialize(
address initialOwner,
address rewardsInitiator,
IStrategy[] memory validatorsStrategies,
address _snowbridgeGatewayAddress
IRewardsCoordinatorTypes.StrategyAndMultiplier[] memory validatorsStrategiesAndMultipliers,
address _snowbridgeGatewayAddress,
address _validatorSetSubmitter
) external;
/**
* @notice Sends a new validator set to the Snowbridge Gateway
* @notice Sends a new validator set for a target era to the Snowbridge Gateway
* @dev The new validator set is made up of the Validators currently
* registered in the DataHaven Service Manager as operators of
* the Validators operator set (operatorSetId = VALIDATORS_SET_ID)
* @dev Only callable by the owner
* @dev Only callable by the validator set submitter
* @param targetEra The target era for the validator set submission
* @param executionFee The execution fee for the Snowbridge message
* @param relayerFee The relayer fee for the Snowbridge message
*/
function sendNewValidatorSet(
function sendNewValidatorSetForEra(
uint64 targetEra,
uint128 executionFee,
uint128 relayerFee
) external payable;
/**
* @notice Builds a new validator set message to be sent to the Snowbridge Gateway
* @return The encoded message bytes to be sent to the Snowbridge Gateway
* @notice Builds a SCALE-encoded message containing the top validators by weighted stake
* @dev Selects up to MAX_ACTIVE_VALIDATORS from registered operators. Each operator's
* weighted stake is computed as: sum(allocatedStake[j] * multiplier[j])
* across all strategies. Operators without a solochain address mapping or with zero
* weighted stake are excluded. Ties are broken by lower operator address.
* @param targetEra The target era to encode in the message
* @return The SCALE-encoded message bytes to be sent to the Snowbridge Gateway
*/
function buildNewValidatorSetMessage() external view returns (bytes memory);
function buildNewValidatorSetMessageForEra(
uint64 targetEra
) external view returns (bytes memory);
/**
* @notice Updates the Solochain address for a Validator
@ -200,12 +265,50 @@ interface IDataHavenServiceManager is
/**
* @notice Adds strategies to the list of supported strategies for DataHaven Validators
* @param _strategies Array of strategy contracts to add to validators operator set
* @dev Each strategy's multiplier determines its weight in the validator selection
* formula: weightedStake = sum(allocatedStake[j] * multiplier[j])
* @param _strategyMultipliers Array of strategy-multiplier pairs to add
*/
function addStrategiesToValidatorsSupportedStrategies(
IStrategy[] calldata _strategies
IRewardsCoordinatorTypes.StrategyAndMultiplier[] calldata _strategyMultipliers
) external;
/**
* @notice Returns the maximum number of active validators in the set
* @return The maximum active validators constant
*/
function MAX_ACTIVE_VALIDATORS() external pure returns (uint32);
/**
* @notice Returns the multiplier for a given strategy
* @dev The multiplier determines how much an operator's allocated stake in this strategy
* contributes to their weighted stake during validator set selection.
* @param strategy The strategy to look up
* @return The multiplier weight
*/
function strategiesAndMultipliers(
IStrategy strategy
) external view returns (uint96);
/**
* @notice Updates multipliers for strategies already in the operator set
* @dev Does not add or remove strategies from EigenLayer; only updates multiplier weights
* used in the validator selection weighted stake formula
* @param _strategyMultipliers Array of strategy-multiplier pairs to update
*/
function setStrategiesAndMultipliers(
IRewardsCoordinatorTypes.StrategyAndMultiplier[] calldata _strategyMultipliers
) external;
/**
* @notice Returns all strategies with their multipliers
* @return Array of StrategyAndMultiplier structs with strategy addresses and multiplier weights
*/
function getStrategiesAndMultipliers()
external
view
returns (IRewardsCoordinatorTypes.StrategyAndMultiplier[] memory);
// ============ Rewards Submitter Functions ============
/**

View file

@ -35,6 +35,8 @@ library DataHavenSnowbridgeMessages {
struct NewValidatorSetPayload {
/// @notice The list of validators in the DataHaven network.
address[] validators;
/// @notice The external index (target era) for the validator set.
uint64 externalIndex;
}
/**
@ -48,8 +50,6 @@ library DataHavenSnowbridgeMessages {
uint32 validatorsLen = uint32(payload.validators.length);
address[] memory validatorSet = payload.validators;
uint64 externalIndex = uint64(0);
// Flatten the validator set into a single bytes array
bytes memory validatorsFlattened;
for (uint32 i = 0; i < validatorSet.length; i++) {
@ -63,7 +63,7 @@ library DataHavenSnowbridgeMessages {
bytes1(uint8(OutboundCommandV1.ReceiveValidators)),
ScaleCodec.encodeCompactU32(validatorsLen),
validatorsFlattened,
ScaleCodec.encodeU64(externalIndex)
ScaleCodec.encodeU64(payload.externalIndex)
);
}
}

View file

@ -0,0 +1,184 @@
{
"storage": [
{
"astId": 138,
"contract": "src/DataHavenServiceManager.sol:DataHavenServiceManager",
"label": "_initialized",
"offset": 0,
"slot": "0",
"type": "t_uint8"
},
{
"astId": 141,
"contract": "src/DataHavenServiceManager.sol:DataHavenServiceManager",
"label": "_initializing",
"offset": 1,
"slot": "0",
"type": "t_bool"
},
{
"astId": 671,
"contract": "src/DataHavenServiceManager.sol:DataHavenServiceManager",
"label": "__gap",
"offset": 0,
"slot": "1",
"type": "t_array(t_uint256)50_storage"
},
{
"astId": 10,
"contract": "src/DataHavenServiceManager.sol:DataHavenServiceManager",
"label": "_owner",
"offset": 0,
"slot": "51",
"type": "t_address"
},
{
"astId": 130,
"contract": "src/DataHavenServiceManager.sol:DataHavenServiceManager",
"label": "__gap",
"offset": 0,
"slot": "52",
"type": "t_array(t_uint256)49_storage"
},
{
"astId": 23775,
"contract": "src/DataHavenServiceManager.sol:DataHavenServiceManager",
"label": "rewardsInitiator",
"offset": 0,
"slot": "101",
"type": "t_address"
},
{
"astId": 23780,
"contract": "src/DataHavenServiceManager.sol:DataHavenServiceManager",
"label": "validatorsAllowlist",
"offset": 0,
"slot": "102",
"type": "t_mapping(t_address,t_bool)"
},
{
"astId": 23784,
"contract": "src/DataHavenServiceManager.sol:DataHavenServiceManager",
"label": "_snowbridgeGateway",
"offset": 0,
"slot": "103",
"type": "t_contract(IGatewayV2)23481"
},
{
"astId": 23789,
"contract": "src/DataHavenServiceManager.sol:DataHavenServiceManager",
"label": "validatorEthAddressToSolochainAddress",
"offset": 0,
"slot": "104",
"type": "t_mapping(t_address,t_address)"
},
{
"astId": 23793,
"contract": "src/DataHavenServiceManager.sol:DataHavenServiceManager",
"label": "validatorSolochainAddressToEthAddress",
"offset": 0,
"slot": "105",
"type": "t_mapping(t_address,t_address)"
},
{
"astId": 23796,
"contract": "src/DataHavenServiceManager.sol:DataHavenServiceManager",
"label": "validatorSetSubmitter",
"offset": 0,
"slot": "106",
"type": "t_address"
},
{
"astId": 23802,
"contract": "src/DataHavenServiceManager.sol:DataHavenServiceManager",
"label": "strategiesAndMultipliers",
"offset": 0,
"slot": "107",
"type": "t_mapping(t_contract(IStrategy)7361,t_uint96)"
},
{
"astId": 23807,
"contract": "src/DataHavenServiceManager.sol:DataHavenServiceManager",
"label": "__GAP",
"offset": 0,
"slot": "108",
"type": "t_array(t_uint256)43_storage"
}
],
"types": {
"t_address": {
"encoding": "inplace",
"label": "address",
"numberOfBytes": "20"
},
"t_array(t_uint256)43_storage": {
"encoding": "inplace",
"label": "uint256[43]",
"numberOfBytes": "1376",
"base": "t_uint256"
},
"t_array(t_uint256)49_storage": {
"encoding": "inplace",
"label": "uint256[49]",
"numberOfBytes": "1568",
"base": "t_uint256"
},
"t_array(t_uint256)50_storage": {
"encoding": "inplace",
"label": "uint256[50]",
"numberOfBytes": "1600",
"base": "t_uint256"
},
"t_bool": {
"encoding": "inplace",
"label": "bool",
"numberOfBytes": "1"
},
"t_contract(IGatewayV2)23481": {
"encoding": "inplace",
"label": "contract IGatewayV2",
"numberOfBytes": "20"
},
"t_contract(IStrategy)7361": {
"encoding": "inplace",
"label": "contract IStrategy",
"numberOfBytes": "20"
},
"t_mapping(t_address,t_address)": {
"encoding": "mapping",
"key": "t_address",
"label": "mapping(address => address)",
"numberOfBytes": "32",
"value": "t_address"
},
"t_mapping(t_address,t_bool)": {
"encoding": "mapping",
"key": "t_address",
"label": "mapping(address => bool)",
"numberOfBytes": "32",
"value": "t_bool"
},
"t_mapping(t_contract(IStrategy)7361,t_uint96)": {
"encoding": "mapping",
"key": "t_contract(IStrategy)7361",
"label": "mapping(contract IStrategy => uint96)",
"numberOfBytes": "32",
"value": "t_uint96"
},
"t_uint256": {
"encoding": "inplace",
"label": "uint256",
"numberOfBytes": "32"
},
"t_uint8": {
"encoding": "inplace",
"label": "uint8",
"numberOfBytes": "1"
},
"t_uint96": {
"encoding": "inplace",
"label": "uint96",
"numberOfBytes": "12"
}
}
}

View file

@ -0,0 +1,75 @@
# Storage Layout Snapshots
This directory contains storage layout snapshots for upgradeable contracts. These snapshots are used to detect unintended storage layout changes that could corrupt state during proxy upgrades.
## How It Works
1. **Snapshot Comparison**: CI compares the current storage layout against committed snapshots
2. **Upgrade Simulation**: Foundry tests verify state preservation across upgrades
## Updating Snapshots
When you intentionally modify the storage layout of a contract (e.g., adding new state variables), you must update the snapshot:
```bash
cd contracts
forge inspect DataHavenServiceManager storage --json > storage-snapshots/DataHavenServiceManager.storage.json
```
## Important Guidelines
- **Never reorder existing variables** - This corrupts existing state
- **Never change types of existing variables** - This corrupts existing state
- **Always add new variables before the `__GAP`** - This preserves upgrade safety
- **Reduce gap size when adding variables** - Keep total slot count constant
- **Review snapshot diffs carefully** - Ensure changes are intentional
## Current Contracts
| Contract | Gap Size | Gap Slot |
|----------|----------|----------|
| DataHavenServiceManager | 46 | 105 |
## Verification Commands
```bash
# Check storage layout (CI script)
./scripts/check-storage-layout.sh
# Negative check (proves detector fails on broken layout)
./scripts/check-storage-layout-negative.sh
# Run upgrade simulation tests
forge test --match-contract StorageLayoutTest -vvv
# View human-readable layout
forge inspect DataHavenServiceManager storage --pretty
```
## How Normalization Works
The snapshot comparison normalizes both files to avoid false positives:
- **Removes `astId`**: Changes with each compiler run
- **Removes `contract`**: Contains full file path
- **Removes `.types` section**: Contains unstable AST IDs that cause false diffs
- **Normalizes type IDs**: Strips unstable numeric suffixes from `type` (e.g., `t_contract(IGatewayV2)12345`)
- **Sorts by slot**: Ensures deterministic comparison
This approach detects:
- Variable reordering or slot changes
- Top-level type changes (primitives, mappings, arrays)
- Gap size modifications
## Note on Struct Storage
If you add struct-typed storage variables in the future, be aware that **internal struct field changes may not be detected** by the snapshot diff. This is because:
1. The `.types` section (which contains struct field definitions) is dropped to avoid unstable AST IDs
2. The storage slot assignment for a struct variable doesn't change when its internal fields change
**However, this does not break upgrades** in the traditional sense. Struct field reordering or type changes within a struct would cause data misinterpretation (reading field A as field B), but the slot-level layout remains stable.
**Mitigation**: If adding struct storage, ensure the upgrade simulation tests (`StorageLayoutTest`) explicitly verify struct field values survive upgrades.
**Current status**: DataHavenServiceManager has no struct-typed storage variables, so this limitation does not apply.

View file

@ -15,7 +15,9 @@ contract MessageEncodingTest is Test {
address[] memory mockValidators = TestUtils.generateMockValidatorsAddresses(3);
DataHavenSnowbridgeMessages.NewValidatorSetPayload memory payload =
DataHavenSnowbridgeMessages.NewValidatorSetPayload({validators: mockValidators});
DataHavenSnowbridgeMessages.NewValidatorSetPayload({
validators: mockValidators, externalIndex: uint64(0)
});
bytes memory encodedMessage =
DataHavenSnowbridgeMessages.scaleEncodeNewValidatorSetMessagePayload(payload);

View file

@ -0,0 +1,158 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.27;
import {AVSDeployer} from "./utils/AVSDeployer.sol";
import {DataHavenServiceManager} from "../src/DataHavenServiceManager.sol";
import {
IAllocationManagerTypes
} from "eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol";
import {Test} from "forge-std/Test.sol";
contract OperatorAddressMappingsTest is AVSDeployer {
address public snowbridgeAgent = address(uint160(uint256(keccak256("snowbridgeAgent"))));
address internal operator1 = address(uint160(uint256(keccak256("operator1"))));
address internal operator2 = address(uint160(uint256(keccak256("operator2"))));
function setUp() public virtual {
_deployMockEigenLayerAndAVS();
// Configure the rewards initiator (not strictly needed for these tests,
// but keeps setup consistent with other suites).
vm.prank(avsOwner);
serviceManager.setRewardsInitiator(snowbridgeAgent);
}
function _registerOperator(
address ethOperator,
address solochainOperator
) internal {
vm.prank(avsOwner);
serviceManager.addValidatorToAllowlist(ethOperator);
vm.prank(ethOperator);
delegationManager.registerAsOperator(address(0), 0, "");
uint32[] memory operatorSetIds = new uint32[](1);
operatorSetIds[0] = serviceManager.VALIDATORS_SET_ID();
IAllocationManagerTypes.RegisterParams memory registerParams =
IAllocationManagerTypes.RegisterParams({
avs: address(serviceManager),
operatorSetIds: operatorSetIds,
data: abi.encodePacked(solochainOperator)
});
vm.prank(ethOperator);
allocationManager.registerForOperatorSets(ethOperator, registerParams);
}
function test_registerOperator_revertsIfSolochainAlreadyAssignedToDifferentOperator() public {
address sharedSolochain = address(0xBEEF);
_registerOperator(operator1, sharedSolochain);
// operator2 cannot claim the same solochain address
vm.prank(avsOwner);
serviceManager.addValidatorToAllowlist(operator2);
vm.prank(operator2);
delegationManager.registerAsOperator(address(0), 0, "");
uint32[] memory operatorSetIds = new uint32[](1);
operatorSetIds[0] = serviceManager.VALIDATORS_SET_ID();
IAllocationManagerTypes.RegisterParams memory registerParams =
IAllocationManagerTypes.RegisterParams({
avs: address(serviceManager),
operatorSetIds: operatorSetIds,
data: abi.encodePacked(sharedSolochain)
});
vm.prank(operator2);
vm.expectRevert(abi.encodeWithSignature("SolochainAddressAlreadyAssigned()"));
allocationManager.registerForOperatorSets(operator2, registerParams);
}
function test_updateSolochainAddressForValidator_revertsIfAlreadyAssignedToDifferentOperator()
public
{
address solo1 = address(0xBEEF);
address solo2 = address(0xCAFE);
_registerOperator(operator1, solo1);
_registerOperator(operator2, solo2);
// operator2 cannot update to operator1's solochain address
vm.prank(operator2);
vm.expectRevert(abi.encodeWithSignature("SolochainAddressAlreadyAssigned()"));
serviceManager.updateSolochainAddressForValidator(solo1);
}
function test_updateSolochainAddressForValidator_clearsOldReverseMapping() public {
address soloOld = address(0xBEEF);
address soloNew = address(0xCAFE);
_registerOperator(operator1, soloOld);
assertEq(
serviceManager.validatorEthAddressToSolochainAddress(operator1),
soloOld,
"forward mapping should be set"
);
assertEq(
serviceManager.validatorSolochainAddressToEthAddress(soloOld),
operator1,
"reverse mapping should be set"
);
vm.prank(operator1);
serviceManager.updateSolochainAddressForValidator(soloNew);
assertEq(
serviceManager.validatorEthAddressToSolochainAddress(operator1),
soloNew,
"forward mapping should update"
);
assertEq(
serviceManager.validatorSolochainAddressToEthAddress(soloNew),
operator1,
"reverse mapping should update"
);
assertEq(
serviceManager.validatorSolochainAddressToEthAddress(soloOld),
address(0),
"old reverse mapping should be cleared"
);
}
function test_registerOperator_replacesSolochainAndClearsOldReverseMapping() public {
address soloOld = address(0xBEEF);
address soloNew = address(0xCAFE);
_registerOperator(operator1, soloOld);
// simulate allocationManager registering operator1 again with a new solochain address
uint32[] memory operatorSetIds = new uint32[](1);
operatorSetIds[0] = serviceManager.VALIDATORS_SET_ID();
vm.prank(address(allocationManager));
serviceManager.registerOperator(
operator1, address(serviceManager), operatorSetIds, abi.encodePacked(soloNew)
);
assertEq(
serviceManager.validatorEthAddressToSolochainAddress(operator1),
soloNew,
"forward mapping should update"
);
assertEq(
serviceManager.validatorSolochainAddressToEthAddress(soloNew),
operator1,
"reverse mapping should update"
);
assertEq(
serviceManager.validatorSolochainAddressToEthAddress(soloOld),
address(0),
"old reverse mapping should be cleared"
);
}
}

View file

@ -6,8 +6,13 @@ pragma solidity ^0.8.13;
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {
IRewardsCoordinator,
IRewardsCoordinatorTypes
} from "eigenlayer-contracts/src/contracts/interfaces/IRewardsCoordinator.sol";
import {
IAllocationManagerTypes
} from "eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol";
import {OperatorSet} from "eigenlayer-contracts/src/contracts/libraries/OperatorSetLib.sol";
import {AVSDeployer} from "./utils/AVSDeployer.sol";
import {ERC20FixedSupply} from "./utils/ERC20FixedSupply.sol";
@ -41,6 +46,30 @@ contract RewardsSubmitterTest is AVSDeployer {
IERC20(address(rewardToken)).safeTransfer(address(serviceManager), 100000e18);
}
function _registerOperator(
address ethOperator,
address solochainOperator
) internal {
// Allow our operator to register
vm.prank(avsOwner);
serviceManager.addValidatorToAllowlist(ethOperator);
vm.prank(ethOperator);
delegationManager.registerAsOperator(address(0), 0, "");
uint32[] memory operatorSetIds = new uint32[](1);
operatorSetIds[0] = serviceManager.VALIDATORS_SET_ID();
IAllocationManagerTypes.RegisterParams memory registerParams =
IAllocationManagerTypes.RegisterParams({
avs: address(serviceManager),
operatorSetIds: operatorSetIds,
data: abi.encodePacked(solochainOperator)
});
vm.prank(ethOperator);
allocationManager.registerForOperatorSets(ethOperator, registerParams);
}
// Helper function to build a submission
function _buildSubmission(
uint256 rewardAmount,
@ -91,6 +120,7 @@ contract RewardsSubmitterTest is AVSDeployer {
// ============ Access Control Tests ============
function test_submitRewards_revertsIfNotRewardsInitiator() public {
_registerOperator(operator1, operator1);
IRewardsCoordinatorTypes.OperatorDirectedRewardsSubmission memory submission =
_buildSubmission(1000e18, operator1);
@ -102,6 +132,7 @@ contract RewardsSubmitterTest is AVSDeployer {
// ============ Success Tests ============
function test_submitRewards_singleOperator() public {
_registerOperator(operator1, operator1);
uint256 rewardAmount = 1000e18;
IRewardsCoordinatorTypes.OperatorDirectedRewardsSubmission memory submission =
_buildSubmission(rewardAmount, operator1);
@ -116,6 +147,9 @@ contract RewardsSubmitterTest is AVSDeployer {
}
function test_submitRewards_multipleOperators() public {
_registerOperator(operator1, operator1);
_registerOperator(operator2, operator2);
// Build strategies
IRewardsCoordinatorTypes.StrategyAndMultiplier[] memory strategiesAndMultipliers =
new IRewardsCoordinatorTypes.StrategyAndMultiplier[](deployedStrategies.length);
@ -126,8 +160,8 @@ contract RewardsSubmitterTest is AVSDeployer {
}
// Ensure operators are sorted in ascending order (required by EigenLayer)
address opLow = address(0x1);
address opHigh = address(0x2);
(address opLow, address opHigh) =
operator1 < operator2 ? (operator1, operator2) : (operator2, operator1);
uint256 amount1 = 600e18;
uint256 amount2 = 400e18;
@ -160,6 +194,7 @@ contract RewardsSubmitterTest is AVSDeployer {
}
function test_submitRewards_multipleSubmissions() public {
_registerOperator(operator1, operator1);
uint32 duration = TEST_CALCULATION_INTERVAL;
// Submit for period 0
@ -188,6 +223,7 @@ contract RewardsSubmitterTest is AVSDeployer {
}
function test_submitRewards_withCustomDescription() public {
_registerOperator(operator1, operator1);
// Build submission with custom description
IRewardsCoordinatorTypes.StrategyAndMultiplier[] memory strategiesAndMultipliers =
new IRewardsCoordinatorTypes.StrategyAndMultiplier[](1);
@ -217,6 +253,7 @@ contract RewardsSubmitterTest is AVSDeployer {
}
function test_submitRewards_withDifferentToken() public {
_registerOperator(operator1, operator1);
// Deploy a different token
ERC20FixedSupply otherToken =
new ERC20FixedSupply("Other", "OTHER", 1000000e18, address(this));
@ -251,4 +288,153 @@ contract RewardsSubmitterTest is AVSDeployer {
emit IDataHavenServiceManagerEvents.RewardsSubmitted(500e18, 1);
serviceManager.submitRewards(submission);
}
function test_submitRewards_translatesSolochainOperatorToEthOperator() public {
address solochainOperator = address(0xBEEF);
_registerOperator(operator1, solochainOperator);
assertEq(
serviceManager.validatorEthAddressToSolochainAddress(operator1),
solochainOperator,
"forward mapping should be set"
);
assertEq(
serviceManager.validatorSolochainAddressToEthAddress(solochainOperator),
operator1,
"reverse mapping should be set"
);
uint256 rewardAmount = 1000e18;
IRewardsCoordinatorTypes.OperatorDirectedRewardsSubmission memory submission =
_buildSubmission(rewardAmount, solochainOperator);
// Warp to a time after the period ends
vm.warp(submission.startTimestamp + submission.duration + 1);
IRewardsCoordinatorTypes.OperatorReward[] memory expectedOperatorRewards =
new IRewardsCoordinatorTypes.OperatorReward[](1);
expectedOperatorRewards[0] =
IRewardsCoordinatorTypes.OperatorReward({operator: operator1, amount: rewardAmount});
IRewardsCoordinatorTypes.OperatorDirectedRewardsSubmission memory expectedSubmission =
IRewardsCoordinatorTypes.OperatorDirectedRewardsSubmission({
strategiesAndMultipliers: submission.strategiesAndMultipliers,
token: submission.token,
operatorRewards: expectedOperatorRewards,
startTimestamp: submission.startTimestamp,
duration: submission.duration,
description: submission.description
});
IRewardsCoordinatorTypes.OperatorDirectedRewardsSubmission[] memory submissions =
new IRewardsCoordinatorTypes.OperatorDirectedRewardsSubmission[](1);
submissions[0] = expectedSubmission;
OperatorSet memory operatorSet =
OperatorSet({avs: address(serviceManager), id: serviceManager.VALIDATORS_SET_ID()});
vm.expectCall(
address(rewardsCoordinator),
abi.encodeCall(
IRewardsCoordinator.createOperatorDirectedOperatorSetRewardsSubmission,
(operatorSet, submissions)
)
);
assertEq(
submission.operatorRewards[0].operator,
solochainOperator,
"submission should use solochain operator"
);
vm.prank(snowbridgeAgent);
serviceManager.submitRewards(submission);
}
function test_submitRewards_revertsIfUnknownSolochainAddress() public {
address unknownSolochainOperator = address(0xDEAD);
IRewardsCoordinatorTypes.OperatorDirectedRewardsSubmission memory submission =
_buildSubmission(1000e18, unknownSolochainOperator);
vm.prank(snowbridgeAgent);
vm.expectRevert(abi.encodeWithSignature("UnknownSolochainAddress()"));
serviceManager.submitRewards(submission);
}
function test_submitRewards_sortsTranslatedOperatorsByAddress() public {
(address ethLow, address ethHigh) =
operator1 < operator2 ? (operator1, operator2) : (operator2, operator1);
address solochainLow = address(0x1000);
address solochainHigh = address(0x2000);
_registerOperator(ethLow, solochainHigh);
_registerOperator(ethHigh, solochainLow);
IRewardsCoordinatorTypes.StrategyAndMultiplier[] memory strategiesAndMultipliers =
new IRewardsCoordinatorTypes.StrategyAndMultiplier[](deployedStrategies.length);
for (uint256 i = 0; i < deployedStrategies.length; i++) {
strategiesAndMultipliers[i] = IRewardsCoordinatorTypes.StrategyAndMultiplier({
strategy: deployedStrategies[i], multiplier: uint96((i + 1) * 1e18)
});
}
uint256 amountForEthLow = 600e18;
uint256 amountForEthHigh = 400e18;
uint256 totalAmount = amountForEthLow + amountForEthHigh;
IRewardsCoordinatorTypes.OperatorReward[] memory inputOperatorRewards =
new IRewardsCoordinatorTypes.OperatorReward[](2);
inputOperatorRewards[0] = IRewardsCoordinatorTypes.OperatorReward({
operator: solochainLow, amount: amountForEthHigh
});
inputOperatorRewards[1] = IRewardsCoordinatorTypes.OperatorReward({
operator: solochainHigh, amount: amountForEthLow
});
IRewardsCoordinatorTypes.OperatorDirectedRewardsSubmission memory submission =
IRewardsCoordinatorTypes.OperatorDirectedRewardsSubmission({
strategiesAndMultipliers: strategiesAndMultipliers,
token: IERC20(address(rewardToken)),
operatorRewards: inputOperatorRewards,
startTimestamp: GENESIS_REWARDS_TIMESTAMP,
duration: TEST_CALCULATION_INTERVAL,
description: "DataHaven rewards"
});
vm.warp(submission.startTimestamp + submission.duration + 1);
IRewardsCoordinatorTypes.OperatorReward[] memory expectedOperatorRewards =
new IRewardsCoordinatorTypes.OperatorReward[](2);
expectedOperatorRewards[0] =
IRewardsCoordinatorTypes.OperatorReward({operator: ethLow, amount: amountForEthLow});
expectedOperatorRewards[1] =
IRewardsCoordinatorTypes.OperatorReward({operator: ethHigh, amount: amountForEthHigh});
IRewardsCoordinatorTypes.OperatorDirectedRewardsSubmission memory expectedSubmission =
IRewardsCoordinatorTypes.OperatorDirectedRewardsSubmission({
strategiesAndMultipliers: strategiesAndMultipliers,
token: submission.token,
operatorRewards: expectedOperatorRewards,
startTimestamp: submission.startTimestamp,
duration: submission.duration,
description: submission.description
});
IRewardsCoordinatorTypes.OperatorDirectedRewardsSubmission[] memory submissions =
new IRewardsCoordinatorTypes.OperatorDirectedRewardsSubmission[](1);
submissions[0] = expectedSubmission;
OperatorSet memory operatorSet =
OperatorSet({avs: address(serviceManager), id: serviceManager.VALIDATORS_SET_ID()});
vm.expectCall(
address(rewardsCoordinator),
abi.encodeCall(
IRewardsCoordinator.createOperatorDirectedOperatorSetRewardsSubmission,
(operatorSet, submissions)
)
);
vm.prank(snowbridgeAgent);
vm.expectEmit(false, false, false, true);
emit IDataHavenServiceManagerEvents.RewardsSubmitted(totalAmount, 2);
serviceManager.submitRewards(submission);
}
}

View file

@ -26,6 +26,8 @@ contract SlashingTest is AVSDeployer {
}
function test_fulfilSlashingRequest() public {
address solochainOperator = address(0xBEEF);
// Allow our operator to register
vm.prank(avsOwner);
serviceManager.addValidatorToAllowlist(operator);
@ -43,7 +45,7 @@ contract SlashingTest is AVSDeployer {
IAllocationManagerTypes.RegisterParams({
avs: address(serviceManager),
operatorSetIds: operatorSetIds,
data: abi.encodePacked(address(operator))
data: abi.encodePacked(solochainOperator)
});
vm.prank(operator);
@ -61,7 +63,7 @@ contract SlashingTest is AVSDeployer {
IStrategy[] memory strategies = allocationManager.getStrategiesInOperatorSet(operatorSet);
slashings[0] = IDataHavenServiceManager.SlashingRequest(
operator, strategies, wadsToSlash, "Testing slashing"
solochainOperator, strategies, wadsToSlash, "Testing slashing"
);
console.log(block.number);
@ -83,6 +85,8 @@ contract SlashingTest is AVSDeployer {
}
function test_fulfilSlashingRequestForOnlyOneStrategy() public {
address solochainOperator = address(0xBEEF);
// Allow our operator to register
vm.prank(avsOwner);
serviceManager.addValidatorToAllowlist(operator);
@ -100,7 +104,7 @@ contract SlashingTest is AVSDeployer {
IAllocationManagerTypes.RegisterParams({
avs: address(serviceManager),
operatorSetIds: operatorSetIds,
data: abi.encodePacked(address(operator))
data: abi.encodePacked(solochainOperator)
});
vm.prank(operator);
@ -119,7 +123,7 @@ contract SlashingTest is AVSDeployer {
strategiesToSlash[0] = strategies[0];
slashings[0] = IDataHavenServiceManager.SlashingRequest(
operator, strategiesToSlash, wadsToSlash, "Testing slashing"
solochainOperator, strategiesToSlash, wadsToSlash, "Testing slashing"
);
console.log(block.number);
@ -139,4 +143,24 @@ contract SlashingTest is AVSDeployer {
emit IDataHavenServiceManagerEvents.SlashingComplete();
serviceManager.slashValidatorsOperator(slashings);
}
function test_fulfilSlashingRequest_revertsIfUnknownSolochainAddress() public {
// Configure the rewards initiator (because only the reward agent can submit slashing request)
vm.prank(avsOwner);
serviceManager.setRewardsInitiator(snowbridgeAgent);
address unknownSolochainOperator = address(0xDEAD);
DataHavenServiceManager.SlashingRequest[] memory slashings =
new DataHavenServiceManager.SlashingRequest[](1);
slashings[0] = IDataHavenServiceManager.SlashingRequest(
unknownSolochainOperator,
new IStrategy[](0),
new uint256[](0),
"Testing unknown solochain operator"
);
vm.prank(snowbridgeAgent);
vm.expectRevert(abi.encodeWithSignature("UnknownSolochainAddress()"));
serviceManager.slashValidatorsOperator(slashings);
}
}

View file

@ -10,8 +10,13 @@ import {OperatorSet} from "eigenlayer-contracts/src/contracts/libraries/Operator
import {SnowbridgeAndAVSDeployer} from "./utils/SnowbridgeAndAVSDeployer.sol";
contract SnowbridgeIntegrationTest is SnowbridgeAndAVSDeployer {
address public submitter = address(uint160(uint256(keccak256("submitter"))));
function setUp() public {
_deployMockAllContracts();
// Set up the validator set submitter
vm.prank(avsOwner);
serviceManager.setValidatorSetSubmitter(submitter);
}
function beforeTestSetup(
@ -19,7 +24,8 @@ contract SnowbridgeIntegrationTest is SnowbridgeAndAVSDeployer {
) public pure returns (bytes[] memory beforeTestCalldata) {
if (testSelector == this.test_sendNewValidatorsSetMessage.selector) {
beforeTestCalldata = new bytes[](1);
beforeTestCalldata[0] = abi.encodeWithSelector(this.setupValidatorsAsOperators.selector);
beforeTestCalldata[0] =
abi.encodeWithSelector(this.setupValidatorsAsOperatorsWithAllocations.selector);
}
}
@ -36,11 +42,13 @@ contract SnowbridgeIntegrationTest is SnowbridgeAndAVSDeployer {
);
}
// Mock balance for the AVS owner
vm.deal(avsOwner, 1000000 ether);
uint64 targetEra = 42;
// Mock balance for the submitter
vm.deal(submitter, 1000000 ether);
// Send the new validator set message to the Snowbridge Gateway
bytes memory message = serviceManager.buildNewValidatorSetMessage();
bytes memory message = serviceManager.buildNewValidatorSetMessageForEra(targetEra);
Payload memory payload = Payload({
origin: address(serviceManager),
assets: new Asset[](0),
@ -52,7 +60,7 @@ contract SnowbridgeIntegrationTest is SnowbridgeAndAVSDeployer {
});
cheats.expectEmit();
emit IGatewayV2.OutboundMessageAccepted(1, payload);
cheats.prank(avsOwner);
serviceManager.sendNewValidatorSet{value: 2 ether}(1 ether, 1 ether);
cheats.prank(submitter);
serviceManager.sendNewValidatorSetForEra{value: 2 ether}(targetEra, 1 ether, 1 ether);
}
}

View file

@ -0,0 +1,568 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.27;
/* solhint-disable func-name-mixedcase */
import {SnowbridgeAndAVSDeployer} from "./utils/SnowbridgeAndAVSDeployer.sol";
import {DataHavenSnowbridgeMessages} from "../src/libraries/DataHavenSnowbridgeMessages.sol";
import {IDataHavenServiceManagerErrors} from "../src/interfaces/IDataHavenServiceManager.sol";
import {IStrategy} from "eigenlayer-contracts/src/contracts/interfaces/IStrategy.sol";
import {
IRewardsCoordinatorTypes
} from "eigenlayer-contracts/src/contracts/interfaces/IRewardsCoordinator.sol";
import {
IAllocationManagerTypes
} from "eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol";
import {OperatorSet} from "eigenlayer-contracts/src/contracts/libraries/OperatorSetLib.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
contract ValidatorSetSelectionTest is SnowbridgeAndAVSDeployer {
function setUp() public {
_deployMockAllContracts();
}
// ============ Helpers ============
function _getStrategies() internal view returns (IStrategy[] memory) {
IStrategy[] memory strategies = new IStrategy[](deployedStrategies.length);
for (uint256 i = 0; i < deployedStrategies.length; i++) {
strategies[i] = deployedStrategies[i];
}
return strategies;
}
function _setupMultipliers(
uint96[] memory multipliers
) internal {
IStrategy[] memory strategies = _getStrategies();
IRewardsCoordinatorTypes.StrategyAndMultiplier[] memory sm =
new IRewardsCoordinatorTypes.StrategyAndMultiplier[](strategies.length);
for (uint256 i = 0; i < strategies.length; i++) {
sm[i] = IRewardsCoordinatorTypes.StrategyAndMultiplier({
strategy: strategies[i], multiplier: multipliers[i]
});
}
cheats.startPrank(avsOwner);
serviceManager.removeStrategiesFromValidatorsSupportedStrategies(strategies);
serviceManager.addStrategiesToValidatorsSupportedStrategies(sm);
cheats.stopPrank();
}
function _uniformMultipliers() internal pure returns (uint96[] memory) {
uint96[] memory m = new uint96[](3);
m[0] = 1;
m[1] = 1;
m[2] = 1;
return m;
}
function _registerOperator(
address op,
address solochainAddr,
uint256[] memory stakeAmounts
) internal {
cheats.prank(avsOwner);
serviceManager.addValidatorToAllowlist(op);
cheats.startPrank(op);
for (uint256 j = 0; j < deployedStrategies.length; j++) {
IERC20 linkedToken = deployedStrategies[j].underlyingToken();
_setERC20Balance(address(linkedToken), op, stakeAmounts[j]);
linkedToken.approve(address(strategyManager), stakeAmounts[j]);
strategyManager.depositIntoStrategy(deployedStrategies[j], linkedToken, stakeAmounts[j]);
}
delegationManager.registerAsOperator(address(0), 0, "");
uint32[] memory operatorSetIds = new uint32[](1);
operatorSetIds[0] = serviceManager.VALIDATORS_SET_ID();
IAllocationManagerTypes.RegisterParams memory registerParams =
IAllocationManagerTypes.RegisterParams({
avs: address(serviceManager),
operatorSetIds: operatorSetIds,
data: abi.encodePacked(solochainAddr)
});
allocationManager.registerForOperatorSets(op, registerParams);
cheats.stopPrank();
}
function _uniformStakes(
uint256 amount
) internal view returns (uint256[] memory) {
uint256[] memory stakes = new uint256[](deployedStrategies.length);
for (uint256 j = 0; j < stakes.length; j++) {
stakes[j] = amount;
}
return stakes;
}
function _allocateForOperator(
address op
) internal {
IStrategy[] memory strategies = _getStrategies();
uint64[] memory newMagnitudes = new uint64[](strategies.length);
for (uint256 j = 0; j < strategies.length; j++) {
newMagnitudes[j] = 1e18;
}
IAllocationManagerTypes.AllocateParams[] memory allocParams =
new IAllocationManagerTypes.AllocateParams[](1);
allocParams[0] = IAllocationManagerTypes.AllocateParams({
operatorSet: OperatorSet({
avs: address(serviceManager), id: serviceManager.VALIDATORS_SET_ID()
}),
strategies: strategies,
newMagnitudes: newMagnitudes
});
cheats.prank(op);
allocationManager.modifyAllocations(op, allocParams);
}
function _advancePastAllocationConfigDelay() internal {
uint32 delay = allocationManager.ALLOCATION_CONFIGURATION_DELAY();
cheats.roll(block.number + delay + 1);
}
function _advancePastAllocationEffect() internal {
cheats.roll(block.number + 1);
}
function _buildExpectedMessage(
address[] memory validators,
uint64 externalIndex
) internal pure returns (bytes memory) {
return DataHavenSnowbridgeMessages.scaleEncodeNewValidatorSetMessagePayload(
DataHavenSnowbridgeMessages.NewValidatorSetPayload({
validators: validators, externalIndex: externalIndex
})
);
}
// ============ Admin Function Tests ============
// Test #7: Add strategy + multiplier in one call; verify both stored
function test_addStrategies_setsMultiplierAtomically() public {
IStrategy[] memory strategies = _getStrategies();
IRewardsCoordinatorTypes.StrategyAndMultiplier[] memory sm =
new IRewardsCoordinatorTypes.StrategyAndMultiplier[](3);
sm[0] = IRewardsCoordinatorTypes.StrategyAndMultiplier({
strategy: strategies[0], multiplier: 5000
});
sm[1] = IRewardsCoordinatorTypes.StrategyAndMultiplier({
strategy: strategies[1], multiplier: 10000
});
sm[2] = IRewardsCoordinatorTypes.StrategyAndMultiplier({
strategy: strategies[2], multiplier: 2000
});
cheats.startPrank(avsOwner);
serviceManager.removeStrategiesFromValidatorsSupportedStrategies(strategies);
serviceManager.addStrategiesToValidatorsSupportedStrategies(sm);
cheats.stopPrank();
assertEq(serviceManager.strategiesAndMultipliers(strategies[0]), 5000);
assertEq(serviceManager.strategiesAndMultipliers(strategies[1]), 10000);
assertEq(serviceManager.strategiesAndMultipliers(strategies[2]), 2000);
}
// Test #9: Remove strategy multiplier and tracking bool deleted
function test_removeStrategies_cleansUpMultiplier() public {
IStrategy[] memory strategies = _getStrategies();
IRewardsCoordinatorTypes.StrategyAndMultiplier[] memory sm =
new IRewardsCoordinatorTypes.StrategyAndMultiplier[](3);
sm[0] = IRewardsCoordinatorTypes.StrategyAndMultiplier({
strategy: strategies[0], multiplier: 5000
});
sm[1] = IRewardsCoordinatorTypes.StrategyAndMultiplier({
strategy: strategies[1], multiplier: 10000
});
sm[2] = IRewardsCoordinatorTypes.StrategyAndMultiplier({
strategy: strategies[2], multiplier: 2000
});
cheats.startPrank(avsOwner);
serviceManager.removeStrategiesFromValidatorsSupportedStrategies(strategies);
serviceManager.addStrategiesToValidatorsSupportedStrategies(sm);
assertEq(serviceManager.strategiesAndMultipliers(strategies[1]), 10000);
serviceManager.removeStrategiesFromValidatorsSupportedStrategies(strategies);
cheats.stopPrank();
assertEq(serviceManager.strategiesAndMultipliers(strategies[0]), 0);
assertEq(serviceManager.strategiesAndMultipliers(strategies[1]), 0);
assertEq(serviceManager.strategiesAndMultipliers(strategies[2]), 0);
}
// Test #11: Returns correct StrategyAndMultiplier structs
function test_getStrategiesAndMultipliers_returnsCorrect() public {
IStrategy[] memory strategies = _getStrategies();
IRewardsCoordinatorTypes.StrategyAndMultiplier[] memory sm =
new IRewardsCoordinatorTypes.StrategyAndMultiplier[](3);
sm[0] = IRewardsCoordinatorTypes.StrategyAndMultiplier({
strategy: strategies[0], multiplier: 5000
});
sm[1] = IRewardsCoordinatorTypes.StrategyAndMultiplier({
strategy: strategies[1], multiplier: 10000
});
sm[2] = IRewardsCoordinatorTypes.StrategyAndMultiplier({
strategy: strategies[2], multiplier: 2000
});
cheats.startPrank(avsOwner);
serviceManager.removeStrategiesFromValidatorsSupportedStrategies(strategies);
serviceManager.addStrategiesToValidatorsSupportedStrategies(sm);
cheats.stopPrank();
IRewardsCoordinatorTypes.StrategyAndMultiplier[] memory result =
serviceManager.getStrategiesAndMultipliers();
assertEq(result.length, 3);
for (uint256 i = 0; i < result.length; i++) {
uint96 expectedMultiplier = serviceManager.strategiesAndMultipliers(result[i].strategy);
assertEq(result[i].multiplier, expectedMultiplier);
}
}
// Test: setStrategiesAndMultipliers updates existing multipliers
function test_setStrategiesAndMultipliers_updatesMultipliers() public {
IStrategy[] memory strategies = _getStrategies();
// Set initial multipliers via _setupMultipliers
uint96[] memory initial = new uint96[](3);
initial[0] = 5000;
initial[1] = 10000;
initial[2] = 2000;
_setupMultipliers(initial);
// Update multipliers
IRewardsCoordinatorTypes.StrategyAndMultiplier[] memory updated =
new IRewardsCoordinatorTypes.StrategyAndMultiplier[](3);
updated[0] = IRewardsCoordinatorTypes.StrategyAndMultiplier({
strategy: strategies[0], multiplier: 1
});
updated[1] = IRewardsCoordinatorTypes.StrategyAndMultiplier({
strategy: strategies[1], multiplier: 1
});
updated[2] = IRewardsCoordinatorTypes.StrategyAndMultiplier({
strategy: strategies[2], multiplier: 9999
});
cheats.prank(avsOwner);
serviceManager.setStrategiesAndMultipliers(updated);
assertEq(serviceManager.strategiesAndMultipliers(strategies[0]), 1);
assertEq(serviceManager.strategiesAndMultipliers(strategies[1]), 1);
assertEq(serviceManager.strategiesAndMultipliers(strategies[2]), 9999);
}
// Test: setStrategiesAndMultipliers changes validator ranking
function test_setStrategiesAndMultipliers_affectsRanking() public {
uint96[] memory mults = new uint96[](3);
mults[0] = 10000;
mults[1] = 1;
mults[2] = 1;
_setupMultipliers(mults);
// Op A: heavy in strategy 0 (high multiplier) initially ranked first
address opA = vm.addr(801);
address solochainA = address(uint160(0x6001));
uint256[] memory stakesA = new uint256[](3);
stakesA[0] = 1000 ether;
stakesA[1] = 10 ether;
stakesA[2] = 10 ether;
_registerOperator(opA, solochainA, stakesA);
// Op B: heavy in strategy 1 (low multiplier) initially ranked second
address opB = vm.addr(802);
address solochainB = address(uint160(0x6002));
uint256[] memory stakesB = new uint256[](3);
stakesB[0] = 10 ether;
stakesB[1] = 1000 ether;
stakesB[2] = 10 ether;
_registerOperator(opB, solochainB, stakesB);
_advancePastAllocationConfigDelay();
_allocateForOperator(opA);
_allocateForOperator(opB);
_advancePastAllocationEffect();
// Before update: A ranks first (strategy 0 has multiplier 10_000)
address[] memory expectedBefore = new address[](2);
expectedBefore[0] = solochainA;
expectedBefore[1] = solochainB;
assertEq(
serviceManager.buildNewValidatorSetMessageForEra(0),
_buildExpectedMessage(expectedBefore, 0)
);
// Flip multipliers: strategy 1 now has high multiplier
IStrategy[] memory strategies = _getStrategies();
IRewardsCoordinatorTypes.StrategyAndMultiplier[] memory flipped =
new IRewardsCoordinatorTypes.StrategyAndMultiplier[](3);
flipped[0] = IRewardsCoordinatorTypes.StrategyAndMultiplier({
strategy: strategies[0], multiplier: 1
});
flipped[1] = IRewardsCoordinatorTypes.StrategyAndMultiplier({
strategy: strategies[1], multiplier: 10000
});
flipped[2] = IRewardsCoordinatorTypes.StrategyAndMultiplier({
strategy: strategies[2], multiplier: 1
});
cheats.prank(avsOwner);
serviceManager.setStrategiesAndMultipliers(flipped);
// After update: B ranks first (strategy 1 now has multiplier 10_000)
address[] memory expectedAfter = new address[](2);
expectedAfter[0] = solochainB;
expectedAfter[1] = solochainA;
assertEq(
serviceManager.buildNewValidatorSetMessageForEra(0),
_buildExpectedMessage(expectedAfter, 0)
);
}
// ============ Selection Tests ============
// Test #1: 3 strategies with different multipliers; verify correct ordering
function test_weightedStake_multipleStrategies() public {
uint96[] memory mults = new uint96[](3);
mults[0] = 5000;
mults[1] = 10000;
mults[2] = 2000;
_setupMultipliers(mults);
// Op A: heavy in strategy 0 (multiplier 5000)
address opA = vm.addr(101);
address solochainA = address(uint160(0xA01));
uint256[] memory stakesA = new uint256[](3);
stakesA[0] = 1000 ether;
stakesA[1] = 100 ether;
stakesA[2] = 100 ether;
_registerOperator(opA, solochainA, stakesA);
// Op B: heavy in strategy 1 (multiplier 10000) highest weighted stake
address opB = vm.addr(102);
address solochainB = address(uint160(0xB01));
uint256[] memory stakesB = new uint256[](3);
stakesB[0] = 100 ether;
stakesB[1] = 1000 ether;
stakesB[2] = 100 ether;
_registerOperator(opB, solochainB, stakesB);
// Op C: heavy in strategy 2 (multiplier 2000) lowest weighted stake
address opC = vm.addr(103);
address solochainC = address(uint160(0xC01));
uint256[] memory stakesC = new uint256[](3);
stakesC[0] = 100 ether;
stakesC[1] = 100 ether;
stakesC[2] = 1000 ether;
_registerOperator(opC, solochainC, stakesC);
_advancePastAllocationConfigDelay();
_allocateForOperator(opA);
_allocateForOperator(opB);
_allocateForOperator(opC);
_advancePastAllocationEffect();
// Expected order: B (highest multiplied strategy), A, C
address[] memory expected = new address[](3);
expected[0] = solochainB;
expected[1] = solochainA;
expected[2] = solochainC;
assertEq(
serviceManager.buildNewValidatorSetMessageForEra(0), _buildExpectedMessage(expected, 0)
);
}
// Test #2: 2 operators with identical weighted stake; lower Eth address ranks first
function test_tieBreak_lowerAddressWins() public {
_setupMultipliers(_uniformMultipliers());
address addrA = vm.addr(201);
address addrB = vm.addr(202);
// Ensure addrLow < addrHigh
address addrLow = addrA < addrB ? addrA : addrB;
address addrHigh = addrA < addrB ? addrB : addrA;
address solochainLow = address(uint160(0xBB));
address solochainHigh = address(uint160(0xAA));
_registerOperator(addrLow, solochainLow, _uniformStakes(500 ether));
_registerOperator(addrHigh, solochainHigh, _uniformStakes(500 ether));
_advancePastAllocationConfigDelay();
_allocateForOperator(addrLow);
_allocateForOperator(addrHigh);
_advancePastAllocationEffect();
// Lower Eth address wins tie-break
address[] memory expected = new address[](2);
expected[0] = solochainLow;
expected[1] = solochainHigh;
assertEq(
serviceManager.buildNewValidatorSetMessageForEra(0), _buildExpectedMessage(expected, 0)
);
}
// Test #3: Register 35 operators; verify only top 32 selected
function test_topN_moreThan32() public {
_setupMultipliers(_uniformMultipliers());
uint256 totalOps = 35;
address[] memory operators = new address[](totalOps);
address[] memory solochainAddrs = new address[](totalOps);
for (uint256 i = 0; i < totalOps; i++) {
operators[i] = vm.addr(300 + i);
solochainAddrs[i] = address(uint160(0x1000 + i));
_registerOperator(operators[i], solochainAddrs[i], _uniformStakes((i + 1) * 10 ether));
}
_advancePastAllocationConfigDelay();
for (uint256 i = 0; i < totalOps; i++) {
_allocateForOperator(operators[i]);
}
_advancePastAllocationEffect();
bytes memory message = serviceManager.buildNewValidatorSetMessageForEra(0);
// Top 32 by descending stake: operators at indices 34, 33, ..., 3
address[] memory expected = new address[](32);
for (uint256 i = 0; i < 32; i++) {
expected[i] = solochainAddrs[totalOps - 1 - i];
}
assertEq(message, _buildExpectedMessage(expected, 0));
}
// Test #4: 5 operators; all included in output
function test_lessThan32_includesAll() public {
_setupMultipliers(_uniformMultipliers());
uint256 totalOps = 5;
address[] memory operators = new address[](totalOps);
address[] memory solochainAddrs = new address[](totalOps);
for (uint256 i = 0; i < totalOps; i++) {
operators[i] = vm.addr(400 + i);
solochainAddrs[i] = address(uint160(0x2000 + i));
_registerOperator(operators[i], solochainAddrs[i], _uniformStakes((i + 1) * 100 ether));
}
_advancePastAllocationConfigDelay();
for (uint256 i = 0; i < totalOps; i++) {
_allocateForOperator(operators[i]);
}
_advancePastAllocationEffect();
// All 5 included, sorted by descending stake
address[] memory expected = new address[](5);
for (uint256 i = 0; i < 5; i++) {
expected[i] = solochainAddrs[totalOps - 1 - i];
}
assertEq(
serviceManager.buildNewValidatorSetMessageForEra(0), _buildExpectedMessage(expected, 0)
);
}
// Test #5: Operator with zero allocation excluded
function test_zeroWeightedStake_filtered() public {
_setupMultipliers(_uniformMultipliers());
address op1 = vm.addr(501);
address solochain1 = address(uint160(0x3001));
_registerOperator(op1, solochain1, _uniformStakes(100 ether));
address op2 = vm.addr(502);
address solochain2 = address(uint160(0x3002));
_registerOperator(op2, solochain2, _uniformStakes(200 ether));
// op3 registered but NOT allocated zero weighted stake
address op3 = vm.addr(503);
address solochain3 = address(uint160(0x3003));
_registerOperator(op3, solochain3, _uniformStakes(300 ether));
_advancePastAllocationConfigDelay();
// Only allocate for op1 and op2
_allocateForOperator(op1);
_allocateForOperator(op2);
_advancePastAllocationEffect();
// op3 should be filtered out
address[] memory expected = new address[](2);
expected[0] = solochain2;
expected[1] = solochain1;
assertEq(
serviceManager.buildNewValidatorSetMessageForEra(0), _buildExpectedMessage(expected, 0)
);
}
// Test #6: A zero multiplier is accepted and causes that strategy's stake to contribute
// no weight. The operator is still included if other strategies have non-zero multipliers.
function test_zeroMultiplier_accepted_contributesNoWeight() public {
IStrategy[] memory strategies = _getStrategies();
// Zero-out the first strategy's multiplier via setStrategiesAndMultipliers
IRewardsCoordinatorTypes.StrategyAndMultiplier[] memory sm =
new IRewardsCoordinatorTypes.StrategyAndMultiplier[](1);
sm[0] = IRewardsCoordinatorTypes.StrategyAndMultiplier({
strategy: strategies[0], multiplier: 0
});
cheats.prank(avsOwner);
serviceManager.setStrategiesAndMultipliers(sm);
assertEq(serviceManager.strategiesAndMultipliers(strategies[0]), 0);
}
// Test #12: Full integration weighted selection + correct message encoding
function test_buildMessage_encodesCorrectly() public {
_setupMultipliers(_uniformMultipliers());
address op1 = vm.addr(701);
address solochain1 = address(uint160(0x5001));
_registerOperator(op1, solochain1, _uniformStakes(500 ether));
address op2 = vm.addr(702);
address solochain2 = address(uint160(0x5002));
_registerOperator(op2, solochain2, _uniformStakes(1000 ether));
_advancePastAllocationConfigDelay();
_allocateForOperator(op1);
_allocateForOperator(op2);
_advancePastAllocationEffect();
bytes memory message = serviceManager.buildNewValidatorSetMessageForEra(0);
// op2 has higher stake first
address[] memory expected = new address[](2);
expected[0] = solochain2;
expected[1] = solochain1;
assertEq(message, _buildExpectedMessage(expected, 0));
}
}

View file

@ -0,0 +1,287 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;
/* solhint-disable func-name-mixedcase */
import {SnowbridgeAndAVSDeployer} from "./utils/SnowbridgeAndAVSDeployer.sol";
import {
IDataHavenServiceManagerErrors,
IDataHavenServiceManagerEvents
} from "../src/interfaces/IDataHavenServiceManager.sol";
import {DataHavenServiceManager} from "../src/DataHavenServiceManager.sol";
import {
TransparentUpgradeableProxy
} from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";
import {
IRewardsCoordinatorTypes
} from "eigenlayer-contracts/src/contracts/interfaces/IRewardsCoordinator.sol";
contract ValidatorSetSubmitterTest is SnowbridgeAndAVSDeployer {
address public submitterA = address(uint160(uint256(keccak256("submitterA"))));
address public submitterB = address(uint160(uint256(keccak256("submitterB"))));
address public nonOwner = address(uint160(uint256(keccak256("nonOwner"))));
function setUp() public {
_deployMockAllContracts();
}
function beforeTestSetup(
bytes4 testSelector
) public pure returns (bytes[] memory beforeTestCalldata) {
if (
testSelector == this.test_sendNewValidatorSetForEra_success.selector
|| testSelector
== this.test_buildNewValidatorSetMessageForEra_encodesTargetEra.selector
|| testSelector == this.test_fuzz_sendNewValidatorSetForEra.selector
|| testSelector
== this.test_buildNewValidatorSetMessageForEra_exactEncoding.selector
) {
beforeTestCalldata = new bytes[](1);
beforeTestCalldata[0] =
abi.encodeWithSelector(this.setupValidatorsAsOperatorsWithAllocations.selector);
}
}
// ============ setValidatorSetSubmitter ============
function test_setValidatorSetSubmitter() public {
// After initialization, validatorSetSubmitter is already set to avsOwner
assertEq(
serviceManager.validatorSetSubmitter(),
avsOwner,
"validatorSetSubmitter should be set to avsOwner after init"
);
cheats.expectEmit();
emit IDataHavenServiceManagerEvents.ValidatorSetSubmitterUpdated(avsOwner, submitterA);
cheats.prank(avsOwner);
serviceManager.setValidatorSetSubmitter(submitterA);
assertEq(
serviceManager.validatorSetSubmitter(),
submitterA,
"validatorSetSubmitter should be set"
);
}
function test_setValidatorSetSubmitter_revertsIfNotOwner() public {
cheats.prank(nonOwner);
cheats.expectRevert();
serviceManager.setValidatorSetSubmitter(submitterA);
}
function test_setValidatorSetSubmitter_revertsOnZeroAddress() public {
cheats.prank(avsOwner);
cheats.expectRevert(
abi.encodeWithSelector(IDataHavenServiceManagerErrors.ZeroAddress.selector)
);
serviceManager.setValidatorSetSubmitter(address(0));
}
function test_setValidatorSetSubmitter_rotation() public {
// Set submitter A (rotating from avsOwner set during init)
cheats.prank(avsOwner);
serviceManager.setValidatorSetSubmitter(submitterA);
assertEq(serviceManager.validatorSetSubmitter(), submitterA);
// Rotate to submitter B
cheats.expectEmit();
emit IDataHavenServiceManagerEvents.ValidatorSetSubmitterUpdated(submitterA, submitterB);
cheats.prank(avsOwner);
serviceManager.setValidatorSetSubmitter(submitterB);
assertEq(serviceManager.validatorSetSubmitter(), submitterB);
// Old submitter A can no longer submit
vm.deal(submitterA, 10 ether);
cheats.prank(submitterA);
cheats.expectRevert(
abi.encodeWithSelector(
IDataHavenServiceManagerErrors.OnlyValidatorSetSubmitter.selector
)
);
serviceManager.sendNewValidatorSetForEra{value: 2 ether}(1, 1 ether, 1 ether);
}
// ============ sendNewValidatorSetForEra ============
function test_sendNewValidatorSetForEra_revertsIfNotSubmitter() public {
cheats.prank(avsOwner);
serviceManager.setValidatorSetSubmitter(submitterA);
vm.deal(nonOwner, 10 ether);
cheats.prank(nonOwner);
cheats.expectRevert(
abi.encodeWithSelector(
IDataHavenServiceManagerErrors.OnlyValidatorSetSubmitter.selector
)
);
serviceManager.sendNewValidatorSetForEra{value: 2 ether}(1, 1 ether, 1 ether);
}
function test_sendNewValidatorSetForEra_success() public {
cheats.prank(avsOwner);
serviceManager.setValidatorSetSubmitter(submitterA);
uint64 targetEra = 42;
vm.deal(submitterA, 1000000 ether);
bytes memory message = serviceManager.buildNewValidatorSetMessageForEra(targetEra);
bytes32 expectedHash = keccak256(message);
cheats.expectEmit();
emit IDataHavenServiceManagerEvents.ValidatorSetMessageSubmitted(
targetEra, expectedHash, submitterA
);
cheats.prank(submitterA);
serviceManager.sendNewValidatorSetForEra{value: 2 ether}(targetEra, 1 ether, 1 ether);
}
function test_sendNewValidatorSetForEra_revertsOnEmptyValidatorSet() public {
cheats.prank(avsOwner);
serviceManager.setValidatorSetSubmitter(submitterA);
vm.deal(submitterA, 10 ether);
cheats.prank(submitterA);
cheats.expectRevert(
abi.encodeWithSelector(IDataHavenServiceManagerErrors.EmptyValidatorSet.selector)
);
serviceManager.sendNewValidatorSetForEra{value: 2 ether}(1, 1 ether, 1 ether);
}
function test_ownerCannotCallSendNewValidatorSetForEra() public {
cheats.prank(avsOwner);
serviceManager.setValidatorSetSubmitter(submitterA);
vm.deal(avsOwner, 10 ether);
cheats.prank(avsOwner);
cheats.expectRevert(
abi.encodeWithSelector(
IDataHavenServiceManagerErrors.OnlyValidatorSetSubmitter.selector
)
);
serviceManager.sendNewValidatorSetForEra{value: 2 ether}(1, 1 ether, 1 ether);
}
// ============ buildNewValidatorSetMessageForEra ============
function test_buildNewValidatorSetMessageForEra_encodesTargetEra() public view {
bytes memory messageEra1 = serviceManager.buildNewValidatorSetMessageForEra(1);
bytes memory messageEra2 = serviceManager.buildNewValidatorSetMessageForEra(2);
bytes memory messageEra100 = serviceManager.buildNewValidatorSetMessageForEra(100);
// Different era values must produce different encoded output
assertTrue(
keccak256(messageEra1) != keccak256(messageEra2),
"Messages for different eras should differ"
);
assertTrue(
keccak256(messageEra1) != keccak256(messageEra100),
"Messages for different eras should differ"
);
}
function test_sendNewValidatorSetForEra_revertsWhenSubmitterIsZeroAddress() public {
// Deploy a fresh proxy with address(0) as the submitter
IRewardsCoordinatorTypes.StrategyAndMultiplier[] memory emptyStrategies =
new IRewardsCoordinatorTypes.StrategyAndMultiplier[](0);
cheats.startPrank(regularDeployer);
DataHavenServiceManager zeroSubmitterSM = DataHavenServiceManager(
address(
new TransparentUpgradeableProxy(
address(serviceManagerImplementation),
address(proxyAdmin),
abi.encodeWithSelector(
DataHavenServiceManager.initialize.selector,
avsOwner,
rewardsInitiator,
emptyStrategies,
address(snowbridgeGatewayMock),
address(0)
)
)
)
);
cheats.stopPrank();
assertEq(
zeroSubmitterSM.validatorSetSubmitter(),
address(0),
"validatorSetSubmitter should be address(0)"
);
vm.deal(submitterA, 10 ether);
cheats.prank(submitterA);
cheats.expectRevert(
abi.encodeWithSelector(
IDataHavenServiceManagerErrors.OnlyValidatorSetSubmitter.selector
)
);
zeroSubmitterSM.sendNewValidatorSetForEra{value: 2 ether}(1, 1 ether, 1 ether);
}
function test_fuzz_sendNewValidatorSetForEra(
uint64 targetEra
) public {
cheats.prank(avsOwner);
serviceManager.setValidatorSetSubmitter(submitterA);
vm.deal(submitterA, 1000000 ether);
bytes memory message = serviceManager.buildNewValidatorSetMessageForEra(targetEra);
bytes32 expectedHash = keccak256(message);
cheats.expectEmit();
emit IDataHavenServiceManagerEvents.ValidatorSetMessageSubmitted(
targetEra, expectedHash, submitterA
);
cheats.prank(submitterA);
serviceManager.sendNewValidatorSetForEra{value: 2 ether}(targetEra, 1 ether, 1 ether);
}
function test_buildNewValidatorSetMessageForEra_exactEncoding() public view {
uint64 targetEra = 42;
bytes memory message = serviceManager.buildNewValidatorSetMessageForEra(targetEra);
// Total: 4 (EL_MESSAGE_ID) + 1 (V0) + 1 (ReceiveValidators)
// + 1 (compact 10) + 10*20 (validators) + 8 (era) = 215
assertEq(message.length, 215, "Message length should be 215 bytes");
// First 4 bytes: EL_MESSAGE_ID = 0x70150038
assertEq(uint8(message[0]), 0x70, "EL_MESSAGE_ID byte 0");
assertEq(uint8(message[1]), 0x15, "EL_MESSAGE_ID byte 1");
assertEq(uint8(message[2]), 0x00, "EL_MESSAGE_ID byte 2");
assertEq(uint8(message[3]), 0x38, "EL_MESSAGE_ID byte 3");
// Byte 4: V0 = 0x00
assertEq(uint8(message[4]), 0x00, "V0 byte mismatch");
// Byte 5: ReceiveValidators = 0x00
assertEq(uint8(message[5]), 0x00, "ReceiveValidators byte mismatch");
// Byte 6: SCALE compact encoding of 10 validators = 10 << 2 = 40 = 0x28
assertEq(uint8(message[6]), 0x28, "Compact encoding of 10 validators");
// Last 8 bytes: era 42 in SCALE little-endian = 0x2A00000000000000
assertEq(uint8(message[207]), 0x2A, "Era LE byte 0");
assertEq(uint8(message[208]), 0x00, "Era LE byte 1");
assertEq(uint8(message[209]), 0x00, "Era LE byte 2");
assertEq(uint8(message[210]), 0x00, "Era LE byte 3");
assertEq(uint8(message[211]), 0x00, "Era LE byte 4");
assertEq(uint8(message[212]), 0x00, "Era LE byte 5");
assertEq(uint8(message[213]), 0x00, "Era LE byte 6");
assertEq(uint8(message[214]), 0x00, "Era LE byte 7");
}
// ============ Legacy function removed ============
function test_legacySendNewValidatorSet_removed() public {
// The old sendNewValidatorSet(uint128,uint128) selector should not be callable
bytes memory callData =
abi.encodeWithSelector(bytes4(keccak256("sendNewValidatorSet(uint128,uint128)")), 1, 1);
vm.deal(avsOwner, 10 ether);
cheats.prank(avsOwner);
(bool success,) = address(serviceManager).call{value: 2 ether}(callData);
assertFalse(success, "Legacy sendNewValidatorSet should not be callable");
}
}

View file

@ -0,0 +1,196 @@
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.27;
import {Test} from "forge-std/Test.sol";
import {
ITransparentUpgradeableProxy
} from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";
import {AVSDeployer} from "../utils/AVSDeployer.sol";
import {DataHavenServiceManager} from "../../src/DataHavenServiceManager.sol";
/// @title Storage Layout Tests for DataHavenServiceManager
/// @notice Verifies that proxy upgrades preserve state correctly
contract StorageLayoutTest is AVSDeployer {
function setUp() public {
_deployMockEigenLayerAndAVS();
}
/// @notice Proves state is preserved across proxy upgrade
function test_upgradePreservesState() public {
// 1. Populate state
address testValidator = address(0x1234);
address newRewardsInitiator = address(0x9999);
address testSubmitter = address(0x5678);
vm.startPrank(avsOwner);
serviceManager.addValidatorToAllowlist(testValidator);
serviceManager.setRewardsInitiator(newRewardsInitiator);
serviceManager.setValidatorSetSubmitter(testSubmitter);
vm.stopPrank();
// 2. Record state before upgrade
bool allowlistBefore = serviceManager.validatorsAllowlist(testValidator);
address rewardsInitiatorBefore = serviceManager.rewardsInitiator();
address ownerBefore = serviceManager.owner();
address gatewayBefore = serviceManager.snowbridgeGateway();
address submitterBefore = serviceManager.validatorSetSubmitter();
// 3. Deploy new implementation
DataHavenServiceManager newImpl =
new DataHavenServiceManager(rewardsCoordinator, allocationManager);
// 4. Upgrade proxy
vm.prank(proxyAdminOwner);
proxyAdmin.upgrade(ITransparentUpgradeableProxy(address(serviceManager)), address(newImpl));
// 5. Verify state preserved
assertEq(
serviceManager.validatorsAllowlist(testValidator),
allowlistBefore,
"validatorsAllowlist should be preserved"
);
assertEq(
serviceManager.rewardsInitiator(),
rewardsInitiatorBefore,
"rewardsInitiator should be preserved"
);
assertEq(serviceManager.owner(), ownerBefore, "owner should be preserved");
assertEq(
serviceManager.snowbridgeGateway(),
gatewayBefore,
"snowbridgeGateway should be preserved"
);
assertEq(
serviceManager.validatorSetSubmitter(),
submitterBefore,
"validatorSetSubmitter should be preserved"
);
}
/// @notice Verifies validatorEthAddressToSolochainAddress mapping is preserved
function test_upgradePreservesValidatorMappings() public {
address testValidator = address(0xABCD);
address testSolochainAddress = address(0xDEF0);
// Add validator to allowlist first
vm.prank(avsOwner);
serviceManager.addValidatorToAllowlist(testValidator);
// Register operator via allocationManager to set the solochain address mapping
uint32[] memory operatorSetIds = new uint32[](1);
operatorSetIds[0] = 0; // VALIDATORS_SET_ID
vm.prank(address(allocationManager));
serviceManager.registerOperator(
testValidator,
address(serviceManager),
operatorSetIds,
abi.encodePacked(testSolochainAddress)
);
// Record state before upgrade
bool inAllowlistBefore = serviceManager.validatorsAllowlist(testValidator);
address solochainAddressBefore =
serviceManager.validatorEthAddressToSolochainAddress(testValidator);
address ethOperatorBefore =
serviceManager.validatorSolochainAddressToEthAddress(testSolochainAddress);
// Verify the mapping was set correctly before upgrade
assertEq(solochainAddressBefore, testSolochainAddress, "Solochain address should be set");
assertEq(ethOperatorBefore, testValidator, "Eth operator should be set");
// Deploy new implementation and upgrade
DataHavenServiceManager newImpl =
new DataHavenServiceManager(rewardsCoordinator, allocationManager);
vm.prank(proxyAdminOwner);
proxyAdmin.upgrade(ITransparentUpgradeableProxy(address(serviceManager)), address(newImpl));
// Verify both mappings preserved after upgrade
assertEq(
serviceManager.validatorsAllowlist(testValidator),
inAllowlistBefore,
"validatorsAllowlist mapping should be preserved after upgrade"
);
assertEq(
serviceManager.validatorEthAddressToSolochainAddress(testValidator),
solochainAddressBefore,
"validatorEthAddressToSolochainAddress mapping should be preserved after upgrade"
);
assertEq(
serviceManager.validatorEthAddressToSolochainAddress(testValidator),
testSolochainAddress,
"validatorEthAddressToSolochainAddress should have correct value after upgrade"
);
assertEq(
serviceManager.validatorSolochainAddressToEthAddress(testSolochainAddress),
ethOperatorBefore,
"validatorSolochainAddressToEthAddress mapping should be preserved after upgrade"
);
assertEq(
serviceManager.validatorSolochainAddressToEthAddress(testSolochainAddress),
testValidator,
"validatorSolochainAddressToEthAddress should have correct value after upgrade"
);
}
/// @notice Verifies multiple validators in allowlist are preserved
function test_upgradePreservesMultipleValidators() public {
address[] memory validators = new address[](3);
validators[0] = address(0x1111);
validators[1] = address(0x2222);
validators[2] = address(0x3333);
// Add multiple validators
vm.startPrank(avsOwner);
for (uint256 i = 0; i < validators.length; i++) {
serviceManager.addValidatorToAllowlist(validators[i]);
}
vm.stopPrank();
// Deploy new implementation and upgrade
DataHavenServiceManager newImpl =
new DataHavenServiceManager(rewardsCoordinator, allocationManager);
vm.prank(proxyAdminOwner);
proxyAdmin.upgrade(ITransparentUpgradeableProxy(address(serviceManager)), address(newImpl));
// Verify all validators still in allowlist
for (uint256 i = 0; i < validators.length; i++) {
assertTrue(
serviceManager.validatorsAllowlist(validators[i]),
"All validators should remain in allowlist after upgrade"
);
}
}
/// @notice Verifies that upgrade doesn't affect functionality
function test_functionalityAfterUpgrade() public {
// Deploy new implementation and upgrade
DataHavenServiceManager newImpl =
new DataHavenServiceManager(rewardsCoordinator, allocationManager);
vm.prank(proxyAdminOwner);
proxyAdmin.upgrade(ITransparentUpgradeableProxy(address(serviceManager)), address(newImpl));
// Verify functionality still works
address newValidator = address(0xBEEF);
vm.prank(avsOwner);
serviceManager.addValidatorToAllowlist(newValidator);
assertTrue(
serviceManager.validatorsAllowlist(newValidator),
"Should be able to add validators after upgrade"
);
vm.prank(avsOwner);
serviceManager.removeValidatorFromAllowlist(newValidator);
assertFalse(
serviceManager.validatorsAllowlist(newValidator),
"Should be able to remove validators after upgrade"
);
}
}

View file

@ -48,11 +48,6 @@ contract AVSDeployer is Test {
DataHavenServiceManager public serviceManager;
DataHavenServiceManager public serviceManagerImplementation;
// Truncation is intentional - deriving a deterministic mock address from hash
address public vetoCommitteeMember =
address(uint160(uint256(keccak256("vetoCommitteeMember"))));
uint32 public vetoWindowBlocks = 100; // 100 blocks veto window for tests
// EigenLayer contracts
StrategyManager public strategyManager;
StrategyManager public strategyManagerImplementation;
@ -243,14 +238,6 @@ contract AVSDeployer is Test {
serviceManagerImplementation =
new DataHavenServiceManager(rewardsCoordinator, allocationManager);
// Create array for validators strategies required by DataHavenServiceManager
IStrategy[] memory validatorsStrategies = new IStrategy[](deployedStrategies.length);
// For testing purposes, we'll use the deployed strategies for validators
for (uint256 i = 0; i < deployedStrategies.length; i++) {
validatorsStrategies[i] = deployedStrategies[i];
}
serviceManager = DataHavenServiceManager(
address(
new TransparentUpgradeableProxy(
@ -260,8 +247,9 @@ contract AVSDeployer is Test {
DataHavenServiceManager.initialize.selector,
avsOwner,
rewardsInitiator,
validatorsStrategies,
address(snowbridgeGatewayMock)
defaultStrategyAndMultipliers,
address(snowbridgeGatewayMock),
avsOwner
)
)
)

View file

@ -16,6 +16,11 @@ import {TestUtils} from "./TestUtils.sol";
import {
IAllocationManagerTypes
} from "eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol";
import {IStrategy} from "eigenlayer-contracts/src/contracts/interfaces/IStrategy.sol";
import {
IRewardsCoordinatorTypes
} from "eigenlayer-contracts/src/contracts/interfaces/IRewardsCoordinator.sol";
import {OperatorSet} from "eigenlayer-contracts/src/contracts/libraries/OperatorSetLib.sol";
import {ValidatorsUtils} from "../../script/utils/ValidatorsUtils.sol";
import {console} from "forge-std/Test.sol";
@ -145,6 +150,61 @@ contract SnowbridgeAndAVSDeployer is AVSDeployer {
serviceManager.setSnowbridgeGateway(address(gateway));
}
function setupValidatorsAsOperatorsWithAllocations() public {
setupValidatorsAsOperators();
// Remove strategies added during initialize (without multipliers)
// and re-add them with explicit multipliers
IStrategy[] memory strategies = new IStrategy[](deployedStrategies.length);
for (uint256 i = 0; i < deployedStrategies.length; i++) {
strategies[i] = deployedStrategies[i];
}
IRewardsCoordinatorTypes.StrategyAndMultiplier[] memory sm =
new IRewardsCoordinatorTypes.StrategyAndMultiplier[](deployedStrategies.length);
for (uint256 i = 0; i < deployedStrategies.length; i++) {
sm[i] = IRewardsCoordinatorTypes.StrategyAndMultiplier({
strategy: strategies[i],
multiplier: 1 // 1x multiplier for all strategies
});
}
cheats.startPrank(avsOwner);
serviceManager.removeStrategiesFromValidatorsSupportedStrategies(strategies);
serviceManager.addStrategiesToValidatorsSupportedStrategies(sm);
cheats.stopPrank();
// Advance past ALLOCATION_CONFIGURATION_DELAY (1 day = 86400 blocks in test setup)
// so operator allocation delays take effect
uint32 allocationConfigDelay = allocationManager.ALLOCATION_CONFIGURATION_DELAY();
cheats.roll(block.number + allocationConfigDelay + 1);
// For each operator, allocate full magnitude to the DataHaven operator set
for (uint256 i = 0; i < validatorsAllowlist.length; i++) {
IAllocationManagerTypes.AllocateParams[] memory allocParams =
new IAllocationManagerTypes.AllocateParams[](1);
uint64[] memory newMagnitudes = new uint64[](deployedStrategies.length);
for (uint256 j = 0; j < deployedStrategies.length; j++) {
newMagnitudes[j] = 1e18; // 100% magnitude
}
allocParams[0] = IAllocationManagerTypes.AllocateParams({
operatorSet: OperatorSet({
avs: address(serviceManager), id: serviceManager.VALIDATORS_SET_ID()
}),
strategies: strategies,
newMagnitudes: newMagnitudes
});
cheats.prank(validatorsAllowlist[i]);
allocationManager.modifyAllocations(validatorsAllowlist[i], allocParams);
}
// Advance past allocation effect delay (operator delay is 0, so just +1 block)
cheats.roll(block.number + 1);
}
function setupValidatorsAsOperators() public {
for (uint256 i = 0; i < validatorsAllowlist.length; i++) {
console.log("Setting up validator %s as operator", validatorsAllowlist[i]);

367
operator/Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -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.25.0"
[workspace]
members = [
@ -44,6 +44,7 @@ pallet-external-validators = { path = "./pallets/external-validators", default-f
pallet-external-validators-rewards = { path = "./pallets/external-validators-rewards", default-features = false }
pallet-outbound-commitment-store = { path = "./pallets/outbound-commitment-store", default-features = false }
pallet-proxy-genesis-companion = { path = "./pallets/proxy-genesis-companion", default-features = false }
pallet-session-benchmarking = { path = "./pallets/session-benchmarking", default-features = false }
# Crates.io (wasm)
alloy-core = { version = "0.8.15", 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" }
@ -113,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 }
@ -139,7 +145,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 }
@ -191,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 }
@ -266,42 +272,42 @@ fc-storage = { git = "https://github.com/polkadot-evm/frontier", branch = "stabl
# StorageHub
## Runtime
pallet-bucket-nfts = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false }
pallet-cr-randomness = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false }
pallet-file-system = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false }
pallet-file-system-runtime-api = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false }
pallet-payment-streams = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false }
pallet-payment-streams-runtime-api = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false }
pallet-proofs-dealer = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false }
pallet-proofs-dealer-runtime-api = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false }
pallet-randomness = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false }
pallet-storage-providers = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false }
pallet-storage-providers-runtime-api = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false }
shp-constants = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false }
shp-data-price-updater = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false }
shp-file-key-verifier = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false }
shp-file-metadata = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false }
shp-forest-verifier = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false }
shp-traits = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false }
shp-treasury-funding = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false }
pallet-bucket-nfts = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.1", default-features = false }
pallet-cr-randomness = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.1", default-features = false }
pallet-file-system = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.1", default-features = false }
pallet-file-system-runtime-api = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.1", default-features = false }
pallet-payment-streams = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.1", default-features = false }
pallet-payment-streams-runtime-api = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.1", default-features = false }
pallet-proofs-dealer = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.1", default-features = false }
pallet-proofs-dealer-runtime-api = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.1", default-features = false }
pallet-randomness = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.1", default-features = false }
pallet-storage-providers = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.1", default-features = false }
pallet-storage-providers-runtime-api = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.1", default-features = false }
shp-constants = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.1", default-features = false }
shp-data-price-updater = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.1", default-features = false }
shp-file-key-verifier = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.1", default-features = false }
shp-file-metadata = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.1", default-features = false }
shp-forest-verifier = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.1", default-features = false }
shp-traits = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.1", default-features = false }
shp-treasury-funding = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.1", default-features = false }
## Client
shc-actors-derive = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false }
shc-actors-framework = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false }
shc-blockchain-service = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false }
shc-client = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false }
shc-common = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false }
shc-file-manager = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false }
shc-file-transfer-service = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false }
shc-fisherman-service = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false }
shc-forest-manager = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false }
shc-indexer-db = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false }
shc-indexer-service = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false }
shc-rpc = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false }
shp-opaque = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false }
shp-tx-implicits-runtime-api = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false }
shp-types = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false }
shc-actors-derive = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.1", default-features = false }
shc-actors-framework = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.1", default-features = false }
shc-blockchain-service = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.1", default-features = false }
shc-client = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.1", default-features = false }
shc-common = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.1", default-features = false }
shc-file-manager = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.1", default-features = false }
shc-file-transfer-service = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.1", default-features = false }
shc-fisherman-service = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.1", default-features = false }
shc-forest-manager = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.1", default-features = false }
shc-indexer-db = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.1", default-features = false }
shc-indexer-service = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.1", default-features = false }
shc-rpc = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.1", default-features = false }
shp-opaque = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.1", default-features = false }
shp-tx-implicits-runtime-api = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.1", default-features = false }
shp-types = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.1", default-features = false }
## Precompiles
pallet-evm-precompile-file-system = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false }
pallet-evm-precompile-file-system = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.1", default-features = false }
# Static linking

View file

@ -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<T>(PhantomData<T>);

View file

@ -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 }
@ -139,7 +141,6 @@ toml = { workspace = true }
#### Needed to build static binaries ####
pq-sys = { workspace = true, optional = true }
[build-dependencies]
substrate-build-script-utils = { workspace = true, default-features = true }

View file

@ -242,6 +242,16 @@ pub struct ProviderConfigurations {
#[arg(long, default_value = "60")]
pub extrinsic_retry_timeout: Option<u64>,
/// Mortality period for extrinsics in number of blocks.
///
/// Determines how long a submitted transaction remains valid before expiring.
/// Must be a power of 2 between 4 and `BlockHashCount` (4096). Non-power-of-2 values
/// will be rounded up to the next valid power of 2. Lower values mean transactions
/// expire faster, which helps recover from stuck nonces after block reorgs, but also
/// reduces the window for a transaction to be included on-chain.
#[arg(long, value_name = "BLOCKS", default_value = "256", value_parser = clap::value_parser!(u32).range(4..))]
pub extrinsic_mortality: Option<u32>,
/// On blocks that are multiples of this number, the blockchain service will trigger the catch of proofs.
#[arg(long, default_value = "4")]
pub check_for_pending_proofs_period: Option<u32>,
@ -607,6 +617,11 @@ impl ProviderConfigurations {
bs_changed = true;
}
if let Some(extrinsic_mortality) = self.extrinsic_mortality {
bs_options.extrinsic_mortality = Some(extrinsic_mortality);
bs_changed = true;
}
if let Some(check_for_pending_proofs_period) = self.check_for_pending_proofs_period {
bs_options.check_for_pending_proofs_period = Some(check_for_pending_proofs_period);
bs_changed = true;
@ -741,9 +756,23 @@ pub struct FishermanConfigurations {
pub fisherman_database_url: Option<String>,
/// Duration between batch deletion processing cycles (in seconds).
#[arg(long, default_value = "60", value_parser = clap::value_parser!(u64).range(1..))]
#[arg(long, default_value = "30", value_parser = clap::value_parser!(u64).range(1..))]
pub fisherman_batch_interval_seconds: u64,
/// Cooldown between batch deletion attempts (in seconds).
///
/// Set to `0` to disable cooldown.
#[arg(long, default_value = "1", value_parser = clap::value_parser!(u64).range(0..))]
pub fisherman_batch_cooldown_seconds: u64,
/// Number of consecutive no-work batches required before switching to the slower idle polling interval.
///
/// The minimum value is 2 because there are two kinds of work: User and Incomplete.
/// If we set the value to 1, a non-work batch in one kind of work will trigger the idle poll interval
/// on the other kind of work.
#[arg(long, default_value = "4", value_parser = clap::value_parser!(u8).range(1..))]
pub fisherman_consecutive_no_work_batches_threshold: u8,
/// Maximum number of files to process per batch deletion cycle.
#[arg(long, default_value = "1000", value_parser = clap::value_parser!(u64).range(1..))]
pub fisherman_batch_deletion_limit: u64,
@ -776,6 +805,16 @@ pub struct FishermanConfigurations {
help_heading = "Fisherman Strategy Options"
)]
pub fisherman_ttl_threshold_seconds: Option<u64>,
/// Mortality period for extrinsics in number of blocks.
///
/// Determines how long a submitted transaction remains valid before expiring.
/// Must be a power of 2 between 4 and BlockHashCount (4096). Non-power-of-2 values
/// will be rounded to the nearest valid power of 2. Lower values mean transactions
/// expire faster, which helps recover from stuck nonces after block reorgs, but also
/// reduces the window for a transaction to be included.
#[arg(long, value_name = "BLOCKS", default_value = "256", value_parser = clap::value_parser!(u32).range(4..))]
pub fisherman_extrinsic_mortality: Option<u32>,
}
impl FishermanConfigurations {
@ -796,6 +835,20 @@ impl FishermanConfigurations {
FishermanOrdering::Randomized => FileOrdering::Randomized,
};
// Build blockchain_service options
let mut blockchain_service = None;
let mut bs_options = BlockchainServiceOptions::default();
let mut bs_changed = false;
if let Some(extrinsic_mortality) = self.fisherman_extrinsic_mortality {
bs_options.extrinsic_mortality = Some(extrinsic_mortality);
bs_changed = true;
}
if bs_changed {
blockchain_service = Some(bs_options);
}
Some(FishermanOptions {
database_url: self
.fisherman_database_url
@ -803,9 +856,13 @@ impl FishermanConfigurations {
.expect("Fisherman database URL is required"),
batch_interval_seconds: self.fisherman_batch_interval_seconds,
batch_deletion_limit: self.fisherman_batch_deletion_limit,
batch_cooldown_seconds: self.fisherman_batch_cooldown_seconds,
consecutive_no_work_batches_threshold: self
.fisherman_consecutive_no_work_batches_threshold,
maintenance_mode: false, // Skipping maintenance mode for now
filtering,
ordering,
blockchain_service,
})
} else {
None

View file

@ -24,10 +24,13 @@
use crate::consensus::BabeConsensusDataProvider;
use crate::eth::DefaultEthConfig;
use datahaven_runtime_common::{time::SLOT_DURATION, Block, BlockNumber, Hash};
use fc_rpc::TxPool;
use fc_rpc::{Eth, EthBlockDataCacheTask, EthFilter, Net, Web3};
use fc_rpc::{EthPubSub, TxPool};
use fc_rpc_core::types::{FeeHistoryCache, FilterPool};
use fc_rpc_core::{EthApiServer, EthFilterApiServer, NetApiServer, TxPoolApiServer, Web3ApiServer};
use fc_rpc_core::{
EthApiServer, EthFilterApiServer, EthPubSubApiServer, NetApiServer, TxPoolApiServer,
Web3ApiServer,
};
use fc_storage::StorageOverride;
use fp_rpc::EthereumRuntimeRPCApi;
use jsonrpsee::RpcModule;
@ -111,6 +114,12 @@ where
/// Instantiate all full RPC extensions.
pub fn create_full<P, BE, AuthorityId, A, FL, FSH, Runtime>(
deps: FullDeps<P, BE, AuthorityId, A, FL, FSH, Runtime>,
subscription_task_executor: sc_rpc::SubscriptionTaskExecutor,
pubsub_notification_sinks: Arc<
fc_mapping_sync::EthereumBlockNotificationSinks<
fc_mapping_sync::EthereumBlockNotification<Block>,
>,
>,
) -> Result<RpcModule<()>, Box<dyn std::error::Error + Send + Sync>>
where
P: TransactionPool<Block = Block> + 'static,
@ -263,6 +272,17 @@ where
)?;
module.merge(Web3::new(Arc::clone(&client)).into_rpc())?;
module.merge(
EthPubSub::new(
pool,
Arc::clone(&client),
sync.clone(),
subscription_task_executor,
overrides,
pubsub_notification_sinks.clone(),
)
.into_rpc(),
)?;
if let Some(command_sink) = command_sink {
module.merge(
@ -275,19 +295,5 @@ where
let tx_pool = TxPool::new(client.clone(), graph.clone());
module.merge(tx_pool.into_rpc())?;
// module.merge(FrontierFinality::new(client.clone(), frontier_backend.clone()).into_rpc())?;
// Extend this RPC with a custom API by using the following syntax.
// `YourRpcStruct` should have a reference to a client, which is needed
// to call into the runtime.
// `module.merge(YourRpcTrait::into_rpc(YourRpcStruct::new(ReferenceToClient, ...)))?;`
// You probably want to enable the `rpc v2 chainSpec` API as well
//
// let chain_name = chain_spec.name().to_string();
// let genesis_hash = client.block_hash(0).ok().flatten().expect("Genesis block exists; qed");
// let properties = chain_spec.properties();
// module.merge(ChainSpec::new(chain_name, genesis_hash, properties).into_rpc())?;
Ok(module)
}

View file

@ -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;
@ -438,7 +439,7 @@ pub async fn new_full_impl<
RuntimeApi,
N: sc_network::NetworkBackend<Block, <Block as sp_runtime::traits::Block>::Hash>,
>(
config: Configuration,
mut config: Configuration,
mut eth_config: EthConfiguration,
role_options: Option<RoleOptions>,
indexer_options: Option<IndexerOptions>,
@ -452,6 +453,9 @@ where
StorageHubBuilder<R, S, Runtime>: 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",
@ -669,7 +673,7 @@ where
},
storage_override,
sync: sync_service.clone(),
pubsub_notification_sinks,
pubsub_notification_sinks: pubsub_notification_sinks.clone(),
},
)
.await;
@ -689,38 +693,52 @@ where
let fee_history_limit = eth_config.fee_history_limit;
let sync = sync_service.clone();
Box::new(move |subscription_executor| {
let deps = crate::rpc::FullDeps {
client: client.clone(),
pool: pool.clone(),
graph: pool.pool().clone(),
beefy: BeefyDeps::<BeefyId> {
beefy_finality_proof_stream: beefy_rpc_links.from_voter_justif_stream.clone(),
beefy_best_block_stream: beefy_rpc_links.from_voter_best_beefy_stream.clone(),
Box::new(
move |subscription_executor: sc_rpc::SubscriptionTaskExecutor| {
let deps = crate::rpc::FullDeps {
client: client.clone(),
pool: pool.clone(),
graph: pool.pool().clone(),
beefy: BeefyDeps::<BeefyId> {
beefy_finality_proof_stream: beefy_rpc_links
.from_voter_justif_stream
.clone(),
beefy_best_block_stream: beefy_rpc_links
.from_voter_best_beefy_stream
.clone(),
subscription_executor: subscription_executor.clone(),
},
max_past_logs,
fee_history_limit,
fee_history_cache: fee_history_cache.clone(),
network: Arc::new(network.clone()),
sync: sync.clone(),
filter_pool: filter_pool.clone(),
block_data_cache: block_data_cache.clone(),
overrides: overrides.clone(),
is_authority: is_authority.clone(),
command_sink: command_sink.clone(),
backend: backend.clone(),
frontier_backend: match &*frontier_backend {
fc_db::Backend::KeyValue(b) => b.clone(),
fc_db::Backend::Sql(b) => b.clone(),
},
forced_parent_hashes: None,
maybe_storage_hub_client_config: maybe_storage_hub_client_rpc_config.clone(),
};
crate::rpc::create_full(
deps,
subscription_executor,
},
max_past_logs,
fee_history_limit,
fee_history_cache: fee_history_cache.clone(),
network: Arc::new(network.clone()),
sync: sync.clone(),
filter_pool: filter_pool.clone(),
block_data_cache: block_data_cache.clone(),
overrides: overrides.clone(),
is_authority: is_authority.clone(),
command_sink: command_sink.clone(),
backend: backend.clone(),
frontier_backend: match &*frontier_backend {
fc_db::Backend::KeyValue(b) => b.clone(),
fc_db::Backend::Sql(b) => b.clone(),
},
forced_parent_hashes: None,
maybe_storage_hub_client_config: maybe_storage_hub_client_rpc_config.clone(),
};
crate::rpc::create_full(deps).map_err(Into::into)
})
pubsub_notification_sinks.clone(),
)
.map_err(Into::into)
},
)
};
// Use Ethereum-style hex subscription IDs (0x-prefixed) instead of jsonrpsee defaults.
config.rpc.id_provider = Some(Box::new(fc_rpc::EthereumSubIdProvider));
let rpc_handlers = sc_service::spawn_tasks(sc_service::SpawnTasksParams {
network: Arc::new(network.clone()),
client: client.clone(),
@ -948,6 +966,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 {
@ -1271,6 +1305,11 @@ where
// Set the indexer db pool
builder.with_indexer_db_pool(Some(db_pool));
// Configure blockchain service options for the fisherman
if let Some(c) = fisherman_options.blockchain_service.clone() {
builder.with_blockchain_service_config(c);
}
// Spawn the fisherman service
builder
.with_fisherman(client.clone(), &fisherman_options)

View file

@ -309,6 +309,12 @@ pub mod pallet {
NoKeysRegistered,
/// Unable to derive validator id from account id
UnableToDeriveValidatorId,
/// The target era is too old (targetEra <= ActiveEra). Message arrived late.
TargetEraTooOld,
/// The target era is too far ahead (targetEra > ActiveEra + 1).
TargetEraTooNew,
/// The target era has already been seen (targetEra <= ExternalIndex). Duplicate or stale.
DuplicateOrStaleTargetEra,
}
#[pallet::call]
@ -419,6 +425,9 @@ pub mod pallet {
validators: Vec<T::ValidatorId>,
external_index: u64,
) -> DispatchResult {
// Validate the target era before accepting the validator set
Self::validate_target_era(external_index)?;
// If more validators than max, take the first n
let validators = BoundedVec::truncate_from(validators);
<ExternalValidators<T>>::put(&validators);
@ -431,6 +440,27 @@ pub mod pallet {
Ok(())
}
fn validate_target_era(target_era: u64) -> DispatchResult {
let active_era_index = Self::active_era()
.map(|info| info.index as u64)
.unwrap_or(0);
let current_external_index = ExternalIndex::<T>::get();
// Must target exactly the next era
if target_era <= active_era_index {
return Err(Error::<T>::TargetEraTooOld.into());
}
if target_era > active_era_index + 1 {
return Err(Error::<T>::TargetEraTooNew.into());
}
// Dedupe/stale guard
if target_era <= current_external_index {
return Err(Error::<T>::DuplicateOrStaleTargetEra.into());
}
Ok(())
}
/// Helper to set a new `ForceEra` mode.
pub(crate) fn set_force_era(mode: Forcing) {
log::info!("Setting force era mode {:?}.", mode);

View file

@ -345,10 +345,96 @@ fn era_hooks() {
});
}
#[test]
fn target_era_validation_accepts_next_era() {
new_test_ext().execute_with(|| {
// Advance to era 1 (session 6 starts era 1)
run_to_session(6);
// ActiveEra is now 1, so target era 2 (ActiveEra + 1) should succeed
assert_ok!(ExternalValidators::set_external_validators_inner(
vec![50, 51],
2
));
});
}
#[test]
fn target_era_validation_rejects_old_era() {
new_test_ext().execute_with(|| {
// Advance to era 1
run_to_session(6);
// target_era = 0 (ActiveEra - 1) should fail
assert_noop!(
ExternalValidators::set_external_validators_inner(vec![50, 51], 0),
Error::<Test>::TargetEraTooOld
);
// target_era = 1 (== ActiveEra) should also fail
assert_noop!(
ExternalValidators::set_external_validators_inner(vec![50, 51], 1),
Error::<Test>::TargetEraTooOld
);
});
}
#[test]
fn target_era_validation_rejects_too_new_era() {
new_test_ext().execute_with(|| {
// Advance to era 1
run_to_session(6);
// target_era = 3 (ActiveEra + 2) should fail
assert_noop!(
ExternalValidators::set_external_validators_inner(vec![50, 51], 3),
Error::<Test>::TargetEraTooNew
);
});
}
#[test]
fn target_era_validation_rejects_duplicate() {
new_test_ext().execute_with(|| {
// Advance to era 1
run_to_session(6);
// First submission with target_era = 2 should succeed
assert_ok!(ExternalValidators::set_external_validators_inner(
vec![50, 51],
2
));
// Second submission with same target_era = 2 should fail (duplicate)
assert_noop!(
ExternalValidators::set_external_validators_inner(vec![50, 51], 2),
Error::<Test>::DuplicateOrStaleTargetEra
);
});
}
#[test]
fn target_era_validation_at_genesis() {
new_test_ext().execute_with(|| {
// At genesis, ActiveEra = 0, so target_era = 1 (ActiveEra + 1) should succeed
assert_ok!(ExternalValidators::set_external_validators_inner(
vec![50, 51],
1
));
// target_era = 0 should fail (too old, <= ActiveEra)
assert_noop!(
ExternalValidators::set_external_validators_inner(vec![50, 51], 0),
Error::<Test>::TargetEraTooOld
);
});
}
#[test]
fn era_hooks_with_external_index() {
new_test_ext().execute_with(|| {
let first_external_index = 1000;
// ActiveEra starts at 0, so target era 1 (ActiveEra + 1) is valid
let first_external_index = 1;
assert_ok!(ExternalValidators::set_external_validators_inner(
vec![50, 51],
first_external_index
@ -356,7 +442,8 @@ fn era_hooks_with_external_index() {
run_to_session(8);
let second_external_index = 2000;
// ActiveEra is now 1, so target era 2 (ActiveEra + 1) is valid
let second_external_index = 2;
assert_ok!(ExternalValidators::set_external_validators_inner(
vec![50, 51],
@ -388,3 +475,81 @@ fn era_hooks_with_external_index() {
assert_eq!(Mock::mock().called_hooks, expected_calls);
});
}
#[test]
fn set_external_validators_extrinsic_rejects_bad_origin() {
new_test_ext().execute_with(|| {
// signed by an arbitrary non-root account → BadOrigin
assert_noop!(
ExternalValidators::set_external_validators(RuntimeOrigin::signed(1), vec![50, 51], 1),
BadOrigin
);
// unsigned → BadOrigin
assert_noop!(
ExternalValidators::set_external_validators(RuntimeOrigin::none(), vec![50, 51], 1),
BadOrigin
);
// root origin (requires signed(777) specifically, not sudo root) → BadOrigin
assert_noop!(
ExternalValidators::set_external_validators(RuntimeOrigin::root(), vec![50, 51], 1),
BadOrigin
);
// success with the correct signed origin
assert_ok!(ExternalValidators::set_external_validators(
RuntimeOrigin::signed(RootAccount::get()),
vec![50, 51],
1
));
});
}
#[test]
fn target_era_validation_rejects_u64_max() {
new_test_ext().execute_with(|| {
// At genesis, active_era = 0; u64::MAX is far above active_era + 1
assert_noop!(
ExternalValidators::set_external_validators_inner(vec![50, 51], u64::MAX),
Error::<Test>::TargetEraTooNew
);
});
}
#[test]
fn era_boundary_race_submit_advance_resubmit() {
new_test_ext().execute_with(|| {
// At genesis (active_era = 0), submit for era 1
assert_ok!(ExternalValidators::set_external_validators_inner(
vec![50, 51],
1
));
// Advance to era 1 (session 6 starts era 1)
run_to_session(6);
// Re-submit for era 1 now that active_era = 1 → TargetEraTooOld
assert_noop!(
ExternalValidators::set_external_validators_inner(vec![50, 51], 1),
Error::<Test>::TargetEraTooOld
);
});
}
#[test]
fn era_boundary_race_resubmit_without_advance() {
new_test_ext().execute_with(|| {
// At genesis (active_era = 0), submit for era 1
assert_ok!(ExternalValidators::set_external_validators_inner(
vec![50, 51],
1
));
// Immediately re-submit for era 1 without advancing → DuplicateOrStaleTargetEra
assert_noop!(
ExternalValidators::set_external_validators_inner(vec![50, 51], 1),
Error::<Test>::DuplicateOrStaleTargetEra
);
});
}

View file

@ -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",
]

View file

@ -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::<T>::inc_providers(&caller);
let keys = T::Keys::decode(&mut sp_runtime::traits::TrailingZeroInput::zeroes()).unwrap();
let proof: Vec<u8> = vec![0, 1, 2, 3];
}: _(RawOrigin::Signed(caller), keys, proof)
purge_keys {
let caller: T::AccountId = whitelisted_caller();
frame_system::Pallet::<T>::inc_providers(&caller);
let keys = T::Keys::decode(&mut sp_runtime::traits::TrailingZeroInput::zeroes()).unwrap();
let proof: Vec<u8> = vec![0, 1, 2, 3];
let _ = pallet_session::Pallet::<T>::set_keys(RawOrigin::Signed(caller.clone()).into(), keys, proof);
}: _(RawOrigin::Signed(caller))
}

View file

@ -0,0 +1,11 @@
#![cfg_attr(not(feature = "std"), no_std)]
extern crate alloc;
pub struct Pallet<T: Config>(pallet_session::Pallet<T>);
/// Benchmarking configuration for pallet-session in DataHaven.
pub trait Config: pallet_session::Config {}
#[cfg(feature = "runtime-benchmarks")]
mod benchmarking;

View file

@ -15,7 +15,9 @@
// along with Moonbeam. If not, see <http://www.gnu.org/licenses/>.
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<AccountId, Balance, CurrencyT>(account: AccountId) -> AccountId
where
Balance: From<u128> + Zero,
CurrencyT: Currency<AccountId, Balance = Balance>,
{
if CurrencyT::free_balance(&account).is_zero() {
let _ = CurrencyT::deposit_creating(&account, 1u128.into());
}
account
}
}

View file

@ -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 = [

View file

@ -27,6 +27,7 @@ frame_benchmarking::define_benchmarks!(
// Substrate pallets
[pallet_balances, Balances]
[pallet_session, pallet_session_benchmarking::Pallet::<Runtime>]
// 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]

View file

@ -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 = <SessionKeys as OpaqueKeys>::KeyTypeIdProviders;
type Keys = SessionKeys;
type WeightInfo = pallet_session::weights::SubstrateWeight<Runtime>;
type WeightInfo = mainnet_weights::pallet_session::WeightInfo<Runtime>;
}
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<Runtime>,
NativeTokenTransferMessageProcessor<Runtime>,
dhp_bridge::EigenLayerMessageProcessor<Runtime>,
dhp_bridge::NativeTokenTransferMessageProcessor<Runtime>,
);
#[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;
@ -1872,7 +1838,7 @@ mod tests {
message_id: EL_MESSAGE_ID,
message: BridgeMessage::V1(InboundCommand::ReceiveValidators {
validators: Vec::new(),
external_index: 0,
external_index: 1,
}),
};

View file

@ -128,9 +128,9 @@ pub mod dynamic_params {
///
/// [`MaxPrice`] = [`MostlyStablePrice`] + u * e ^ ( 1 - [`SystemUtilisationUpperThresholdPercentage`] )
///
/// 500 = 50 + u * (e ^ (1 - 0.95) - 1)
/// u = (500 - 50) / (e ^ (1 - 0.95) - 1) ≈ 8777
pub static UpperExponentFactor: u32 = 8777;
/// 500 GIGAWEI = 50 GIGAWEI + u * (e ^ (1 - 0.95) - 1)
/// u = (500 GIGAWEI - 50 GIGAWEI) / (e ^ (1 - 0.95) - 1) ≈ 8,776,874,921,880
pub static UpperExponentFactor: Balance = 8_776_874_921_880;
#[codec(index = 15)]
#[allow(non_upper_case_globals)]
@ -139,9 +139,9 @@ pub mod dynamic_params {
///
/// [`MinPrice`] = [`MostlyStablePrice`] - u * e ^ ( [`SystemUtilisationLowerThresholdPercentage`] - 0 )
///
/// 10 = 50 - l * (e ^ (0.3 - 0) - 1)
/// l = (50 - 10) / (e ^ (0.3 - 0) - 1) ≈ 114
pub static LowerExponentFactor: u32 = 114;
/// 10 GIGAWEI = 50 GIGAWEI - l * (e ^ (0.3 - 0) - 1)
/// l = (50 GIGAWEI - 10 GIGAWEI) / (e ^ (0.3 - 0) - 1) ≈ 114,331,836,540
pub static LowerExponentFactor: Balance = 114_331_836_540;
#[codec(index = 16)]
#[allow(non_upper_case_globals)]

View file

@ -14,9 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with DataHaven. If not, see <http://www.gnu.org/licenses/>.
#[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<BlakeTwo256>;
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 = <Signature as Verify>::Signer;
type WeightInfo = pallet_nfts::weights::SubstrateWeight<Runtime>;
type WeightInfo = crate::weights::pallet_nfts::WeightInfo<Runtime>;
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<u32, u32, <Signature as Verify>::Signer, AccountId, Signature>
for NftHelper
{
fn collection(i: u16) -> u32 {
i.into()
}
fn item(i: u16) -> u32 {
i.into()
}
fn signer() -> (<Signature as Verify>::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: <Signature as Verify>::Signer = public.into();
let account: AccountId = public_key.clone().into_account();
(public_key, account)
}
fn sign(_public: &<Signature as Verify>::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<AccountId> for StorageHubTreasuryAccount {
fn get() -> AccountId {
let account = TreasuryAccount::get();
StorageHubBenchmarking::ensure_treasury_account::<AccountId, Balance, Balances>(account)
}
}
// Benchmark helpers for Storage Providers pallet.
#[cfg(feature = "runtime-benchmarks")]
pub struct ProvidersBenchmarkHelpers;
#[cfg(feature = "runtime-benchmarks")]
impl pallet_storage_providers::benchmarking::BenchmarkHelpers<Runtime>
for ProvidersBenchmarkHelpers
{
type ProviderId = <Runtime as pallet_storage_providers::Config>::ProviderId;
fn set_accrued_failed_proofs(provider_id: Self::ProviderId, value: u32) {
pallet_proofs_dealer::SlashableProviders::<Runtime>::insert(provider_id, value);
}
fn get_accrued_failed_proofs(provider_id: Self::ProviderId) -> u32 {
pallet_proofs_dealer::SlashableProviders::<Runtime>::get(provider_id).unwrap_or(0)
}
}
impl pallet_storage_providers::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type WeightInfo = pallet_storage_providers::weights::SubstrateWeight<Runtime>;
type WeightInfo = crate::weights::pallet_storage_providers::WeightInfo<Runtime>;
type ProvidersRandomness = pallet_randomness::RandomnessFromOneEpochAgo<Runtime>;
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<Runtime>;
type WeightInfo = crate::weights::pallet_payment_streams::WeightInfo<Runtime>;
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<Runtime, Perbill>;
#[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<Runtime>;
type WeightInfo = crate::weights::pallet_proofs_dealer::WeightInfo<Runtime>;
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<Runtime>;
#[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<AccountId>;
type PriorityChallengeOrigin = EnsureRoot<AccountId>;
#[cfg(not(feature = "runtime-benchmarks"))]
type ChallengeOrigin = frame_system::EnsureRoot<AccountId>;
#[cfg(feature = "runtime-benchmarks")]
type ChallengeOrigin = EnsureSigned<AccountId>;
#[cfg(not(feature = "runtime-benchmarks"))]
type PriorityChallengeOrigin = frame_system::EnsureRoot<AccountId>;
#[cfg(feature = "runtime-benchmarks")]
type PriorityChallengeOrigin = EnsureSigned<AccountId>;
}
// Converter from the Balance type to the BlockNumber type for math.
@ -452,12 +602,24 @@ impl Get<u32> 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<Runtime>;
type WeightInfo = crate::weights::pallet_file_system::WeightInfo<Runtime>;
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>;

View file

@ -258,7 +258,7 @@ pub fn dorothy() -> AccountId {
}
pub fn ethan() -> AccountId {
AccountId::from(hex!("Ff64d3F6efE2317EE2807d2235B1ac2AA69d9E87"))
AccountId::from(hex!("Ff64d3F6efE2317EE2807d223a0Bdc4c0c49dfDB"))
}
pub fn frank() -> AccountId {

View file

@ -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: 1300,
impl_version: 1,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
@ -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;
@ -1263,6 +1264,9 @@ impl_runtime_apis! {
) -> Vec<H256> {
FileSystem::query_pending_bsp_confirm_storage_requests(bsp_id, file_keys)
}
fn get_max_batch_confirm_storage_requests() -> BlockNumber {
FileSystem::get_max_batch_confirm_storage_requests()
}
}
impl pallet_payment_streams_runtime_api::PaymentStreamsApi<Block, ProviderIdFor<Runtime>, Balance, AccountId> for Runtime {

View file

@ -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;

View file

@ -0,0 +1,5 @@
//! Weights for `pallet_file_system`.
//!
//! Generated weights should overwrite this file.
pub use pallet_file_system::weights::SubstrateWeight as WeightInfo;

View file

@ -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<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_nfts::WeightInfo for WeightInfo<T> {
/// 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()))
}
}

View file

@ -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 <http://www.gnu.org/licenses/>.
//! 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<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_payment_streams::weights::WeightInfo for WeightInfo<T> {
/// 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()))
}
}

View file

@ -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 <http://www.gnu.org/licenses/>.
//! 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<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_proofs_dealer::weights::WeightInfo for WeightInfo<T> {
/// 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))
}
}

View file

@ -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 <http://www.gnu.org/licenses/>.
//! 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<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_session::WeightInfo for WeightInfo<T> {
/// 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))
}
}

View file

@ -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 <http://www.gnu.org/licenses/>.
//! 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<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_storage_providers::weights::WeightInfo for WeightInfo<T> {
/// 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))
}
}

View file

@ -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 = [

View file

@ -27,6 +27,7 @@ frame_benchmarking::define_benchmarks!(
// Substrate pallets
[pallet_balances, Balances]
[pallet_session, pallet_session_benchmarking::Pallet::<Runtime>]
// 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]

View file

@ -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 = <SessionKeys as OpaqueKeys>::KeyTypeIdProviders;
type Keys = SessionKeys;
type WeightInfo = pallet_session::weights::SubstrateWeight<Runtime>;
type WeightInfo = stagenet_weights::pallet_session::WeightInfo<Runtime>;
}
parameter_types! {
@ -1038,8 +1037,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();
@ -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<Runtime>,
NativeTokenTransferMessageProcessor<Runtime>,
dhp_bridge::EigenLayerMessageProcessor<Runtime>,
dhp_bridge::NativeTokenTransferMessageProcessor<Runtime>,
);
#[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;
@ -1853,7 +1819,7 @@ mod tests {
message_id: EL_MESSAGE_ID,
message: BridgeMessage::V1(InboundCommand::ReceiveValidators {
validators: Vec::new(),
external_index: 0,
external_index: 1,
}),
};
@ -1928,4 +1894,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<u8> = (b"AccountKey20", rewards_account).encode();
// Full encoding: "GlobalConsensus" + NetworkId::ByGenesis(genesis) + interior
let encoded: Vec<u8> = (
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
);
}
}

View file

@ -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).
@ -131,9 +135,9 @@ pub mod dynamic_params {
///
/// [`MaxPrice`] = [`MostlyStablePrice`] + u * e ^ ( 1 - [`SystemUtilisationUpperThresholdPercentage`] )
///
/// 500 = 50 + u * (e ^ (1 - 0.95) - 1)
/// u = (500 - 50) / (e ^ (1 - 0.95) - 1) ≈ 8777
pub static UpperExponentFactor: u32 = 8777;
/// 500 GIGAWEI = 50 GIGAWEI + u * (e ^ (1 - 0.95) - 1)
/// u = (500 GIGAWEI - 50 GIGAWEI) / (e ^ (1 - 0.95) - 1) ≈ 8,776,874,921,880
pub static UpperExponentFactor: Balance = 8_776_874_921_880;
#[codec(index = 15)]
#[allow(non_upper_case_globals)]
@ -142,9 +146,9 @@ pub mod dynamic_params {
///
/// [`MinPrice`] = [`MostlyStablePrice`] - u * e ^ ( [`SystemUtilisationLowerThresholdPercentage`] - 0 )
///
/// 10 = 50 - l * (e ^ (0.3 - 0) - 1)
/// l = (50 - 10) / (e ^ (0.3 - 0) - 1) ≈ 114
pub static LowerExponentFactor: u32 = 114;
/// 10 GIGAWEI = 50 GIGAWEI - l * (e ^ (0.3 - 0) - 1)
/// l = (50 GIGAWEI - 10 GIGAWEI) / (e ^ (0.3 - 0) - 1) ≈ 114,331,836,540
pub static LowerExponentFactor: Balance = 114_331_836_540;
#[codec(index = 16)]
#[allow(non_upper_case_globals)]

View file

@ -14,9 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with DataHaven. If not, see <http://www.gnu.org/licenses/>.
#[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<BlakeTwo256>;
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 = <Signature as Verify>::Signer;
type WeightInfo = pallet_nfts::weights::SubstrateWeight<Runtime>;
type WeightInfo = crate::weights::pallet_nfts::WeightInfo<Runtime>;
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<u32, u32, <Signature as Verify>::Signer, AccountId, Signature>
for NftHelper
{
fn collection(i: u16) -> u32 {
i.into()
}
fn item(i: u16) -> u32 {
i.into()
}
fn signer() -> (<Signature as Verify>::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: <Signature as Verify>::Signer = public.into();
let account: AccountId = public_key.clone().into_account();
(public_key, account)
}
fn sign(_public: &<Signature as Verify>::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<AccountId> for StorageHubTreasuryAccount {
fn get() -> AccountId {
let account = TreasuryAccount::get();
StorageHubBenchmarking::ensure_treasury_account::<AccountId, Balance, Balances>(account)
}
}
// Benchmark helpers for Storage Providers pallet.
#[cfg(feature = "runtime-benchmarks")]
pub struct ProvidersBenchmarkHelpers;
#[cfg(feature = "runtime-benchmarks")]
impl pallet_storage_providers::benchmarking::BenchmarkHelpers<Runtime>
for ProvidersBenchmarkHelpers
{
type ProviderId = <Runtime as pallet_storage_providers::Config>::ProviderId;
fn set_accrued_failed_proofs(provider_id: Self::ProviderId, value: u32) {
pallet_proofs_dealer::SlashableProviders::<Runtime>::insert(provider_id, value);
}
fn get_accrued_failed_proofs(provider_id: Self::ProviderId) -> u32 {
pallet_proofs_dealer::SlashableProviders::<Runtime>::get(provider_id).unwrap_or(0)
}
}
impl pallet_storage_providers::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type WeightInfo = pallet_storage_providers::weights::SubstrateWeight<Runtime>;
type WeightInfo = crate::weights::pallet_storage_providers::WeightInfo<Runtime>;
type ProvidersRandomness = pallet_randomness::RandomnessFromOneEpochAgo<Runtime>;
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<Runtime>;
type WeightInfo = crate::weights::pallet_payment_streams::WeightInfo<Runtime>;
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<Runtime, Perbill>;
#[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<Runtime>;
type WeightInfo = crate::weights::pallet_proofs_dealer::WeightInfo<Runtime>;
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<Runtime>;
#[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<AccountId>;
type PriorityChallengeOrigin = EnsureRoot<AccountId>;
#[cfg(not(feature = "runtime-benchmarks"))]
type ChallengeOrigin = frame_system::EnsureRoot<AccountId>;
#[cfg(feature = "runtime-benchmarks")]
type ChallengeOrigin = EnsureSigned<AccountId>;
#[cfg(not(feature = "runtime-benchmarks"))]
type PriorityChallengeOrigin = frame_system::EnsureRoot<AccountId>;
#[cfg(feature = "runtime-benchmarks")]
type PriorityChallengeOrigin = EnsureSigned<AccountId>;
}
// Converter from the Balance type to the BlockNumber type for math.
@ -452,12 +602,24 @@ impl Get<u32> 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<Runtime>;
type WeightInfo = crate::weights::pallet_file_system::WeightInfo<Runtime>;
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>;

View file

@ -267,7 +267,7 @@ pub fn dorothy() -> AccountId {
}
pub fn ethan() -> AccountId {
AccountId::from(hex!("Ff64d3F6efE2317EE2807d2235B1ac2AA69d9E87"))
AccountId::from(hex!("Ff64d3F6efE2317EE2807d223a0Bdc4c0c49dfDB"))
}
pub fn frank() -> AccountId {

View file

@ -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: 1300,
impl_version: 1,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
@ -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;
@ -1266,6 +1267,9 @@ impl_runtime_apis! {
) -> Vec<H256> {
FileSystem::query_pending_bsp_confirm_storage_requests(bsp_id, file_keys)
}
fn get_max_batch_confirm_storage_requests() -> BlockNumber {
FileSystem::get_max_batch_confirm_storage_requests()
}
}
impl pallet_payment_streams_runtime_api::PaymentStreamsApi<Block, ProviderIdFor<Runtime>, Balance, AccountId> for Runtime {

View file

@ -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;

View file

@ -0,0 +1,5 @@
//! Weights for `pallet_file_system`.
//!
//! Generated weights should overwrite this file.
pub use pallet_file_system::weights::SubstrateWeight as WeightInfo;

View file

@ -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<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_nfts::WeightInfo for WeightInfo<T> {
/// 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()))
}
}

View file

@ -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 <http://www.gnu.org/licenses/>.
//! 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<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_payment_streams::weights::WeightInfo for WeightInfo<T> {
/// 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()))
}
}

View file

@ -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 <http://www.gnu.org/licenses/>.
//! 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<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_proofs_dealer::weights::WeightInfo for WeightInfo<T> {
/// 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))
}
}

View file

@ -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 <http://www.gnu.org/licenses/>.
//! 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<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_session::WeightInfo for WeightInfo<T> {
/// 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))
}
}

View file

@ -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 <http://www.gnu.org/licenses/>.
//! 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<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_storage_providers::weights::WeightInfo for WeightInfo<T> {
/// 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))
}
}

View file

@ -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 = [

View file

@ -27,6 +27,7 @@ frame_benchmarking::define_benchmarks!(
// Substrate pallets
[pallet_balances, Balances]
[pallet_session, pallet_session_benchmarking::Pallet::<Runtime>]
[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]

View file

@ -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 = <SessionKeys as OpaqueKeys>::KeyTypeIdProviders;
type Keys = SessionKeys;
type WeightInfo = pallet_session::weights::SubstrateWeight<Runtime>;
type WeightInfo = testnet_weights::pallet_session::WeightInfo<Runtime>;
}
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<Runtime>;
type WeightInfo = testnet_weights::pallet_identity::WeightInfo<Runtime>;
type UsernameDeposit = UsernameDeposit;
type UsernameGracePeriod = UsernameGracePeriod;
@ -1041,8 +1040,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();
@ -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<Runtime>,
NativeTokenTransferMessageProcessor<Runtime>,
dhp_bridge::EigenLayerMessageProcessor<Runtime>,
dhp_bridge::NativeTokenTransferMessageProcessor<Runtime>,
);
#[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;
@ -1875,7 +1841,7 @@ mod tests {
message_id: EL_MESSAGE_ID,
message: BridgeMessage::V1(InboundCommand::ReceiveValidators {
validators: Vec::new(),
external_index: 0,
external_index: 1,
}),
};
@ -1950,4 +1916,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<u8> = (b"AccountKey20", rewards_account).encode();
// Full encoding: "GlobalConsensus" + NetworkId::ByGenesis(genesis) + interior
let encoded: Vec<u8> = (
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
);
}
}

View file

@ -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).
@ -129,9 +133,9 @@ pub mod dynamic_params {
///
/// [`MaxPrice`] = [`MostlyStablePrice`] + u * e ^ ( 1 - [`SystemUtilisationUpperThresholdPercentage`] )
///
/// 500 = 50 + u * (e ^ (1 - 0.95) - 1)
/// u = (500 - 50) / (e ^ (1 - 0.95) - 1) ≈ 8777
pub static UpperExponentFactor: u32 = 8777;
/// 500 GIGAWEI = 50 GIGAWEI + u * (e ^ (1 - 0.95) - 1)
/// u = (500 GIGAWEI - 50 GIGAWEI) / (e ^ (1 - 0.95) - 1) ≈ 8,776,874,921,880
pub static UpperExponentFactor: Balance = 8_776_874_921_880;
#[codec(index = 15)]
#[allow(non_upper_case_globals)]
@ -140,9 +144,9 @@ pub mod dynamic_params {
///
/// [`MinPrice`] = [`MostlyStablePrice`] - u * e ^ ( [`SystemUtilisationLowerThresholdPercentage`] - 0 )
///
/// 10 = 50 - l * (e ^ (0.3 - 0) - 1)
/// l = (50 - 10) / (e ^ (0.3 - 0) - 1) ≈ 114
pub static LowerExponentFactor: u32 = 114;
/// 10 GIGAWEI = 50 GIGAWEI - l * (e ^ (0.3 - 0) - 1)
/// l = (50 GIGAWEI - 10 GIGAWEI) / (e ^ (0.3 - 0) - 1) ≈ 114,331,836,540
pub static LowerExponentFactor: Balance = 114_331_836_540;
#[codec(index = 16)]
#[allow(non_upper_case_globals)]

View file

@ -14,9 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with DataHaven. If not, see <http://www.gnu.org/licenses/>.
#[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<BlakeTwo256>;
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 = <Signature as Verify>::Signer;
type WeightInfo = pallet_nfts::weights::SubstrateWeight<Runtime>;
type WeightInfo = crate::weights::pallet_nfts::WeightInfo<Runtime>;
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<u32, u32, <Signature as Verify>::Signer, AccountId, Signature>
for NftHelper
{
fn collection(i: u16) -> u32 {
i.into()
}
fn item(i: u16) -> u32 {
i.into()
}
fn signer() -> (<Signature as Verify>::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: <Signature as Verify>::Signer = public.into();
let account: AccountId = public_key.clone().into_account();
(public_key, account)
}
fn sign(_public: &<Signature as Verify>::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<AccountId> for StorageHubTreasuryAccount {
fn get() -> AccountId {
let account = TreasuryAccount::get();
StorageHubBenchmarking::ensure_treasury_account::<AccountId, Balance, Balances>(account)
}
}
// Benchmark helpers for Storage Providers pallet.
#[cfg(feature = "runtime-benchmarks")]
pub struct ProvidersBenchmarkHelpers;
#[cfg(feature = "runtime-benchmarks")]
impl pallet_storage_providers::benchmarking::BenchmarkHelpers<Runtime>
for ProvidersBenchmarkHelpers
{
type ProviderId = <Runtime as pallet_storage_providers::Config>::ProviderId;
fn set_accrued_failed_proofs(provider_id: Self::ProviderId, value: u32) {
pallet_proofs_dealer::SlashableProviders::<Runtime>::insert(provider_id, value);
}
fn get_accrued_failed_proofs(provider_id: Self::ProviderId) -> u32 {
pallet_proofs_dealer::SlashableProviders::<Runtime>::get(provider_id).unwrap_or(0)
}
}
impl pallet_storage_providers::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type WeightInfo = pallet_storage_providers::weights::SubstrateWeight<Runtime>;
type WeightInfo = crate::weights::pallet_storage_providers::WeightInfo<Runtime>;
type ProvidersRandomness = pallet_randomness::RandomnessFromOneEpochAgo<Runtime>;
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<Runtime>;
type WeightInfo = crate::weights::pallet_payment_streams::WeightInfo<Runtime>;
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<Runtime, Perbill>;
#[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<Runtime>;
type WeightInfo = crate::weights::pallet_proofs_dealer::WeightInfo<Runtime>;
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<Runtime>;
#[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<AccountId>;
type PriorityChallengeOrigin = EnsureRoot<AccountId>;
#[cfg(not(feature = "runtime-benchmarks"))]
type ChallengeOrigin = frame_system::EnsureRoot<AccountId>;
#[cfg(feature = "runtime-benchmarks")]
type ChallengeOrigin = EnsureSigned<AccountId>;
#[cfg(not(feature = "runtime-benchmarks"))]
type PriorityChallengeOrigin = frame_system::EnsureRoot<AccountId>;
#[cfg(feature = "runtime-benchmarks")]
type PriorityChallengeOrigin = EnsureSigned<AccountId>;
}
// Converter from the Balance type to the BlockNumber type for math.
@ -452,12 +603,24 @@ impl Get<u32> 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<Runtime>;
type WeightInfo = crate::weights::pallet_file_system::WeightInfo<Runtime>;
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>;

View file

@ -265,7 +265,7 @@ pub fn dorothy() -> AccountId {
}
pub fn ethan() -> AccountId {
AccountId::from(hex!("Ff64d3F6efE2317EE2807d2235B1ac2AA69d9E87"))
AccountId::from(hex!("Ff64d3F6efE2317EE2807d223a0Bdc4c0c49dfDB"))
}
pub fn frank() -> AccountId {

View file

@ -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: 1300,
impl_version: 1,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
@ -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;
@ -1263,6 +1264,9 @@ impl_runtime_apis! {
) -> Vec<H256> {
FileSystem::query_pending_bsp_confirm_storage_requests(bsp_id, file_keys)
}
fn get_max_batch_confirm_storage_requests() -> BlockNumber {
FileSystem::get_max_batch_confirm_storage_requests()
}
}
impl pallet_payment_streams_runtime_api::PaymentStreamsApi<Block, ProviderIdFor<Runtime>, Balance, AccountId> for Runtime {

View file

@ -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;

View file

@ -0,0 +1,5 @@
//! Weights for `pallet_file_system`.
//!
//! Generated weights should overwrite this file.
pub use pallet_file_system::weights::SubstrateWeight as WeightInfo;

View file

@ -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<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_nfts::WeightInfo for WeightInfo<T> {
/// 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()))
}
}

View file

@ -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 <http://www.gnu.org/licenses/>.
//! 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<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_payment_streams::weights::WeightInfo for WeightInfo<T> {
/// 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()))
}
}

View file

@ -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 <http://www.gnu.org/licenses/>.
//! 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<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_proofs_dealer::weights::WeightInfo for WeightInfo<T> {
/// 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))
}
}

View file

@ -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 <http://www.gnu.org/licenses/>.
//! 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<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_session::WeightInfo for WeightInfo<T> {
/// 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))
}
}

View file

@ -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 <http://www.gnu.org/licenses/>.
//! 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<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_storage_providers::weights::WeightInfo for WeightInfo<T> {
/// 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))
}
}

View file

@ -0,0 +1,247 @@
# Validator Set Selection Specification
## Top-32 by Weighted Stake (Continuation of PR #433)
- Status: Draft
- Owners: DataHaven Team
- Last Updated: February 12, 2026
- Depends on: PR #433 (`feat: automated validator set submission with era targeting`)
## 1. Summary
PR #433 introduced era-targeted validator-set submission with a dedicated submitter role and runtime era validation. This spec is a continuation of that work.
This document adds deterministic weighted-stake selection so the outbound validator set is ranked before it is bridged:
1. Ethereum computes weighted stake per operator.
2. Ethereum deterministically sorts operators and selects top candidates.
3. DataHaven enforces a final total active authority cap of 32 after combining whitelisted and external validators.
The era-targeting model from PR #433 remains unchanged.
## 2. Baseline From PR #433
This spec assumes the following behavior already exists:
1. `DataHavenServiceManager.sendNewValidatorSetForEra(uint64 targetEra, ...)` is used for submission.
2. Submission is restricted to `validatorSetSubmitter` (`onlyValidatorSetSubmitter`).
3. `external_index` in the Snowbridge payload is the `targetEra`.
4. DataHaven runtime enforces era validity (`targetEra` old/too-new/duplicate checks).
## 3. Goals
1. Select external validators by weighted stake instead of raw member ordering.
2. Keep selection deterministic (`same chain state -> same selected set`).
3. Preserve PR #433 era-targeting invariants and submitter authorization flow.
4. Enforce total active authority cap = 32 (`whitelisted + external`).
5. Keep payload shape stable unless there is a hard requirement to version it.
## 4. Non-Goals
1. Replacing PR #433 submitter-role model.
2. Changing PR #433 era-target validation semantics.
3. Redesigning Snowbridge transport internals.
4. Changing reward formulas in this spec.
## 5. Current Behavior (Post-PR #433)
### 5.1 Ethereum
`buildNewValidatorSetMessageForEra(targetEra)` gathers all operator-set members with a mapped solochain address and forwards them in that order. There is no stake-based ranking.
### 5.2 Payload
Current payload carries:
1. `validators`
2. `external_index` (interpreted as `targetEra`)
### 5.3 DataHaven Runtime
`set_external_validators_inner()` stores incoming validators and `ExternalIndex`, then era application and validator composition logic consume them.
### 5.4 Limitation
Without stake-aware ordering, high-stake operators may be displaced by lower-stake operators when list size pressure or downstream caps apply.
## 6. Design Decisions
### D1. Do ranking on Ethereum
EigenLayer membership/allocation context is available on Ethereum, so weighted ranking is computed there.
### D2. Keep PR #433 era semantics unchanged
`external_index` must continue to encode `targetEra`. This spec does not repurpose it (no nonce/block-number substitution).
### D3. Deterministic tie-break
For equal weighted stake, lower Ethereum operator address wins.
### D4. Cap applies to total active authorities
Final active validator set must satisfy:
`final_active = take_32(dedupe(whitelisted ++ external_sorted_limited))`
### D5. Strategy multipliers are explicit and default to zero if unset
Multipliers are owner-managed in `strategiesAndMultipliers`. If an entry is unset for a strategy, its effective multiplier is `0` (no weighted contribution).
### D6. Keep strategy list and multipliers in sync
Multiplier lifecycle is tied to strategy lifecycle:
1. Add strategy -> add multiplier in the same call via `IRewardsCoordinatorTypes.StrategyAndMultiplier` struct.
2. Remove strategy -> delete multiplier in the same call.
## 7. Weighted Stake Model
For each operator `o`:
`weightedStake(o) = sum_i( allocatedStake(o, strategy_i) * multiplier(strategy_i) )`
Where:
1. `allocatedStake` comes from EigenLayer allocation data.
2. `multiplier` is a per-strategy weight (no normalization divisor is applied during ranking).
### 7.1 Strategy Weight Semantics
1. Every supported strategy should have an explicit multiplier entry for operational clarity.
2. Missing multiplier entry is treated as `0` multiplier.
3. Multiplier values are managed explicitly by owner/governance.
### 7.2 Unit Assumption
Stake inputs must be unit-consistent across strategies. If they are not, normalize before summing.
## 8. Ethereum Contract Changes (On Top of PR #433)
File: `contracts/src/DataHavenServiceManager.sol`
### 8.1 New State
```solidity
uint32 public constant MAX_ACTIVE_VALIDATORS = 32;
mapping(IStrategy => uint96) public strategiesAndMultipliers;
```
### 8.2 New/Updated Admin APIs
```solidity
function setStrategiesAndMultipliers(IRewardsCoordinatorTypes.StrategyAndMultiplier[] calldata strategyMultipliers) external onlyOwner;
function addStrategiesToValidatorsSupportedStrategies(IRewardsCoordinatorTypes.StrategyAndMultiplier[] calldata strategyMultipliers) external onlyOwner;
function removeStrategiesFromValidatorsSupportedStrategies(IStrategy[] calldata strategies) external onlyOwner;
function getStrategiesAndMultipliers() external view returns (IRewardsCoordinatorTypes.StrategyAndMultiplier[] memory);
```
Using EigenLayer's `StrategyAndMultiplier` struct pairs each strategy with its multiplier, eliminating the possibility of length mismatches between parallel arrays. Duplicate strategies in `addStrategies` are rejected by EigenLayer's `StrategyAlreadyInOperatorSet` check; duplicates in `setStrategiesAndMultipliers` are harmless (last-write-wins on the mapping).
### 8.3 Updated Selection Flow
`buildNewValidatorSetMessageForEra(uint64 targetEra)` should:
1. Read validator operator set members.
2. Compute weighted stake per operator.
3. Filter out operators with no solochain mapping.
4. Resolve multiplier from `strategiesAndMultipliers` for each strategy used.
5. If any strategy is missing a multiplier entry, treat it as `0` multiplier.
6. Filter out operators with zero weighted stake.
7. Select at most `MAX_ACTIVE_VALIDATORS` (32) candidates by weighted stake desc + address asc tie-break (if fewer than 32 eligible candidates exist, include all).
8. Encode using existing payload shape with `externalIndex = targetEra`.
For any EigenLayer call that consumes `StrategyAndMultiplier[]`, materialize the list in ascending strategy-address order.
`sendNewValidatorSetForEra(...)` and `onlyValidatorSetSubmitter` remain unchanged from PR #433.
## 9. Bridge Message Format
No payload version bump in this spec.
Continue using existing `ReceiveValidators` message shape:
```text
[EL_MESSAGE_ID]
[MessageVersion]
[ReceiveValidators]
[validator_count]
[validators (N * 20B)]
[external_index (u64 targetEra)]
```
If stake vectors are required in the future, that should be a separate versioned command proposal.
## 10. DataHaven Runtime Changes
File: `operator/pallets/external-validators/src/lib.rs`
### 10.1 Keep PR #433 era validation
Retain existing target-era gates and error semantics (`TargetEraTooOld`, `TargetEraTooNew`, `DuplicateOrStaleTargetEra`).
### 10.2 Enforce final total cap = 32
At validator composition time:
1. `w = whitelisted.len()`
2. `external_budget = 32.saturating_sub(w)`
3. Use at most `external_budget` external validators from the ranked list.
4. Build final set as `take_32(dedupe(whitelisted ++ external_limited))`.
### 10.3 Runtime constants
`MaxExternalValidators` can remain a defensive bound, but final active enforcement must guarantee max 32 authorities.
## 11. Rollout Plan
1. Merge/deploy PR #433 baseline first (submitter role + era-target checks).
2. Deploy ServiceManager upgrade with weighted ranking logic.
3. Backfill/confirm `strategiesAndMultipliers` for all currently supported strategies.
4. Deploy runtime changes for final total-cap enforcement.
5. Re-run submitter daemon unchanged (it still submits `targetEra = ActiveEra + 1`).
6. Monitor across multiple era cycles before production rollout.
## 12. Testing Plan
### 12.1 Solidity
1. Weighted stake computation across multiple strategies.
2. Deterministic tie-break behavior.
3. Top-32 selection when candidate count exceeds 32.
4. Behavior when candidate count is below 32.
5. Zero-stake filtering.
6. Missing multiplier entries are treated as zero contribution.
7. `addStrategies...` sets multipliers atomically via `StrategyAndMultiplier` struct.
8. `removeStrategies...` removes multiplier entries for removed strategies.
9. `getStrategiesAndMultipliers()` returns a list matching EigenLayer's operator set strategies.
11. Integration with `buildNewValidatorSetMessageForEra(targetEra)` and correct target era encoding.
### 12.2 Runtime
1. Existing PR #433 era-validation tests continue to pass unchanged.
2. Final active authority cap remains <= 32 with mixed whitelisted/external sets.
3. Composition logic preserves whitelisted priority while enforcing cap.
### 12.3 Integration / E2E
1. End-to-end submission through `sendNewValidatorSetForEra` with ranked validator output.
2. Delayed relay still fails with PR #433 semantics (no regressions).
3. Ranked selection outcome is deterministic across repeated runs at fixed state.
## 13. Security Considerations
1. Owner-managed strategy weights are governance-sensitive and should remain multisig/governance controlled.
2. Deterministic ordering prevents non-deterministic set drift.
3. Preserve PR #433 stale/duplicate/too-early rejection invariants.
4. Apply overflow checks in weighted arithmetic and any integer downcasts.
## 14. File Change Summary
1. `contracts/src/DataHavenServiceManager.sol`
- weighted stake computation and deterministic top selection in `buildNewValidatorSetMessageForEra`.
2. `contracts/src/interfaces/IDataHavenServiceManager.sol`
- `strategiesAndMultipliers` naming and add/remove strategy API signature updates with multipliers.
3. `operator/pallets/external-validators/src/lib.rs`
- final authority cap enforcement at composition time (while keeping PR #433 era validation behavior).
4. `contracts/test/*`, `operator/pallets/external-validators/src/tests.rs`, `test/e2e/suites/validator-set-update.test.ts`
- unit/runtime/e2e coverage for weighted selection + strategy/multiplier sync + cap behavior + non-regression on era-targeted flow.

View file

@ -0,0 +1,268 @@
# Validator Set Submission
**Status:** Accepted
**Owner:** DataHaven Protocol / AVS Integration
**Last Updated:** 2026-02-11
**Scope:** Ethereum -> Snowbridge -> DataHaven validator set synchronization
## Background
This specification defines an automation-first validator-set synchronization flow.
In this document:
- the validator-set submitter runs once per era window, and
- each message is valid only for the immediate next era.
The primary objective is to run an off-chain validator-set-submitter that automatically calls validator-set submission without manual intervention.
The design is:
1. Validator-set messages are permissioned on Ethereum by a dedicated submitter role.
2. The payload field `external_index` is used as `targetEra` (the era the message is intended for).
3. DataHaven accepts a message only if it targets the next era at receive time.
4. Delayed messages for past eras are rejected and never applied to later eras.
This enforces the invariant: **at most one canonical validator-set apply per target era, and no late-era spillover**.
### Current mechanism (as-is)
- Manual and one-shot submission flow is done via `test/scripts/update-validator-set.ts`.
- `sendNewValidatorSet(uint128 executionFee, uint128 relayerFee)` in `contracts/src/DataHavenServiceManager.sol` is owner-only.
- Message building currently does not carry explicit era intent.
- DataHaven inbound processing applies decoded `external_index` without era-target validation.
- Operational flow relies on fixed fee constants and has no automated submission pipeline.
## Problems addressed by this spec
- Manual operation for validator-set submission.
- Late relay can cause old messages to arrive after their intended era.
- Ambiguity between "message order" and "era intent".
- Owner-key usage for routine automated submissions.
## Goals
1. Run an off-chain component that automatically submits validator-set updates in the required era window.
2. Ensure each message is explicitly bound to a specific target era.
3. Accept a message only when it targets the immediate next era.
4. Reject delayed (past-era), duplicate, and too-far-ahead messages deterministically.
5. Accept that a failed submission for a given era is permanently missed (single submission window per era).
6. Avoid skipping era advancement even when validator addresses are unchanged.
### Non-goals
- Redesigning Snowbridge protocol internals.
- Replacing the existing owner/governance model outside submitter assignment.
- Building a multi-node HA control plane (single submitter process is acceptable initially).
## Terminology
- `ActiveEra`: era currently active on DataHaven.
- `NextEra`: `ActiveEra + 1`.
- `targetEra`: era this validator-set message is intended for.
- `external_index`: payload field; in this design, its value is `targetEra`.
- `ExternalIndex`: latest bridge-received `targetEra` accepted on DataHaven.
- `PendingExternalIndex`: staged external index applied when the next era starts.
- `CurrentExternalIndex`: external index currently applied to the active era.
- `Canonical apply`: the accepted validator-set apply for a specific `targetEra`.
## Proposed design
### High-level overview
The solution centers on a long-running off-chain validator-set-submitter under `test/tools/` that automatically submits validator-set updates.
Contract and runtime changes make the submitter service safe and deterministic:
- only the submitter role can send validator-set messages,
- payloads include explicit era intent (`targetEra`), and
- DataHaven accepts only messages targeting `NextEra`.
The submitter subscribes to finalized session changes via PAPI's `watchValue("finalized")` on `Session.CurrentIndex`. On each session change it evaluates whether submission is needed, and acts during the last session of the active era. Each era gets a single submission attempt — if it fails, the era is missed and the submitter moves on.
```
┌───────────────────────────────┐ submit (for era) ┌───────────────────────────────┐
│ Validator-Set-Submitter │ ──────────────────────────► │ ServiceManager (Ethereum) │
│ - watches session changes │ │ - submitter-gated API │
│ - computes targetEra │ │ - builds payload with target │
│ - single attempt per era │ └───────────────┬───────────────┘
└───────────────────────────────┘ │
│ Snowbridge message
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ DataHaven inbound (`operator/primitives/bridge`) + external validators pallet │
│ - authorized origin check │
│ - era gate: targetEra == ActiveEra + 1 │
│ - duplicate/stale gate: targetEra > ExternalIndex │
│ - delayed messages for past eras are rejected │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
```
### A) Ethereum contract changes
**Target contract**
- `contracts/src/DataHavenServiceManager.sol`
**Permissioned submitter role**
- Add state:
- `address public validatorSetSubmitter`
- Add admin API:
- `setValidatorSetSubmitter(address newSubmitter) external onlyOwner`
- `newSubmitter` MUST be non-zero
- emit `ValidatorSetSubmitterUpdated(oldSubmitter, newSubmitter)`
- Add modifier:
- `onlyValidatorSetSubmitter` (revert unless `msg.sender == validatorSetSubmitter`)
**Era-targeted submission**
- Add submission API:
- `sendNewValidatorSetForEra(uint64 targetEra, uint128 executionFee, uint128 relayerFee) external payable onlyValidatorSetSubmitter`
- builds validator payload with `targetEra`
- calls gateway `v2_sendMessage`
- emits `ValidatorSetMessageSubmitted`
- Add builder API:
- `buildNewValidatorSetMessageForEra(uint64 targetEra) public view returns (bytes memory)`
- encodes `targetEra` as `external_index`
**Legacy submission path**
- Legacy `sendNewValidatorSet(uint128,uint128)` must be removed from the production contract.
**Contract-side trust scope (this release)**
- No additional `lastSubmittedTargetEra` contract guard is required in this release.
- Rationale: submission is permissioned and runtime is the source of truth for era correctness (`targetEra == ActiveEra + 1`).
**Events**
- `event ValidatorSetSubmitterUpdated(address indexed oldSubmitter, address indexed newSubmitter);`
- `event ValidatorSetMessageSubmitted(uint64 indexed targetEra, bytes32 payloadHash, address indexed submitter);`
### B) Runtime changes (DataHaven)
**Target processor**
- `operator/primitives/bridge/src/lib.rs` in `EigenLayerMessageProcessor::process_message`
**Era-target validation rule**
Before `set_external_validators_inner`, validate `targetEra`:
1. Must satisfy `targetEra == ActiveEra + 1`
2. Must satisfy `targetEra > ExternalIndex` (dedupe/stale guard)
Reject cases:
- `targetEra <= ActiveEra`: delayed/past-era message.
- `targetEra > ActiveEra + 1`: too-far-ahead message.
- `targetEra <= ExternalIndex`: stale/duplicate message.
This ensures a delayed message cannot be applied to a later era.
**Error semantics**
Return deterministic dispatch errors, for example:
- `TargetEraTooOld`
- `TargetEraTooNew`
- `DuplicateOrStaleTargetEra`
**Authorization**
- Keep existing authorized-origin checks unchanged.
### C) Validator-set-submitter service (`test/tools/`)
**Location and runtime model**
- New component at `test/tools/validator-set-submitter/`
- Long-running daemon
- TypeScript + Bun
**Authoritative inputs**
- DataHaven:
- `ActiveEra`
- `ExternalIndex`
- `CurrentExternalIndex`
- `SessionsPerEra` and era-window session boundaries
- Ethereum:
- current validator set view from ServiceManager message-builder inputs
**Target era computation**
- `targetEra = ActiveEra + 1`
**Submission model**
- Submitter subscribes to finalized `Session.CurrentIndex` via PAPI `watchValue("finalized")`.
- On each session change, evaluates preconditions: `ActiveEra` set, `targetEra` not already processed, `ExternalIndex < targetEra`, and current session is the last session of the era.
- One submission attempt per era window. If the attempt fails (revert, missing event, or error), the era is marked as processed and permanently missed.
- Rationale: `validate_target_era` on the Substrate side rejects `targetEra <= activeEraIndex`, so once `ActiveEra` advances past the target, retries are impossible.
- Overlapping session emissions are dropped via RxJS `exhaustMap`.
**Delay/gap behavior (required)**
- If message for era `N` is delayed and arrives after `ActiveEra >= N`, it is rejected.
- If message for era `N` never relays, the system can still proceed by submitting for era `N+1` when `ActiveEra = N`.
- Out-of-order future messages are rejected until they become the next era target.
**Success criteria**
- Transaction receipt status is `success`.
- `OutboundMessageAccepted` event emitted in receipt logs.
**State model**
- Submitter is recoverable from chain state (reads `ActiveEra`, `ExternalIndex`, and session boundaries on each tick).
- In-memory state is limited to `submittedEra` (the last processed target era), held in a closure.
## API / interface changes
### Ethereum interface
- Add era-targeted submit function.
- Add submitter admin function + getter.
- Add era-targeted builder function.
### DataHaven runtime behavior
- Add next-era-only acceptance in inbound bridge path.
- Add explicit delayed/too-early/duplicate rejection paths.
### Tooling
- New daemon CLI entrypoint:
- `bun test/tools/validator-set-submitter/main.ts run`
- optional `--dry-run`
## Security considerations
- Submitter key compromise risk is reduced by dedicated role separation (vs broad owner use).
- Era-target checks prevent delayed-message replay into later eras.
- Authorized-origin restriction remains required and unchanged.
- Single-attempt model eliminates fee burn loops; a failed era is missed rather than retried.
## Observability and operations
Required metrics/log dimensions:
- `targetEra`
- current `ActiveEra` and `ExternalIndex`
- current session index
- outbound tx hash
- fee pair used
- submission outcome (success / revert / missing event / error)
Alert conditions:
- missed submission window (failed attempt logged as "era will be missed")
- repeated era misses across consecutive eras
- subscription errors on `Session.CurrentIndex`
## Testing
### Solidity tests
- submitter-only enforcement
- submitter rotation by owner
- payload encodes caller `targetEra`
- event fields emitted correctly
- zero-address submitter rejected
- legacy `sendNewValidatorSet` path is removed (no callable legacy submit path)
### Runtime tests
- accepts only `targetEra == ActiveEra + 1`
- rejects `targetEra <= ActiveEra` (late)
- rejects `targetEra > ActiveEra + 1` (too early)
- rejects `targetEra <= ExternalIndex` (duplicate/stale)
- origin authorization behavior unchanged
### Integration tests
- one canonical apply per target era
- delayed message for old era is rejected after era advances
- missing relay for era `N` does not block acceptance for era `N+1` when it becomes next
- boundary race: arrival at era transition behaves correctly (`N` stale, `N+1` accepted)
## Rollout
1. Implement and test contract + runtime changes.
2. Deploy to stagenet.
3. Run submitter service in dry-run mode and validate era-target decisions.
4. Enable active mode.
5. Monitor across multiple era cycles.
6. Promote to mainnet after stability criteria are met.
## Dependencies
- Existing manual script `test/scripts/update-validator-set.ts` may remain for emergency/manual use, but must be marked non-canonical.
- Legacy unscoped submit path `sendNewValidatorSet` must be removed in production.
## Possible improvements (future)
- Keep this release simple: `external_index` carries `targetEra`, and runtime enforces next-era-only acceptance.
- Add a generalized failure-handling strategy for the submitter, including retry behavior for transient issues while preserving safety and idempotency.
- Add generalized resiliency for event watching and connectivity, including recovery after disconnects and missed updates.
- Add production monitoring and operations dashboards (for example Prometheus/Grafana) covering service health, submission outcomes, retries, missed eras, and end-to-end latency.
- Add alerting/SLO definitions for validator-set submission reliability and response runbooks for incidents.
- Alternative direction: remove era dependency from payload and use an Ethereum-stamped freshness model:
- `ServiceManager` assigns message metadata on-chain (e.g., `issuedAt` timestamp and monotonic message nonce/ID).
- DataHaven accepts only fresh messages within a configured max relay delay and rejects expired ones.
- This reduces trust in submitter-provided era values while preserving deterministic stale/duplicate rejection.
## Acceptance criteria
This spec is accepted when:
- an off-chain validator-set-submitter runs unattended and automatically submits validator-set updates
- dedicated submitter role exists and is enforced
- era-targeted submission API is live
- runtime applies messages only when they target the next era
- delayed messages for past eras are rejected and not applied to later eras
- end-to-end tests pass for delayed/missing/out-of-order scenarios

View file

@ -1,5 +1,5 @@
{
"version": "0.1.0-autogenerated.14314240478086326730",
"version": "0.1.0-autogenerated.13357056092938763018",
"name": "@polkadot-api/descriptors",
"files": [
"dist"

Binary file not shown.

View file

@ -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<BeefyCheckpointData> => {
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<void> => {
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<void> => {
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<void> => {
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
});
};

Some files were not shown because too many files have changed in this diff Show more