Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace legacy XRB ratios #4733

Merged
merged 12 commits into from
Sep 28, 2024
36 changes: 18 additions & 18 deletions nano/core_test/active_elections.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -334,15 +334,15 @@ TEST (inactive_votes_cache, existing_vote)
auto send = builder.send ()
.previous (latest)
.destination (key.pub)
.balance (nano::dev::constants.genesis_amount - 100 * nano::Gxrb_ratio)
.balance (nano::dev::constants.genesis_amount - 100 * nano::Knano_ratio)
.sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub)
.work (*system.work.generate (latest))
.build ();
auto open = builder.state ()
.account (key.pub)
.previous (0)
.representative (key.pub)
.balance (100 * nano::Gxrb_ratio)
.balance (100 * nano::Knano_ratio)
.link (send->hash ())
.sign (key.prv, key.pub)
.work (*system.work.generate (key.pub))
Expand Down Expand Up @@ -388,15 +388,15 @@ TEST (inactive_votes_cache, multiple_votes)
auto send1 = builder.send ()
.previous (nano::dev::genesis->hash ())
.destination (key1.pub)
.balance (nano::dev::constants.genesis_amount - 100 * nano::Gxrb_ratio)
.balance (nano::dev::constants.genesis_amount - 100 * nano::Knano_ratio)
.sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub)
.work (*system.work.generate (nano::dev::genesis->hash ()))
.build ();

auto send2 = builder.send ()
.previous (send1->hash ())
.destination (key1.pub)
.balance (100 * nano::Gxrb_ratio)
.balance (100 * nano::Knano_ratio)
.sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub)
.work (*system.work.generate (send1->hash ()))
.build ();
Expand All @@ -405,7 +405,7 @@ TEST (inactive_votes_cache, multiple_votes)
.account (key1.pub)
.previous (0)
.representative (key1.pub)
.balance (100 * nano::Gxrb_ratio)
.balance (100 * nano::Knano_ratio)
.link (send1->hash ())
.sign (key1.prv, key1.pub)
.work (*system.work.generate (key1.pub))
Expand Down Expand Up @@ -442,7 +442,7 @@ TEST (inactive_votes_cache, election_start)
nano::send_block_builder send_block_builder;
nano::state_block_builder state_block_builder;
// Enough weight to trigger election hinting but not enough to confirm block on its own
auto amount = ((node.online_reps.trended () / 100) * node.config.hinted_scheduler.hinting_threshold_percent) / 2 + 1000 * nano::Gxrb_ratio;
auto amount = ((node.online_reps.trended () / 100) * node.config.hinted_scheduler.hinting_threshold_percent) / 2 + 1000 * nano::Knano_ratio;
auto send1 = send_block_builder.make_block ()
.previous (latest)
.destination (key1.pub)
Expand Down Expand Up @@ -549,7 +549,7 @@ TEST (active_elections, vote_replays)
.account (nano::dev::genesis_key.pub)
.previous (nano::dev::genesis->hash ())
.representative (nano::dev::genesis_key.pub)
.balance (nano::dev::constants.genesis_amount - nano::Gxrb_ratio)
.balance (nano::dev::constants.genesis_amount - nano::Knano_ratio)
.link (key.pub)
.sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub)
.work (*system.work.generate (nano::dev::genesis->hash ()))
Expand All @@ -561,7 +561,7 @@ TEST (active_elections, vote_replays)
.account (key.pub)
.previous (0)
.representative (key.pub)
.balance (nano::Gxrb_ratio)
.balance (nano::Knano_ratio)
.link (send1->hash ())
.sign (key.prv, key.pub)
.work (*system.work.generate (key.pub))
Expand Down Expand Up @@ -589,14 +589,14 @@ TEST (active_elections, vote_replays)
ASSERT_EQ (nano::vote_code::replay, node.vote_router.vote (vote_open1).at (open1->hash ()));
ASSERT_TIMELY (5s, node.active.empty ());
ASSERT_EQ (nano::vote_code::replay, node.vote_router.vote (vote_open1).at (open1->hash ()));
ASSERT_EQ (nano::Gxrb_ratio, node.ledger.weight (key.pub));
ASSERT_EQ (nano::Knano_ratio, node.ledger.weight (key.pub));

// send 1 raw to key to key
auto send2 = builder.make_block ()
.account (key.pub)
.previous (open1->hash ())
.representative (key.pub)
.balance (nano::Gxrb_ratio - 1)
.balance (nano::Knano_ratio - 1)
.link (key.pub)
.sign (key.prv, key.pub)
.work (*system.work.generate (open1->hash ()))
Expand Down Expand Up @@ -706,7 +706,7 @@ TEST (active_elections, republish_winner)
.account (nano::dev::genesis_key.pub)
.previous (nano::dev::genesis->hash ())
.representative (nano::dev::genesis_key.pub)
.balance (nano::dev::constants.genesis_amount - nano::Gxrb_ratio)
.balance (nano::dev::constants.genesis_amount - nano::Knano_ratio)
.link (key.pub)
.sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub)
.work (*system.work.generate (nano::dev::genesis->hash ()))
Expand Down Expand Up @@ -739,7 +739,7 @@ TEST (active_elections, republish_winner)
.account (nano::dev::genesis_key.pub)
.previous (nano::dev::genesis->hash ())
.representative (nano::dev::genesis_key.pub)
.balance (nano::dev::constants.genesis_amount - 2 * nano::Gxrb_ratio)
.balance (nano::dev::constants.genesis_amount - 2 * nano::Knano_ratio)
.link (key.pub)
.sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub)
.work (*system.work.generate (nano::dev::genesis->hash ()))
Expand Down Expand Up @@ -772,7 +772,7 @@ TEST (active_elections, fork_filter_cleanup)
.previous (latest_hash)
.account (nano::dev::genesis_key.pub)
.representative (nano::dev::genesis_key.pub)
.balance (nano::dev::constants.genesis_amount - nano::Gxrb_ratio)
.balance (nano::dev::constants.genesis_amount - nano::Knano_ratio)
.link (key.pub)
.sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub)
.work (*system.work.generate (latest_hash))
Expand Down Expand Up @@ -889,7 +889,7 @@ TEST (active_elections, fork_replacement_tally)
.account (nano::dev::genesis_key.pub)
.previous (latest)
.representative (nano::dev::genesis_key.pub)
.balance (balance - 2 * nano::Gxrb_ratio)
.balance (balance - 2 * nano::Knano_ratio)
.link (key.pub)
.sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub)
.work (*system.work.generate (latest))
Expand All @@ -902,7 +902,7 @@ TEST (active_elections, fork_replacement_tally)
.account (nano::dev::genesis_key.pub)
.previous (latest)
.representative (nano::dev::genesis_key.pub)
.balance (balance - nano::Gxrb_ratio - i)
.balance (balance - nano::Knano_ratio - i)
.link (key.pub)
.sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub)
.work (*system.work.generate (latest))
Expand Down Expand Up @@ -1304,7 +1304,7 @@ TEST (active_elections, vacancy)
.previous (nano::dev::genesis->hash ())
.representative (nano::dev::genesis_key.pub)
.link (nano::dev::genesis_key.pub)
.balance (nano::dev::constants.genesis_amount - nano::Gxrb_ratio)
.balance (nano::dev::constants.genesis_amount - nano::Knano_ratio)
.sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub)
.work (*system.work.generate (nano::dev::genesis->hash ()))
.build ();
Expand Down Expand Up @@ -1339,7 +1339,7 @@ TEST (active_elections, limit_vote_hinted_elections)

// Setup representatives
// Enough weight to trigger election hinting but not enough to confirm block on its own
const auto amount = ((node.online_reps.trended () / 100) * node.config.hinted_scheduler.hinting_threshold_percent) + 1000 * nano::Gxrb_ratio;
const auto amount = ((node.online_reps.trended () / 100) * node.config.hinted_scheduler.hinting_threshold_percent) + 1000 * nano::Knano_ratio;
nano::keypair rep1 = nano::test::setup_rep (system, node, amount / 2);
nano::keypair rep2 = nano::test::setup_rep (system, node, amount / 2);

Expand Down Expand Up @@ -1464,7 +1464,7 @@ TEST (active_elections, broadcast_block_on_activation)
.account (nano::dev::genesis_key.pub)
.previous (nano::dev::genesis->hash ())
.representative (nano::dev::genesis_key.pub)
.balance (nano::dev::constants.genesis_amount - nano::Gxrb_ratio)
.balance (nano::dev::constants.genesis_amount - nano::Knano_ratio)
.link (nano::dev::genesis_key.pub)
.sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub)
.work (*system.work.generate (nano::dev::genesis->hash ()))
Expand Down
2 changes: 1 addition & 1 deletion nano/core_test/backlog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ TEST (backlog, election_activation)
.account (nano::dev::genesis_key.pub)
.previous (nano::dev::genesis->hash ())
.representative (nano::dev::genesis_key.pub)
.balance (nano::dev::constants.genesis_amount - nano::Gxrb_ratio)
.balance (nano::dev::constants.genesis_amount - nano::Knano_ratio)
.link (key.pub)
.sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub)
.work (*node.work_generate_blocking (nano::dev::genesis->hash ()))
Expand Down
14 changes: 7 additions & 7 deletions nano/core_test/block_store.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1009,7 +1009,7 @@ TEST (mdb_block_store, sideband_height)
.send ()
.previous (nano::dev::genesis->hash ())
.destination (nano::dev::genesis_key.pub)
.balance (nano::dev::constants.genesis_amount - nano::Gxrb_ratio)
.balance (nano::dev::constants.genesis_amount - nano::Knano_ratio)
.sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub)
.work (*pool.generate (nano::dev::genesis->hash ()))
.build ();
Expand All @@ -1035,7 +1035,7 @@ TEST (mdb_block_store, sideband_height)
.account (nano::dev::genesis_key.pub)
.previous (change->hash ())
.representative (0)
.balance (nano::dev::constants.genesis_amount - nano::Gxrb_ratio)
.balance (nano::dev::constants.genesis_amount - nano::Knano_ratio)
.link (key1.pub)
.sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub)
.work (*pool.generate (change->hash ()))
Expand All @@ -1046,7 +1046,7 @@ TEST (mdb_block_store, sideband_height)
.account (nano::dev::genesis_key.pub)
.previous (state_send1->hash ())
.representative (0)
.balance (nano::dev::constants.genesis_amount - 2 * nano::Gxrb_ratio)
.balance (nano::dev::constants.genesis_amount - 2 * nano::Knano_ratio)
.link (key2.pub)
.sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub)
.work (*pool.generate (state_send1->hash ()))
Expand All @@ -1057,7 +1057,7 @@ TEST (mdb_block_store, sideband_height)
.account (nano::dev::genesis_key.pub)
.previous (state_send2->hash ())
.representative (0)
.balance (nano::dev::constants.genesis_amount - 3 * nano::Gxrb_ratio)
.balance (nano::dev::constants.genesis_amount - 3 * nano::Knano_ratio)
.link (key3.pub)
.sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub)
.work (*pool.generate (state_send2->hash ()))
Expand All @@ -1068,7 +1068,7 @@ TEST (mdb_block_store, sideband_height)
.account (key1.pub)
.previous (0)
.representative (0)
.balance (nano::Gxrb_ratio)
.balance (nano::Knano_ratio)
.link (state_send1->hash ())
.sign (key1.prv, key1.pub)
.work (*pool.generate (key1.pub))
Expand All @@ -1079,7 +1079,7 @@ TEST (mdb_block_store, sideband_height)
.account (key1.pub)
.previous (state_open->hash ())
.representative (0)
.balance (nano::Gxrb_ratio)
.balance (nano::Knano_ratio)
.link (ledger.epoch_link (nano::epoch::epoch_1))
.sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub)
.work (*pool.generate (state_open->hash ()))
Expand All @@ -1103,7 +1103,7 @@ TEST (mdb_block_store, sideband_height)
.account (key2.pub)
.previous (epoch_open->hash ())
.representative (0)
.balance (nano::Gxrb_ratio)
.balance (nano::Knano_ratio)
.link (state_send2->hash ())
.sign (key2.prv, key2.pub)
.work (*pool.generate (epoch_open->hash ()))
Expand Down
Loading
Loading