mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
Disable anycast address, allow deploying with "fixed prefix length"
This commit is contained in:
parent
44e7e091b2
commit
61862c07c5
11 changed files with 241 additions and 157 deletions
|
@ -738,7 +738,7 @@ const TickTock t_TickTock;
|
|||
const RefAnything t_RefCell;
|
||||
|
||||
bool StateInit::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const {
|
||||
return Maybe<UInt>{5}.validate_skip(ops, cs, weak) // split_depth:(Maybe (## 5))
|
||||
return Maybe<UInt>{5}.validate_skip(ops, cs, weak) // fixed_prefix_length:(Maybe (## 5))
|
||||
&& Maybe<TickTock>{}.validate_skip(ops, cs, weak) // special:(Maybe TickTock)
|
||||
&& Maybe<RefAnything>{}.validate_skip(ops, cs, weak) // code:(Maybe ^Cell)
|
||||
&& Maybe<RefAnything>{}.validate_skip(ops, cs, weak) // data:(Maybe ^Cell)
|
||||
|
@ -1085,7 +1085,7 @@ bool Account::skip_copy_depth_balance(vm::CellBuilder& cb, vm::CellSlice& cs) co
|
|||
case account:
|
||||
return cs.advance(1) // account$1
|
||||
&& t_MsgAddressInt.skip_get_depth(cs, depth) // addr:MsgAddressInt
|
||||
&& cb.store_uint_leq(30, depth) // -> store split_depth:(#<= 30)
|
||||
&& cb.store_uint_leq(30, depth) // -> store fixed_prefix_length:(#<= 30)
|
||||
&& t_StorageInfo.skip(cs) // storage_stat:StorageInfo
|
||||
&& t_AccountStorage.skip_copy_balance(cb, cs); // storage:AccountStorage
|
||||
}
|
||||
|
@ -1230,13 +1230,14 @@ bool HashmapAugE::extract_extra(vm::CellSlice& cs) const {
|
|||
bool DepthBalanceInfo::skip(vm::CellSlice& cs) const {
|
||||
return cs.advance(5) &&
|
||||
t_CurrencyCollection.skip(
|
||||
cs); // depth_balance$_ split_depth:(#<= 30) balance:CurrencyCollection = DepthBalanceInfo;
|
||||
cs); // depth_balance$_ fixed_prefix_length:(#<= 30) balance:CurrencyCollection = DepthBalanceInfo;
|
||||
}
|
||||
|
||||
bool DepthBalanceInfo::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const {
|
||||
return cs.fetch_ulong(5) <= 30 &&
|
||||
t_CurrencyCollection.validate_skip(ops, cs,
|
||||
weak); // depth_balance$_ split_depth:(#<= 30) balance:CurrencyCollection
|
||||
t_CurrencyCollection.validate_skip(
|
||||
ops, cs,
|
||||
weak); // depth_balance$_ fixed_prefix_length:(#<= 30) balance:CurrencyCollection
|
||||
}
|
||||
|
||||
bool DepthBalanceInfo::null_value(vm::CellBuilder& cb) const {
|
||||
|
|
|
@ -141,12 +141,12 @@ ext_out_msg_info$11 src:MsgAddress dest:MsgAddressExt
|
|||
|
||||
tick_tock$_ tick:Bool tock:Bool = TickTock;
|
||||
|
||||
_ split_depth:(Maybe (## 5)) special:(Maybe TickTock)
|
||||
_ fixed_prefix_length:(Maybe (## 5)) special:(Maybe TickTock)
|
||||
code:(Maybe ^Cell) data:(Maybe ^Cell)
|
||||
library:(Maybe ^Cell) = StateInit;
|
||||
|
||||
// StateInitWithLibs is used to validate sent and received messages
|
||||
_ split_depth:(Maybe (## 5)) special:(Maybe TickTock)
|
||||
_ fixed_prefix_length:(Maybe (## 5)) special:(Maybe TickTock)
|
||||
code:(Maybe ^Cell) data:(Maybe ^Cell)
|
||||
library:(HashmapE 256 SimpleLib) = StateInitWithLibs;
|
||||
|
||||
|
@ -273,14 +273,6 @@ acc_state_frozen$01 = AccountStatus;
|
|||
acc_state_active$10 = AccountStatus;
|
||||
acc_state_nonexist$11 = AccountStatus;
|
||||
|
||||
/* duplicates
|
||||
tick_tock$_ tick:Bool tock:Bool = TickTock;
|
||||
|
||||
_ split_depth:(Maybe (## 5)) special:(Maybe TickTock)
|
||||
code:(Maybe ^Cell) data:(Maybe ^Cell)
|
||||
library:(Maybe ^Cell) = StateInit;
|
||||
*/
|
||||
|
||||
account_descr$_ account:^Account last_trans_hash:bits256
|
||||
last_trans_lt:uint64 = ShardAccount;
|
||||
|
||||
|
@ -801,7 +793,8 @@ size_limits_config#01 max_msg_bits:uint32 max_msg_cells:uint32 max_library_cells
|
|||
max_ext_msg_size:uint32 max_ext_msg_depth:uint16 = SizeLimitsConfig;
|
||||
size_limits_config_v2#02 max_msg_bits:uint32 max_msg_cells:uint32 max_library_cells:uint32 max_vm_data_depth:uint16
|
||||
max_ext_msg_size:uint32 max_ext_msg_depth:uint16 max_acc_state_cells:uint32 max_acc_state_bits:uint32
|
||||
max_acc_public_libraries:uint32 defer_out_queue_size_limit:uint32 max_msg_extra_currencies:uint32 = SizeLimitsConfig;
|
||||
max_acc_public_libraries:uint32 defer_out_queue_size_limit:uint32 max_msg_extra_currencies:uint32
|
||||
max_acc_fixed_prefix_length:uint8 = SizeLimitsConfig;
|
||||
_ SizeLimitsConfig = ConfigParam 43;
|
||||
|
||||
// key is [ wc:int32 addr:uint256 ]
|
||||
|
|
|
@ -94,12 +94,12 @@ typedef td::BitArray<256> hash_t;
|
|||
|
||||
struct SmcDescr {
|
||||
hash_t addr;
|
||||
int split_depth;
|
||||
int fixed_prefix_length;
|
||||
bool preinit_only;
|
||||
td::RefInt256 gram_balance;
|
||||
Ref<vm::DataCell> state_init; // StateInit
|
||||
Ref<vm::DataCell> account; // Account
|
||||
SmcDescr(const hash_t& _addr) : addr(_addr), split_depth(0), preinit_only(false) {
|
||||
SmcDescr(const hash_t& _addr) : addr(_addr), fixed_prefix_length(0), preinit_only(false) {
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -123,7 +123,7 @@ vm::Dictionary config_dict{32};
|
|||
ton::UnixTime now;
|
||||
|
||||
bool set_config_smc(const SmcDescr& smc) {
|
||||
if (config_addr_set || smc.preinit_only || workchain_id != wc_master || smc.split_depth) {
|
||||
if (config_addr_set || smc.preinit_only || workchain_id != wc_master || smc.fixed_prefix_length) {
|
||||
return false;
|
||||
}
|
||||
vm::CellSlice cs = load_cell_slice(smc.state_init);
|
||||
|
@ -221,7 +221,7 @@ bool add_public_library(hash_t lib_addr, hash_t smc_addr, Ref<vm::Cell> lib_root
|
|||
}
|
||||
|
||||
td::RefInt256 create_smartcontract(td::RefInt256 smc_addr, Ref<vm::Cell> code, Ref<vm::Cell> data,
|
||||
Ref<vm::Cell> library, td::RefInt256 balance, int special, int split_depth,
|
||||
Ref<vm::Cell> library, td::RefInt256 balance, int special, int fixed_prefix_length,
|
||||
int mode) {
|
||||
if (is_empty_cell(code)) {
|
||||
code.clear();
|
||||
|
@ -238,12 +238,12 @@ td::RefInt256 create_smartcontract(td::RefInt256 smc_addr, Ref<vm::Cell> code, R
|
|||
THRERR("not a valid library collection");
|
||||
}
|
||||
vm::CellBuilder cb;
|
||||
if (!split_depth) {
|
||||
if (!fixed_prefix_length) {
|
||||
PDO(cb.store_long_bool(0, 1));
|
||||
} else {
|
||||
PDO(cb.store_long_bool(1, 1) && cb.store_ulong_rchk_bool(split_depth, 5));
|
||||
PDO(cb.store_long_bool(1, 1) && cb.store_ulong_rchk_bool(fixed_prefix_length, 5));
|
||||
}
|
||||
THRERR("invalid split_depth for a smart contract");
|
||||
THRERR("invalid fixed_prefix_length for a smart contract");
|
||||
if (!special) {
|
||||
PDO(cb.store_long_bool(0, 1));
|
||||
} else {
|
||||
|
@ -287,7 +287,7 @@ td::RefInt256 create_smartcontract(td::RefInt256 smc_addr, Ref<vm::Cell> code, R
|
|||
auto ins = smart_contracts.emplace(addr, addr);
|
||||
assert(ins.second);
|
||||
SmcDescr& smc = ins.first->second;
|
||||
smc.split_depth = split_depth;
|
||||
smc.fixed_prefix_length = fixed_prefix_length;
|
||||
smc.preinit_only = (mode == 1);
|
||||
smc.gram_balance = balance;
|
||||
total_smc_balance += balance;
|
||||
|
@ -328,10 +328,10 @@ td::RefInt256 create_smartcontract(td::RefInt256 smc_addr, Ref<vm::Cell> code, R
|
|||
ctor = 2; // addr_std$10
|
||||
}
|
||||
PDO(cb.store_long_bool(ctor, 2)); // addr_std$10 or addr_var$11
|
||||
if (split_depth) {
|
||||
if (fixed_prefix_length) {
|
||||
PDO(cb.store_long_bool(1, 1) // just$1
|
||||
&& cb.store_ulong_rchk_bool(split_depth, 5) // depth:(## 5)
|
||||
&& cb.store_bits_bool(addr.cbits(), split_depth)); // rewrite pfx:(depth * Bit)
|
||||
&& cb.store_ulong_rchk_bool(fixed_prefix_length, 5) // depth:(## 5)
|
||||
&& cb.store_bits_bool(addr.cbits(), fixed_prefix_length)); // rewrite pfx:(depth * Bit)
|
||||
} else {
|
||||
PDO(cb.store_long_bool(0, 1)); // nothing$0
|
||||
}
|
||||
|
@ -514,7 +514,7 @@ Ref<vm::Cell> create_state() {
|
|||
// data (cell)
|
||||
// library (cell)
|
||||
// balance (int)
|
||||
// split_depth (int 0..32)
|
||||
// fixed_prefix_length (int 0..32)
|
||||
// special (int 0..3, +2 = tick, +1 = tock)
|
||||
// [ address (uint256) ]
|
||||
// mode (0 = compute address only, 1 = create uninit, 2 = create complete; +4 = with specified address)
|
||||
|
@ -536,7 +536,7 @@ void interpret_register_smartcontract(vm::Stack& stack) {
|
|||
if (special && workchain_id != wc_master) {
|
||||
throw fift::IntError{"cannot create special smartcontracts outside of the masterchain"};
|
||||
}
|
||||
int split_depth = stack.pop_smallint_range(32);
|
||||
int fixed_prefix_length = stack.pop_smallint_range(32);
|
||||
td::RefInt256 balance = stack.pop_int_finite();
|
||||
if (sgn(balance) < 0) {
|
||||
throw fift::IntError{"initial balance of a smartcontract cannot be negative"};
|
||||
|
@ -548,7 +548,7 @@ void interpret_register_smartcontract(vm::Stack& stack) {
|
|||
Ref<vm::Cell> data = stack.pop_cell();
|
||||
Ref<vm::Cell> code = stack.pop_cell();
|
||||
td::RefInt256 addr = create_smartcontract(std::move(spec_addr), std::move(code), std::move(data), std::move(library),
|
||||
std::move(balance), special, split_depth, mode);
|
||||
std::move(balance), special, fixed_prefix_length, mode);
|
||||
if (addr.is_null()) {
|
||||
throw fift::IntError{"internal error while creating smartcontract"};
|
||||
}
|
||||
|
|
|
@ -1961,6 +1961,7 @@ td::Result<SizeLimitsConfig> Config::do_get_size_limits_config(td::Ref<vm::CellS
|
|||
limits.max_acc_public_libraries = rec.max_acc_public_libraries;
|
||||
limits.defer_out_queue_size_limit = rec.defer_out_queue_size_limit;
|
||||
limits.max_msg_extra_currencies = rec.max_msg_extra_currencies;
|
||||
limits.max_acc_fixed_prefix_length = rec.max_acc_fixed_prefix_length;
|
||||
};
|
||||
gen::SizeLimitsConfig::Record_size_limits_config rec_v1;
|
||||
gen::SizeLimitsConfig::Record_size_limits_config_v2 rec_v2;
|
||||
|
|
|
@ -398,6 +398,7 @@ struct SizeLimitsConfig {
|
|||
td::uint32 max_acc_public_libraries = 256;
|
||||
td::uint32 defer_out_queue_size_limit = 256;
|
||||
td::uint32 max_msg_extra_currencies = 2;
|
||||
td::uint32 max_acc_fixed_prefix_length = 8;
|
||||
};
|
||||
|
||||
struct CatchainValidatorsConfig {
|
||||
|
|
|
@ -115,42 +115,42 @@ bool Account::set_address(ton::WorkchainId wc, td::ConstBitPtr new_addr) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets the split depth of the account.
|
||||
* Sets the length of anycast prefix length in the account address.
|
||||
*
|
||||
* @param new_split_depth The new split depth value to be set.
|
||||
* @param new_length The new rewrite lingth.
|
||||
*
|
||||
* @returns True if the split depth was successfully set, False otherwise.
|
||||
* @returns True if the length was successfully set, False otherwise.
|
||||
*/
|
||||
bool Account::set_split_depth(int new_split_depth) {
|
||||
if (new_split_depth < 0 || new_split_depth > 30) {
|
||||
return false; // invalid value for split_depth
|
||||
bool Account::set_addr_rewrite_length(int new_length) {
|
||||
if (new_length < 0 || new_length > 30) {
|
||||
return false; // invalid value
|
||||
}
|
||||
if (split_depth_set_) {
|
||||
return split_depth_ == new_split_depth;
|
||||
if (addr_rewrite_length_set) {
|
||||
return addr_rewrite_length == new_length;
|
||||
} else {
|
||||
split_depth_ = (unsigned char)new_split_depth;
|
||||
split_depth_set_ = true;
|
||||
addr_rewrite_length = (unsigned char)new_length;
|
||||
addr_rewrite_length_set = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the given split depth is valid for the Account.
|
||||
* Checks if the given addr rewrite length is valid for the Account.
|
||||
*
|
||||
* @param split_depth The split depth to be checked.
|
||||
* @param length The addr rewrite length to be checked.
|
||||
*
|
||||
* @returns True if the split depth is valid, False otherwise.
|
||||
* @returns True if the addr rewrite length is valid, False otherwise.
|
||||
*/
|
||||
bool Account::check_split_depth(int split_depth) const {
|
||||
return split_depth_set_ ? (split_depth == split_depth_) : (split_depth >= 0 && split_depth <= 30);
|
||||
bool Account::check_addr_rewrite_length(int length) const {
|
||||
return addr_rewrite_length_set ? (length == addr_rewrite_length) : (length >= 0 && length <= 30);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses anycast data of the account address.
|
||||
*
|
||||
* Initializes split_depth and addr_rewrite.
|
||||
* Initializes addr_rewrite.
|
||||
*
|
||||
* @param cs The cell slice containing partially-parsed account addressa.
|
||||
* @param cs The cell slice containing partially-parsed account address.
|
||||
*
|
||||
* @returns True if parsing was successful, false otherwise.
|
||||
*/
|
||||
|
@ -159,13 +159,13 @@ bool Account::parse_maybe_anycast(vm::CellSlice& cs) {
|
|||
if (t < 0) {
|
||||
return false;
|
||||
} else if (!t) {
|
||||
return set_split_depth(0);
|
||||
return set_addr_rewrite_length(0);
|
||||
}
|
||||
int depth;
|
||||
return cs.fetch_uint_leq(30, depth) // anycast_info$_ depth:(#<= 30)
|
||||
&& depth // { depth >= 1 }
|
||||
&& cs.fetch_bits_to(addr_rewrite.bits(), depth) // rewrite_pfx:(bits depth)
|
||||
&& set_split_depth(depth);
|
||||
&& set_addr_rewrite_length(depth);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -176,12 +176,12 @@ bool Account::parse_maybe_anycast(vm::CellSlice& cs) {
|
|||
* @returns True if the anycast information was successfully stored, false otherwise.
|
||||
*/
|
||||
bool Account::store_maybe_anycast(vm::CellBuilder& cb) const {
|
||||
if (!split_depth_set_ || !split_depth_) {
|
||||
if (!addr_rewrite_length_set || !addr_rewrite_length) {
|
||||
return cb.store_bool_bool(false);
|
||||
}
|
||||
return cb.store_bool_bool(true) // just$1
|
||||
&& cb.store_uint_leq(30, split_depth_) // depth:(#<= 30)
|
||||
&& cb.store_bits_bool(addr_rewrite.cbits(), split_depth_); // rewrite_pfx:(bits depth)
|
||||
&& cb.store_uint_leq(30, addr_rewrite_length) // depth:(#<= 30)
|
||||
&& cb.store_bits_bool(addr_rewrite.cbits(), addr_rewrite_length); // rewrite_pfx:(bits depth)
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -214,14 +214,14 @@ bool Account::unpack_address(vm::CellSlice& addr_cs) {
|
|||
if (workchain == ton::workchainInvalid) {
|
||||
workchain = new_wc;
|
||||
addr = addr_orig;
|
||||
addr.bits().copy_from(addr_rewrite.cbits(), split_depth_);
|
||||
} else if (split_depth_) {
|
||||
addr.bits().copy_from(addr_rewrite.cbits(), addr_rewrite_length);
|
||||
} else if (addr_rewrite_length) {
|
||||
ton::StdSmcAddress new_addr = addr_orig;
|
||||
new_addr.bits().copy_from(addr_rewrite.cbits(), split_depth_);
|
||||
new_addr.bits().copy_from(addr_rewrite.cbits(), addr_rewrite_length);
|
||||
if (new_addr != addr) {
|
||||
LOG(ERROR) << "error unpacking account " << workchain << ":" << addr.to_hex()
|
||||
<< " : account header contains different address " << new_addr.to_hex() << " (with splitting depth "
|
||||
<< (int)split_depth_ << ")";
|
||||
<< (int)addr_rewrite_length << ")";
|
||||
return false;
|
||||
}
|
||||
} else if (addr != addr_orig) {
|
||||
|
@ -235,7 +235,7 @@ bool Account::unpack_address(vm::CellSlice& addr_cs) {
|
|||
return false;
|
||||
}
|
||||
addr_rewrite = addr.bits(); // initialize all 32 bits of addr_rewrite
|
||||
if (!split_depth_) {
|
||||
if (!addr_rewrite_length) {
|
||||
my_addr_exact = my_addr;
|
||||
}
|
||||
return true;
|
||||
|
@ -280,7 +280,7 @@ bool Account::unpack_storage_info(vm::CellSlice& cs) {
|
|||
* Unpacks the state of an Account from a CellSlice.
|
||||
*
|
||||
* State is serialized using StateInit TLB-scheme.
|
||||
* Initializes split_depth (from account state - StateInit)
|
||||
* Initializes fixed_prefix_length (from account state - StateInit)
|
||||
*
|
||||
* @param cs The CellSlice containing the serialized state.
|
||||
*
|
||||
|
@ -291,12 +291,9 @@ bool Account::unpack_state(vm::CellSlice& cs) {
|
|||
if (!tlb::unpack_exact(cs, state)) {
|
||||
return false;
|
||||
}
|
||||
int sd = 0;
|
||||
if (state.split_depth->size() == 6) {
|
||||
sd = (int)state.split_depth->prefetch_ulong(6) - 32;
|
||||
}
|
||||
if (!set_split_depth(sd)) {
|
||||
return false;
|
||||
fixed_prefix_length = 0;
|
||||
if (state.fixed_prefix_length->size() == 6) {
|
||||
fixed_prefix_length = (int)state.fixed_prefix_length->prefetch_ulong(6) - 32;
|
||||
}
|
||||
if (state.special->size() > 1) {
|
||||
int z = (int)state.special->prefetch_ulong(3);
|
||||
|
@ -363,23 +360,25 @@ bool Account::compute_my_addr(bool force) {
|
|||
/**
|
||||
* Computes the address of the Account.
|
||||
*
|
||||
* Legacy (used only if global_version < 10).
|
||||
*
|
||||
* @param tmp_addr A reference to the CellSlice for the result.
|
||||
* @param split_depth The split depth for the address.
|
||||
* @param orig_addr_rewrite Address prefox of length split_depth.
|
||||
* @param fixed_prefix_length The fixed prefix length for the address.
|
||||
* @param orig_addr_rewrite Address prefix of length fixed_prefix_length.
|
||||
*
|
||||
* @returns True if the address was successfully computed, false otherwise.
|
||||
*/
|
||||
bool Account::recompute_tmp_addr(Ref<vm::CellSlice>& tmp_addr, int split_depth,
|
||||
bool Account::recompute_tmp_addr(Ref<vm::CellSlice>& tmp_addr, int fixed_prefix_length,
|
||||
td::ConstBitPtr orig_addr_rewrite) const {
|
||||
if (!split_depth && my_addr_exact.not_null()) {
|
||||
if (!fixed_prefix_length && my_addr_exact.not_null()) {
|
||||
tmp_addr = my_addr_exact;
|
||||
return true;
|
||||
}
|
||||
if (split_depth == split_depth_ && my_addr.not_null()) {
|
||||
if (fixed_prefix_length == addr_rewrite_length && my_addr.not_null()) {
|
||||
tmp_addr = my_addr;
|
||||
return true;
|
||||
}
|
||||
if (split_depth < 0 || split_depth > 30) {
|
||||
if (fixed_prefix_length < 0 || fixed_prefix_length > 30) {
|
||||
return false;
|
||||
}
|
||||
vm::CellBuilder cb;
|
||||
|
@ -387,13 +386,13 @@ bool Account::recompute_tmp_addr(Ref<vm::CellSlice>& tmp_addr, int split_depth,
|
|||
if (!cb.store_long_bool(std ? 2 : 3, 2)) { // addr_std$10 or addr_var$11
|
||||
return false;
|
||||
}
|
||||
if (!split_depth) {
|
||||
if (!fixed_prefix_length) {
|
||||
if (!cb.store_bool_bool(false)) { // anycast:(Maybe Anycast)
|
||||
return false;
|
||||
}
|
||||
} else if (!(cb.store_bool_bool(true) // just$1
|
||||
&& cb.store_long_bool(split_depth, 5) // depth:(#<= 30)
|
||||
&& cb.store_bits_bool(addr.bits(), split_depth))) { // rewrite_pfx:(bits depth)
|
||||
&& cb.store_long_bool(fixed_prefix_length, 5) // depth:(#<= 30)
|
||||
&& cb.store_bits_bool(addr.bits(), fixed_prefix_length))) { // rewrite_pfx:(bits depth)
|
||||
return false;
|
||||
}
|
||||
if (std) {
|
||||
|
@ -405,26 +404,26 @@ bool Account::recompute_tmp_addr(Ref<vm::CellSlice>& tmp_addr, int split_depth,
|
|||
return false;
|
||||
}
|
||||
Ref<vm::Cell> cell;
|
||||
return cb.store_bits_bool(orig_addr_rewrite, split_depth) // address:(bits addr_len) or bits256
|
||||
&& cb.store_bits_bool(addr.bits() + split_depth, 256 - split_depth) && cb.finalize_to(cell) &&
|
||||
return cb.store_bits_bool(orig_addr_rewrite, fixed_prefix_length) // address:(bits addr_len) or bits256
|
||||
&& cb.store_bits_bool(addr.bits() + fixed_prefix_length, 256 - fixed_prefix_length) && cb.finalize_to(cell) &&
|
||||
(tmp_addr = vm::load_cell_slice_ref(std::move(cell))).not_null();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets address rewriting info for a newly-activated account.
|
||||
*
|
||||
* @param split_depth The split depth for the account address.
|
||||
* @param orig_addr_rewrite Address frepix of length split_depth.
|
||||
* @param rewrite_length The fixed prefix length for the account address.
|
||||
* @param orig_addr_rewrite Address prefix of length fixed_prefix_length.
|
||||
*
|
||||
* @returns True if the rewriting info was successfully set, false otherwise.
|
||||
*/
|
||||
bool Account::init_rewrite_addr(int split_depth, td::ConstBitPtr orig_addr_rewrite) {
|
||||
if (split_depth_set_ || !set_split_depth(split_depth)) {
|
||||
bool Account::init_rewrite_addr(int rewrite_length, td::ConstBitPtr orig_addr_rewrite) {
|
||||
if (addr_rewrite_length_set || !set_addr_rewrite_length(rewrite_length)) {
|
||||
return false;
|
||||
}
|
||||
addr_orig = addr;
|
||||
addr_rewrite = addr.bits();
|
||||
addr_orig.bits().copy_from(orig_addr_rewrite, split_depth);
|
||||
addr_orig.bits().copy_from(orig_addr_rewrite, rewrite_length);
|
||||
return compute_my_addr(true);
|
||||
}
|
||||
|
||||
|
@ -480,7 +479,7 @@ bool Account::unpack(Ref<vm::CellSlice> shard_account, ton::UnixTime now, bool s
|
|||
case block::gen::AccountState::account_uninit:
|
||||
status = orig_status = acc_uninit;
|
||||
state_hash = addr;
|
||||
forget_split_depth();
|
||||
forget_addr_rewrite_length();
|
||||
break;
|
||||
case block::gen::AccountState::account_frozen:
|
||||
status = orig_status = acc_frozen;
|
||||
|
@ -554,18 +553,18 @@ bool Account::init_new(ton::UnixTime now) {
|
|||
}
|
||||
state_hash = addr_orig;
|
||||
status = orig_status = acc_nonexist;
|
||||
split_depth_set_ = false;
|
||||
addr_rewrite_length_set = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the split depth of the account.
|
||||
* Resets the fixed prefix length of the account.
|
||||
*
|
||||
* @returns True if the split depth was successfully reset, false otherwise.
|
||||
* @returns True if the fixed prefix length was successfully reset, false otherwise.
|
||||
*/
|
||||
bool Account::forget_split_depth() {
|
||||
split_depth_set_ = false;
|
||||
split_depth_ = 0;
|
||||
bool Account::forget_addr_rewrite_length() {
|
||||
addr_rewrite_length_set = false;
|
||||
addr_rewrite_length = 0;
|
||||
addr_orig = addr;
|
||||
my_addr = my_addr_exact;
|
||||
addr_rewrite = addr.bits();
|
||||
|
@ -583,9 +582,10 @@ bool Account::deactivate() {
|
|||
}
|
||||
// forget special (tick/tock) info
|
||||
tick = tock = false;
|
||||
fixed_prefix_length = 0;
|
||||
if (status == acc_nonexist || status == acc_uninit) {
|
||||
// forget split depth and address rewriting info
|
||||
forget_split_depth();
|
||||
// forget fixed prefix length and address rewriting info
|
||||
forget_addr_rewrite_length();
|
||||
// forget specific state hash for deleted or uninitialized accounts (revert to addr)
|
||||
state_hash = addr;
|
||||
}
|
||||
|
@ -706,6 +706,7 @@ Transaction::Transaction(const Account& _account, int ttype, ton::LogicalTime re
|
|||
, is_first(_account.transactions.empty())
|
||||
, new_tick(_account.tick)
|
||||
, new_tock(_account.tock)
|
||||
, new_fixed_prefix_length(_account.fixed_prefix_length)
|
||||
, now(_now)
|
||||
, account(_account)
|
||||
, my_addr(_account.my_addr)
|
||||
|
@ -782,6 +783,18 @@ bool Transaction::unpack_input_msg(bool ihr_delivered, const ActionPhaseConfig*
|
|||
}
|
||||
src_addr = std::move(info.src);
|
||||
dest_addr = std::move(info.dest);
|
||||
if (cfg->disable_anycast) {
|
||||
// Check that dest is addr_std without anycast
|
||||
block::gen::MsgAddressInt::Record_addr_std rec;
|
||||
if (!block::gen::csr_unpack(dest_addr, rec)) {
|
||||
LOG(DEBUG) << "destination address of the external message is not a valid addr_std";
|
||||
return false;
|
||||
}
|
||||
if (rec.anycast->size() > 1) {
|
||||
LOG(DEBUG) << "destination address of the external message is an anycast address";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
in_msg_type = 2;
|
||||
in_msg_extern = true;
|
||||
// compute forwarding fees for this external message
|
||||
|
@ -1438,10 +1451,13 @@ bool Transaction::unpack_msg_state(const ComputePhaseConfig& cfg, bool lib_only,
|
|||
in_msg_library = state.library->prefetch_ref();
|
||||
return true;
|
||||
}
|
||||
if (state.split_depth->size() == 6) {
|
||||
new_split_depth = (signed char)(state.split_depth->prefetch_ulong(6) - 32);
|
||||
if (state.fixed_prefix_length->size() == 6) {
|
||||
new_fixed_prefix_length = (signed char)(state.fixed_prefix_length->prefetch_ulong(6) - 32);
|
||||
} else {
|
||||
new_split_depth = 0;
|
||||
new_fixed_prefix_length = 0;
|
||||
}
|
||||
if (!cfg.disable_anycast) {
|
||||
new_addr_rewrite_length = new_fixed_prefix_length;
|
||||
}
|
||||
if (state.special->size() > 1) {
|
||||
int z = (int)state.special->prefetch_ulong(3);
|
||||
|
@ -1496,19 +1512,26 @@ std::vector<Ref<vm::Cell>> Transaction::compute_vm_libraries(const ComputePhaseC
|
|||
/**
|
||||
* Checks if the input message StateInit hash corresponds to the account address.
|
||||
*
|
||||
* @param cfg The configuration for the compute phase.
|
||||
*
|
||||
* @returns True if the input message state hash is valid, False otherwise.
|
||||
*/
|
||||
bool Transaction::check_in_msg_state_hash() {
|
||||
bool Transaction::check_in_msg_state_hash(const ComputePhaseConfig& cfg) {
|
||||
CHECK(in_msg_state.not_null());
|
||||
CHECK(new_split_depth >= 0 && new_split_depth < 32);
|
||||
CHECK(new_fixed_prefix_length >= 0 && new_fixed_prefix_length < 32);
|
||||
td::Bits256 in_state_hash = in_msg_state->get_hash().bits();
|
||||
int d = new_split_depth;
|
||||
int d = new_fixed_prefix_length;
|
||||
if ((in_state_hash.bits() + d).compare(account.addr.bits() + d, 256 - d)) {
|
||||
return false;
|
||||
}
|
||||
orig_addr_rewrite = in_state_hash.bits();
|
||||
orig_addr_rewrite_set = true;
|
||||
return account.recompute_tmp_addr(my_addr, d, orig_addr_rewrite.bits());
|
||||
if (cfg.disable_anycast) {
|
||||
my_addr = my_addr_exact;
|
||||
return true;
|
||||
} else {
|
||||
return account.recompute_tmp_addr(my_addr, d, orig_addr_rewrite.bits());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1639,16 +1662,24 @@ bool Transaction::prepare_compute_phase(const ComputePhaseConfig& cfg) {
|
|||
use_msg_state = true;
|
||||
bool forbid_public_libs =
|
||||
acc_status == Account::acc_uninit && account.is_masterchain(); // Forbid for deploying, allow for unfreezing
|
||||
if (!(unpack_msg_state(cfg, false, forbid_public_libs) && account.check_split_depth(new_split_depth))) {
|
||||
LOG(DEBUG) << "cannot unpack in_msg_state, or it has bad split_depth; cannot init account state";
|
||||
if (!(unpack_msg_state(cfg, false, forbid_public_libs) &&
|
||||
account.check_addr_rewrite_length(new_fixed_prefix_length))) {
|
||||
LOG(DEBUG) << "cannot unpack in_msg_state, or it has bad fixed_prefix_length; cannot init account state";
|
||||
cp.skip_reason = ComputePhase::sk_bad_state;
|
||||
return true;
|
||||
}
|
||||
if (acc_status == Account::acc_uninit && !check_in_msg_state_hash()) {
|
||||
if (acc_status == Account::acc_uninit && !check_in_msg_state_hash(cfg)) {
|
||||
LOG(DEBUG) << "in_msg_state hash mismatch, cannot init account state";
|
||||
cp.skip_reason = ComputePhase::sk_bad_state;
|
||||
return true;
|
||||
}
|
||||
if (cfg.disable_anycast && acc_status == Account::acc_uninit &&
|
||||
new_fixed_prefix_length > cfg.size_limits.max_acc_fixed_prefix_length) {
|
||||
LOG(DEBUG) << "cannot init account state: too big fixed prefix length (" << new_fixed_prefix_length << ", max "
|
||||
<< cfg.size_limits.max_acc_fixed_prefix_length << ")";
|
||||
cp.skip_reason = ComputePhase::sk_bad_state;
|
||||
return true;
|
||||
}
|
||||
} else if (acc_status != Account::acc_active) {
|
||||
// no state, cannot perform transactions
|
||||
cp.skip_reason = in_msg_state.not_null() ? ComputePhase::sk_bad_state : ComputePhase::sk_no_state;
|
||||
|
@ -1671,6 +1702,11 @@ bool Transaction::prepare_compute_phase(const ComputePhaseConfig& cfg) {
|
|||
return true;
|
||||
}
|
||||
}
|
||||
if (cfg.disable_anycast) {
|
||||
my_addr = my_addr_exact;
|
||||
new_addr_rewrite_length = 0;
|
||||
force_remove_anycast_address = true;
|
||||
}
|
||||
|
||||
td::optional<PrecompiledContractsConfig::Contract> precompiled;
|
||||
if (new_code.not_null() && trans_type == tr_ord) {
|
||||
|
@ -2237,11 +2273,12 @@ bool Transaction::check_replace_src_addr(Ref<vm::CellSlice>& src_addr) const {
|
|||
* @param dest_addr A reference to the destination address of the transaction.
|
||||
* @param cfg The configuration for the action phase.
|
||||
* @param is_mc A pointer to a boolean where it will be stored whether the destination is in the masterchain.
|
||||
* @param allow_anycast Allow anycast the address.
|
||||
*
|
||||
* @returns True if the destination address is valid, false otherwise.
|
||||
*/
|
||||
bool Transaction::check_rewrite_dest_addr(Ref<vm::CellSlice>& dest_addr, const ActionPhaseConfig& cfg,
|
||||
bool* is_mc) const {
|
||||
bool* is_mc, bool allow_anycast) const {
|
||||
if (!dest_addr->prefetch_ulong(1)) {
|
||||
// all external addresses allowed
|
||||
if (is_mc) {
|
||||
|
@ -2301,6 +2338,9 @@ bool Transaction::check_rewrite_dest_addr(Ref<vm::CellSlice>& dest_addr, const A
|
|||
}
|
||||
}
|
||||
if (rec.anycast->size() > 1) {
|
||||
if (!allow_anycast) {
|
||||
return false;
|
||||
}
|
||||
// destination address is an anycast
|
||||
vm::CellSlice cs{*rec.anycast};
|
||||
int d = (int)cs.fetch_ulong(6) - 32;
|
||||
|
@ -2468,7 +2508,7 @@ int Transaction::try_action_send_msg(const vm::CellSlice& cs0, ActionPhase& ap,
|
|||
return 35; // invalid source address
|
||||
}
|
||||
bool to_mc = false;
|
||||
if (!check_rewrite_dest_addr(info.dest, cfg, &to_mc)) {
|
||||
if (!check_rewrite_dest_addr(info.dest, cfg, &to_mc, !cfg.disable_anycast)) {
|
||||
LOG(DEBUG) << "invalid destination address in a proposed outbound message";
|
||||
return check_skip_invalid(36); // invalid destination address
|
||||
}
|
||||
|
@ -3240,13 +3280,14 @@ bool Transaction::compute_state(const SerializeConfig& cfg) {
|
|||
&& balance.store(cb)); // balance:CurrencyCollection
|
||||
int ticktock = new_tick * 2 + new_tock;
|
||||
unsigned si_pos = 0;
|
||||
int fixed_prefix_length = cfg.disable_anycast ? new_fixed_prefix_length : account.addr_rewrite_length;
|
||||
if (acc_status == Account::acc_uninit) {
|
||||
CHECK(cb.store_long_bool(0, 2)); // account_uninit$00 = AccountState
|
||||
} else if (acc_status == Account::acc_frozen) {
|
||||
if (was_frozen) {
|
||||
vm::CellBuilder cb2;
|
||||
CHECK(account.split_depth_ ? cb2.store_long_bool(account.split_depth_ + 32, 6) // _ ... = StateInit
|
||||
: cb2.store_long_bool(0, 1)); // ... split_depth:(Maybe (## 5))
|
||||
CHECK(fixed_prefix_length ? cb2.store_long_bool(fixed_prefix_length + 32, 6) // _ ... = StateInit
|
||||
: cb2.store_long_bool(0, 1)); // ... fixed_prefix_length:(Maybe (## 5))
|
||||
CHECK(ticktock ? cb2.store_long_bool(ticktock | 4, 3) : cb2.store_long_bool(0, 1)); // special:(Maybe TickTock)
|
||||
CHECK(cb2.store_maybe_ref(new_code) && cb2.store_maybe_ref(new_data) && cb2.store_maybe_ref(new_library));
|
||||
// code:(Maybe ^Cell) data:(Maybe ^Cell) library:(HashmapE 256 SimpleLib)
|
||||
|
@ -3275,8 +3316,8 @@ bool Transaction::compute_state(const SerializeConfig& cfg) {
|
|||
} else {
|
||||
CHECK(acc_status == Account::acc_active && !was_frozen && !was_deleted);
|
||||
si_pos = cb.size_ext() + 1;
|
||||
CHECK(account.split_depth_ ? cb.store_long_bool(account.split_depth_ + 96, 7) // account_active$1 _:StateInit
|
||||
: cb.store_long_bool(2, 2)); // ... split_depth:(Maybe (## 5))
|
||||
CHECK(fixed_prefix_length ? cb.store_long_bool(fixed_prefix_length + 96, 7) // account_active$1 _:StateInit
|
||||
: cb.store_long_bool(2, 2)); // ... fixed_prefix_length:(Maybe (## 5))
|
||||
CHECK(ticktock ? cb.store_long_bool(ticktock | 4, 3) : cb.store_long_bool(0, 1)); // special:(Maybe TickTock)
|
||||
CHECK(cb.store_maybe_ref(new_code) && cb.store_maybe_ref(new_data) && cb.store_maybe_ref(new_library));
|
||||
// code:(Maybe ^Cell) data:(Maybe ^Cell) library:(HashmapE 256 SimpleLib)
|
||||
|
@ -3316,8 +3357,8 @@ bool Transaction::compute_state(const SerializeConfig& cfg) {
|
|||
LOG(INFO) << "Compute used storage took " << timer.elapsed() << "s";
|
||||
}
|
||||
}
|
||||
CHECK(cb.store_long_bool(1, 1) // account$1
|
||||
&& cb.append_cellslice_bool(account.my_addr) // addr:MsgAddressInt
|
||||
CHECK(cb.store_long_bool(1, 1) // account$1
|
||||
&& cb.append_cellslice_bool(cfg.disable_anycast ? my_addr : account.my_addr) // addr:MsgAddressInt
|
||||
&& block::store_UInt7(cb, stats.cells) // storage_used$_ cells:(VarUInteger 7)
|
||||
&& block::store_UInt7(cb, stats.bits) // bits:(VarUInteger 7)
|
||||
&& block::store_UInt7(cb, stats.public_cells) // public_cells:(VarUInteger 7)
|
||||
|
@ -3676,12 +3717,14 @@ Ref<vm::Cell> Transaction::commit(Account& acc) {
|
|||
CHECK((const void*)&acc == (const void*)&account);
|
||||
// export all fields modified by the Transaction into original account
|
||||
// NB: this is the only method that modifies account
|
||||
if (orig_addr_rewrite_set && new_split_depth >= 0 && acc.status != Account::acc_active &&
|
||||
if (force_remove_anycast_address) {
|
||||
CHECK(acc.forget_addr_rewrite_length());
|
||||
} else if (orig_addr_rewrite_set && new_addr_rewrite_length >= 0 && acc.status != Account::acc_active &&
|
||||
acc_status == Account::acc_active) {
|
||||
LOG(DEBUG) << "setting address rewriting info for newly-activated account " << acc.addr.to_hex()
|
||||
<< " with split_depth=" << new_split_depth
|
||||
<< ", orig_addr_rewrite=" << orig_addr_rewrite.bits().to_hex(new_split_depth);
|
||||
CHECK(acc.init_rewrite_addr(new_split_depth, orig_addr_rewrite.bits()));
|
||||
<< " with addr_rewrite_length=" << new_addr_rewrite_length
|
||||
<< ", orig_addr_rewrite=" << orig_addr_rewrite.bits().to_hex(new_addr_rewrite_length);
|
||||
CHECK(acc.init_rewrite_addr(new_addr_rewrite_length, orig_addr_rewrite.bits()));
|
||||
}
|
||||
acc.status = (acc_status == Account::acc_deleted ? Account::acc_nonexist : acc_status);
|
||||
acc.last_trans_lt_ = start_lt;
|
||||
|
@ -3705,6 +3748,7 @@ Ref<vm::Cell> Transaction::commit(Account& acc) {
|
|||
if (acc.status == Account::acc_active) {
|
||||
acc.tick = new_tick;
|
||||
acc.tock = new_tock;
|
||||
acc.fixed_prefix_length = new_fixed_prefix_length;
|
||||
} else {
|
||||
CHECK(acc.deactivate());
|
||||
}
|
||||
|
@ -3905,6 +3949,7 @@ td::Status FetchConfigParams::fetch_config_params(
|
|||
compute_phase_cfg->size_limits = size_limits;
|
||||
compute_phase_cfg->precompiled_contracts = config.get_precompiled_contracts_config();
|
||||
compute_phase_cfg->allow_external_unfreeze = compute_phase_cfg->global_version >= 8;
|
||||
compute_phase_cfg->disable_anycast = config.get_global_version() >= 10;
|
||||
}
|
||||
{
|
||||
// compute action_phase_cfg
|
||||
|
@ -3933,9 +3978,11 @@ td::Status FetchConfigParams::fetch_config_params(
|
|||
action_phase_cfg->reserve_extra_enabled = config.get_global_version() >= 9;
|
||||
action_phase_cfg->mc_blackhole_addr = config.get_burning_config().blackhole_addr;
|
||||
action_phase_cfg->extra_currency_v2 = config.get_global_version() >= 10;
|
||||
action_phase_cfg->disable_anycast = config.get_global_version() >= 10;
|
||||
}
|
||||
{
|
||||
serialize_cfg->extra_currency_v2 = config.get_global_version() >= 10;
|
||||
serialize_cfg->disable_anycast = config.get_global_version() >= 10;
|
||||
}
|
||||
{
|
||||
// fetch block_grams_created
|
||||
|
|
|
@ -130,6 +130,7 @@ struct ComputePhaseConfig {
|
|||
PrecompiledContractsConfig precompiled_contracts;
|
||||
bool dont_run_precompiled_ = false;
|
||||
bool allow_external_unfreeze{false};
|
||||
bool disable_anycast{false};
|
||||
|
||||
ComputePhaseConfig() : gas_price(0), gas_limit(0), special_gas_limit(0), gas_credit(0) {
|
||||
compute_threshold();
|
||||
|
@ -172,6 +173,7 @@ struct ActionPhaseConfig {
|
|||
bool reserve_extra_enabled{false};
|
||||
bool extra_currency_v2{false};
|
||||
td::optional<td::Bits256> mc_blackhole_addr;
|
||||
bool disable_anycast{false};
|
||||
const MsgPrices& fetch_msg_prices(bool is_masterchain) const {
|
||||
return is_masterchain ? fwd_mc : fwd_std;
|
||||
}
|
||||
|
@ -179,6 +181,7 @@ struct ActionPhaseConfig {
|
|||
|
||||
struct SerializeConfig {
|
||||
bool extra_currency_v2{false};
|
||||
bool disable_anycast{false};
|
||||
};
|
||||
|
||||
struct CreditPhase {
|
||||
|
@ -252,12 +255,13 @@ struct Account {
|
|||
bool is_special{false};
|
||||
bool tick{false};
|
||||
bool tock{false};
|
||||
bool split_depth_set_{false};
|
||||
unsigned char split_depth_{0};
|
||||
int fixed_prefix_length{0};
|
||||
int verbosity{3 * 0};
|
||||
ton::UnixTime now_{0};
|
||||
ton::WorkchainId workchain{ton::workchainInvalid};
|
||||
td::BitArray<32> addr_rewrite; // rewrite (anycast) data, split_depth bits
|
||||
td::BitArray<32> addr_rewrite; // rewrite (anycast) data, addr_rewrite_length bits
|
||||
bool addr_rewrite_length_set{false};
|
||||
unsigned char addr_rewrite_length{0};
|
||||
ton::StdSmcAddress addr; // rewritten address (by replacing a prefix of `addr_orig` with `addr_rewrite`); it is the key in ShardAccounts
|
||||
ton::StdSmcAddress addr_orig; // address indicated in smart-contract data (must coincide with hash of StateInit)
|
||||
Ref<vm::CellSlice> my_addr; // address as stored in the smart contract (MsgAddressInt); corresponds to `addr_orig` + anycast info
|
||||
|
@ -280,9 +284,6 @@ struct Account {
|
|||
Account() = default;
|
||||
Account(ton::WorkchainId wc, td::ConstBitPtr _addr) : workchain(wc), addr(_addr) {
|
||||
}
|
||||
Account(ton::WorkchainId wc, td::ConstBitPtr _addr, int depth)
|
||||
: split_depth_set_(true), split_depth_((unsigned char)depth), workchain(wc), addr(_addr) {
|
||||
}
|
||||
block::CurrencyCollection get_balance() const {
|
||||
return balance;
|
||||
}
|
||||
|
@ -290,7 +291,7 @@ struct Account {
|
|||
bool unpack(Ref<vm::CellSlice> account, ton::UnixTime now, bool special);
|
||||
bool init_new(ton::UnixTime now);
|
||||
bool deactivate();
|
||||
bool recompute_tmp_addr(Ref<vm::CellSlice>& tmp_addr, int split_depth, td::ConstBitPtr orig_addr_rewrite) const;
|
||||
bool recompute_tmp_addr(Ref<vm::CellSlice>& tmp_addr, int fixed_prefix_length, td::ConstBitPtr orig_addr_rewrite) const;
|
||||
td::RefInt256 compute_storage_fees(ton::UnixTime now, const std::vector<block::StoragePrices>& pricing) const;
|
||||
bool is_masterchain() const {
|
||||
return workchain == ton::masterchainId;
|
||||
|
@ -306,10 +307,10 @@ struct Account {
|
|||
|
||||
protected:
|
||||
friend struct transaction::Transaction;
|
||||
bool set_split_depth(int split_depth);
|
||||
bool check_split_depth(int split_depth) const;
|
||||
bool forget_split_depth();
|
||||
bool init_rewrite_addr(int split_depth, td::ConstBitPtr orig_addr_rewrite);
|
||||
bool set_addr_rewrite_length(int new_length);
|
||||
bool check_addr_rewrite_length(int length) const;
|
||||
bool forget_addr_rewrite_length();
|
||||
bool init_rewrite_addr(int rewrite_length, td::ConstBitPtr orig_addr_rewrite);
|
||||
|
||||
private:
|
||||
bool unpack_address(vm::CellSlice& addr_cs);
|
||||
|
@ -346,7 +347,9 @@ struct Transaction {
|
|||
bool orig_addr_rewrite_set{false};
|
||||
bool new_tick;
|
||||
bool new_tock;
|
||||
signed char new_split_depth{-1};
|
||||
int new_fixed_prefix_length{-1};
|
||||
int new_addr_rewrite_length{-1};
|
||||
bool force_remove_anycast_address = false;
|
||||
ton::UnixTime now;
|
||||
int acc_status;
|
||||
int verbosity{3 * 0};
|
||||
|
@ -382,7 +385,7 @@ struct Transaction {
|
|||
Transaction(const Account& _account, int ttype, ton::LogicalTime req_start_lt, ton::UnixTime _now,
|
||||
Ref<vm::Cell> _inmsg = {});
|
||||
bool unpack_input_msg(bool ihr_delivered, const ActionPhaseConfig* cfg);
|
||||
bool check_in_msg_state_hash();
|
||||
bool check_in_msg_state_hash(const ComputePhaseConfig& cfg);
|
||||
bool prepare_storage_phase(const StoragePhaseConfig& cfg, bool force_collect = true, bool adjust_msg_value = false);
|
||||
bool prepare_credit_phase();
|
||||
td::uint64 gas_bought_for(const ComputePhaseConfig& cfg, td::RefInt256 nanograms);
|
||||
|
@ -418,7 +421,7 @@ struct Transaction {
|
|||
int try_action_reserve_currency(vm::CellSlice& cs, ActionPhase& ap, const ActionPhaseConfig& cfg);
|
||||
bool check_replace_src_addr(Ref<vm::CellSlice>& src_addr) const;
|
||||
bool check_rewrite_dest_addr(Ref<vm::CellSlice>& dest_addr, const ActionPhaseConfig& cfg,
|
||||
bool* is_mc = nullptr) const;
|
||||
bool* is_mc = nullptr, bool allow_anycast = true) const;
|
||||
bool serialize_storage_phase(vm::CellBuilder& cb);
|
||||
bool serialize_credit_phase(vm::CellBuilder& cb);
|
||||
bool serialize_compute_phase(vm::CellBuilder& cb);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue