From 21164b5dd2194e554977bb07916dbcf5bf2559f7 Mon Sep 17 00:00:00 2001 From: yarkin Date: Mon, 11 Mar 2024 16:11:31 +0800 Subject: [PATCH] Function argument list tweak, no functionality changes expected. --- silkworm/node/db/access_layer.cpp | 6 +++--- silkworm/node/db/access_layer.hpp | 4 ++-- silkworm/node/db/access_layer_test.cpp | 12 ++++++------ 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/silkworm/node/db/access_layer.cpp b/silkworm/node/db/access_layer.cpp index 937acb63..54c7b5ea 100644 --- a/silkworm/node/db/access_layer.cpp +++ b/silkworm/node/db/access_layer.cpp @@ -1196,7 +1196,7 @@ std::optional read_runtime_states_bytes(ROTxn& txn, RuntimeState runti return from_slice(data.value); } -void write_runtime_states_bytes(RWTxn& txn, const Bytes value, RuntimeState runtime_state) { +void write_runtime_states_bytes(RWTxn& txn, RuntimeState runtime_state, const Bytes value) { auto cursor = txn.rw_cursor(table::kRuntimeStates); auto key{db::block_key(runtime_state)}; cursor->upsert(to_slice(key), db::to_slice(value)); @@ -1214,9 +1214,9 @@ std::optional read_runtime_states_u64(ROTxn& txn, RuntimeState runtime return num; } -void write_runtime_states_u64(RWTxn& txn, uint64_t num, RuntimeState runtime_state) { +void write_runtime_states_u64(RWTxn& txn, RuntimeState runtime_state, uint64_t num) { Bytes value{db::block_key(num)}; - write_runtime_states_bytes(txn, value, runtime_state); + write_runtime_states_bytes(txn, runtime_state, value); } std::optional read_consensus_parameters(ROTxn& txn, BlockNum index) { diff --git a/silkworm/node/db/access_layer.hpp b/silkworm/node/db/access_layer.hpp index 5ad62635..347bad91 100644 --- a/silkworm/node/db/access_layer.hpp +++ b/silkworm/node/db/access_layer.hpp @@ -243,13 +243,13 @@ void write_last_finalized_block(RWTxn& txn, const evmc::bytes32& hash); std::optional read_runtime_states_bytes(ROTxn& txn, RuntimeState runtime_state); //! \brief Write runtime states by index -void write_runtime_states_bytes(RWTxn& txn, const Bytes value, RuntimeState runtime_state); +void write_runtime_states_bytes(RWTxn& txn, RuntimeState runtime_state, const Bytes value); //! \brief Read runtime states by index as uint64_t std::optional read_runtime_states_u64(ROTxn& txn, RuntimeState runtime_state); //! \brief Write uint64_t as runtime states by index -void write_runtime_states_u64(RWTxn& txn, uint64_t num, RuntimeState runtime_state); +void write_runtime_states_u64(RWTxn& txn, RuntimeState runtime_state, uint64_t num); //! \brief Read ConsensusParameters indexed by blocknum that it is added. std::optional read_consensus_parameters(ROTxn& txn, BlockNum index); diff --git a/silkworm/node/db/access_layer_test.cpp b/silkworm/node/db/access_layer_test.cpp index 2365bf91..0af1586d 100644 --- a/silkworm/node/db/access_layer_test.cpp +++ b/silkworm/node/db/access_layer_test.cpp @@ -875,14 +875,14 @@ TEST_CASE("RuntimeStates_u64") { CHECK(read_runtime_states_u64(txn, kLibProcessed) == std::nullopt); - write_runtime_states_u64(txn, value1, index ); + write_runtime_states_u64(txn, index, value1); CHECK(read_runtime_states_u64(txn, index) == value1); - write_runtime_states_u64(txn, value1, RuntimeState(1) ); + write_runtime_states_u64(txn, RuntimeState(1), value1); CHECK(read_runtime_states_u64(txn, RuntimeState(1)) == value1); - write_runtime_states_u64(txn, value2, index ); + write_runtime_states_u64(txn, index, value2); CHECK(read_runtime_states_u64(txn, index) == value2); CHECK(read_runtime_states_u64(txn, RuntimeState(1)) == value1); @@ -901,14 +901,14 @@ TEST_CASE("RuntimeStates_bytes") { CHECK(read_runtime_states_bytes(txn, kLibProcessed) == std::nullopt); - write_runtime_states_bytes(txn, value1, index ); + write_runtime_states_bytes(txn, index, value1); CHECK(read_runtime_states_bytes(txn, index) == value1); - write_runtime_states_bytes(txn, value1, RuntimeState(1) ); + write_runtime_states_bytes(txn, RuntimeState(1), value1); CHECK(read_runtime_states_bytes(txn, RuntimeState(1)) == value1); - write_runtime_states_bytes(txn, value2, index ); + write_runtime_states_bytes(txn, index, value2); CHECK(read_runtime_states_bytes(txn, index) == value2); CHECK(read_runtime_states_bytes(txn, RuntimeState(1)) == value1);