27 #include <unordered_map> 39 struct ChainOperationParams;
41 class PrecompiledFace;
42 class TransactionBase;
50 virtual std::string
name()
const = 0;
51 virtual unsigned revision()
const {
return 0; }
67 virtual std::string
sealer()
const {
return "default"; }
118 if (m_onSealGenerated)
119 m_onSealGenerated(ret.
out());
136 static SealEngineFace*
create(std::string
const& _name) {
if (!
get()->m_sealEngines.count(_name))
return nullptr;
return get()->m_sealEngines[_name](); }
148 #define ETH_REGISTER_SEAL_ENGINE(Name) static SealEngineFactory __eth_registerSealEngineFactory ## Name = SealEngineRegistrar::registerSealEngine<Name>(#Name) 153 std::string
name()
const override {
return "NoProof"; }
Adapted from code found on http://stackoverflow.com/questions/180947/base64-decode-snippet-in-c Origi...
EVMSchedule & getFascSchedule() const
#define function(a, b, c, d, k, s)
ChainOperationParams const & chainParams() const
std::function< SealEngineFace *()> SealEngineFactory
boost::multiprecision::number< boost::multiprecision::cpp_int_backend<>> bigint
virtual ~SealEngineFace()
bytes const & out() const
Read the byte stream.
virtual void generateSeal(BlockHeader const &_bi)=0
virtual StringHashMap jsInfo(BlockHeader const &) const
static SealEngineFace * create(std::string const &_name)
virtual void verifyTransaction(ImportRequirements::value _ir, TransactionBase const &_t, BlockHeader const &_bi) const
Additional verification for transactions in blocks.
std::vector< std::string > strings
virtual std::pair< bool, bytes > executePrecompiled(Address const &_a, bytesConstRef _in, u256 const &) const
virtual std::string name() const =0
SealEngineFace * withChainParams(ChainOperationParams const &_params)
void generateSeal(BlockHeader const &_bi) override
std::lock_guard< std::mutex > Guard
ChainOperationParams m_params
static void unregisterSealEngine(std::string const &_name)
void onSealGenerated(std::function< void(bytes const &)> const &_f) override
virtual void onSealGenerated(std::function< void(bytes const &s)> const &_f)=0
std::unordered_map< Address, PrecompiledContract > precompiled
Precompiled contracts as specified in the chain params.
std::vector< byte > bytes
vector_ref< byte const > bytesConstRef
Fixed-size raw-byte array container type, with an API optimised for storing hashes.
virtual strings sealers() const
std::unordered_map< std::string, SealEngineFactory > m_sealEngines
boost::multiprecision::number< boost::multiprecision::cpp_int_backend< 256, 256, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void >> u256
std::unordered_map< std::string, std::string > StringHashMap
Main API hub for interfacing with Ethereum.
virtual void setSealer(std::string const &)
static SealEngineFactory registerSealEngine(std::string const &_name)
static SealEngineRegistrar * s_this
virtual EVMSchedule const & evmSchedule(EnvInfo const &) const =0
bool setOption(std::string const &_name, bytes const &_value)
std::set< Address > deleteAddresses
virtual bigint costOfPrecompiled(Address const &_a, bytesConstRef _in, u256 const &) const
std::function< void(bytes const &s)> m_onSealGenerated
void setChainParams(ChainOperationParams const &_params)
bytes option(std::string const &_name) const
virtual bool shouldSeal(Interface *)
virtual void populateFromParent(BlockHeader &_bi, BlockHeader const &_parent) const
Don't forget to call Super::populateFromParent when subclassing & overriding.
virtual bool isPrecompiled(Address const &_a, u256 const &_blockNumber) const
virtual unsigned revision() const
virtual bool onOptionChanging(std::string const &, bytes const &)
virtual bytes sealRLP() const
virtual unsigned sealFields() const
std::unordered_map< std::string, bytes > m_options
Class for writing to an RLP bytestream.
virtual std::string sealer() const
virtual void verify(Strictness _s, BlockHeader const &_bi, BlockHeader const &_parent=BlockHeader(), bytesConstRef _block=bytesConstRef()) const
Don't forget to call Super::verify when subclassing & overriding.
Encodes a transaction, ready to be exported to or freshly imported from RLP.
virtual void cancelGeneration()
void setFascSchedule(EVMSchedule _fascSchedule) const
std::string name() const override