Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
8043c38
Enable performance based rewards governance
pietrodimarco-dfinity Nov 17, 2025
c99c13b
Fix tests
pietrodimarco-dfinity Nov 19, 2025
fa36ad4
Fix tests
pietrodimarco-dfinity Nov 19, 2025
85ae738
Fix tests
pietrodimarco-dfinity Nov 19, 2025
03d4161
Fix tests
pietrodimarco-dfinity Nov 19, 2025
3e956b9
Add explanation comments
pietrodimarco-dfinity Nov 19, 2025
8b1dab8
Add explanation comments
pietrodimarco-dfinity Nov 19, 2025
b1d49f2
Add explanation comments
pietrodimarco-dfinity Nov 19, 2025
11b24d3
Add explanation comments
pietrodimarco-dfinity Nov 19, 2025
8252856
Add explanation comments
pietrodimarco-dfinity Nov 19, 2025
9ca7944
Add explanation comments
pietrodimarco-dfinity Nov 19, 2025
50368a5
Add explanation comments
pietrodimarco-dfinity Nov 19, 2025
f641204
Add explanation comments
pietrodimarco-dfinity Nov 19, 2025
ac063b4
Add node
pietrodimarco-dfinity Nov 19, 2025
92d7e3a
Add explanation comments
pietrodimarco-dfinity Nov 20, 2025
6d12907
Test change
pietrodimarco-dfinity Nov 20, 2025
eba7ccf
Test change
pietrodimarco-dfinity Nov 20, 2025
1035a5d
Test change
pietrodimarco-dfinity Nov 21, 2025
8e3ebe1
Add gov. tests
pietrodimarco-dfinity Nov 25, 2025
f1c948b
Merge branch 'master' into pmarco/enable-performance-based-rewards
pietrodimarco-dfinity Nov 25, 2025
5a25951
Add changelog
pietrodimarco-dfinity Nov 25, 2025
d1c56d7
Fix clippy
pietrodimarco-dfinity Nov 25, 2025
8eadbfd
Merge branch 'master' into pmarco/enable-performance-based-rewards
pietrodimarco-dfinity Nov 25, 2025
c8e8429
Merging master
pietrodimarco-dfinity Nov 25, 2025
b671951
Simplifying tests
pietrodimarco-dfinity Nov 25, 2025
3fd63b7
Use test canister
pietrodimarco-dfinity Nov 26, 2025
685ee02
Add features test
pietrodimarco-dfinity Nov 26, 2025
3104d13
Add features test
pietrodimarco-dfinity Nov 26, 2025
316545f
Add test feature to nrc
pietrodimarco-dfinity Nov 26, 2025
655cb23
Move ICCanisterClient for test in proper module
pietrodimarco-dfinity Nov 26, 2025
42c39be
Move ICCanisterClient for test in proper module
pietrodimarco-dfinity Nov 26, 2025
83f8d3e
Remove useless import config
pietrodimarco-dfinity Nov 26, 2025
c5deab1
Revert
pietrodimarco-dfinity Nov 26, 2025
2fab3e5
Revert
pietrodimarco-dfinity Nov 26, 2025
a0eafd1
Add implementation
pietrodimarco-dfinity Nov 26, 2025
593047d
Merge branch 'pmarco/add-feature-test-nrc' into pmarco/enable-perform…
pietrodimarco-dfinity Nov 26, 2025
9f963e3
Remove test feature nrc
pietrodimarco-dfinity Nov 26, 2025
8ed939f
Merge branch 'master' into pmarco/enable-performance-based-rewards
pietrodimarco-dfinity Nov 26, 2025
9afdb62
Merge branch 'master' into pmarco/enable-performance-based-rewards
pietrodimarco-dfinity Nov 26, 2025
79b39e8
Solved comments
pietrodimarco-dfinity Nov 26, 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
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion rs/nns/governance/src/governance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ pub(crate) const LOG_PREFIX: &str = "[Governance] ";

/// The number of seconds between automated Node Provider reward events
/// Currently 1/12 of a year: 2629800 = 86400 * 365.25 / 12
const NODE_PROVIDER_REWARD_PERIOD_SECONDS: u64 = 2629800;
pub const NODE_PROVIDER_REWARD_PERIOD_SECONDS: u64 = 2629800;

const VALID_MATURITY_MODULATION_BASIS_POINTS_RANGE: RangeInclusive<i32> = -500..=500;

Expand Down
2 changes: 1 addition & 1 deletion rs/nns/governance/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ thread_local! {
}

thread_local! {
static ARE_PERFORMANCE_BASED_REWARDS_ENABLED: Cell<bool> = const { Cell::new(false) };
static ARE_PERFORMANCE_BASED_REWARDS_ENABLED: Cell<bool> = const { Cell::new(cfg!(feature = "test")) };
}

pub(crate) fn are_performance_based_rewards_enabled() -> bool {
Expand Down
17 changes: 17 additions & 0 deletions rs/nns/governance/tests/fake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@ use ic_nns_governance::governance::tla::{
self, Destination, TLA_INSTRUMENTATION_STATE, ToTla, account_to_tla, tla_function,
};
use ic_nns_governance::{tla_log_request, tla_log_response};
use ic_node_rewards_canister_api::RewardsCalculationAlgorithmVersion;
use ic_node_rewards_canister_api::monthly_rewards::GetNodeProvidersMonthlyXdrRewardsResponse;
use ic_node_rewards_canister_api::providers_rewards::{
GetNodeProvidersRewardsResponse, NodeProvidersRewards,
};

lazy_static! {
pub(crate) static ref SNS_ROOT_CANISTER_ID: PrincipalId = PrincipalId::new_user_test_id(213599);
Expand Down Expand Up @@ -612,6 +616,19 @@ impl Environment for FakeDriver {
.unwrap());
}

if method_name == "get_node_providers_rewards" {
assert_eq!(PrincipalId::from(target), NODE_REWARDS_CANISTER_ID.get());

let response: GetNodeProvidersRewardsResponse = Ok(NodeProvidersRewards {
rewards_xdr_permyriad: btreemap! {
PrincipalId::new_user_test_id(1).0 => NODE_PROVIDER_REWARD,
},
algorithm_version: RewardsCalculationAlgorithmVersion::default(),
});

return Ok(Encode!(&response).unwrap());
}

if method_name == "get_average_icp_xdr_conversion_rate" {
assert_eq!(PrincipalId::from(target), CYCLES_MINTING_CANISTER_ID.get());

Expand Down
4 changes: 1 addition & 3 deletions rs/nns/governance/tests/governance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1354,7 +1354,7 @@ async fn test_mint_monthly_node_provider_rewards() {
xdr_conversion_rate,
minimum_xdr_permyriad_per_icp,
maximum_node_provider_rewards_e8s,
registry_version,
registry_version: _,
node_providers,
algorithm_version: _,
} = most_recent_monthly_node_provider_rewards;
Expand All @@ -1369,8 +1369,6 @@ async fn test_mint_monthly_node_provider_rewards() {
maximum_node_provider_rewards_e8s,
Some(default_economics.maximum_node_provider_rewards_e8s)
);
// It happens to be 5, we just want to ensure it is set.
assert_eq!(registry_version, Some(5));
assert_eq!(node_providers.len(), 1);
}

Expand Down
4 changes: 4 additions & 0 deletions rs/nns/integration_tests/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,10 @@ DEV_DEPENDENCIES = [
"//rs/nervous_system/common/test_utils",
"//rs/nervous_system/integration_tests:nervous_system_integration_tests",
"//rs/nns/test_utils/golden_nns_state",
"//rs/node_rewards/rewards_calculation",
"//rs/test_utilities/metrics",
"//rs/types/types_test_utils",
"@crate_index//:chrono_canisters",
"@crate_index//:ic-cbor",
"@crate_index//:ic-certificate-verification",
"@crate_index//:ic-certification",
Expand Down Expand Up @@ -158,6 +160,7 @@ DEV_DATA = [
"//rs/nns/handlers/root/impl:root-canister",
"//rs/nns/sns-wasm:sns-wasm-canister",
"//rs/node_rewards/canister:node-rewards-canister",
"//rs/node_rewards/canister:node-rewards-canister-test",
"//rs/pocket_ic_server:pocket-ic-server",
"//rs/registry/canister:registry-canister",
"//rs/registry/canister:registry-canister-test",
Expand Down Expand Up @@ -188,6 +191,7 @@ DEV_ENV = {
"CYCLES_MINTING_CANISTER_WASM_PATH": "$(rootpath //rs/nns/cmc:cycles-minting-canister)",
"MEM_UTILS_TEST_CANISTER_WASM_PATH": "$(rootpath :mem-utils-test-canister)",
"NODE_REWARDS_CANISTER_WASM_PATH": "$(rootpath //rs/node_rewards/canister:node-rewards-canister)",
"NODE_REWARDS_CANISTER_TEST_WASM_PATH": "$(rootpath //rs/node_rewards/canister:node-rewards-canister-test)",
"POCKET_IC_BIN": "$(rootpath //rs/pocket_ic_server:pocket-ic-server)",
"CANISTER_PLAYGROUND_CANISTER_WASM_PATH": "$(rootpath :canister-playground-canister)",
"SNS_WASM_CANISTER_WASM_PATH": "$(rootpath //rs/nns/sns-wasm:sns-wasm-canister)",
Expand Down
2 changes: 2 additions & 0 deletions rs/nns/integration_tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,5 @@ ic-nervous-system-integration-tests = { path = "../../nervous_system/integration
ic-nns-test-utils-golden-nns-state = { path = "../test_utils/golden_nns_state" }
ic-registry-canister-api = { path = "../../registry/canister/api" }
pretty_assertions = { workspace = true }
rewards-calculation = { path = "../../node_rewards/rewards_calculation" }
chrono = { workspace = true }
Loading
Loading