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

[1.0] Change db serialization format for non-legacy transactions #151

Merged
merged 2 commits into from
Jun 4, 2024
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
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
Loading