Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
950a47b
fix: transfer service payments to rewards pallet for operator claims
drewstone Oct 13, 2025
7b138f2
fix: remove broken old payment_integration tests
drewstone Oct 13, 2025
130087b
feat: add comprehensive E2E operator rewards tests with real balance …
drewstone Oct 13, 2025
7c73e89
docs: add E2E test reality analysis and pallet-rewards integration guide
drewstone Oct 13, 2025
88abf1a
feat: add new reward distribution simulation test
drewstone Oct 13, 2025
71a09a6
test: improve reward distribution test suite to production-ready
drewstone Oct 14, 2025
4fc3cb1
feat: more tests, including subscription cursor and reward aggregation
drewstone Oct 14, 2025
4966022
chore: fix
drewstone Oct 14, 2025
9983184
chore: fix
drewstone Oct 15, 2025
ae4dc05
chore: setup msbm
drewstone Oct 15, 2025
7d6818b
chore: benchmarking work
drewstone Oct 15, 2025
2726cde
feat(rewards): implement O(1) delegator reward distribution with oper…
drewstone Oct 20, 2025
acd88e3
chore(rewards): add benchmark, storage version, and safety-check migr…
drewstone Oct 20, 2025
52af7b5
chore(services): add storage version for profiling_data backward comp…
drewstone Oct 20, 2025
b706ba6
chore: fmt
drewstone Oct 20, 2025
e8567e5
fix: suppress TestFetcher deprecated warnings for clippy
drewstone Oct 21, 2025
d566ad3
fix: add Vec import for wasm32 compatibility and regenerate subxt met…
drewstone Oct 21, 2025
5c12d4b
fix: add missing RewardRecorder::account_id and TreasuryAccount to se…
drewstone Oct 21, 2025
564c8ce
fix: resolve all clippy warnings in tests
drewstone Oct 21, 2025
9cfdb81
chore: cleanup and update bench
1xstj Oct 21, 2025
26f4f51
Merge branch 'drew/rewards-updates' of https://github.com/webb-tools/…
drewstone Oct 21, 2025
5700c6c
chore: fmt
drewstone Oct 21, 2025
308af53
fix: update benchmarking code for new delegator reward storage structure
drewstone Oct 21, 2025
de6fc6d
fix: use pallet_assets Instance1 in services benchmarking
drewstone Oct 21, 2025
8e9e349
chore: fmt
drewstone Oct 21, 2025
5cd9d61
chore: fmt
drewstone Oct 21, 2025
24c7602
chore: fmt
drewstone Oct 21, 2025
21df6d3
chore: apply nightly rustfmt formatting
drewstone Oct 21, 2025
780e492
chore: apply nightly-2025-01-09 rustfmt formatting
drewstone Oct 21, 2025
a5432d7
fix: fund pallet account in test_claim_updates_debt
drewstone Oct 21, 2025
0d99998
revert: remove DbWeight from services mock for test compatibility
drewstone Oct 21, 2025
eb6e6a1
fix: exclude profiling_data from EVM ABI encoding for backward compat…
drewstone Oct 21, 2025
3a46ced
test: mark 4 broken subscription_cursor tests as ignored
drewstone Oct 22, 2025
aa81898
security: comprehensive security audit and adversarial tests for subs…
drewstone Oct 22, 2025
49a9fd4
fix: comprehensive adversarial tests for subscription cursor security
drewstone Oct 22, 2025
6b39067
fix: correct TNT balance funding in adversarial subscription tests
drewstone Oct 22, 2025
0a33088
feat: add large-scale subscription processing tests
drewstone Oct 22, 2025
6258dcd
docs: comprehensive audit of subscription tests and scale analysis
drewstone Oct 22, 2025
61d9aba
chore: fix failing tests
1xstj Oct 23, 2025
c7ac394
chore: fix types
1xstj Oct 23, 2025
40f9cb4
chore: fix e2e
1xstj Oct 23, 2025
97a137c
chore: clippy and test fixes
drewstone Oct 23, 2025
56629b1
Merge branch 'drew/rewards-updates' of https://github.com/webb-tools/…
drewstone Oct 23, 2025
e1f4b9d
feat(services): add manual subscription payment trigger
drewstone Oct 23, 2025
19f9166
fix(services): improve stress test reliability
drewstone Oct 23, 2025
d8ec25b
chore: types update
drewstone Oct 24, 2025
d52577b
fix: make pallet-rewards benchmarking work
danielbui12 Oct 24, 2025
3e104f3
chore: update pallet-reward benchmarking
danielbui12 Oct 26, 2025
3332fe9
chore: remove hbs file
drewstone Oct 27, 2025
2fb51ad
fix(pallet-reward): benmark metadata functions
danielbui12 Oct 27, 2025
6328fa5
chore: update pallet-multi-asset-delegation benchmarking
danielbui12 Oct 31, 2025
dfa6585
chore: update pallet-airdrop-claims weight
danielbui12 Oct 31, 2025
a71a8e0
fix: benchmarking pallet credits
danielbui12 Nov 3, 2025
f764627
fix: separate benchmarking traits from core traits
danielbui12 Nov 3, 2025
1974b9b
fix: benchmarking pallet-serivces
danielbui12 Nov 3, 2025
8f3e056
fix: sticking benchmark helper traits to runtime-benchmarks feature
danielbui12 Nov 5, 2025
f9d1aa0
fix: benchmarking pallet-serivces
danielbui12 Nov 5, 2025
b3978cd
fix: update all benchmarkings
danielbui12 Nov 6, 2025
de2ab6f
fix: update all benchmarkings
danielbui12 Nov 7, 2025
8228010
chore: apply weight to pallet services
danielbui12 Nov 10, 2025
1c97954
feat: fix more review comments and add tests (#1058)
drewstone Nov 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 80 additions & 11 deletions .maintain/frame-weights-template.hbs
Original file line number Diff line number Diff line change
@@ -1,11 +1,27 @@
// This file is part of Tangle.
// Copyright (C) 2022-2025 Tangle Foundation.
//
// Tangle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Tangle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Tangle. If not, see <http://www.gnu.org/licenses/>.

{{header}}
//! Autogenerated weights for `{{pallet}}`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION {{version}}
//! DATE: {{date}}, STEPS: `{{cmd.steps}}`, REPEAT: `{{cmd.repeat}}`, LOW RANGE: `{{cmd.lowest_range_values}}`, HIGH RANGE: `{{cmd.highest_range_values}}`
//! WORST CASE MAP SIZE: `{{cmd.worst_case_map_values}}`
//! HOSTNAME: `{{hostname}}`, CPU: `{{cpuname}}`
//! WASM-EXECUTION: `{{cmd.wasm_execution}}`, CHAIN: `{{cmd.chain}}`, DB CACHE: {{cmd.db_cache}}
//! WASM-EXECUTION: `{{cmd.wasm_execution}}`, CHAIN: `{{cmd.chain}}`, DB CACHE: `{{cmd.db_cache}}`

// Executed Command:
{{#each args as |arg|}}
Expand All @@ -16,16 +32,28 @@
#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(missing_docs)]
#![allow(dead_code)]

use frame_support::{traits::Get, weights::Weight};
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use core::marker::PhantomData;

/// Weight functions for `{{pallet}}`.
pub struct WeightInfo<T>(PhantomData<T>);
{{#if (eq pallet "frame_system_extensions")}}
impl<T: frame_system::Config> frame_system::ExtensionsWeightInfo for WeightInfo<T> {
/// Weight functions needed for `{{pallet}}`.
pub trait WeightInfo {
{{#each benchmarks as |benchmark|}}
fn {{benchmark.name~}}
(
{{~#each benchmark.components as |c| ~}}
{{c.name}}: u32, {{/each~}}
) -> Weight;
{{/each}}
}

/// Weights for `{{pallet}}` using the Substrate node and recommended hardware.
pub struct SubstrateWeight<T>(PhantomData<T>);
{{#if (or (eq pallet "frame_system") (eq pallet "frame_system_extensions"))}}
impl<T: crate::Config> WeightInfo for SubstrateWeight<T> {
{{else}}
impl<T: frame_system::Config> {{pallet}}::WeightInfo for WeightInfo<T> {
impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
{{/if}}
{{#each benchmarks as |benchmark|}}
{{#each benchmark.comments as |comment|}}
Expand All @@ -43,20 +71,19 @@ impl<T: frame_system::Config> {{pallet}}::WeightInfo for WeightInfo<T> {
// Measured: `{{benchmark.base_recorded_proof_size}}{{#each benchmark.component_recorded_proof_size as |cp|}} + {{cp.name}} * ({{cp.slope}} ±{{underscore cp.error}}){{/each}}`
// Estimated: `{{benchmark.base_calculated_proof_size}}{{#each benchmark.component_calculated_proof_size as |cp|}} + {{cp.name}} * ({{cp.slope}} ±{{underscore cp.error}}){{/each}}`
// Minimum execution time: {{underscore benchmark.min_execution_time}}_000 picoseconds.
Weight::from_parts({{underscore benchmark.base_weight}}, 0)
.saturating_add(Weight::from_parts(0, {{benchmark.base_calculated_proof_size}}))
Weight::from_parts({{underscore benchmark.base_weight}}, {{benchmark.base_calculated_proof_size}})
{{#each benchmark.component_weight as |cw|}}
// Standard Error: {{underscore cw.error}}
.saturating_add(Weight::from_parts({{underscore cw.slope}}, 0).saturating_mul({{cw.name}}.into()))
{{/each}}
{{#if (ne benchmark.base_reads "0")}}
.saturating_add(T::DbWeight::get().reads({{benchmark.base_reads}}))
.saturating_add(T::DbWeight::get().reads({{benchmark.base_reads}}_u64))
{{/if}}
{{#each benchmark.component_reads as |cr|}}
.saturating_add(T::DbWeight::get().reads(({{cr.slope}}_u64).saturating_mul({{cr.name}}.into())))
{{/each}}
{{#if (ne benchmark.base_writes "0")}}
.saturating_add(T::DbWeight::get().writes({{benchmark.base_writes}}))
.saturating_add(T::DbWeight::get().writes({{benchmark.base_writes}}_u64))
{{/if}}
{{#each benchmark.component_writes as |cw|}}
.saturating_add(T::DbWeight::get().writes(({{cw.slope}}_u64).saturating_mul({{cw.name}}.into())))
Expand All @@ -67,3 +94,45 @@ impl<T: frame_system::Config> {{pallet}}::WeightInfo for WeightInfo<T> {
}
{{/each}}
}

// For backwards compatibility and tests.
impl WeightInfo for () {
{{#each benchmarks as |benchmark|}}
{{#each benchmark.comments as |comment|}}
/// {{comment}}
{{/each}}
{{#each benchmark.component_ranges as |range|}}
/// The range of component `{{range.name}}` is `[{{range.min}}, {{range.max}}]`.
{{/each}}
fn {{benchmark.name~}}
(
{{~#each benchmark.components as |c| ~}}
{{~#if (not c.is_used)}}_{{/if}}{{c.name}}: u32, {{/each~}}
) -> Weight {
// Proof Size summary in bytes:
// Measured: `{{benchmark.base_recorded_proof_size}}{{#each benchmark.component_recorded_proof_size as |cp|}} + {{cp.name}} * ({{cp.slope}} ±{{underscore cp.error}}){{/each}}`
// Estimated: `{{benchmark.base_calculated_proof_size}}{{#each benchmark.component_calculated_proof_size as |cp|}} + {{cp.name}} * ({{cp.slope}} ±{{underscore cp.error}}){{/each}}`
// Minimum execution time: {{underscore benchmark.min_execution_time}}_000 picoseconds.
Weight::from_parts({{underscore benchmark.base_weight}}, {{benchmark.base_calculated_proof_size}})
{{#each benchmark.component_weight as |cw|}}
// Standard Error: {{underscore cw.error}}
.saturating_add(Weight::from_parts({{underscore cw.slope}}, 0).saturating_mul({{cw.name}}.into()))
{{/each}}
{{#if (ne benchmark.base_reads "0")}}
.saturating_add(RocksDbWeight::get().reads({{benchmark.base_reads}}_u64))
{{/if}}
{{#each benchmark.component_reads as |cr|}}
.saturating_add(RocksDbWeight::get().reads(({{cr.slope}}_u64).saturating_mul({{cr.name}}.into())))
{{/each}}
{{#if (ne benchmark.base_writes "0")}}
.saturating_add(RocksDbWeight::get().writes({{benchmark.base_writes}}_u64))
{{/if}}
{{#each benchmark.component_writes as |cw|}}
.saturating_add(RocksDbWeight::get().writes(({{cw.slope}}_u64).saturating_mul({{cw.name}}.into())))
{{/each}}
{{#each benchmark.component_calculated_proof_size as |cp|}}
.saturating_add(Weight::from_parts(0, {{cp.slope}}).saturating_mul({{cp.name}}.into()))
{{/each}}
}
{{/each}}
}
33 changes: 33 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Repository Guidelines

## Project Structure & Module Organization
- `node/` hosts the Substrate node binary; treat `runtime/mainnet` and `runtime/testnet` as the authoritative runtime crates.
- Pallets live under `pallets/…`, with matching runtime APIs in `pallets/*/rpc` and precompiles in `precompiles/`.
- `client/` contains RPC layers and tracing utilities, while `chainspecs/` and `deployment/` hold network configuration and release artifacts.
- Scripts for local orchestration sit in `scripts/`; TypeScript simulations are in `user-simulation/` for scenario-driven testing.

## Build, Test, and Development Commands
- `nix flake develop` opens a fully provisioned shell when using Nix.
- `cargo check -p node` validates core changes quickly; prefer before pushing.
- `cargo build --release --features testnet` produces the testnet node; swap features to target mainnet.
- `./scripts/run-standalone-local.sh --clean` spins up a fresh local testnet with authorities and logs under `/tmp`.
- `npx @acala-network/chopsticks@latest --config=scripts/chopsticks.yml` forks the live chain for rapid iteration.
- From `user-simulation/`, use `yarn install && yarn start` to exercise end-to-end flows against a local node.

## Coding Style & Naming Conventions
- Stick to the pinned toolchain in `rust-toolchain.toml` (Rust 1.86 plus `rustfmt`, `clippy`, and `wasm32-unknown-unknown` target).
- Format via `cargo fmt` (hard tabs, 100-column width) and lint with `cargo clippy --workspace --all-targets`.
- Prefer `snake_case` for modules/functions, `UpperCamelCase` for types, and `SCREAMING_SNAKE_CASE` for constants; mirror existing pallet naming when adding crates.
- Run `dprint fmt` on TOML manifests when touching dependency metadata.

## Testing Guidelines
- `cargo test --workspace` must pass; add focused crates with `-p pallet-name` for faster loops.
- Mirror runtime invariants in Rust unit tests; use benchmarks or fuzzers under `pallets/*/benchmarking` and `pallets/*/fuzzer` when logic is math-heavy.
- Execute `yarn test` in `user-simulation/` before merging features that affect external RPC flows.
- Document new integration scenarios in `scripts/` (e.g., additional Chopsticks configs) when manual steps are required.

## Commit & Pull Request Guidelines
- Follow the existing Conventional Commit pattern (`feat:`, `fix:`, `docs:`, `chore:`) seen in `git log`.
- Keep commits scoped to one logical change and include relevant crate paths in the body when touching multiple pallets.
- PRs should summarize motivation, list test commands run, and link issues or RFCs; attach screenshots only when UX or telemetry dashboards change.
- Request reviews from runtime and node owners for consensus-critical updates; surface migration notes for storage changes.
Loading
Loading