1
0
Fork 0
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:
EmelyanenkoK 2024-03-05 16:54:49 +03:00 committed by GitHub
parent b09f910bf2
commit 9d05696452
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 991 additions and 95 deletions

View file

@ -20,6 +20,7 @@
#include "common/refcnt.hpp"
#include "vm/cells.h"
#include "vm/vmstate.h"
#include "td/utils/optional.h"
namespace vm {
using td::Ref;
@ -34,4 +35,23 @@ class FakeVmStateLimits : public VmStateInterface {
bool register_op(int op_units = 1) override;
};
class DummyVmState : public VmStateInterface {
public:
explicit DummyVmState(std::vector<Ref<Cell>> libraries, int global_version = ton::SUPPORTED_VERSION)
: libraries(std::move(libraries)), global_version(global_version) {
}
Ref<Cell> load_library(td::ConstBitPtr hash) override;
int get_global_version() const override {
return global_version;
}
td::optional<td::Bits256> get_missing_library() const {
return missing_library;
}
private:
std::vector<Ref<Cell>> libraries;
int global_version;
td::optional<td::Bits256> missing_library;
};
} // namespace vm