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

Cleanup of genesis constants within ledger_constants #3381

Merged
merged 5 commits into from
Jul 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
30 changes: 15 additions & 15 deletions nano/core_test/block_store.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ TEST (block_store, genesis)
auto hash (genesis.hash ());
nano::ledger_cache ledger_cache;
auto transaction (store->tx_begin_write ());
store->initialize (transaction, genesis, ledger_cache);
store->initialize (transaction, ledger_cache);
nano::account_info info;
ASSERT_FALSE (store->account.get (transaction, nano::genesis_account, info));
ASSERT_EQ (hash, info.head);
Expand Down Expand Up @@ -668,7 +668,7 @@ TEST (mdb_block_store, supported_version_upgrades)
nano::stat stats;
nano::ledger ledger (store, stats);
auto transaction (store.tx_begin_write ());
store.initialize (transaction, genesis, ledger.cache);
store.initialize (transaction, ledger.cache);
// Lower the database to the max version unsupported for upgrades
store.version.put (transaction, store.minimum_version - 1);
}
Expand All @@ -686,7 +686,7 @@ TEST (mdb_block_store, supported_version_upgrades)
nano::stat stats;
nano::ledger ledger (store, stats);
auto transaction (store.tx_begin_write ());
store.initialize (transaction, genesis, ledger.cache);
store.initialize (transaction, ledger.cache);
// Lower the database version to the minimum version supported for upgrade.
store.version.put (transaction, store.minimum_version);
store.confirmation_height.del (transaction, nano::genesis_account);
Expand Down Expand Up @@ -882,7 +882,7 @@ TEST (block_store, cemented_count_cache)
auto transaction (store->tx_begin_write ());
nano::genesis genesis;
nano::ledger_cache ledger_cache;
store->initialize (transaction, genesis, ledger_cache);
store->initialize (transaction, ledger_cache);
ASSERT_EQ (1, ledger_cache.cemented_count);
}

Expand All @@ -895,7 +895,7 @@ TEST (block_store, block_random)
{
nano::ledger_cache ledger_cache;
auto transaction (store->tx_begin_write ());
store->initialize (transaction, genesis, ledger_cache);
store->initialize (transaction, ledger_cache);
}
auto transaction (store->tx_begin_read ());
auto block (store->block.random (transaction));
Expand All @@ -915,7 +915,7 @@ TEST (block_store, pruned_random)
{
nano::ledger_cache ledger_cache;
auto transaction (store->tx_begin_write ());
store->initialize (transaction, genesis, ledger_cache);
store->initialize (transaction, ledger_cache);
store->pruned.put (transaction, hash1);
}
auto transaction (store->tx_begin_read ());
Expand Down Expand Up @@ -977,7 +977,7 @@ TEST (block_store, state_block)
{
nano::ledger_cache ledger_cache;
auto transaction (store->tx_begin_write ());
store->initialize (transaction, genesis, ledger_cache);
store->initialize (transaction, ledger_cache);
ASSERT_EQ (nano::block_type::state, block1.type ());
store->block.put (transaction, block1.hash (), block1);
ASSERT_TRUE (store->block.exists (transaction, block1.hash ()));
Expand Down Expand Up @@ -1014,7 +1014,7 @@ TEST (mdb_block_store, sideband_height)
nano::stat stat;
nano::ledger ledger (store, stat);
auto transaction (store.tx_begin_write ());
store.initialize (transaction, genesis, ledger.cache);
store.initialize (transaction, ledger.cache);
nano::work_pool pool (std::numeric_limits<unsigned>::max ());
nano::send_block send (genesis.hash (), nano::dev_genesis_key.pub, nano::genesis_amount - nano::Gxrb_ratio, nano::dev_genesis_key.prv, nano::dev_genesis_key.pub, *pool.generate (genesis.hash ()));
ASSERT_EQ (nano::process_result::progress, ledger.process (transaction, send).code);
Expand Down Expand Up @@ -1283,7 +1283,7 @@ TEST (mdb_block_store, upgrade_v14_v15)
nano::stat stats;
nano::ledger ledger (store, stats);
auto transaction (store.tx_begin_write ());
store.initialize (transaction, genesis, ledger.cache);
store.initialize (transaction, ledger.cache);
nano::account_info account_info;
ASSERT_FALSE (store.account.get (transaction, nano::genesis_account, account_info));
nano::confirmation_height_info confirmation_height_info;
Expand Down Expand Up @@ -1391,7 +1391,7 @@ TEST (mdb_block_store, upgrade_v15_v16)
nano::stat stats;
nano::ledger ledger (store, stats);
auto transaction (store.tx_begin_write ());
store.initialize (transaction, genesis, ledger.cache);
store.initialize (transaction, ledger.cache);
// The representation table should get removed after, so readd it so that we can later confirm this actually happens
auto txn = store.env.tx (transaction);
ASSERT_FALSE (mdb_dbi_open (txn, "representation", MDB_CREATE, &store.representation_handle));
Expand Down Expand Up @@ -1444,7 +1444,7 @@ TEST (mdb_block_store, upgrade_v16_v17)
nano::stat stats;
nano::ledger ledger (store, stats);
auto transaction (store.tx_begin_write ());
store.initialize (transaction, genesis, ledger.cache);
store.initialize (transaction, ledger.cache);
ASSERT_EQ (nano::process_result::progress, ledger.process (transaction, block1).code);
ASSERT_EQ (nano::process_result::progress, ledger.process (transaction, block2).code);
ASSERT_EQ (nano::process_result::progress, ledger.process (transaction, block3).code);
Expand Down Expand Up @@ -1517,7 +1517,7 @@ TEST (mdb_block_store, upgrade_v17_v18)
auto transaction (store.tx_begin_write ());
nano::stat stats;
nano::ledger ledger (store, stats);
store.initialize (transaction, genesis, ledger.cache);
store.initialize (transaction, ledger.cache);
ASSERT_EQ (nano::process_result::progress, ledger.process (transaction, send_zero).code);
ASSERT_EQ (nano::process_result::progress, ledger.process (transaction, state_receive_zero).code);
ASSERT_EQ (nano::process_result::progress, ledger.process (transaction, epoch).code);
Expand Down Expand Up @@ -1714,7 +1714,7 @@ TEST (mdb_block_store, upgrade_v18_v19)
nano::stat stats;
nano::ledger ledger (store, stats);
auto transaction (store.tx_begin_write ());
store.initialize (transaction, genesis, ledger.cache);
store.initialize (transaction, ledger.cache);

ASSERT_EQ (nano::process_result::progress, ledger.process (transaction, send).code);
ASSERT_EQ (nano::process_result::progress, ledger.process (transaction, receive).code);
Expand Down Expand Up @@ -1797,7 +1797,7 @@ TEST (mdb_block_store, upgrade_v19_v20)
nano::mdb_store store (logger, path);
nano::ledger ledger (store, stats);
auto transaction (store.tx_begin_write ());
store.initialize (transaction, genesis, ledger.cache);
store.initialize (transaction, ledger.cache);
// Delete pruned table
ASSERT_FALSE (mdb_drop (store.env.tx (transaction), store.pruned_handle, 1));
store.version.put (transaction, 19);
Expand Down Expand Up @@ -1827,7 +1827,7 @@ TEST (mdb_block_store, upgrade_v20_v21)
nano::mdb_store store (logger, path);
nano::ledger ledger (store, stats);
auto transaction (store.tx_begin_write ());
store.initialize (transaction, genesis, ledger.cache);
store.initialize (transaction, ledger.cache);
// Delete pruned table
ASSERT_FALSE (mdb_drop (store.env.tx (transaction), store.final_votes_handle, 1));
store.version.put (transaction, 20);
Expand Down
10 changes: 5 additions & 5 deletions nano/core_test/confirmation_height.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@ TEST (confirmation_heightDeathTest, rollback_added_block)
auto send = std::make_shared<nano::send_block> (genesis.hash (), key1.pub, nano::genesis_amount - nano::Gxrb_ratio, nano::dev_genesis_key.prv, nano::dev_genesis_key.pub, *pool.generate (genesis.hash ()));
{
auto transaction (store->tx_begin_write ());
store->initialize (transaction, genesis, ledger.cache);
store->initialize (transaction, ledger.cache);
}

uint64_t batch_write_size = 2048;
Expand Down Expand Up @@ -809,7 +809,7 @@ TEST (confirmation_heightDeathTest, modified_chain)
auto send = std::make_shared<nano::send_block> (nano::genesis_hash, key1.pub, nano::genesis_amount - nano::Gxrb_ratio, nano::dev_genesis_key.prv, nano::dev_genesis_key.pub, *pool.generate (nano::genesis_hash));
{
auto transaction (store->tx_begin_write ());
store->initialize (transaction, genesis, ledger.cache);
store->initialize (transaction, ledger.cache);
ASSERT_EQ (nano::process_result::progress, ledger.process (transaction, *send).code);
}

Expand Down Expand Up @@ -881,7 +881,7 @@ TEST (confirmation_heightDeathTest, modified_chain_account_removed)
auto open = std::make_shared<nano::state_block> (key1.pub, 0, 0, nano::Gxrb_ratio, send->hash (), key1.prv, key1.pub, *pool.generate (key1.pub));
{
auto transaction (store->tx_begin_write ());
store->initialize (transaction, genesis, ledger.cache);
store->initialize (transaction, ledger.cache);
ASSERT_EQ (nano::process_result::progress, ledger.process (transaction, *send).code);
ASSERT_EQ (nano::process_result::progress, ledger.process (transaction, *open).code);
}
Expand Down Expand Up @@ -1376,7 +1376,7 @@ TEST (confirmation_height, unbounded_block_cache_iteration)
auto send1 = std::make_shared<nano::send_block> (send->hash (), key1.pub, nano::genesis_amount - nano::Gxrb_ratio * 2, nano::dev_genesis_key.prv, nano::dev_genesis_key.pub, *pool.generate (send->hash ()));
{
auto transaction (store->tx_begin_write ());
store->initialize (transaction, genesis, ledger.cache);
store->initialize (transaction, ledger.cache);
ASSERT_EQ (nano::process_result::progress, ledger.process (transaction, *send).code);
ASSERT_EQ (nano::process_result::progress, ledger.process (transaction, *send1).code);
}
Expand Down Expand Up @@ -1429,7 +1429,7 @@ TEST (confirmation_height, pruned_source)
auto open2 = std::make_shared<nano::state_block> (key2.pub, 0, key1.pub, 50, send2->hash (), key2.prv, key2.pub, *pool.generate (key2.pub));
{
auto transaction (store->tx_begin_write ());
store->initialize (transaction, genesis, ledger.cache);
store->initialize (transaction, ledger.cache);
ASSERT_EQ (nano::process_result::progress, ledger.process (transaction, *send1).code);
ASSERT_EQ (nano::process_result::progress, ledger.process (transaction, *open1).code);
ASSERT_EQ (nano::process_result::progress, ledger.process (transaction, *send2).code);
Expand Down
Loading