src/runtime/binaryen/runtime_api/block_builder_impl.cpp¶
Namespaces¶
| Name |
|---|
| sgns |
| sgns::runtime |
| sgns::runtime::binaryen |
Classes¶
| Name | |
|---|---|
| class | sgns::runtime::binaryen::Buffer Class represents arbitrary (including empty) byte buffer. |
| struct | sgns::runtime::binaryen::Block Block primitive consisting of a header and extrinsics. |
| struct | sgns::runtime::binaryen::BlockHeader Header of a block in the chain. |
| struct | sgns::runtime::binaryen::CheckInherentsResult result of check_inherents method of BlockBuilder runtime api |
| struct | sgns::runtime::binaryen::Extrinsic Extrinsic class represents extrinsic. |
| struct | sgns::runtime::binaryen::InherentData |
Source code¶
#include "runtime/binaryen/runtime_api/block_builder_impl.hpp"
namespace sgns::runtime::binaryen {
using base::Buffer;
using extensions::Extension;
using primitives::Block;
using primitives::BlockHeader;
using primitives::CheckInherentsResult;
using primitives::Extrinsic;
using primitives::InherentData;
BlockBuilderImpl::BlockBuilderImpl(
const std::shared_ptr<WasmProvider> &wasm_provider,
const std::shared_ptr<RuntimeManager> &runtime_manager)
: RuntimeApi(wasm_provider, runtime_manager),
logger_{base::createLogger("BlockBuilderImpl")} {}
outcome::result<primitives::ApplyResult> BlockBuilderImpl::apply_extrinsic(
const Extrinsic &extrinsic) {
logger_->debug("BlockBuilder_apply_extrinsic {}", extrinsic.data.toHex());
return execute<primitives::ApplyResult>(
"BlockBuilder_apply_extrinsic", CallPersistency::PERSISTENT, extrinsic);
}
outcome::result<BlockHeader> BlockBuilderImpl::finalise_block() {
logger_->debug("BlockBuilder_finalize_block {}");
return execute<BlockHeader>("BlockBuilder_finalize_block",
CallPersistency::PERSISTENT);
}
outcome::result<std::vector<Extrinsic>> BlockBuilderImpl::inherent_extrinsics(
const InherentData &data) {
logger_->debug("BlockBuilder_inherent_extrinsics {}");
return execute<std::vector<Extrinsic>>(
"BlockBuilder_inherent_extrinsics", CallPersistency::EPHEMERAL, data);
}
outcome::result<CheckInherentsResult> BlockBuilderImpl::check_inherents(
const Block &block, const InherentData &data) {
logger_->debug("BlockBuilder_check_inherents {}");
return execute<CheckInherentsResult>("BlockBuilder_check_inherents",
CallPersistency::EPHEMERAL,
block,
data);
}
outcome::result<base::Hash256> BlockBuilderImpl::random_seed() {
logger_->debug("BlockBuilder_random_seed {}");
// TODO(Harrm) PRE-154 Figure out what it requires
return execute<base::Hash256>("BlockBuilder_random_seed",
CallPersistency::EPHEMERAL);
}
} // namespace sgns::runtime::binaryen
Updated on 2026-03-04 at 13:10:45 -0800