diff --git a/clients/tfchain-client-go/events.go b/clients/tfchain-client-go/events.go index 2538fa374..70f462826 100644 --- a/clients/tfchain-client-go/events.go +++ b/clients/tfchain-client-go/events.go @@ -107,6 +107,34 @@ type TwinAccountBounded struct { Topics []types.Hash } +// Twin transfer events +type TwinTransferRequested struct { + Phase types.Phase + RequestID types.U64 `json:"request_id"` + TwinID types.U32 `json:"twin_id"` + From AccountID `json:"from"` + To AccountID `json:"to"` + Topics []types.Hash +} + +type TwinOwnershipTransferred struct { + Phase types.Phase + RequestID types.U64 `json:"request_id"` + TwinID types.U32 `json:"twin_id"` + From AccountID `json:"from"` + To AccountID `json:"to"` + Topics []types.Hash +} + +type TwinTransferCanceled struct { + Phase types.Phase + RequestID types.U64 `json:"request_id"` + TwinID types.U32 `json:"twin_id"` + From AccountID `json:"from"` + To AccountID `json:"to"` + Topics []types.Hash +} + // numeric enum for unit type Unit byte @@ -414,12 +442,15 @@ type EventRecords struct { TfgridModule_EntityDeleted []EntityDeleted //nolint:stylecheck,golint // twin events - TfgridModule_TwinStored []TwinStored //nolint:stylecheck,golint - TfgridModule_TwinUpdated []TwinStored //nolint:stylecheck,golint - TfgridModule_TwinDeleted []TwinDeleted //nolint:stylecheck,golint - TfgridModule_TwinEntityStored []TwinEntityStored //nolint:stylecheck,golint - TfgridModule_TwinEntityRemoved []TwinEntityRemoved //nolint:stylecheck,golint - TfgridModule_TwinAccountBounded []TwinAccountBounded //nolint:stylecheck,golint + TfgridModule_TwinStored []TwinStored //nolint:stylecheck,golint + TfgridModule_TwinUpdated []TwinStored //nolint:stylecheck,golint + TfgridModule_TwinDeleted []TwinDeleted //nolint:stylecheck,golint + TfgridModule_TwinEntityStored []TwinEntityStored //nolint:stylecheck,golint + TfgridModule_TwinEntityRemoved []TwinEntityRemoved //nolint:stylecheck,golint + TfgridModule_TwinAccountBounded []TwinAccountBounded //nolint:stylecheck,golint + TfgridModule_TwinTransferRequested []TwinTransferRequested //nolint:stylecheck,golint + TfgridModule_TwinOwnershipTransferred []TwinOwnershipTransferred //nolint:stylecheck,golint + TfgridModule_TwinTransferCanceled []TwinTransferCanceled //nolint:stylecheck,golint // policy events TfgridModule_PricingPolicyStored []PricingPolicyStored //nolint:stylecheck,golint diff --git a/docs/architecture/0024-twin-ownership-transfer.md b/docs/architecture/0024-twin-ownership-transfer.md new file mode 100644 index 000000000..d8f15a060 --- /dev/null +++ b/docs/architecture/0024-twin-ownership-transfer.md @@ -0,0 +1,81 @@ +# 24. Twin Ownership Transfer in pallet-tfgrid + +Date: 2025-09-03 + +## Status + +Accepted + +## Context + +Operators occasionally need to transfer ownership of an existing Twin to a different account (e.g., organization handover, compromised keys, or account restructuring). +Previously there was no safe, on-chain mediated process to move Twin ownership while preserving accounting invariants and preventing hijacks. + +## Decision + +Introduce a simple two-step transfer protocol implemented in `pallet-tfgrid` that: + +- Requires the current (old) owner to initiate and specify the intended new account. +- Enforces that the new account has accepted Terms & Conditions and does not already own a Twin. +- Requires explicit acceptance by the new account. +- Allows the current owner to cancel a pending request at any time. +- Repatriates all reserved balance from old owner to new owner on acceptance. + +### Dispatchables + +- `request_twin_transfer(origin=old_account, new_account)` + - Origin is the current (old) owner. + - Validates preconditions and creates a pending transfer. + - Emits `TwinTransferRequested { request_id, twin_id, from, to }`. + +- `accept_twin_transfer(origin=new_account, request_id)` + - Origin must be the intended new owner. + - Moves reserved balance from old to new as reserved, updates Twin owner and indexes, and completes the request. + - Emits `TwinOwnershipTransferred { request_id, twin_id, from, to }` and `TwinUpdated(Twin)`. + +- `cancel_twin_transfer(origin=old_account, request_id)` + - Origin must be the current (old) owner. + - Cancels and removes the pending request. + - Emits `TwinTransferCanceled { request_id, twin_id, from, to }`. + +### Storage + +- `TwinTransferRequests: RequestId -> TwinTransferRequest` (twin_id, from, to, created_at) +- `PendingTransferByTwin: TwinId -> RequestId` (enforces one pending request per Twin) +- `TwinTransferRequestID: u64` (monotonic counter) + +### Types + +- `TwinTransferRequest` includes `from: AccountId`, `to: AccountId`, and `created_at: BlockNumber` to record when the request was created. + - There is no expiry logic in v1. + - Future cleaners (on_finalize/offchain) can use `created_at` to remove stale items if desired. + +### Errors and Semantics + +- Request flow is capped at one request per twin. If a request already exists, `request_twin_transfer` returns a single error: + - `TwinTransferPendingExists` ("cancel the existing request first") +- Accept flow has no expiry checks; presence of a matching request and correct signer are sufficient. +- Cancel flow always succeeds for the old owner: + - Removes the request and emits `TwinTransferCanceled`. + +## Security Considerations + +- Current owner cannot push a transfer without new account cooperation (accept step by new account is required). +- New account must have signed T&C and must not own another Twin (prevents multi-ownership and aligns with usage rules). +- Owner can cancel any time to unblock. +- On acceptance, reserved balance is repatriated using `repatriate_reserved(..., BalanceStatus::Reserved)`; failures are tolerated but the pallet attempts best-effort transfer before ownership move. + +## Consequences + +- Clear, auditable transfer trail via events. +- Compatible with existing Twin lifecycle; no changes to Twin schema. + +## Backwards Compatibility & Migration + +- New storage items are additive. +- No migration of existing state required. + +## References + +- Implementation: `substrate-node/pallets/pallet-tfgrid/src/twin_transfer.rs` +- Extrinsics wiring: `substrate-node/pallets/pallet-tfgrid/src/lib.rs` (call_index 40, 41, 42) diff --git a/docs/misc/twin_transfer.md b/docs/misc/twin_transfer.md new file mode 100644 index 000000000..76ddc316b --- /dev/null +++ b/docs/misc/twin_transfer.md @@ -0,0 +1,53 @@ +# Twin Ownership Transfer + +This document explains the twin ownership transfer flow in the `pallet-tfgrid` pallet and the main events and errors. + +## Overview + +- The current (old) owner initiates the transfer via `request_twin_transfer(new_account)`. +- The prospective new owner accepts via `accept_twin_transfer(request_id)`. +- The current owner may cancel via `cancel_twin_transfer(request_id)`. +- On success, ownership of the twin moves to the new account, reserved balances are repatriated, and indices are updated. + +## Dispatchables + +- request_twin_transfer(origin=old_owner, new_account) + - Origin (signer) is the current (old) owner; `twin_id` is derived from the signer. + - Emits `TwinTransferRequested { request_id, twin_id, from, to }`. +- accept_twin_transfer(origin=new_account, request_id) + - Origin must be the intended new owner of the twin. + - Emits `TwinOwnershipTransferred { request_id, twin_id, from, to }` and `TwinUpdated(Twin)`. +- cancel_twin_transfer(origin=old_owner, request_id) + - Origin must be the current (old) owner of the twin. + - Emits `TwinTransferCanceled { request_id, twin_id, from, to }`. + +## Preconditions + +- Twin must exist. +- New account must have accepted Terms & Conditions (`user_accept_tc`). +- New account must not already own a twin. +- Only one pending transfer per twin. + +## Common Errors + +- UserDidNotSignTermsAndConditions: new account did not accept T&C. +- TwinTransferNewAccountHasTwin: new account already has a twin. +- TwinTransferPendingExists: a pending transfer already exists for this twin. +- TwinTransferRequestNotFound: request ID does not exist. +- UnauthorizedToUpdateTwin: signer is not authorized for this action. + +## Events + +- TwinTransferRequested { request_id, twin_id, from, to } +- TwinOwnershipTransferred { request_id, twin_id, from, to } +- TwinTransferCanceled { request_id, twin_id, from, to } +- TwinUpdated(Twin) + +## Storage + +- `TwinTransferRequests: RequestId -> TwinTransferRequest` where `TwinTransferRequest { twin_id, from, to, created_at }`. +- `PendingTransferByTwin: TwinId -> RequestId` enforces at most one pending transfer per twin. + +## Notes + +- Reserved balance of the old owner is repatriated to the new owner as reserved during acceptance. diff --git a/substrate-node/Cargo.lock b/substrate-node/Cargo.lock index 830c5bcd2..e7d9fb2d1 100644 --- a/substrate-node/Cargo.lock +++ b/substrate-node/Cargo.lock @@ -4632,6 +4632,7 @@ dependencies = [ "frame-support", "frame-system", "log", + "pallet-balances", "pallet-collective", "pallet-membership", "pallet-tfgrid", diff --git a/substrate-node/pallets/pallet-burning/src/weights.rs b/substrate-node/pallets/pallet-burning/src/weights.rs index af9393c3e..c319c57ae 100644 --- a/substrate-node/pallets/pallet-burning/src/weights.rs +++ b/substrate-node/pallets/pallet-burning/src/weights.rs @@ -2,9 +2,9 @@ //! Autogenerated weights for pallet_burning //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2024-10-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2025-09-15, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `585a9f003813`, CPU: `AMD Ryzen 7 5800X 8-Core Processor` +//! HOSTNAME: `ebea9d7a9918`, CPU: `AMD Ryzen 7 5800X 8-Core Processor` //! EXECUTION: , WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: @@ -45,8 +45,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `109` // Estimated: `1594` - // Minimum execution time: 27_051_000 picoseconds. - Weight::from_parts(27_762_000, 1594) + // Minimum execution time: 26_060_000 picoseconds. + Weight::from_parts(26_561_000, 1594) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -60,8 +60,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `109` // Estimated: `1594` - // Minimum execution time: 27_051_000 picoseconds. - Weight::from_parts(27_762_000, 1594) + // Minimum execution time: 26_060_000 picoseconds. + Weight::from_parts(26_561_000, 1594) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } diff --git a/substrate-node/pallets/pallet-dao/Cargo.toml b/substrate-node/pallets/pallet-dao/Cargo.toml index 343521909..d051c3d7d 100644 --- a/substrate-node/pallets/pallet-dao/Cargo.toml +++ b/substrate-node/pallets/pallet-dao/Cargo.toml @@ -35,6 +35,7 @@ pallet-tfgrid.workspace = true [dev-dependencies] sp-core.workspace = true env_logger = "*" +pallet-balances.workspace = true [features] default = ["std"] @@ -49,6 +50,7 @@ std = [ "pallet-membership/std", "pallet-collective/std", "pallet-timestamp/std", + "pallet-balances/std", "pallet-tfgrid/std", "tfchain-support/std", "scale-info/std", diff --git a/substrate-node/pallets/pallet-dao/src/mock.rs b/substrate-node/pallets/pallet-dao/src/mock.rs index c59aedd98..7f2cf818d 100644 --- a/substrate-node/pallets/pallet-dao/src/mock.rs +++ b/substrate-node/pallets/pallet-dao/src/mock.rs @@ -1,7 +1,6 @@ use crate::{self as pallet_dao}; use frame_support::{construct_runtime, parameter_types, traits::ConstU32, BoundedVec}; use frame_system::EnsureRoot; -use pallet_collective; use pallet_tfgrid::{ farm::FarmName, interface::{InterfaceIp, InterfaceMac, InterfaceName}, @@ -10,7 +9,6 @@ use pallet_tfgrid::{ CityNameInput, CountryNameInput, DocumentHashInput, DocumentLinkInput, Gw4Input, Ip4Input, LatitudeInput, LongitudeInput, PkInput, RelayInput, }; -use pallet_timestamp; use sp_core::H256; use sp_runtime::{ traits::{BlakeTwo256, IdentityLookup}, @@ -28,6 +26,7 @@ construct_runtime!( { System: frame_system::{Pallet, Call, Config, Storage, Event}, DaoModule: pallet_dao::pallet::{Pallet, Call, Storage, Event}, + Balances: pallet_balances::{Pallet, Call, Storage, Config, Event}, TfgridModule: pallet_tfgrid::{Pallet, Call, Storage, Event}, Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent}, Council: pallet_collective::::{Pallet, Call, Origin, Event, Config}, @@ -58,13 +57,40 @@ impl frame_system::Config for TestRuntime { type PalletInfo = PalletInfo; type OnNewAccount = (); type OnKilledAccount = (); - type AccountData = (); + type AccountData = pallet_balances::AccountData; type SystemWeightInfo = (); type SS58Prefix = (); type OnSetCode = (); type MaxConsumers = ConstU32<16>; } +// Balances pallet configuration for the mock runtime +pub const EXISTENTIAL_DEPOSIT: u64 = 500; + +parameter_types! { + pub const MaxLocks: u32 = 50; + pub const MaxReserves: u32 = 50; + pub const ExistentialDepositBalance: u64 = EXISTENTIAL_DEPOSIT; +} + +impl pallet_balances::Config for TestRuntime { + type MaxLocks = MaxLocks; + type MaxReserves = MaxReserves; + type ReserveIdentifier = [u8; 8]; + /// The type for recording an account's balance. + type Balance = u64; + /// The ubiquitous event type. + type RuntimeEvent = RuntimeEvent; + type DustRemoval = (); + type ExistentialDeposit = ExistentialDepositBalance; + type AccountStore = System; + type WeightInfo = pallet_balances::weights::SubstrateWeight; + type FreezeIdentifier = (); + type MaxFreezes = (); + type RuntimeHoldReason = (); + type MaxHolds = (); +} + pub type BlockNumber = u32; parameter_types! { pub const DaoMotionDuration: BlockNumber = 4; @@ -156,6 +182,7 @@ impl pallet_tfgrid::Config for TestRuntime { type Location = TestLocation; type SerialNumber = TestSerialNumber; type TimestampHintDrift = TimestampHintDrift; + type Currency = Balances; } impl pallet_timestamp::Config for TestRuntime { diff --git a/substrate-node/pallets/pallet-dao/src/weights.rs b/substrate-node/pallets/pallet-dao/src/weights.rs index 8455b96c3..b97ec0112 100644 --- a/substrate-node/pallets/pallet-dao/src/weights.rs +++ b/substrate-node/pallets/pallet-dao/src/weights.rs @@ -2,9 +2,9 @@ //! Autogenerated weights for pallet_dao //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2024-10-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2025-09-15, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `585a9f003813`, CPU: `AMD Ryzen 7 5800X 8-Core Processor` +//! HOSTNAME: `ebea9d7a9918`, CPU: `AMD Ryzen 7 5800X 8-Core Processor` //! EXECUTION: , WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: @@ -58,8 +58,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `208` // Estimated: `4687` - // Minimum execution time: 19_757_000 picoseconds. - Weight::from_parts(20_439_000, 4687) + // Minimum execution time: 18_274_000 picoseconds. + Weight::from_parts(18_706_000, 4687) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -77,8 +77,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `979` // Estimated: `4444` - // Minimum execution time: 26_691_000 picoseconds. - Weight::from_parts(27_332_000, 4444) + // Minimum execution time: 24_997_000 picoseconds. + Weight::from_parts(25_498_000, 4444) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -92,8 +92,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `487` // Estimated: `4687` - // Minimum execution time: 18_845_000 picoseconds. - Weight::from_parts(19_287_000, 4687) + // Minimum execution time: 17_904_000 picoseconds. + Weight::from_parts(18_395_000, 4687) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -111,8 +111,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `521` // Estimated: `4687` - // Minimum execution time: 25_638_000 picoseconds. - Weight::from_parts(26_180_000, 4687) + // Minimum execution time: 24_947_000 picoseconds. + Weight::from_parts(26_390_000, 4687) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -136,8 +136,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `208` // Estimated: `4687` - // Minimum execution time: 19_757_000 picoseconds. - Weight::from_parts(20_439_000, 4687) + // Minimum execution time: 18_274_000 picoseconds. + Weight::from_parts(18_706_000, 4687) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } @@ -155,8 +155,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `979` // Estimated: `4444` - // Minimum execution time: 26_691_000 picoseconds. - Weight::from_parts(27_332_000, 4444) + // Minimum execution time: 24_997_000 picoseconds. + Weight::from_parts(25_498_000, 4444) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -170,8 +170,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `487` // Estimated: `4687` - // Minimum execution time: 18_845_000 picoseconds. - Weight::from_parts(19_287_000, 4687) + // Minimum execution time: 17_904_000 picoseconds. + Weight::from_parts(18_395_000, 4687) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -189,8 +189,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `521` // Estimated: `4687` - // Minimum execution time: 25_638_000 picoseconds. - Weight::from_parts(26_180_000, 4687) + // Minimum execution time: 24_947_000 picoseconds. + Weight::from_parts(26_390_000, 4687) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } diff --git a/substrate-node/pallets/pallet-kvstore/src/weights.rs b/substrate-node/pallets/pallet-kvstore/src/weights.rs index db54cbf85..df9f5ae3f 100644 --- a/substrate-node/pallets/pallet-kvstore/src/weights.rs +++ b/substrate-node/pallets/pallet-kvstore/src/weights.rs @@ -2,9 +2,9 @@ //! Autogenerated weights for pallet_kvstore //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2024-10-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2025-09-15, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `585a9f003813`, CPU: `AMD Ryzen 7 5800X 8-Core Processor` +//! HOSTNAME: `ebea9d7a9918`, CPU: `AMD Ryzen 7 5800X 8-Core Processor` //! EXECUTION: , WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: @@ -46,8 +46,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_903_000 picoseconds. - Weight::from_parts(7_153_000, 0) + // Minimum execution time: 6_833_000 picoseconds. + Weight::from_parts(7_104_000, 0) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: `TFKVStore::TFKVStore` (r:1 w:1) @@ -56,8 +56,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `146` // Estimated: `3611` - // Minimum execution time: 12_274_000 picoseconds. - Weight::from_parts(12_734_000, 3611) + // Minimum execution time: 11_963_000 picoseconds. + Weight::from_parts(12_283_000, 3611) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -71,8 +71,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_903_000 picoseconds. - Weight::from_parts(7_153_000, 0) + // Minimum execution time: 6_833_000 picoseconds. + Weight::from_parts(7_104_000, 0) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// Storage: `TFKVStore::TFKVStore` (r:1 w:1) @@ -81,8 +81,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `146` // Estimated: `3611` - // Minimum execution time: 12_274_000 picoseconds. - Weight::from_parts(12_734_000, 3611) + // Minimum execution time: 11_963_000 picoseconds. + Weight::from_parts(12_283_000, 3611) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } diff --git a/substrate-node/pallets/pallet-smart-contract/src/mock.rs b/substrate-node/pallets/pallet-smart-contract/src/mock.rs index e19775bb9..3863acfd8 100644 --- a/substrate-node/pallets/pallet-smart-contract/src/mock.rs +++ b/substrate-node/pallets/pallet-smart-contract/src/mock.rs @@ -244,6 +244,7 @@ impl pallet_tfgrid::Config for TestRuntime { type Location = TestLocation; type SerialNumber = TestSerialNumber; type TimestampHintDrift = TimestampHintDrift; + type Currency = Balances; } impl pallet_tft_price::Config for TestRuntime { diff --git a/substrate-node/pallets/pallet-smart-contract/src/weights.rs b/substrate-node/pallets/pallet-smart-contract/src/weights.rs index aeede7066..fc3e7c640 100644 --- a/substrate-node/pallets/pallet-smart-contract/src/weights.rs +++ b/substrate-node/pallets/pallet-smart-contract/src/weights.rs @@ -2,9 +2,9 @@ //! Autogenerated weights for pallet_smart_contract //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2024-10-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2025-09-15, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `585a9f003813`, CPU: `AMD Ryzen 7 5800X 8-Core Processor` +//! HOSTNAME: `ebea9d7a9918`, CPU: `AMD Ryzen 7 5800X 8-Core Processor` //! EXECUTION: , WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: @@ -95,8 +95,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `868` // Estimated: `4333` - // Minimum execution time: 48_471_000 picoseconds. - Weight::from_parts(49_253_000, 4333) + // Minimum execution time: 47_449_000 picoseconds. + Weight::from_parts(48_522_000, 4333) .saturating_add(T::DbWeight::get().reads(12_u64)) .saturating_add(T::DbWeight::get().writes(8_u64)) } @@ -110,8 +110,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `869` // Estimated: `4334` - // Minimum execution time: 23_585_000 picoseconds. - Weight::from_parts(24_016_000, 4334) + // Minimum execution time: 22_553_000 picoseconds. + Weight::from_parts(23_053_000, 4334) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -149,8 +149,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1650` // Estimated: `7590` - // Minimum execution time: 77_096_000 picoseconds. - Weight::from_parts(78_488_000, 7590) + // Minimum execution time: 73_609_000 picoseconds. + Weight::from_parts(74_771_000, 7590) .saturating_add(T::DbWeight::get().reads(13_u64)) .saturating_add(T::DbWeight::get().writes(7_u64)) } @@ -174,8 +174,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `340` // Estimated: `3805` - // Minimum execution time: 24_797_000 picoseconds. - Weight::from_parts(25_157_000, 3805) + // Minimum execution time: 24_006_000 picoseconds. + Weight::from_parts(24_456_000, 3805) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -201,8 +201,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `949` // Estimated: `4414` - // Minimum execution time: 51_929_000 picoseconds. - Weight::from_parts(53_511_000, 4414) + // Minimum execution time: 50_195_000 picoseconds. + Weight::from_parts(51_317_000, 4414) .saturating_add(T::DbWeight::get().reads(8_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -224,8 +224,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1286` // Estimated: `4751` - // Minimum execution time: 38_173_000 picoseconds. - Weight::from_parts(38_663_000, 4751) + // Minimum execution time: 36_339_000 picoseconds. + Weight::from_parts(36_919_000, 4751) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -241,8 +241,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `765` // Estimated: `4230` - // Minimum execution time: 23_385_000 picoseconds. - Weight::from_parts(23_876_000, 4230) + // Minimum execution time: 22_412_000 picoseconds. + Weight::from_parts(23_384_000, 4230) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -272,8 +272,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `776` // Estimated: `4241` - // Minimum execution time: 34_906_000 picoseconds. - Weight::from_parts(35_367_000, 4241) + // Minimum execution time: 33_453_000 picoseconds. + Weight::from_parts(34_145_000, 4241) .saturating_add(T::DbWeight::get().reads(9_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -309,8 +309,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1607` // Estimated: `7547` - // Minimum execution time: 72_007_000 picoseconds. - Weight::from_parts(73_199_000, 7547) + // Minimum execution time: 70_012_000 picoseconds. + Weight::from_parts(71_505_000, 7547) .saturating_add(T::DbWeight::get().reads(14_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -322,8 +322,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `37` // Estimated: `1522` - // Minimum execution time: 9_798_000 picoseconds. - Weight::from_parts(10_129_000, 1522) + // Minimum execution time: 9_618_000 picoseconds. + Weight::from_parts(10_009_000, 1522) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -333,8 +333,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `215` // Estimated: `3680` - // Minimum execution time: 12_794_000 picoseconds. - Weight::from_parts(12_955_000, 3680) + // Minimum execution time: 12_484_000 picoseconds. + Weight::from_parts(12_854_000, 3680) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -374,8 +374,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `2077` // Estimated: `8017` - // Minimum execution time: 87_206_000 picoseconds. - Weight::from_parts(88_408_000, 8017) + // Minimum execution time: 83_768_000 picoseconds. + Weight::from_parts(85_121_000, 8017) .saturating_add(T::DbWeight::get().reads(17_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -389,8 +389,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `395` // Estimated: `6335` - // Minimum execution time: 18_244_000 picoseconds. - Weight::from_parts(18_726_000, 6335) + // Minimum execution time: 17_804_000 picoseconds. + Weight::from_parts(18_284_000, 6335) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -402,8 +402,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `489` // Estimated: `3954` - // Minimum execution time: 16_522_000 picoseconds. - Weight::from_parts(16_892_000, 3954) + // Minimum execution time: 15_980_000 picoseconds. + Weight::from_parts(16_271_000, 3954) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -415,8 +415,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `489` // Estimated: `3954` - // Minimum execution time: 16_201_000 picoseconds. - Weight::from_parts(16_482_000, 3954) + // Minimum execution time: 15_880_000 picoseconds. + Weight::from_parts(16_190_000, 3954) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -428,8 +428,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `502` // Estimated: `3967` - // Minimum execution time: 16_461_000 picoseconds. - Weight::from_parts(16_982_000, 3967) + // Minimum execution time: 16_311_000 picoseconds. + Weight::from_parts(16_672_000, 3967) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -441,8 +441,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `502` // Estimated: `3967` - // Minimum execution time: 17_202_000 picoseconds. - Weight::from_parts(17_463_000, 3967) + // Minimum execution time: 16_271_000 picoseconds. + Weight::from_parts(17_142_000, 3967) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -454,8 +454,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `502` // Estimated: `3967` - // Minimum execution time: 15_760_000 picoseconds. - Weight::from_parts(16_351_000, 3967) + // Minimum execution time: 15_620_000 picoseconds. + Weight::from_parts(15_930_000, 3967) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -473,8 +473,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `841` // Estimated: `6781` - // Minimum execution time: 28_654_000 picoseconds. - Weight::from_parts(29_275_000, 6781) + // Minimum execution time: 28_193_000 picoseconds. + Weight::from_parts(28_955_000, 6781) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -484,8 +484,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `37` // Estimated: `1522` - // Minimum execution time: 7_474_000 picoseconds. - Weight::from_parts(7_865_000, 1522) + // Minimum execution time: 7_585_000 picoseconds. + Weight::from_parts(7_805_000, 1522) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -499,8 +499,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `965` // Estimated: `4430` - // Minimum execution time: 21_992_000 picoseconds. - Weight::from_parts(22_443_000, 4430) + // Minimum execution time: 21_100_000 picoseconds. + Weight::from_parts(21_641_000, 4430) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -520,8 +520,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `733` // Estimated: `4198` - // Minimum execution time: 23_004_000 picoseconds. - Weight::from_parts(23_434_000, 4198) + // Minimum execution time: 22_243_000 picoseconds. + Weight::from_parts(23_034_000, 4198) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -559,8 +559,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1650` // Estimated: `7590` - // Minimum execution time: 74_531_000 picoseconds. - Weight::from_parts(75_944_000, 7590) + // Minimum execution time: 71_696_000 picoseconds. + Weight::from_parts(73_088_000, 7590) .saturating_add(T::DbWeight::get().reads(13_u64)) .saturating_add(T::DbWeight::get().writes(7_u64)) } @@ -602,8 +602,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `868` // Estimated: `4333` - // Minimum execution time: 48_471_000 picoseconds. - Weight::from_parts(49_253_000, 4333) + // Minimum execution time: 47_449_000 picoseconds. + Weight::from_parts(48_522_000, 4333) .saturating_add(RocksDbWeight::get().reads(12_u64)) .saturating_add(RocksDbWeight::get().writes(8_u64)) } @@ -617,8 +617,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `869` // Estimated: `4334` - // Minimum execution time: 23_585_000 picoseconds. - Weight::from_parts(24_016_000, 4334) + // Minimum execution time: 22_553_000 picoseconds. + Weight::from_parts(23_053_000, 4334) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -656,8 +656,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1650` // Estimated: `7590` - // Minimum execution time: 77_096_000 picoseconds. - Weight::from_parts(78_488_000, 7590) + // Minimum execution time: 73_609_000 picoseconds. + Weight::from_parts(74_771_000, 7590) .saturating_add(RocksDbWeight::get().reads(13_u64)) .saturating_add(RocksDbWeight::get().writes(7_u64)) } @@ -681,8 +681,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `340` // Estimated: `3805` - // Minimum execution time: 24_797_000 picoseconds. - Weight::from_parts(25_157_000, 3805) + // Minimum execution time: 24_006_000 picoseconds. + Weight::from_parts(24_456_000, 3805) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } @@ -708,8 +708,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `949` // Estimated: `4414` - // Minimum execution time: 51_929_000 picoseconds. - Weight::from_parts(53_511_000, 4414) + // Minimum execution time: 50_195_000 picoseconds. + Weight::from_parts(51_317_000, 4414) .saturating_add(RocksDbWeight::get().reads(8_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -731,8 +731,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1286` // Estimated: `4751` - // Minimum execution time: 38_173_000 picoseconds. - Weight::from_parts(38_663_000, 4751) + // Minimum execution time: 36_339_000 picoseconds. + Weight::from_parts(36_919_000, 4751) .saturating_add(RocksDbWeight::get().reads(7_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -748,8 +748,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `765` // Estimated: `4230` - // Minimum execution time: 23_385_000 picoseconds. - Weight::from_parts(23_876_000, 4230) + // Minimum execution time: 22_412_000 picoseconds. + Weight::from_parts(23_384_000, 4230) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -779,8 +779,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `776` // Estimated: `4241` - // Minimum execution time: 34_906_000 picoseconds. - Weight::from_parts(35_367_000, 4241) + // Minimum execution time: 33_453_000 picoseconds. + Weight::from_parts(34_145_000, 4241) .saturating_add(RocksDbWeight::get().reads(9_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } @@ -816,8 +816,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1607` // Estimated: `7547` - // Minimum execution time: 72_007_000 picoseconds. - Weight::from_parts(73_199_000, 7547) + // Minimum execution time: 70_012_000 picoseconds. + Weight::from_parts(71_505_000, 7547) .saturating_add(RocksDbWeight::get().reads(14_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -829,8 +829,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `37` // Estimated: `1522` - // Minimum execution time: 9_798_000 picoseconds. - Weight::from_parts(10_129_000, 1522) + // Minimum execution time: 9_618_000 picoseconds. + Weight::from_parts(10_009_000, 1522) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -840,8 +840,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `215` // Estimated: `3680` - // Minimum execution time: 12_794_000 picoseconds. - Weight::from_parts(12_955_000, 3680) + // Minimum execution time: 12_484_000 picoseconds. + Weight::from_parts(12_854_000, 3680) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -881,8 +881,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `2077` // Estimated: `8017` - // Minimum execution time: 87_206_000 picoseconds. - Weight::from_parts(88_408_000, 8017) + // Minimum execution time: 83_768_000 picoseconds. + Weight::from_parts(85_121_000, 8017) .saturating_add(RocksDbWeight::get().reads(17_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -896,8 +896,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `395` // Estimated: `6335` - // Minimum execution time: 18_244_000 picoseconds. - Weight::from_parts(18_726_000, 6335) + // Minimum execution time: 17_804_000 picoseconds. + Weight::from_parts(18_284_000, 6335) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -909,8 +909,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `489` // Estimated: `3954` - // Minimum execution time: 16_522_000 picoseconds. - Weight::from_parts(16_892_000, 3954) + // Minimum execution time: 15_980_000 picoseconds. + Weight::from_parts(16_271_000, 3954) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -922,8 +922,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `489` // Estimated: `3954` - // Minimum execution time: 16_201_000 picoseconds. - Weight::from_parts(16_482_000, 3954) + // Minimum execution time: 15_880_000 picoseconds. + Weight::from_parts(16_190_000, 3954) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -935,8 +935,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `502` // Estimated: `3967` - // Minimum execution time: 16_461_000 picoseconds. - Weight::from_parts(16_982_000, 3967) + // Minimum execution time: 16_311_000 picoseconds. + Weight::from_parts(16_672_000, 3967) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -948,8 +948,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `502` // Estimated: `3967` - // Minimum execution time: 17_202_000 picoseconds. - Weight::from_parts(17_463_000, 3967) + // Minimum execution time: 16_271_000 picoseconds. + Weight::from_parts(17_142_000, 3967) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -961,8 +961,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `502` // Estimated: `3967` - // Minimum execution time: 15_760_000 picoseconds. - Weight::from_parts(16_351_000, 3967) + // Minimum execution time: 15_620_000 picoseconds. + Weight::from_parts(15_930_000, 3967) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -980,8 +980,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `841` // Estimated: `6781` - // Minimum execution time: 28_654_000 picoseconds. - Weight::from_parts(29_275_000, 6781) + // Minimum execution time: 28_193_000 picoseconds. + Weight::from_parts(28_955_000, 6781) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -991,8 +991,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `37` // Estimated: `1522` - // Minimum execution time: 7_474_000 picoseconds. - Weight::from_parts(7_865_000, 1522) + // Minimum execution time: 7_585_000 picoseconds. + Weight::from_parts(7_805_000, 1522) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1006,8 +1006,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `965` // Estimated: `4430` - // Minimum execution time: 21_992_000 picoseconds. - Weight::from_parts(22_443_000, 4430) + // Minimum execution time: 21_100_000 picoseconds. + Weight::from_parts(21_641_000, 4430) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1027,8 +1027,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `733` // Estimated: `4198` - // Minimum execution time: 23_004_000 picoseconds. - Weight::from_parts(23_434_000, 4198) + // Minimum execution time: 22_243_000 picoseconds. + Weight::from_parts(23_034_000, 4198) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1066,8 +1066,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1650` // Estimated: `7590` - // Minimum execution time: 74_531_000 picoseconds. - Weight::from_parts(75_944_000, 7590) + // Minimum execution time: 71_696_000 picoseconds. + Weight::from_parts(73_088_000, 7590) .saturating_add(RocksDbWeight::get().reads(13_u64)) .saturating_add(RocksDbWeight::get().writes(7_u64)) } diff --git a/substrate-node/pallets/pallet-tfgrid/src/benchmarking.rs b/substrate-node/pallets/pallet-tfgrid/src/benchmarking.rs index 958880ad6..1bf13bc87 100644 --- a/substrate-node/pallets/pallet-tfgrid/src/benchmarking.rs +++ b/substrate-node/pallets/pallet-tfgrid/src/benchmarking.rs @@ -534,6 +534,113 @@ benchmarks! { assert!(TfgridModule::::users_terms_and_condition(caller).is_some()); } + // request_twin_transfer(new_account) + request_twin_transfer { + let old_owner: T::AccountId = whitelisted_caller(); + // old owner must have signed T&C and have a twin + TfgridModule::::user_accept_tc( + RawOrigin::Signed(old_owner.clone()).into(), + get_document_link_input(b"some_link"), + get_document_hash_input(b"some_hash"), + ).unwrap(); + assert_ok!(TfgridModule::::create_twin( + RawOrigin::Signed(old_owner.clone()).into(), + get_relay_input(b"relay"), + get_public_key_input(b"0x0102030405060708090001020304050607080900010203040506070809000102"), + )); + + // new account: T&C accepted, no twin + let new_owner: T::AccountId = account("new", 0, 0); + TfgridModule::::user_accept_tc( + RawOrigin::Signed(new_owner.clone()).into(), + get_document_link_input(b"some_link"), + get_document_hash_input(b"some_hash"), + ).unwrap(); + }: _(RawOrigin::Signed(old_owner.clone()), new_owner.clone()) + verify { + assert!(TfgridModule::::pending_transfer_by_twin(1).is_some()); + assert_has_event::(Event::TwinTransferRequested { + request_id: 1, + twin_id: 1, + from: old_owner, + to: new_owner, + }.into()); + } + + // accept_twin_transfer(request_id) + accept_twin_transfer { + let old_owner: T::AccountId = whitelisted_caller(); + TfgridModule::::user_accept_tc( + RawOrigin::Signed(old_owner.clone()).into(), + get_document_link_input(b"some_link"), + get_document_hash_input(b"some_hash"), + ).unwrap(); + assert_ok!(TfgridModule::::create_twin( + RawOrigin::Signed(old_owner.clone()).into(), + get_relay_input(b"relay"), + get_public_key_input(b"0x0102030405060708090001020304050607080900010203040506070809000103"), + )); + + let new_owner: T::AccountId = account("new", 0, 0); + TfgridModule::::user_accept_tc( + RawOrigin::Signed(new_owner.clone()).into(), + get_document_link_input(b"some_link"), + get_document_hash_input(b"some_hash"), + ).unwrap(); + + assert_ok!(TfgridModule::::request_twin_transfer( + RawOrigin::Signed(old_owner.clone()).into(), + new_owner.clone(), + )); + let request_id: u64 = 1; + }: _(RawOrigin::Signed(new_owner.clone()), request_id) + verify { + assert!(TfgridModule::::pending_transfer_by_twin(1).is_none()); + assert_has_event::(Event::TwinOwnershipTransferred { + request_id, + twin_id: 1, + from: old_owner, + to: new_owner, + }.into()); + } + + // cancel_twin_transfer(request_id) + cancel_twin_transfer { + let old_owner: T::AccountId = whitelisted_caller(); + TfgridModule::::user_accept_tc( + RawOrigin::Signed(old_owner.clone()).into(), + get_document_link_input(b"some_link"), + get_document_hash_input(b"some_hash"), + ).unwrap(); + assert_ok!(TfgridModule::::create_twin( + RawOrigin::Signed(old_owner.clone()).into(), + get_relay_input(b"relay"), + get_public_key_input(b"0x0102030405060708090001020304050607080900010203040506070809000104"), + )); + + let new_owner: T::AccountId = account("new", 0, 0); + TfgridModule::::user_accept_tc( + RawOrigin::Signed(new_owner.clone()).into(), + get_document_link_input(b"some_link"), + get_document_hash_input(b"some_hash"), + ).unwrap(); + + assert_ok!(TfgridModule::::request_twin_transfer( + RawOrigin::Signed(old_owner.clone()).into(), + new_owner.clone(), + )); + let request_id: u64 = 1; + }: _(RawOrigin::Signed(old_owner.clone()), request_id) + verify { + assert!(TfgridModule::::pending_transfer_by_twin(1).is_none()); + assert_has_event::(Event::TwinTransferCanceled { + request_id, + twin_id: 1, + from: old_owner, + to: account("new", 0, 0), + }.into()); + } + // delete_node_farm() delete_node_farm { let caller: T::AccountId = whitelisted_caller(); @@ -749,6 +856,13 @@ fn assert_last_event(generic_event: ::RuntimeEvent) { assert_eq!(event, &system_event); } +fn assert_has_event(generic_event: ::RuntimeEvent) { + let events = System::::events(); + let system_event: ::RuntimeEvent = generic_event.into(); + let found = events.iter().any(|ev| ev.event == system_event); + assert!(found, "Expected event not found in events list"); +} + pub fn _prepare_farm_with_node(source: T::AccountId) { _prepare_farm::(source.clone()); _create_node::(source); diff --git a/substrate-node/pallets/pallet-tfgrid/src/lib.rs b/substrate-node/pallets/pallet-tfgrid/src/lib.rs index 55c032ef9..2ecbd4ab1 100644 --- a/substrate-node/pallets/pallet-tfgrid/src/lib.rs +++ b/substrate-node/pallets/pallet-tfgrid/src/lib.rs @@ -9,6 +9,7 @@ pub mod node; pub mod pricing; pub mod terms_cond; pub mod twin; +pub mod twin_transfer; pub mod types; pub mod weights; @@ -30,6 +31,7 @@ pub use pallet::*; pub mod pallet { use super::weights::WeightInfo; use super::*; + use frame_support::traits::ReservableCurrency; use frame_support::{ dispatch::DispatchResultWithPostInfo, ensure, pallet_prelude::*, storage::bounded_vec::BoundedVec, traits::ConstU32, traits::EnsureOrigin, Blake2_128Concat, @@ -263,6 +265,31 @@ pub mod pallet { ValueQuery, >; + // Twin ownership transfer storage types with creation timestamp + #[derive(Encode, Decode, Clone, PartialEq, Eq, TypeInfo, MaxEncodedLen)] + #[scale_info(skip_type_params(T))] + pub struct TwinTransferRequest { + pub twin_id: u32, + pub from: T::AccountId, + pub to: T::AccountId, + pub created_at: BlockNumberFor, + } + + #[pallet::storage] + #[pallet::getter(fn twin_transfer_request_id)] + pub type TwinTransferRequestID = StorageValue<_, u64, ValueQuery>; + + #[pallet::storage] + #[pallet::getter(fn twin_transfer_requests)] + pub type TwinTransferRequests = + StorageMap<_, Blake2_128Concat, u64, TwinTransferRequest, OptionQuery>; + + // Index to ensure at most one pending transfer per twin + #[pallet::storage] + #[pallet::getter(fn pending_transfer_by_twin)] + pub type PendingTransferByTwin = + StorageMap<_, Blake2_128Concat, u32, u64, OptionQuery>; + #[pallet::config] pub trait Config: frame_system::Config + pallet_timestamp::Config { type RuntimeEvent: From> + IsType<::RuntimeEvent>; @@ -386,6 +413,9 @@ pub mod pallet { #[pallet::constant] type TimestampHintDrift: Get; + + /// Currency used for reserving/repatriating balances during twin ownership transfer + type Currency: ReservableCurrency; } #[pallet::event] @@ -438,6 +468,26 @@ pub mod pallet { node_id: u32, power_state: PowerState>, }, + + // Twin ownership transfer lifecycle + TwinTransferRequested { + request_id: u64, + twin_id: u32, + from: T::AccountId, + to: T::AccountId, + }, + TwinOwnershipTransferred { + request_id: u64, + twin_id: u32, + from: T::AccountId, + to: T::AccountId, + }, + TwinTransferCanceled { + request_id: u64, + twin_id: u32, + from: T::AccountId, + to: T::AccountId, + }, } #[pallet::error] @@ -574,6 +624,11 @@ pub mod pallet { InvalidTimestampHint, InvalidStorageInput, + + // Twin transfer specific errors + TwinTransferRequestNotFound, + TwinTransferNewAccountHasTwin, + TwinTransferPendingExists, } #[pallet::genesis_config] @@ -1238,5 +1293,35 @@ pub mod pallet { // Deprecated! Use index 40 for next extrinsic // #[pallet::call_index(39)] // #[pallet::weight(::WeightInfo::set_node_gpu_status())] + + // Twin ownership transfer: request by current owner (specify new_account) + #[pallet::call_index(40)] + #[pallet::weight(::WeightInfo::request_twin_transfer())] + pub fn request_twin_transfer( + origin: OriginFor, + new_account: T::AccountId, + ) -> DispatchResultWithPostInfo { + Self::_request_twin_transfer(origin, new_account) + } + + // Twin ownership transfer: accept by new account + #[pallet::call_index(41)] + #[pallet::weight(::WeightInfo::accept_twin_transfer())] + pub fn accept_twin_transfer( + origin: OriginFor, + request_id: u64, + ) -> DispatchResultWithPostInfo { + Self::_accept_twin_transfer(origin, request_id) + } + + // Twin ownership transfer: cancel by current owner + #[pallet::call_index(42)] + #[pallet::weight(::WeightInfo::cancel_twin_transfer())] + pub fn cancel_twin_transfer( + origin: OriginFor, + request_id: u64, + ) -> DispatchResultWithPostInfo { + Self::_cancel_twin_transfer(origin, request_id) + } } } diff --git a/substrate-node/pallets/pallet-tfgrid/src/mock.rs b/substrate-node/pallets/pallet-tfgrid/src/mock.rs index 39eaa9534..0f516d9cc 100644 --- a/substrate-node/pallets/pallet-tfgrid/src/mock.rs +++ b/substrate-node/pallets/pallet-tfgrid/src/mock.rs @@ -129,6 +129,7 @@ impl Config for TestRuntime { type PublicIpModifier = PublicIpModifierType; type NodeActiveContracts = NodeActiveContractsType; type TermsAndConditions = TestTermsAndConditions; + type Currency = Balances; type FarmName = TestFarmName; type MaxFarmNameLength = MaxFarmNameLength; type MaxFarmPublicIps = MaxFarmPublicIps; @@ -213,9 +214,16 @@ impl ExternalityBuilder { pub fn build() -> TestExternalities { let _ = env_logger::try_init(); - let storage = frame_system::GenesisConfig::::default() + let mut storage = frame_system::GenesisConfig::::default() .build_storage() .unwrap(); + + // Provide balances for accounts used in tests + let balances_genesis = pallet_balances::GenesisConfig:: { + balances: vec![(alice(), 1_000_000_000_000), (bob(), 1_000_000_000_000)], + }; + balances_genesis.assimilate_storage(&mut storage).unwrap(); + let mut ext = TestExternalities::from(storage); ext.execute_with(|| System::set_block_number(1)); ext diff --git a/substrate-node/pallets/pallet-tfgrid/src/tests.rs b/substrate-node/pallets/pallet-tfgrid/src/tests.rs index 9845d6f16..1bb52ef5e 100644 --- a/substrate-node/pallets/pallet-tfgrid/src/tests.rs +++ b/substrate-node/pallets/pallet-tfgrid/src/tests.rs @@ -12,6 +12,11 @@ use tfchain_support::types::{ }; const GIGABYTE: u64 = 1024 * 1024 * 1024; +use crate::pallet::{ + PendingTransferByTwin, TwinIdByAccountID, TwinTransferRequestID, TwinTransferRequests, Twins, +}; +use frame_support::traits::ReservableCurrency; + #[test] fn test_create_entity_works() { ExternalityBuilder::build().execute_with(|| { @@ -19,6 +24,191 @@ fn test_create_entity_works() { }); } +#[test] +fn twin_transfer_request_happy_path() { + ExternalityBuilder::build().execute_with(|| { + create_twin(); // twin 1 owned by alice + + // new owner candidate (bob) accepts T&C + assert_ok!(TfgridModule::user_accept_tc( + RuntimeOrigin::signed(bob()), + get_document_link_input(b"some_link"), + get_document_hash_input(b"some_hash"), + )); + + // request must be initiated by current owner (alice), specifying new_account (bob) + assert_ok!(TfgridModule::_request_twin_transfer( + RuntimeOrigin::signed(alice()), + bob(), + )); + + // storage checks + assert_eq!(TwinTransferRequestID::::get(), 1); + let req = TwinTransferRequests::::get(1).expect("request stored"); + assert_eq!(req.twin_id, 1); + assert_eq!(req.from, alice()); + assert_eq!(req.to, bob()); + assert_eq!(PendingTransferByTwin::::get(1), Some(1)); + }); +} + +// Note: request must be initiated by the new account (signer). No test needed for mismatched initiator. + +#[test] +fn twin_transfer_request_without_tc_fails() { + ExternalityBuilder::build().execute_with(|| { + // Given: an existing twin owned by alice + create_twin(); + + // When: owner (alice) tries to request transfer to bob (who did NOT accept T&C) + // Then: it should fail with UserDidNotSignTermsAndConditions + assert_noop!( + TfgridModule::_request_twin_transfer(RuntimeOrigin::signed(alice()), bob()), + Error::::UserDidNotSignTermsAndConditions + ); + }); +} + +#[test] +fn twin_transfer_request_new_account_has_twin_fails() { + ExternalityBuilder::build().execute_with(|| { + create_twin(); + create_twin_bob(); // bob already has a twin + + assert_noop!( + TfgridModule::_request_twin_transfer(RuntimeOrigin::signed(alice()), bob()), + Error::::TwinTransferNewAccountHasTwin + ); + }); +} + +#[test] +fn twin_transfer_request_duplicate_pending_fails() { + ExternalityBuilder::build().execute_with(|| { + create_twin(); + assert_ok!(TfgridModule::user_accept_tc( + RuntimeOrigin::signed(bob()), + get_document_link_input(b"some_link"), + get_document_hash_input(b"some_hash"), + )); + assert_ok!(TfgridModule::_request_twin_transfer( + RuntimeOrigin::signed(alice()), + bob(), + )); + + // second request while pending should fail + assert_noop!( + TfgridModule::_request_twin_transfer(RuntimeOrigin::signed(alice()), bob()), + Error::::TwinTransferPendingExists + ); + }); +} + +#[test] +fn twin_transfer_accept_happy_path_moves_reserved_and_updates_owner() { + ExternalityBuilder::build().execute_with(|| { + create_twin(); + assert_ok!(TfgridModule::user_accept_tc( + RuntimeOrigin::signed(bob()), + get_document_link_input(b"some_link"), + get_document_hash_input(b"some_hash"), + )); + + // create request id 1 + assert_ok!(TfgridModule::_request_twin_transfer( + RuntimeOrigin::signed(alice()), + bob(), + )); + + // reserve some balance on alice + assert_ok!(::Currency::reserve( + &alice(), + 100 + )); + assert_eq!( + ::Currency::reserved_balance(&alice()), + 100 + ); + + // accept by new account (bob) + assert_ok!(TfgridModule::_accept_twin_transfer( + RuntimeOrigin::signed(bob()), + 1, + )); + + // twin owner updated + let twin = Twins::::get(&1).expect("twin exists"); + assert_eq!(twin.account_id, bob()); + + // account->twin mapping updated + assert_eq!(TwinIdByAccountID::::get(&alice()), None); + assert_eq!(TwinIdByAccountID::::get(&bob()), Some(1)); + + // request removed and pending cleared + let req = TwinTransferRequests::::get(1); + assert!(req.is_none()); + assert_eq!(PendingTransferByTwin::::get(1), None); + + // reserved moved to bob + assert_eq!( + ::Currency::reserved_balance(&alice()), + 0 + ); + assert_eq!( + ::Currency::reserved_balance(&bob()), + 100 + ); + }); +} + +#[test] +fn twin_transfer_accept_wrong_signer_fails() { + ExternalityBuilder::build().execute_with(|| { + create_twin(); + assert_ok!(TfgridModule::user_accept_tc( + RuntimeOrigin::signed(bob()), + get_document_link_input(b"some_link"), + get_document_hash_input(b"some_hash"), + )); + assert_ok!(TfgridModule::_request_twin_transfer( + RuntimeOrigin::signed(alice()), + bob(), + )); + + // alice (old owner) cannot accept; must be new account (bob) + assert_noop!( + TfgridModule::_accept_twin_transfer(RuntimeOrigin::signed(alice()), 1), + Error::::UnauthorizedToUpdateTwin + ); + }); +} + +#[test] +fn twin_transfer_cancel_by_owner_clears_request() { + ExternalityBuilder::build().execute_with(|| { + create_twin(); + assert_ok!(TfgridModule::user_accept_tc( + RuntimeOrigin::signed(bob()), + get_document_link_input(b"some_link"), + get_document_hash_input(b"some_hash"), + )); + assert_ok!(TfgridModule::_request_twin_transfer( + RuntimeOrigin::signed(alice()), + bob(), + )); + + // cancel by owner (alice) + assert_ok!(TfgridModule::_cancel_twin_transfer( + RuntimeOrigin::signed(alice()), + 1 + )); + + // request removed and pending cleared + assert!(TwinTransferRequests::::get(1).is_none()); + assert_eq!(PendingTransferByTwin::::get(1), None); + }); +} + #[test] fn test_create_entity_sr_works() { ExternalityBuilder::build().execute_with(|| { diff --git a/substrate-node/pallets/pallet-tfgrid/src/twin_transfer.rs b/substrate-node/pallets/pallet-tfgrid/src/twin_transfer.rs new file mode 100644 index 000000000..317ccffee --- /dev/null +++ b/substrate-node/pallets/pallet-tfgrid/src/twin_transfer.rs @@ -0,0 +1,154 @@ +use crate::*; +use frame_support::traits::{BalanceStatus, ReservableCurrency}; +use frame_support::{dispatch::DispatchResultWithPostInfo, ensure}; +use frame_system::ensure_signed; +use sp_runtime::traits::Zero; + +impl Pallet { + pub fn _request_twin_transfer( + origin: T::RuntimeOrigin, + new_account: T::AccountId, + ) -> DispatchResultWithPostInfo { + // Old owner is the signer + let old_account = ensure_signed(origin)?; + + // Derive twin_id from old owner + let twin_id = TwinIdByAccountID::::get(&old_account).ok_or(Error::::TwinNotExists)?; + let twin = Twins::::get(twin_id).ok_or(Error::::TwinNotExists)?; + // pure defensive check for Stale/corrupted index + ensure!( + twin.account_id == old_account, + Error::::UnauthorizedToUpdateTwin + ); + + // New account must have signed T&C + ensure!( + UsersTermsAndConditions::::contains_key(new_account.clone()), + Error::::UserDidNotSignTermsAndConditions + ); + + // New account must not already have a twin + ensure!( + !TwinIdByAccountID::::contains_key(&new_account), + Error::::TwinTransferNewAccountHasTwin + ); + + // Only one pending transfer per twin + ensure!( + PendingTransferByTwin::::get(twin_id).is_none(), + Error::::TwinTransferPendingExists + ); + + // Create request (pending exists as long as entry is present) + let mut req_id = TwinTransferRequestID::::get(); + req_id = req_id.saturating_add(1); + TwinTransferRequestID::::put(req_id); + + let now = >::block_number(); + let request = TwinTransferRequest:: { + twin_id, + from: old_account.clone(), + to: new_account.clone(), + created_at: now, + }; + + TwinTransferRequests::::insert(req_id, &request); + PendingTransferByTwin::::insert(twin_id, req_id); + + Self::deposit_event(Event::TwinTransferRequested { + request_id: req_id, + twin_id, + from: old_account, + to: new_account, + }); + + Ok(().into()) + } + + pub fn _accept_twin_transfer( + origin: T::RuntimeOrigin, + request_id: u64, + ) -> DispatchResultWithPostInfo { + let signer = ensure_signed(origin)?; + + let req = TwinTransferRequests::::get(request_id) + .ok_or(Error::::TwinTransferRequestNotFound)?; + + // Only the intended new account can accept + ensure!(req.to == signer, Error::::UnauthorizedToUpdateTwin); + + // Twin must exist and still be owned by old_account + let mut twin = Twins::::get(req.twin_id).ok_or(Error::::TwinNotExists)?; + ensure!( + twin.account_id == req.from, + Error::::UnauthorizedToUpdateTwin + ); + + // New account must still not have a twin + ensure!( + !TwinIdByAccountID::::contains_key(&req.to), + Error::::TwinTransferNewAccountHasTwin + ); + + // Move all reserved from old -> new as reserved + let reserved = T::Currency::reserved_balance(&req.from); + if !reserved.is_zero() { + let _ = T::Currency::repatriate_reserved( + &req.from, + &req.to, + reserved, + BalanceStatus::Reserved, + ); + } + + // Update twin ownership and indexes + twin.account_id = req.to.clone(); + Twins::::insert(req.twin_id, &twin); + + // Update account->twin mapping + TwinIdByAccountID::::remove(&req.from); + TwinIdByAccountID::::insert(&req.to, req.twin_id); + + // Clear pending index and delete request + PendingTransferByTwin::::remove(req.twin_id); + TwinTransferRequests::::remove(request_id); + + // Emit events + Self::deposit_event(Event::TwinOwnershipTransferred { + request_id, + twin_id: req.twin_id, + from: req.from.clone(), + to: req.to.clone(), + }); + Self::deposit_event(Event::TwinUpdated(twin)); + + Ok(().into()) + } + + pub fn _cancel_twin_transfer( + origin: T::RuntimeOrigin, + request_id: u64, + ) -> DispatchResultWithPostInfo { + let signer = ensure_signed(origin)?; + + let req = TwinTransferRequests::::get(request_id) + .ok_or(Error::::TwinTransferRequestNotFound)?; + + // Only current owner (old_account) can cancel + ensure!(req.from == signer, Error::::UnauthorizedToUpdateTwin); + + // Remove request and index + PendingTransferByTwin::::remove(req.twin_id); + TwinTransferRequests::::remove(request_id); + + // Emit cancel event + Self::deposit_event(Event::TwinTransferCanceled { + request_id, + twin_id: req.twin_id, + from: req.from, + to: req.to, + }); + + Ok(().into()) + } +} diff --git a/substrate-node/pallets/pallet-tfgrid/src/weights.rs b/substrate-node/pallets/pallet-tfgrid/src/weights.rs index 446c831a5..e9d1ffa27 100644 --- a/substrate-node/pallets/pallet-tfgrid/src/weights.rs +++ b/substrate-node/pallets/pallet-tfgrid/src/weights.rs @@ -2,9 +2,9 @@ //! Autogenerated weights for pallet_tfgrid //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2024-10-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2025-09-15, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `585a9f003813`, CPU: `AMD Ryzen 7 5800X 8-Core Processor` +//! HOSTNAME: `ebea9d7a9918`, CPU: `AMD Ryzen 7 5800X 8-Core Processor` //! EXECUTION: , WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: @@ -52,6 +52,9 @@ pub trait WeightInfo { fn update_pricing_policy() -> Weight; fn create_farming_policy() -> Weight; fn user_accept_tc() -> Weight; + fn request_twin_transfer() -> Weight; + fn accept_twin_transfer() -> Weight; + fn cancel_twin_transfer() -> Weight; fn delete_node_farm() -> Weight; fn set_farm_dedicated() -> Weight; fn force_reset_farm_ip() -> Weight; @@ -76,8 +79,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_788_000 picoseconds. - Weight::from_parts(4_018_000, 0) + // Minimum execution time: 2_284_000 picoseconds. + Weight::from_parts(2_405_000, 0) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: `TfgridModule::TwinIdByAccountID` (r:1 w:0) @@ -94,8 +97,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `496` // Estimated: `3961` - // Minimum execution time: 19_638_000 picoseconds. - Weight::from_parts(20_018_000, 3961) + // Minimum execution time: 18_746_000 picoseconds. + Weight::from_parts(19_337_000, 3961) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -109,8 +112,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `507` // Estimated: `3972` - // Minimum execution time: 21_551_000 picoseconds. - Weight::from_parts(22_363_000, 3972) + // Minimum execution time: 20_800_000 picoseconds. + Weight::from_parts(21_331_000, 3972) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -124,8 +127,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `453` // Estimated: `3918` - // Minimum execution time: 15_699_000 picoseconds. - Weight::from_parts(16_131_000, 3918) + // Minimum execution time: 14_998_000 picoseconds. + Weight::from_parts(15_429_000, 3918) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -135,8 +138,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `412` // Estimated: `3877` - // Minimum execution time: 13_215_000 picoseconds. - Weight::from_parts(13_456_000, 3877) + // Minimum execution time: 12_654_000 picoseconds. + Weight::from_parts(13_035_000, 3877) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -148,8 +151,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `569` // Estimated: `4034` - // Minimum execution time: 17_754_000 picoseconds. - Weight::from_parts(18_194_000, 4034) + // Minimum execution time: 17_192_000 picoseconds. + Weight::from_parts(17_713_000, 4034) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -161,8 +164,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `569` // Estimated: `4034` - // Minimum execution time: 16_962_000 picoseconds. - Weight::from_parts(17_342_000, 4034) + // Minimum execution time: 16_260_000 picoseconds. + Weight::from_parts(16_882_000, 4034) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -190,8 +193,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `905` // Estimated: `11795` - // Minimum execution time: 47_349_000 picoseconds. - Weight::from_parts(48_843_000, 11795) + // Minimum execution time: 46_238_000 picoseconds. + Weight::from_parts(47_430_000, 11795) .saturating_add(T::DbWeight::get().reads(12_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -207,8 +210,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `661` // Estimated: `4126` - // Minimum execution time: 26_720_000 picoseconds. - Weight::from_parts(27_242_000, 4126) + // Minimum execution time: 26_069_000 picoseconds. + Weight::from_parts(26_841_000, 4126) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -222,8 +225,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `956` // Estimated: `11846` - // Minimum execution time: 34_234_000 picoseconds. - Weight::from_parts(35_077_000, 11846) + // Minimum execution time: 32_842_000 picoseconds. + Weight::from_parts(33_854_000, 11846) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -239,8 +242,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `454` // Estimated: `3919` - // Minimum execution time: 18_786_000 picoseconds. - Weight::from_parts(19_336_000, 3919) + // Minimum execution time: 17_933_000 picoseconds. + Weight::from_parts(18_254_000, 3919) .saturating_add(T::DbWeight::get().reads(4_u64)) } /// Storage: `TfgridModule::Farms` (r:1 w:0) @@ -253,8 +256,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `779` // Estimated: `4244` - // Minimum execution time: 24_206_000 picoseconds. - Weight::from_parts(25_237_000, 4244) + // Minimum execution time: 23_605_000 picoseconds. + Weight::from_parts(24_676_000, 4244) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -274,8 +277,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `682` // Estimated: `4147` - // Minimum execution time: 27_802_000 picoseconds. - Weight::from_parts(28_273_000, 4147) + // Minimum execution time: 26_640_000 picoseconds. + Weight::from_parts(27_292_000, 4147) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -291,8 +294,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `235` // Estimated: `3700` - // Minimum execution time: 14_217_000 picoseconds. - Weight::from_parts(14_568_000, 3700) + // Minimum execution time: 14_107_000 picoseconds. + Weight::from_parts(14_448_000, 3700) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -304,8 +307,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `428` // Estimated: `3893` - // Minimum execution time: 14_848_000 picoseconds. - Weight::from_parts(15_440_000, 3893) + // Minimum execution time: 14_458_000 picoseconds. + Weight::from_parts(14_858_000, 3893) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -319,8 +322,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `134` // Estimated: `3599` - // Minimum execution time: 11_923_000 picoseconds. - Weight::from_parts(12_324_000, 3599) + // Minimum execution time: 12_073_000 picoseconds. + Weight::from_parts(12_394_000, 3599) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -334,8 +337,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `382` // Estimated: `3847` - // Minimum execution time: 16_441_000 picoseconds. - Weight::from_parts(16_851_000, 3847) + // Minimum execution time: 16_020_000 picoseconds. + Weight::from_parts(16_551_000, 3847) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -347,8 +350,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `134` // Estimated: `1619` - // Minimum execution time: 10_229_000 picoseconds. - Weight::from_parts(10_560_000, 1619) + // Minimum execution time: 9_868_000 picoseconds. + Weight::from_parts(10_139_000, 1619) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -360,11 +363,62 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `140` // Estimated: `3605` - // Minimum execution time: 7_464_000 picoseconds. - Weight::from_parts(7_694_000, 3605) + // Minimum execution time: 7_134_000 picoseconds. + Weight::from_parts(7_604_000, 3605) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } + /// Storage: `TfgridModule::TwinIdByAccountID` (r:2 w:0) + /// Proof: `TfgridModule::TwinIdByAccountID` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `TfgridModule::Twins` (r:1 w:0) + /// Proof: `TfgridModule::Twins` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `TfgridModule::UsersTermsAndConditions` (r:1 w:0) + /// Proof: `TfgridModule::UsersTermsAndConditions` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `TfgridModule::PendingTransferByTwin` (r:1 w:1) + /// Proof: `TfgridModule::PendingTransferByTwin` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `TfgridModule::TwinTransferRequestID` (r:1 w:1) + /// Proof: `TfgridModule::TwinTransferRequestID` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `TfgridModule::TwinTransferRequests` (r:0 w:1) + /// Proof: `TfgridModule::TwinTransferRequests` (`max_values`: None, `max_size`: None, mode: `Measured`) + fn request_twin_transfer() -> Weight { + // Proof Size summary in bytes: + // Measured: `527` + // Estimated: `6467` + // Minimum execution time: 22_352_000 picoseconds. + Weight::from_parts(22_903_000, 6467) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: `TfgridModule::TwinTransferRequests` (r:1 w:1) + /// Proof: `TfgridModule::TwinTransferRequests` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `TfgridModule::Twins` (r:1 w:1) + /// Proof: `TfgridModule::Twins` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `TfgridModule::TwinIdByAccountID` (r:1 w:2) + /// Proof: `TfgridModule::TwinIdByAccountID` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `TfgridModule::PendingTransferByTwin` (r:0 w:1) + /// Proof: `TfgridModule::PendingTransferByTwin` (`max_values`: None, `max_size`: None, mode: `Measured`) + fn accept_twin_transfer() -> Weight { + // Proof Size summary in bytes: + // Measured: `605` + // Estimated: `4070` + // Minimum execution time: 25_308_000 picoseconds. + Weight::from_parts(25_959_000, 4070) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } + /// Storage: `TfgridModule::TwinTransferRequests` (r:1 w:1) + /// Proof: `TfgridModule::TwinTransferRequests` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `TfgridModule::PendingTransferByTwin` (r:0 w:1) + /// Proof: `TfgridModule::PendingTransferByTwin` (`max_values`: None, `max_size`: None, mode: `Measured`) + fn cancel_twin_transfer() -> Weight { + // Proof Size summary in bytes: + // Measured: `403` + // Estimated: `3868` + // Minimum execution time: 12_684_000 picoseconds. + Weight::from_parts(13_095_000, 3868) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } /// Storage: `TfgridModule::TwinIdByAccountID` (r:1 w:0) /// Proof: `TfgridModule::TwinIdByAccountID` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `TfgridModule::Nodes` (r:1 w:1) @@ -385,8 +439,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `828` // Estimated: `4293` - // Minimum execution time: 32_201_000 picoseconds. - Weight::from_parts(32_992_000, 4293) + // Minimum execution time: 31_390_000 picoseconds. + Weight::from_parts(31_870_000, 4293) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -396,8 +450,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `412` // Estimated: `3877` - // Minimum execution time: 13_666_000 picoseconds. - Weight::from_parts(13_986_000, 3877) + // Minimum execution time: 13_085_000 picoseconds. + Weight::from_parts(13_495_000, 3877) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -407,8 +461,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `412` // Estimated: `3877` - // Minimum execution time: 13_445_000 picoseconds. - Weight::from_parts(13_836_000, 3877) + // Minimum execution time: 13_355_000 picoseconds. + Weight::from_parts(13_636_000, 3877) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -418,8 +472,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_570_000 picoseconds. - Weight::from_parts(5_971_000, 0) + // Minimum execution time: 5_430_000 picoseconds. + Weight::from_parts(5_671_000, 0) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: `TfgridModule::AllowedNodeCertifiers` (r:1 w:1) @@ -428,8 +482,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `355` // Estimated: `1840` - // Minimum execution time: 9_608_000 picoseconds. - Weight::from_parts(9_899_000, 1840) + // Minimum execution time: 9_378_000 picoseconds. + Weight::from_parts(9_708_000, 1840) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -439,8 +493,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `413` // Estimated: `1898` - // Minimum execution time: 11_913_000 picoseconds. - Weight::from_parts(12_253_000, 1898) + // Minimum execution time: 11_522_000 picoseconds. + Weight::from_parts(11_943_000, 1898) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -450,8 +504,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `294` // Estimated: `3759` - // Minimum execution time: 12_985_000 picoseconds. - Weight::from_parts(13_155_000, 3759) + // Minimum execution time: 12_774_000 picoseconds. + Weight::from_parts(13_095_000, 3759) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -465,8 +519,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `572` // Estimated: `4037` - // Minimum execution time: 21_440_000 picoseconds. - Weight::from_parts(22_112_000, 4037) + // Minimum execution time: 21_541_000 picoseconds. + Weight::from_parts(22_332_000, 4037) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -476,8 +530,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `134` // Estimated: `1619` - // Minimum execution time: 7_664_000 picoseconds. - Weight::from_parts(8_085_000, 1619) + // Minimum execution time: 7_715_000 picoseconds. + Weight::from_parts(8_015_000, 1619) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -493,8 +547,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `621` // Estimated: `4086` - // Minimum execution time: 22_663_000 picoseconds. - Weight::from_parts(23_244_000, 4086) + // Minimum execution time: 21_741_000 picoseconds. + Weight::from_parts(22_542_000, 4086) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -514,8 +568,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `792` // Estimated: `4257` - // Minimum execution time: 25_729_000 picoseconds. - Weight::from_parts(26_470_000, 4257) + // Minimum execution time: 25_217_000 picoseconds. + Weight::from_parts(26_030_000, 4257) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -527,8 +581,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `387` // Estimated: `3852` - // Minimum execution time: 11_743_000 picoseconds. - Weight::from_parts(12_053_000, 3852) + // Minimum execution time: 11_622_000 picoseconds. + Weight::from_parts(12_113_000, 3852) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -544,8 +598,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `454` // Estimated: `3919` - // Minimum execution time: 18_084_000 picoseconds. - Weight::from_parts(18_465_000, 3919) + // Minimum execution time: 17_093_000 picoseconds. + Weight::from_parts(17_382_000, 3919) .saturating_add(T::DbWeight::get().reads(4_u64)) } } @@ -558,8 +612,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_788_000 picoseconds. - Weight::from_parts(4_018_000, 0) + // Minimum execution time: 2_284_000 picoseconds. + Weight::from_parts(2_405_000, 0) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// Storage: `TfgridModule::TwinIdByAccountID` (r:1 w:0) @@ -576,8 +630,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `496` // Estimated: `3961` - // Minimum execution time: 19_638_000 picoseconds. - Weight::from_parts(20_018_000, 3961) + // Minimum execution time: 18_746_000 picoseconds. + Weight::from_parts(19_337_000, 3961) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -591,8 +645,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `507` // Estimated: `3972` - // Minimum execution time: 21_551_000 picoseconds. - Weight::from_parts(22_363_000, 3972) + // Minimum execution time: 20_800_000 picoseconds. + Weight::from_parts(21_331_000, 3972) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -606,8 +660,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `453` // Estimated: `3918` - // Minimum execution time: 15_699_000 picoseconds. - Weight::from_parts(16_131_000, 3918) + // Minimum execution time: 14_998_000 picoseconds. + Weight::from_parts(15_429_000, 3918) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -617,8 +671,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `412` // Estimated: `3877` - // Minimum execution time: 13_215_000 picoseconds. - Weight::from_parts(13_456_000, 3877) + // Minimum execution time: 12_654_000 picoseconds. + Weight::from_parts(13_035_000, 3877) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -630,8 +684,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `569` // Estimated: `4034` - // Minimum execution time: 17_754_000 picoseconds. - Weight::from_parts(18_194_000, 4034) + // Minimum execution time: 17_192_000 picoseconds. + Weight::from_parts(17_713_000, 4034) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -643,8 +697,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `569` // Estimated: `4034` - // Minimum execution time: 16_962_000 picoseconds. - Weight::from_parts(17_342_000, 4034) + // Minimum execution time: 16_260_000 picoseconds. + Weight::from_parts(16_882_000, 4034) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -672,8 +726,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `905` // Estimated: `11795` - // Minimum execution time: 47_349_000 picoseconds. - Weight::from_parts(48_843_000, 11795) + // Minimum execution time: 46_238_000 picoseconds. + Weight::from_parts(47_430_000, 11795) .saturating_add(RocksDbWeight::get().reads(12_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } @@ -689,8 +743,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `661` // Estimated: `4126` - // Minimum execution time: 26_720_000 picoseconds. - Weight::from_parts(27_242_000, 4126) + // Minimum execution time: 26_069_000 picoseconds. + Weight::from_parts(26_841_000, 4126) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -704,8 +758,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `956` // Estimated: `11846` - // Minimum execution time: 34_234_000 picoseconds. - Weight::from_parts(35_077_000, 11846) + // Minimum execution time: 32_842_000 picoseconds. + Weight::from_parts(33_854_000, 11846) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -721,8 +775,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `454` // Estimated: `3919` - // Minimum execution time: 18_786_000 picoseconds. - Weight::from_parts(19_336_000, 3919) + // Minimum execution time: 17_933_000 picoseconds. + Weight::from_parts(18_254_000, 3919) .saturating_add(RocksDbWeight::get().reads(4_u64)) } /// Storage: `TfgridModule::Farms` (r:1 w:0) @@ -735,8 +789,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `779` // Estimated: `4244` - // Minimum execution time: 24_206_000 picoseconds. - Weight::from_parts(25_237_000, 4244) + // Minimum execution time: 23_605_000 picoseconds. + Weight::from_parts(24_676_000, 4244) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -756,8 +810,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `682` // Estimated: `4147` - // Minimum execution time: 27_802_000 picoseconds. - Weight::from_parts(28_273_000, 4147) + // Minimum execution time: 26_640_000 picoseconds. + Weight::from_parts(27_292_000, 4147) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -773,8 +827,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `235` // Estimated: `3700` - // Minimum execution time: 14_217_000 picoseconds. - Weight::from_parts(14_568_000, 3700) + // Minimum execution time: 14_107_000 picoseconds. + Weight::from_parts(14_448_000, 3700) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -786,8 +840,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `428` // Estimated: `3893` - // Minimum execution time: 14_848_000 picoseconds. - Weight::from_parts(15_440_000, 3893) + // Minimum execution time: 14_458_000 picoseconds. + Weight::from_parts(14_858_000, 3893) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -801,8 +855,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `134` // Estimated: `3599` - // Minimum execution time: 11_923_000 picoseconds. - Weight::from_parts(12_324_000, 3599) + // Minimum execution time: 12_073_000 picoseconds. + Weight::from_parts(12_394_000, 3599) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -816,8 +870,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `382` // Estimated: `3847` - // Minimum execution time: 16_441_000 picoseconds. - Weight::from_parts(16_851_000, 3847) + // Minimum execution time: 16_020_000 picoseconds. + Weight::from_parts(16_551_000, 3847) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -829,8 +883,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `134` // Estimated: `1619` - // Minimum execution time: 10_229_000 picoseconds. - Weight::from_parts(10_560_000, 1619) + // Minimum execution time: 9_868_000 picoseconds. + Weight::from_parts(10_139_000, 1619) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -842,11 +896,62 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `140` // Estimated: `3605` - // Minimum execution time: 7_464_000 picoseconds. - Weight::from_parts(7_694_000, 3605) + // Minimum execution time: 7_134_000 picoseconds. + Weight::from_parts(7_604_000, 3605) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } + /// Storage: `TfgridModule::TwinIdByAccountID` (r:2 w:0) + /// Proof: `TfgridModule::TwinIdByAccountID` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `TfgridModule::Twins` (r:1 w:0) + /// Proof: `TfgridModule::Twins` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `TfgridModule::UsersTermsAndConditions` (r:1 w:0) + /// Proof: `TfgridModule::UsersTermsAndConditions` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `TfgridModule::PendingTransferByTwin` (r:1 w:1) + /// Proof: `TfgridModule::PendingTransferByTwin` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `TfgridModule::TwinTransferRequestID` (r:1 w:1) + /// Proof: `TfgridModule::TwinTransferRequestID` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `TfgridModule::TwinTransferRequests` (r:0 w:1) + /// Proof: `TfgridModule::TwinTransferRequests` (`max_values`: None, `max_size`: None, mode: `Measured`) + fn request_twin_transfer() -> Weight { + // Proof Size summary in bytes: + // Measured: `527` + // Estimated: `6467` + // Minimum execution time: 22_352_000 picoseconds. + Weight::from_parts(22_903_000, 6467) + .saturating_add(RocksDbWeight::get().reads(6_u64)) + .saturating_add(RocksDbWeight::get().writes(3_u64)) + } + /// Storage: `TfgridModule::TwinTransferRequests` (r:1 w:1) + /// Proof: `TfgridModule::TwinTransferRequests` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `TfgridModule::Twins` (r:1 w:1) + /// Proof: `TfgridModule::Twins` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `TfgridModule::TwinIdByAccountID` (r:1 w:2) + /// Proof: `TfgridModule::TwinIdByAccountID` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `TfgridModule::PendingTransferByTwin` (r:0 w:1) + /// Proof: `TfgridModule::PendingTransferByTwin` (`max_values`: None, `max_size`: None, mode: `Measured`) + fn accept_twin_transfer() -> Weight { + // Proof Size summary in bytes: + // Measured: `605` + // Estimated: `4070` + // Minimum execution time: 25_308_000 picoseconds. + Weight::from_parts(25_959_000, 4070) + .saturating_add(RocksDbWeight::get().reads(3_u64)) + .saturating_add(RocksDbWeight::get().writes(5_u64)) + } + /// Storage: `TfgridModule::TwinTransferRequests` (r:1 w:1) + /// Proof: `TfgridModule::TwinTransferRequests` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `TfgridModule::PendingTransferByTwin` (r:0 w:1) + /// Proof: `TfgridModule::PendingTransferByTwin` (`max_values`: None, `max_size`: None, mode: `Measured`) + fn cancel_twin_transfer() -> Weight { + // Proof Size summary in bytes: + // Measured: `403` + // Estimated: `3868` + // Minimum execution time: 12_684_000 picoseconds. + Weight::from_parts(13_095_000, 3868) + .saturating_add(RocksDbWeight::get().reads(1_u64)) + .saturating_add(RocksDbWeight::get().writes(2_u64)) + } /// Storage: `TfgridModule::TwinIdByAccountID` (r:1 w:0) /// Proof: `TfgridModule::TwinIdByAccountID` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `TfgridModule::Nodes` (r:1 w:1) @@ -867,8 +972,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `828` // Estimated: `4293` - // Minimum execution time: 32_201_000 picoseconds. - Weight::from_parts(32_992_000, 4293) + // Minimum execution time: 31_390_000 picoseconds. + Weight::from_parts(31_870_000, 4293) .saturating_add(RocksDbWeight::get().reads(7_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -878,8 +983,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `412` // Estimated: `3877` - // Minimum execution time: 13_666_000 picoseconds. - Weight::from_parts(13_986_000, 3877) + // Minimum execution time: 13_085_000 picoseconds. + Weight::from_parts(13_495_000, 3877) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -889,8 +994,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `412` // Estimated: `3877` - // Minimum execution time: 13_445_000 picoseconds. - Weight::from_parts(13_836_000, 3877) + // Minimum execution time: 13_355_000 picoseconds. + Weight::from_parts(13_636_000, 3877) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -900,8 +1005,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_570_000 picoseconds. - Weight::from_parts(5_971_000, 0) + // Minimum execution time: 5_430_000 picoseconds. + Weight::from_parts(5_671_000, 0) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// Storage: `TfgridModule::AllowedNodeCertifiers` (r:1 w:1) @@ -910,8 +1015,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `355` // Estimated: `1840` - // Minimum execution time: 9_608_000 picoseconds. - Weight::from_parts(9_899_000, 1840) + // Minimum execution time: 9_378_000 picoseconds. + Weight::from_parts(9_708_000, 1840) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -921,8 +1026,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `413` // Estimated: `1898` - // Minimum execution time: 11_913_000 picoseconds. - Weight::from_parts(12_253_000, 1898) + // Minimum execution time: 11_522_000 picoseconds. + Weight::from_parts(11_943_000, 1898) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -932,8 +1037,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `294` // Estimated: `3759` - // Minimum execution time: 12_985_000 picoseconds. - Weight::from_parts(13_155_000, 3759) + // Minimum execution time: 12_774_000 picoseconds. + Weight::from_parts(13_095_000, 3759) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -947,8 +1052,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `572` // Estimated: `4037` - // Minimum execution time: 21_440_000 picoseconds. - Weight::from_parts(22_112_000, 4037) + // Minimum execution time: 21_541_000 picoseconds. + Weight::from_parts(22_332_000, 4037) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -958,8 +1063,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `134` // Estimated: `1619` - // Minimum execution time: 7_664_000 picoseconds. - Weight::from_parts(8_085_000, 1619) + // Minimum execution time: 7_715_000 picoseconds. + Weight::from_parts(8_015_000, 1619) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -975,8 +1080,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `621` // Estimated: `4086` - // Minimum execution time: 22_663_000 picoseconds. - Weight::from_parts(23_244_000, 4086) + // Minimum execution time: 21_741_000 picoseconds. + Weight::from_parts(22_542_000, 4086) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -996,8 +1101,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `792` // Estimated: `4257` - // Minimum execution time: 25_729_000 picoseconds. - Weight::from_parts(26_470_000, 4257) + // Minimum execution time: 25_217_000 picoseconds. + Weight::from_parts(26_030_000, 4257) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1009,8 +1114,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `387` // Estimated: `3852` - // Minimum execution time: 11_743_000 picoseconds. - Weight::from_parts(12_053_000, 3852) + // Minimum execution time: 11_622_000 picoseconds. + Weight::from_parts(12_113_000, 3852) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1026,8 +1131,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `454` // Estimated: `3919` - // Minimum execution time: 18_084_000 picoseconds. - Weight::from_parts(18_465_000, 3919) + // Minimum execution time: 17_093_000 picoseconds. + Weight::from_parts(17_382_000, 3919) .saturating_add(RocksDbWeight::get().reads(4_u64)) } } diff --git a/substrate-node/pallets/pallet-tft-bridge/src/weights.rs b/substrate-node/pallets/pallet-tft-bridge/src/weights.rs index 9514c4df0..8225b3306 100644 --- a/substrate-node/pallets/pallet-tft-bridge/src/weights.rs +++ b/substrate-node/pallets/pallet-tft-bridge/src/weights.rs @@ -2,9 +2,9 @@ //! Autogenerated weights for pallet_tft_bridge //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2024-10-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2025-09-15, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `585a9f003813`, CPU: `AMD Ryzen 7 5800X 8-Core Processor` +//! HOSTNAME: `ebea9d7a9918`, CPU: `AMD Ryzen 7 5800X 8-Core Processor` //! EXECUTION: , WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: @@ -55,8 +55,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `256` // Estimated: `1741` - // Minimum execution time: 7_324_000 picoseconds. - Weight::from_parts(7_545_000, 1741) + // Minimum execution time: 6_913_000 picoseconds. + Weight::from_parts(7_134_000, 1741) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -66,8 +66,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `289` // Estimated: `1774` - // Minimum execution time: 7_154_000 picoseconds. - Weight::from_parts(7_384_000, 1774) + // Minimum execution time: 6_813_000 picoseconds. + Weight::from_parts(7_003_000, 1774) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -77,8 +77,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_484_000 picoseconds. - Weight::from_parts(2_575_000, 0) + // Minimum execution time: 2_254_000 picoseconds. + Weight::from_parts(2_385_000, 0) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: `TFTBridgeModule::WithdrawFee` (r:0 w:1) @@ -87,8 +87,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_324_000 picoseconds. - Weight::from_parts(2_435_000, 0) + // Minimum execution time: 2_184_000 picoseconds. + Weight::from_parts(2_275_000, 0) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: `TFTBridgeModule::DepositFee` (r:0 w:1) @@ -97,8 +97,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_275_000 picoseconds. - Weight::from_parts(2_505_000, 0) + // Minimum execution time: 2_164_000 picoseconds. + Weight::from_parts(2_244_000, 0) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: `TFTBridgeModule::WithdrawFee` (r:1 w:0) @@ -115,8 +115,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `253` // Estimated: `3593` - // Minimum execution time: 43_462_000 picoseconds. - Weight::from_parts(44_163_000, 3593) + // Minimum execution time: 42_621_000 picoseconds. + Weight::from_parts(43_412_000, 3593) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -136,8 +136,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `499` // Estimated: `3964` - // Minimum execution time: 60_224_000 picoseconds. - Weight::from_parts(61_235_000, 3964) + // Minimum execution time: 61_707_000 picoseconds. + Weight::from_parts(62_769_000, 3964) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -151,8 +151,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `631` // Estimated: `4096` - // Minimum execution time: 25_489_000 picoseconds. - Weight::from_parts(26_390_000, 4096) + // Minimum execution time: 24_806_000 picoseconds. + Weight::from_parts(25_419_000, 4096) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -166,8 +166,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `571` // Estimated: `4036` - // Minimum execution time: 18_204_000 picoseconds. - Weight::from_parts(18_515_000, 4036) + // Minimum execution time: 17_683_000 picoseconds. + Weight::from_parts(17_964_000, 4036) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -179,8 +179,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `385` // Estimated: `3850` - // Minimum execution time: 21_551_000 picoseconds. - Weight::from_parts(21_821_000, 3850) + // Minimum execution time: 20_929_000 picoseconds. + Weight::from_parts(21_421_000, 3850) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -194,8 +194,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `560` // Estimated: `4025` - // Minimum execution time: 18_625_000 picoseconds. - Weight::from_parts(18_946_000, 4025) + // Minimum execution time: 17_773_000 picoseconds. + Weight::from_parts(18_355_000, 4025) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -209,8 +209,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `256` // Estimated: `1741` - // Minimum execution time: 7_324_000 picoseconds. - Weight::from_parts(7_545_000, 1741) + // Minimum execution time: 6_913_000 picoseconds. + Weight::from_parts(7_134_000, 1741) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -220,8 +220,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `289` // Estimated: `1774` - // Minimum execution time: 7_154_000 picoseconds. - Weight::from_parts(7_384_000, 1774) + // Minimum execution time: 6_813_000 picoseconds. + Weight::from_parts(7_003_000, 1774) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -231,8 +231,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_484_000 picoseconds. - Weight::from_parts(2_575_000, 0) + // Minimum execution time: 2_254_000 picoseconds. + Weight::from_parts(2_385_000, 0) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// Storage: `TFTBridgeModule::WithdrawFee` (r:0 w:1) @@ -241,8 +241,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_324_000 picoseconds. - Weight::from_parts(2_435_000, 0) + // Minimum execution time: 2_184_000 picoseconds. + Weight::from_parts(2_275_000, 0) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// Storage: `TFTBridgeModule::DepositFee` (r:0 w:1) @@ -251,8 +251,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_275_000 picoseconds. - Weight::from_parts(2_505_000, 0) + // Minimum execution time: 2_164_000 picoseconds. + Weight::from_parts(2_244_000, 0) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// Storage: `TFTBridgeModule::WithdrawFee` (r:1 w:0) @@ -269,8 +269,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `253` // Estimated: `3593` - // Minimum execution time: 43_462_000 picoseconds. - Weight::from_parts(44_163_000, 3593) + // Minimum execution time: 42_621_000 picoseconds. + Weight::from_parts(43_412_000, 3593) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -290,8 +290,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `499` // Estimated: `3964` - // Minimum execution time: 60_224_000 picoseconds. - Weight::from_parts(61_235_000, 3964) + // Minimum execution time: 61_707_000 picoseconds. + Weight::from_parts(62_769_000, 3964) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -305,8 +305,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `631` // Estimated: `4096` - // Minimum execution time: 25_489_000 picoseconds. - Weight::from_parts(26_390_000, 4096) + // Minimum execution time: 24_806_000 picoseconds. + Weight::from_parts(25_419_000, 4096) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -320,8 +320,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `571` // Estimated: `4036` - // Minimum execution time: 18_204_000 picoseconds. - Weight::from_parts(18_515_000, 4036) + // Minimum execution time: 17_683_000 picoseconds. + Weight::from_parts(17_964_000, 4036) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -333,8 +333,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `385` // Estimated: `3850` - // Minimum execution time: 21_551_000 picoseconds. - Weight::from_parts(21_821_000, 3850) + // Minimum execution time: 20_929_000 picoseconds. + Weight::from_parts(21_421_000, 3850) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -348,8 +348,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `560` // Estimated: `4025` - // Minimum execution time: 18_625_000 picoseconds. - Weight::from_parts(18_946_000, 4025) + // Minimum execution time: 17_773_000 picoseconds. + Weight::from_parts(18_355_000, 4025) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } diff --git a/substrate-node/pallets/pallet-tft-price/src/weights.rs b/substrate-node/pallets/pallet-tft-price/src/weights.rs index 4f9e921cd..a62725ab6 100644 --- a/substrate-node/pallets/pallet-tft-price/src/weights.rs +++ b/substrate-node/pallets/pallet-tft-price/src/weights.rs @@ -2,9 +2,9 @@ //! Autogenerated weights for pallet_tft_price //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2024-10-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2025-09-15, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `585a9f003813`, CPU: `AMD Ryzen 7 5800X 8-Core Processor` +//! HOSTNAME: `ebea9d7a9918`, CPU: `AMD Ryzen 7 5800X 8-Core Processor` //! EXECUTION: , WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: @@ -61,8 +61,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `235` // Estimated: `6175` - // Minimum execution time: 29_515_000 picoseconds. - Weight::from_parts(30_608_000, 6175) + // Minimum execution time: 29_376_000 picoseconds. + Weight::from_parts(30_267_000, 6175) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -74,8 +74,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `93` // Estimated: `1578` - // Minimum execution time: 5_149_000 picoseconds. - Weight::from_parts(5_340_000, 1578) + // Minimum execution time: 4_960_000 picoseconds. + Weight::from_parts(5_109_000, 1578) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -87,8 +87,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `93` // Estimated: `1578` - // Minimum execution time: 5_129_000 picoseconds. - Weight::from_parts(5_190_000, 1578) + // Minimum execution time: 4_929_000 picoseconds. + Weight::from_parts(5_090_000, 1578) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -116,8 +116,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `235` // Estimated: `6175` - // Minimum execution time: 29_515_000 picoseconds. - Weight::from_parts(30_608_000, 6175) + // Minimum execution time: 29_376_000 picoseconds. + Weight::from_parts(30_267_000, 6175) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } @@ -129,8 +129,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `93` // Estimated: `1578` - // Minimum execution time: 5_149_000 picoseconds. - Weight::from_parts(5_340_000, 1578) + // Minimum execution time: 4_960_000 picoseconds. + Weight::from_parts(5_109_000, 1578) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -142,8 +142,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `93` // Estimated: `1578` - // Minimum execution time: 5_129_000 picoseconds. - Weight::from_parts(5_190_000, 1578) + // Minimum execution time: 4_929_000 picoseconds. + Weight::from_parts(5_090_000, 1578) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } diff --git a/substrate-node/pallets/pallet-validator/src/weights.rs b/substrate-node/pallets/pallet-validator/src/weights.rs index 26340102e..8e0bacce9 100644 --- a/substrate-node/pallets/pallet-validator/src/weights.rs +++ b/substrate-node/pallets/pallet-validator/src/weights.rs @@ -2,9 +2,9 @@ //! Autogenerated weights for pallet_validator //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2024-10-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2025-09-15, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `585a9f003813`, CPU: `AMD Ryzen 7 5800X 8-Core Processor` +//! HOSTNAME: `ebea9d7a9918`, CPU: `AMD Ryzen 7 5800X 8-Core Processor` //! EXECUTION: , WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: @@ -50,8 +50,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `42` // Estimated: `3507` - // Minimum execution time: 8_877_000 picoseconds. - Weight::from_parts(9_368_000, 3507) + // Minimum execution time: 9_378_000 picoseconds. + Weight::from_parts(9_668_000, 3507) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -65,8 +65,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `365` // Estimated: `3830` - // Minimum execution time: 24_096_000 picoseconds. - Weight::from_parts(24_637_000, 3830) + // Minimum execution time: 23_925_000 picoseconds. + Weight::from_parts(24_466_000, 3830) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -80,8 +80,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `431` // Estimated: `3896` - // Minimum execution time: 32_832_000 picoseconds. - Weight::from_parts(33_994_000, 3896) + // Minimum execution time: 32_140_000 picoseconds. + Weight::from_parts(33_153_000, 3896) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -91,8 +91,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `42` // Estimated: `3507` - // Minimum execution time: 8_286_000 picoseconds. - Weight::from_parts(8_506_000, 3507) + // Minimum execution time: 8_345_000 picoseconds. + Weight::from_parts(8_717_000, 3507) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -110,8 +110,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `494` // Estimated: `4687` - // Minimum execution time: 24_105_000 picoseconds. - Weight::from_parts(24_918_000, 4687) + // Minimum execution time: 24_096_000 picoseconds. + Weight::from_parts(24_967_000, 4687) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -131,8 +131,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `558` // Estimated: `4687` - // Minimum execution time: 21_501_000 picoseconds. - Weight::from_parts(22_092_000, 4687) + // Minimum execution time: 21_440_000 picoseconds. + Weight::from_parts(21_822_000, 4687) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -146,8 +146,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `42` // Estimated: `3507` - // Minimum execution time: 8_877_000 picoseconds. - Weight::from_parts(9_368_000, 3507) + // Minimum execution time: 9_378_000 picoseconds. + Weight::from_parts(9_668_000, 3507) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -161,8 +161,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `365` // Estimated: `3830` - // Minimum execution time: 24_096_000 picoseconds. - Weight::from_parts(24_637_000, 3830) + // Minimum execution time: 23_925_000 picoseconds. + Weight::from_parts(24_466_000, 3830) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -176,8 +176,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `431` // Estimated: `3896` - // Minimum execution time: 32_832_000 picoseconds. - Weight::from_parts(33_994_000, 3896) + // Minimum execution time: 32_140_000 picoseconds. + Weight::from_parts(33_153_000, 3896) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -187,8 +187,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `42` // Estimated: `3507` - // Minimum execution time: 8_286_000 picoseconds. - Weight::from_parts(8_506_000, 3507) + // Minimum execution time: 8_345_000 picoseconds. + Weight::from_parts(8_717_000, 3507) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -206,8 +206,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `494` // Estimated: `4687` - // Minimum execution time: 24_105_000 picoseconds. - Weight::from_parts(24_918_000, 4687) + // Minimum execution time: 24_096_000 picoseconds. + Weight::from_parts(24_967_000, 4687) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -227,8 +227,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `558` // Estimated: `4687` - // Minimum execution time: 21_501_000 picoseconds. - Weight::from_parts(22_092_000, 4687) + // Minimum execution time: 21_440_000 picoseconds. + Weight::from_parts(21_822_000, 4687) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } diff --git a/substrate-node/pallets/substrate-validator-set/src/weights.rs b/substrate-node/pallets/substrate-validator-set/src/weights.rs index 770fde18b..f65ce65a1 100644 --- a/substrate-node/pallets/substrate-validator-set/src/weights.rs +++ b/substrate-node/pallets/substrate-validator-set/src/weights.rs @@ -2,9 +2,9 @@ //! Autogenerated weights for substrate_validator_set //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2024-10-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2025-09-15, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `585a9f003813`, CPU: `AMD Ryzen 7 5800X 8-Core Processor` +//! HOSTNAME: `ebea9d7a9918`, CPU: `AMD Ryzen 7 5800X 8-Core Processor` //! EXECUTION: , WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: @@ -49,8 +49,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `139` // Estimated: `1624` - // Minimum execution time: 13_986_000 picoseconds. - Weight::from_parts(14_347_000, 1624) + // Minimum execution time: 13_355_000 picoseconds. + Weight::from_parts(13_676_000, 1624) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -62,8 +62,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `205` // Estimated: `1690` - // Minimum execution time: 11_381_000 picoseconds. - Weight::from_parts(11_673_000, 1690) + // Minimum execution time: 10_951_000 picoseconds. + Weight::from_parts(11_181_000, 1690) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -75,8 +75,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `172` // Estimated: `1657` - // Minimum execution time: 12_584_000 picoseconds. - Weight::from_parts(12_894_000, 1657) + // Minimum execution time: 12_073_000 picoseconds. + Weight::from_parts(12_424_000, 1657) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -92,8 +92,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `139` // Estimated: `1624` - // Minimum execution time: 13_986_000 picoseconds. - Weight::from_parts(14_347_000, 1624) + // Minimum execution time: 13_355_000 picoseconds. + Weight::from_parts(13_676_000, 1624) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -105,8 +105,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `205` // Estimated: `1690` - // Minimum execution time: 11_381_000 picoseconds. - Weight::from_parts(11_673_000, 1690) + // Minimum execution time: 10_951_000 picoseconds. + Weight::from_parts(11_181_000, 1690) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -118,8 +118,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `172` // Estimated: `1657` - // Minimum execution time: 12_584_000 picoseconds. - Weight::from_parts(12_894_000, 1657) + // Minimum execution time: 12_073_000 picoseconds. + Weight::from_parts(12_424_000, 1657) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } diff --git a/substrate-node/runtime/src/lib.rs b/substrate-node/runtime/src/lib.rs index 5edfd09a4..61333c0e8 100644 --- a/substrate-node/runtime/src/lib.rs +++ b/substrate-node/runtime/src/lib.rs @@ -383,6 +383,7 @@ impl pallet_tfgrid::Config for Runtime { type Location = pallet_tfgrid::node::Location; type SerialNumber = pallet_tfgrid::node::SerialNumber; type TimestampHintDrift = TimestampHintDrift; + type Currency = Balances; } parameter_types! { diff --git a/substrate-node/rust-toolchain.toml b/substrate-node/rust-toolchain.toml index 1405ae81a..23a39f973 100644 --- a/substrate-node/rust-toolchain.toml +++ b/substrate-node/rust-toolchain.toml @@ -1,5 +1,5 @@ [toolchain] -channel = "1.70.0" +channel = "1.78.0" components = [ "cargo", "clippy",