mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
Add infrastructure for precompiled smartcontracts (#927)
* Utils for writing precompiled contracts * Precompiled contracts in config, override gas_usage for them * Add base class for precompiled contracts * Improve utils for precompiled smc * Implement GETPRECOMPILEDGAS * Enable precompiles by flag * Process null data in PrecompiledSmartContract * Fix ton_block wasm build * Fix vm::util::store_(u)long --------- Co-authored-by: SpyCheese <mikle98@yandex.ru>
This commit is contained in:
parent
b09f910bf2
commit
9d05696452
21 changed files with 991 additions and 95 deletions
|
@ -526,6 +526,15 @@ struct BurningConfig {
|
|||
}
|
||||
};
|
||||
|
||||
struct PrecompiledContractsConfig {
|
||||
struct Contract {
|
||||
td::uint64 gas_usage;
|
||||
};
|
||||
vm::Dictionary list{256};
|
||||
|
||||
td::optional<Contract> get_contract(td::Bits256 code_hash) const;
|
||||
};
|
||||
|
||||
class Config {
|
||||
enum {
|
||||
default_mc_catchain_lifetime = 200,
|
||||
|
@ -644,6 +653,7 @@ class Config {
|
|||
std::unique_ptr<vm::Dictionary> get_suspended_addresses(ton::UnixTime now) const;
|
||||
BurningConfig get_burning_config() const;
|
||||
td::Ref<vm::Tuple> get_unpacked_config_tuple(ton::UnixTime now) const;
|
||||
PrecompiledContractsConfig get_precompiled_contracts_config() const;
|
||||
static std::vector<ton::ValidatorDescr> do_compute_validator_set(const block::CatchainValidatorsConfig& ccv_conf,
|
||||
ton::ShardIdFull shard,
|
||||
const block::ValidatorSet& vset, ton::UnixTime time,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue