Skip to content

Commit

Permalink
Merge pull request #151 from eosnetworkfoundation/elmato/change-seria…
Browse files Browse the repository at this point in the history
…lization-rlptx

[1.0] Change db serialization format for non-legacy transactions
  • Loading branch information
elmato authored Jun 4, 2024
2 parents 6325c33 + b693331 commit 7bc0250
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions silkworm/node/db/access_layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ void write_transactions(RWTxn& txn, const std::vector<Transaction>& transactions
auto key{db::block_key(base_id)};
for (const auto& transaction : transactions) {
Bytes value{};
rlp::encode(value, transaction);
rlp::encode(value, transaction, false);
mdbx::slice value_slice{value.data(), value.length()};
cursor->put(to_slice(key), &value_slice, MDBX_APPEND);
++base_id;
Expand All @@ -333,7 +333,7 @@ void read_transactions(ROCursor& txn_table, uint64_t base_id, uint64_t count, st
for (auto data{txn_table.find(to_slice(key), false)}; data.done && i < count;
data = txn_table.to_next(/*throw_notfound = */ false), ++i) {
ByteView data_view{from_slice(data.value)};
success_or_throw(rlp::decode(data_view, v.at(i)));
success_or_throw(rlp::decode_transaction(data_view, v.at(i), silkworm::rlp::Eip2718Wrapping::kNone));
}
SILKWORM_ASSERT(i == count);
}
Expand Down
2 changes: 1 addition & 1 deletion silkworm/node/db/access_layer_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,7 @@ TEST_CASE("read rlp encoded transactions") {

for (size_t i = 0; i < rlp_transactions.size(); i++) {
Bytes rlp_tx;
CHECK_NOTHROW(rlp::encode(rlp_tx, body.transactions[i]));
CHECK_NOTHROW(rlp::encode(rlp_tx, body.transactions[i], false));
CHECK(rlp_transactions[i] == rlp_tx);
}
}
Expand Down
2 changes: 1 addition & 1 deletion silkworm/silkrpc/core/rawdb/chain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ boost::asio::awaitable<Transactions> read_canonical_transactions(const DatabaseR
SILK_TRACE << "v: " << silkworm::to_hex(v);
silkworm::ByteView value{v};
silkworm::Transaction tx{};
const auto error = silkworm::rlp::decode(value, tx);
const auto error = silkworm::rlp::decode_transaction(value, tx, silkworm::rlp::Eip2718Wrapping::kNone);
if (!error) {
SILK_ERROR << "invalid RLP decoding for transaction index " << i;
return false;
Expand Down

0 comments on commit 7bc0250

Please sign in to comment.