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

capi: execute single transaction #2665

Merged
merged 48 commits into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
4b1494b
Provisional execution code
JacekGlen Dec 7, 2024
79bcfee
Merge branch 'master' into capi-execute-single-txn
JacekGlen Dec 7, 2024
e000cfc
Update remote state
JacekGlen Dec 9, 2024
aa9bd06
Merge branch 'master' into capi-execute-single-txn
JacekGlen Dec 9, 2024
3ff8c24
Test run
JacekGlen Dec 10, 2024
3e21459
Make code compile
bzawisto Dec 10, 2024
6102617
Update mdbx
JacekGlen Dec 10, 2024
e5d602c
Update single_tx
JacekGlen Jan 6, 2025
06331a0
Merge branch 'master' into capi-execute-single-txn
JacekGlen Jan 6, 2025
b97e458
Merge branch 'master' into capi-execute-single-txn
JacekGlen Jan 14, 2025
5d30a9b
disable domain accessor index
battlmonstr Jan 15, 2025
c6f356e
remove T prefix from non-template types
battlmonstr Jan 15, 2025
cbe767f
rename InvertedIndexRangeByKeyQuery to entity/entity_name for unifica…
battlmonstr Jan 15, 2025
7ae5e3d
Merge branch 'master' into capi-execute-single-txn
JacekGlen Jan 16, 2025
5b1ebc6
move murmur_hash3 to snapshots/common
battlmonstr Jan 16, 2025
c368efc
salt file
battlmonstr Jan 16, 2025
225351d
DomainGetLatestQuery
battlmonstr Jan 15, 2025
50c05da
Update to latest code changes
JacekGlen Jan 17, 2025
04d8841
Merge remote-tracking branch 'origin/pr/domain_get_latest2' into capi…
JacekGlen Jan 17, 2025
befd4b1
Add DomainState and tests
JacekGlen Jan 19, 2025
34a0efe
make fmt
web-flow Jan 19, 2025
e7bc232
Merge branch 'master' into capi-execute-single-txn
JacekGlen Jan 19, 2025
ec6a7e5
Update copyright
JacekGlen Jan 19, 2025
4777cb0
Remove temp log comments
JacekGlen Jan 19, 2025
2e159cc
make fmt
web-flow Jan 19, 2025
6ef32fd
Fix test execution
JacekGlen Jan 19, 2025
a9f2bde
Merge branch 'capi-execute-single-txn' of https://github.com/erigonte…
JacekGlen Jan 19, 2025
222e78d
Add unit tests and optimize domain state queries
JacekGlen Jan 23, 2025
1736796
Fix silkworm capi test
JacekGlen Jan 24, 2025
8969083
Consistent naming for txn index
JacekGlen Jan 24, 2025
c7160b8
Remove redundant debug messages
JacekGlen Jan 24, 2025
a3f3f18
Merge branch 'master' into capi-execute-single-txn
JacekGlen Jan 27, 2025
79e12b5
Merge branch 'master' into capi-execute-single-txn
JacekGlen Jan 28, 2025
4f6c8d2
Simplify domain queries
JacekGlen Jan 29, 2025
23676f1
Merge branch 'master' into capi-execute-single-txn
JacekGlen Jan 29, 2025
2ce87c2
Fix CI build errors
JacekGlen Jan 29, 2025
6f77609
Cleanup code
JacekGlen Jan 29, 2025
ce38609
make fmt
web-flow Jan 29, 2025
eaadfd4
Remove redundant var
JacekGlen Jan 29, 2025
857d3a1
Merge branch 'capi-execute-single-txn' of https://github.com/erigonte…
JacekGlen Jan 29, 2025
0f40861
Merge branch 'master' into capi-execute-single-txn
JacekGlen Jan 29, 2025
5794859
Changes from code review
JacekGlen Jan 30, 2025
4e79e96
make fmt
web-flow Jan 30, 2025
d234325
Merge branch 'master' into capi-execute-single-txn
JacekGlen Jan 30, 2025
f032bf6
Merge branch 'capi-execute-single-txn' of https://github.com/erigonte…
JacekGlen Jan 30, 2025
40856f6
Fix build
JacekGlen Jan 30, 2025
6bd9213
Changes from code review
JacekGlen Jan 30, 2025
7314d13
Changes from code review
JacekGlen Jan 30, 2025
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
2 changes: 2 additions & 0 deletions silkworm/capi/instance.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ struct SilkwormInstance {
std::unique_ptr<silkworm::rpc::Daemon> rpcdaemon;
std::unique_ptr<silkworm::stagedsync::ExecutionEngine> execution_engine;

std::optional<silkworm::ChainConfig> chain_config;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also have this field inside instance.node_settings.chain_config.
I have on my TODO list to split it to be separate from NodeSettings, because we believe that NodeSettings should just only reflect static CLI options.
So even if duplicate - it is a change in a good direction :)


// sentry
std::unique_ptr<std::thread> sentry_thread;
boost::asio::cancellation_signal sentry_stop_signal;
Expand Down
88 changes: 88 additions & 0 deletions silkworm/capi/silkworm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,33 @@
#include <silkworm/db/buffer.hpp>
#include <silkworm/db/datastore/snapshots/index_builder.hpp>
#include <silkworm/db/datastore/snapshots/segment/segment_reader.hpp>
#include <silkworm/db/kv/grpc/client/remote_client.hpp>
#include <silkworm/db/stages.hpp>
#include <silkworm/db/state/schema_config.hpp>
#include <silkworm/execution/domain_state.hpp>
#include <silkworm/execution/remote_state.hpp>
#include <silkworm/execution/state_factory.hpp>
#include <silkworm/infra/common/bounded_buffer.hpp>
#include <silkworm/infra/common/directories.hpp>
#include <silkworm/infra/common/stopwatch.hpp>
#include <silkworm/infra/concurrency/context_pool_settings.hpp>
#include <silkworm/infra/concurrency/signal_handler.hpp>
#include <silkworm/infra/concurrency/spawn.hpp>
#include <silkworm/infra/concurrency/thread_pool.hpp>
#include <silkworm/infra/grpc/client/client_context_pool.hpp>
#include <silkworm/node/execution/block/block_executor.hpp>
#include <silkworm/node/stagedsync/execution_engine.hpp>
#include <silkworm/rpc/daemon.hpp>
#include <silkworm/rpc/ethbackend/remote_backend.hpp>
#include <silkworm/rpc/ethdb/kv/backend_providers.hpp>

#include "common.hpp"
#include "instance.hpp"

using namespace std::chrono_literals;
using namespace silkworm;
// using namespace silkworm::db;
// using namespace silkworm::rpc;

static MemoryMappedRegion make_region(const SilkwormMemoryMappedFile& mmf) {
return {mmf.memory_address, mmf.memory_length};
Expand Down Expand Up @@ -741,6 +751,84 @@ int silkworm_execute_blocks_perpetual(SilkwormHandle handle, MDBX_env* mdbx_env,
}
}

SILKWORM_EXPORT int silkworm_execute_txn(SilkwormHandle handle, MDBX_txn* mdbx_tx, uint64_t block_num, struct SilkwormBytes32 block_hash, uint64_t txn_index, uint64_t txn_num, uint64_t* gas_used, uint64_t* blob_gas_used) SILKWORM_NOEXCEPT {
log::Info{"silkworm_execute_txn", {"block_num", std::to_string(block_num), "txn_index", std::to_string(txn_index)}};
if (!handle) {
return SILKWORM_INVALID_HANDLE;
}

if (!mdbx_tx) {
return SILKWORM_INVALID_MDBX_TXN;
}

if (gas_used) {
*gas_used = 0;
}

if (blob_gas_used) {
*blob_gas_used = 0;
}

silkworm::Hash block_header_hash{};
memcpy(block_header_hash.bytes, block_hash.bytes, sizeof(block_hash.bytes));
BlockNum block_number{block_num};
TxnId txn_id_{txn_num};

auto unmanaged_tx = datastore::kvdb::RWTxnUnmanaged{mdbx_tx};
auto unmanaged_env = silkworm::datastore::kvdb::EnvUnmanaged{::mdbx_txn_env(mdbx_tx)};
auto chain_db = db::DataStore::make_chaindata_database(std::move(unmanaged_env));
auto db_ref = chain_db.ref();
auto state = silkworm::execution::DomainState{txn_id_, unmanaged_tx, db_ref, *handle->blocks_repository, *handle->state_repository};
if (!handle->chain_config) {
handle->chain_config = db::read_chain_config(unmanaged_tx);
}

// TODO: cache block, also consider preloading
silkworm::Block block{};
auto block_read_ok = state.read_body(block_number, block_header_hash, block);
if (!block_read_ok) {
SILK_ERROR << "Block not found"
<< " block_number: " << block_number << " block_hash: " << block_header_hash;
return SILKWORM_INVALID_BLOCK;
}
auto header = state.read_header(block_number, block_header_hash);
if (!header) {
SILK_ERROR << "Header not found"
<< " block_number: " << block_number << " block_hash: " << block_header_hash;
return SILKWORM_INVALID_BLOCK;
JacekGlen marked this conversation as resolved.
Show resolved Hide resolved
}
block.header = header.value();

if (txn_index >= block.transactions.size()) {
SILK_ERROR << "Transaction not found"
<< " txn_index: " << txn_index;
return SILKWORM_INVALID_BLOCK;
}

auto& transaction = block.transactions[txn_index];

auto protocol_rule_set_{protocol::rule_set_factory(*handle->chain_config)};
ExecutionProcessor processor{block, *protocol_rule_set_, state, *handle->chain_config, false};
// TODO: add analysis cache, check block exec for more

silkworm::Receipt receipt{};
const ValidationResult err{protocol::validate_transaction(transaction, processor.intra_block_state(), processor.available_gas())};
if (err != ValidationResult::kOk) {
return SILKWORM_INVALID_BLOCK;
}
processor.execute_transaction(transaction, receipt);
state.insert_receipts(block_number, std::vector<silkworm::Receipt>{receipt});

if (gas_used) {
*gas_used = receipt.cumulative_gas_used;
}
if (blob_gas_used) {
*blob_gas_used = transaction.total_blob_gas();
}

return SILKWORM_OK;
}

SILKWORM_EXPORT int silkworm_fini(SilkwormHandle handle) SILKWORM_NOEXCEPT {
if (!handle) {
return SILKWORM_INVALID_HANDLE;
Expand Down
14 changes: 14 additions & 0 deletions silkworm/capi/silkworm.h
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,20 @@ SILKWORM_EXPORT int silkworm_execute_blocks_perpetual(SilkwormHandle handle, MDB
bool write_change_sets, bool write_receipts, bool write_call_traces,
uint64_t* last_executed_block, int* mdbx_error_code) SILKWORM_NOEXCEPT;

/**
* \brief Execute a transaction in a block.
* \param[in] handle A valid Silkworm instance handle, got with silkworm_init.
* \param[in] mdbx_tx A valid external read-write MDBX transaction.
* \param[in] block_num The number of the block containing the transaction.
* \param[in] block_hash The hash of the block.
* \param[in] txn_index The transaction number in the block.
* \param[in] txn_num The canonical transaction ID.
* \param[out] gas_used The gas used by the transaction.
* \param[out] blob_gas_used The blob gas used by the transaction.
* \return SILKWORM_OK (=0) on success, a non-zero error value on failure.
*/
SILKWORM_EXPORT int silkworm_execute_txn(SilkwormHandle handle, MDBX_txn* mdbx_tx, uint64_t block_num, struct SilkwormBytes32 block_hash, uint64_t txn_index, uint64_t txn_num, uint64_t* gas_used, uint64_t* blob_gas_used) SILKWORM_NOEXCEPT;

/**
* \brief Finalize the Silkworm C API library.
* \param[in] handle A valid Silkworm instance handle got with silkworm_init.
Expand Down
46 changes: 46 additions & 0 deletions silkworm/capi/silkworm_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,13 @@ struct SilkwormLibrary {
return result;
}

int execute_txn(MDBX_txn* txn, uint64_t block_num, silkworm::Hash head_hash, uint64_t txn_index, uint64_t txn_id) const {
SilkwormBytes32 head_hash_bytes{};
std::memcpy(head_hash_bytes.bytes, head_hash.bytes, 32);

return silkworm_execute_txn(handle_, txn, block_num, head_hash_bytes, txn_index, txn_id, nullptr, nullptr);
}

int add_snapshot(SilkwormChainSnapshot* snapshot) const {
return silkworm_add_snapshot(handle_, snapshot);
}
Expand Down Expand Up @@ -1153,4 +1160,43 @@ TEST_CASE_METHOD(CApiTest, "CAPI silkworm_fork_validator", "[silkworm][capi]") {
}
}

TEST_CASE_METHOD(CApiTest, "CAPI silkworm_tx: single", "[silkworm][capi]") {
// Use Silkworm as a library with silkworm_init/silkworm_fini automated by RAII
SilkwormLibrary silkworm_lib{env_path()};
silkworm_lib.start_fork_validator(env, &kValidForkValidatorSettings);

// Prepare and insert block 10 (just 1 tx w/ value transfer)
evmc::address from{0x658bdf435d810c91414ec09147daa6db62406379_address}; // funded in genesis
evmc::address to{0x8b299e2b7d7f43c0ce3068263545309ff4ffb521_address}; // untouched address
intx::uint256 value{1 * kEther};

Block block{};
block.header.number = 10;
block.header.gas_limit = 5'000'000;
block.header.gas_used = 21'000;

static constexpr auto kEncoder = [](Bytes& dest, const Receipt& r) { rlp::encode(dest, r); };
std::vector<Receipt> receipts{
{TransactionType::kLegacy, true, block.header.gas_used, {}, {}},
};
block.header.receipts_root = trie::root_hash(receipts, kEncoder);
block.transactions.resize(1);
block.transactions[0].to = to;
block.transactions[0].gas_limit = block.header.gas_limit;
block.transactions[0].type = TransactionType::kLegacy;
block.transactions[0].max_priority_fee_per_gas = 0;
block.transactions[0].max_fee_per_gas = 20 * kGiga;
block.transactions[0].value = value;
block.transactions[0].r = 1; // dummy
block.transactions[0].s = 1; // dummy
block.transactions[0].set_sender(from);

insert_block(env, block);

RWTxnManaged external_txn{env};
auto result = silkworm_lib.execute_txn(*external_txn, 10, block.header.hash(), 0, 9);
CHECK(result == SILKWORM_INVALID_BLOCK);
CHECK_NOTHROW(external_txn.abort());
}

} // namespace silkworm
16 changes: 12 additions & 4 deletions silkworm/db/datastore/kvdb/domain_get_latest_query.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,24 @@ struct DomainGetLatestQuery {
key_encoder.value.timestamp.value = Step{std::numeric_limits<decltype(Step::value)>::max()};
Slice key_slice = key_encoder.encode();

auto result = tx.ro_cursor(entity.values_table)->lower_bound(key_slice, false);
if (!result) return std::nullopt;
auto db_cursor = tx.ro_cursor(entity.values_table);
auto result = entity.has_large_values ? db_cursor->lower_bound(key_slice, false) : db_cursor->find(key_slice, false);

if (!result) {
return std::nullopt;
}

DomainKeyDecoder<RawDecoder<ByteView>> key_decoder{entity.has_large_values};
key_decoder.decode(result.key);
if (key_decoder.value.key.value != from_slice(key_slice)) return std::nullopt;
if (key_decoder.value.key.value != from_slice(key_slice)) {
return std::nullopt;
}

DomainValueDecoder<RawDecoder<ByteView>> empty_value_decoder{entity.has_large_values};
empty_value_decoder.decode(result.value);
if (empty_value_decoder.value.value.value.empty()) return std::nullopt;
if (empty_value_decoder.value.value.value.empty()) {
return std::nullopt;
}

DomainValueDecoder<TValueDecoder> value_decoder{entity.has_large_values};
value_decoder.decode(result.value);
Expand Down
36 changes: 25 additions & 11 deletions silkworm/db/state/accounts_domain.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,39 @@ namespace silkworm::db::state {

using AccountsDomainKVSegmentReader = snapshots::segment::KVSegmentReader<AddressSnapshotsDecoder, AccountSnapshotsCodec>;

using AccountsDomainGetLatestQueryBase = datastore::DomainGetLatestQuery<
AddressKVDBEncoder, AddressSnapshotsEncoder,
AccountKVDBCodec, AccountSnapshotsCodec>;

struct AccountsDomainGetLatestQuery : public AccountsDomainGetLatestQueryBase {
struct AccountsDomainGetLatestQuery : public datastore::DomainGetLatestQuery<
AddressKVDBEncoder, AddressSnapshotsEncoder,
AccountKVDBCodec, AccountSnapshotsCodec> {
AccountsDomainGetLatestQuery(
const datastore::kvdb::DatabaseRef& database,
datastore::kvdb::ROTxn& tx,
const snapshots::SnapshotRepositoryROAccess& repository)
: AccountsDomainGetLatestQueryBase{
: datastore::DomainGetLatestQuery<
AddressKVDBEncoder, AddressSnapshotsEncoder,
AccountKVDBCodec, AccountSnapshotsCodec>(
JacekGlen marked this conversation as resolved.
Show resolved Hide resolved
db::state::kDomainNameAccounts,
database,
database.domain(db::state::kDomainNameAccounts),
tx,
repository,
} {}
repository) {}
};

using AccountsDomainPutQuery = datastore::kvdb::DomainPutQuery<AddressKVDBEncoder, AccountKVDBCodec>;
using AccountsDomainDeleteQuery = datastore::kvdb::DomainDeleteQuery<AddressKVDBEncoder, AccountKVDBCodec>;
struct AccountsDomainPutQuery : public datastore::kvdb::DomainPutQuery<AddressKVDBEncoder, AccountKVDBCodec> {
AccountsDomainPutQuery(
const datastore::kvdb::DatabaseRef& database,
datastore::kvdb::RWTxn& rw_tx)
: datastore::kvdb::DomainPutQuery<AddressKVDBEncoder, AccountKVDBCodec>{
rw_tx,
database.domain(db::state::kDomainNameAccounts)} {}
};

struct AccountsDomainDeleteQuery : datastore::kvdb::DomainDeleteQuery<AddressKVDBEncoder, AccountKVDBCodec> {
AccountsDomainDeleteQuery(
const datastore::kvdb::DatabaseRef& database,
datastore::kvdb::RWTxn& rw_tx)
: datastore::kvdb::DomainDeleteQuery<AddressKVDBEncoder, AccountKVDBCodec>{
rw_tx,
database.domain(db::state::kDomainNameAccounts)} {}
};

using AccountsHistoryGetQuery = datastore::HistoryGetQuery<
AddressKVDBEncoder, AddressSnapshotsEncoder,
Expand Down
36 changes: 25 additions & 11 deletions silkworm/db/state/code_domain.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,39 @@ namespace silkworm::db::state {

using CodeDomainKVSegmentReader = snapshots::segment::KVSegmentReader<AddressSnapshotsDecoder, snapshots::RawDecoder<Bytes>>;

using CodeDomainGetLatestQueryBase = datastore::DomainGetLatestQuery<
AddressKVDBEncoder, AddressSnapshotsEncoder,
datastore::kvdb::RawDecoder<Bytes>, snapshots::RawDecoder<Bytes>>;

struct CodeDomainGetLatestQuery : public CodeDomainGetLatestQueryBase {
struct CodeDomainGetLatestQuery : public datastore::DomainGetLatestQuery<
AddressKVDBEncoder, AddressSnapshotsEncoder,
datastore::kvdb::RawDecoder<ByteView>, snapshots::RawDecoder<ByteView>> {
CodeDomainGetLatestQuery(
const datastore::kvdb::DatabaseRef& database,
datastore::kvdb::ROTxn& tx,
const snapshots::SnapshotRepositoryROAccess& repository)
: CodeDomainGetLatestQueryBase{
: datastore::DomainGetLatestQuery<
AddressKVDBEncoder, AddressSnapshotsEncoder,
datastore::kvdb::RawDecoder<ByteView>, snapshots::RawDecoder<ByteView>>(
db::state::kDomainNameCode,
database,
database.domain(db::state::kDomainNameCode),
tx,
repository,
} {}
repository) {}
};

using CodeDomainPutQuery = datastore::kvdb::DomainPutQuery<AddressKVDBEncoder, datastore::kvdb::RawEncoder<ByteView>>;
using CodeDomainDeleteQuery = datastore::kvdb::DomainDeleteQuery<AddressKVDBEncoder, datastore::kvdb::RawEncoder<ByteView>>;
struct CodeDomainPutQuery : public datastore::kvdb::DomainPutQuery<AddressKVDBEncoder, datastore::kvdb::RawEncoder<ByteView>> {
CodeDomainPutQuery(
const datastore::kvdb::DatabaseRef& database,
datastore::kvdb::RWTxn& rw_tx)
: datastore::kvdb::DomainPutQuery<AddressKVDBEncoder, datastore::kvdb::RawEncoder<ByteView>>{
rw_tx,
database.domain(db::state::kDomainNameCode)} {}
};

struct CodeDomainDeleteQuery : datastore::kvdb::DomainDeleteQuery<AddressKVDBEncoder, datastore::kvdb::RawEncoder<ByteView>> {
CodeDomainDeleteQuery(
const datastore::kvdb::DatabaseRef& database,
datastore::kvdb::RWTxn& rw_tx)
: datastore::kvdb::DomainDeleteQuery<AddressKVDBEncoder, datastore::kvdb::RawEncoder<ByteView>>{
rw_tx,
database.domain(db::state::kDomainNameCode)} {}
};

using CodeHistoryGetQuery = datastore::HistoryGetQuery<
AddressKVDBEncoder, AddressSnapshotsEncoder,
Expand Down
36 changes: 25 additions & 11 deletions silkworm/db/state/commitment_domain.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,39 @@ namespace silkworm::db::state {

using CommitmentDomainKVSegmentReader = snapshots::segment::KVSegmentReader<snapshots::RawDecoder<Bytes>, snapshots::RawDecoder<Bytes>>;

using CommitmentDomainGetLatestQueryBase = datastore::DomainGetLatestQuery<
datastore::kvdb::RawEncoder<ByteView>, snapshots::RawEncoder<ByteView>,
datastore::kvdb::RawDecoder<Bytes>, snapshots::RawDecoder<Bytes>>;

struct CommitmentDomainGetLatestQuery : public CommitmentDomainGetLatestQueryBase {
struct CommitmentDomainGetLatestQuery : public datastore::DomainGetLatestQuery<
datastore::kvdb::RawEncoder<ByteView>, snapshots::RawEncoder<ByteView>,
datastore::kvdb::RawDecoder<Bytes>, snapshots::RawDecoder<Bytes>> {
CommitmentDomainGetLatestQuery(
const datastore::kvdb::DatabaseRef& database,
datastore::kvdb::ROTxn& tx,
const snapshots::SnapshotRepositoryROAccess& repository)
: CommitmentDomainGetLatestQueryBase{
: datastore::DomainGetLatestQuery<
datastore::kvdb::RawEncoder<ByteView>, snapshots::RawEncoder<ByteView>,
datastore::kvdb::RawDecoder<Bytes>, snapshots::RawDecoder<Bytes>>(
db::state::kDomainNameCommitment,
database,
database.domain(db::state::kDomainNameCommitment),
tx,
repository,
} {}
repository) {}
};

using CommitmentDomainPutQuery = datastore::kvdb::DomainPutQuery<datastore::kvdb::RawEncoder<ByteView>, datastore::kvdb::RawEncoder<ByteView>>;
using CommitmentDomainDeleteQuery = datastore::kvdb::DomainDeleteQuery<datastore::kvdb::RawEncoder<ByteView>, datastore::kvdb::RawEncoder<ByteView>>;
struct CommitmentDomainPutQuery : public datastore::kvdb::DomainPutQuery<datastore::kvdb::RawEncoder<ByteView>, datastore::kvdb::RawEncoder<ByteView>> {
CommitmentDomainPutQuery(
const datastore::kvdb::DatabaseRef& database,
datastore::kvdb::RWTxn& rw_tx)
: datastore::kvdb::DomainPutQuery<datastore::kvdb::RawEncoder<ByteView>, datastore::kvdb::RawEncoder<ByteView>>{
rw_tx,
database.domain(db::state::kDomainNameCommitment)} {}
};

struct CommitmentDomainDeleteQuery : datastore::kvdb::DomainDeleteQuery<datastore::kvdb::RawEncoder<ByteView>, datastore::kvdb::RawEncoder<ByteView>> {
CommitmentDomainDeleteQuery(
const datastore::kvdb::DatabaseRef& database,
datastore::kvdb::RWTxn& rw_tx)
: datastore::kvdb::DomainDeleteQuery<datastore::kvdb::RawEncoder<ByteView>, datastore::kvdb::RawEncoder<ByteView>>{
rw_tx,
database.domain(db::state::kDomainNameCommitment)} {}
};

using CommitmentHistoryGetQuery = datastore::HistoryGetQuery<
datastore::kvdb::RawEncoder<ByteView>, snapshots::RawEncoder<ByteView>,
Expand Down
Loading
Loading