mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
updated vm (breaking compatibility)
- updated vm - new actor scheduler - updated tonlib - updated DNS smartcontract
This commit is contained in:
parent
9e4816e7f6
commit
e27fb1e09c
100 changed files with 3692 additions and 1299 deletions
|
@ -14,7 +14,7 @@
|
|||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with TON Blockchain Library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Copyright 2017-2019 Telegram Systems LLP
|
||||
Copyright 2017-2020 Telegram Systems LLP
|
||||
*/
|
||||
#include "td/utils/bits.h"
|
||||
#include "block/block-parse.h"
|
||||
|
@ -80,7 +80,7 @@ bool Maybe_Anycast::skip_get_depth(vm::CellSlice& cs, int& depth) const {
|
|||
|
||||
const Maybe_Anycast t_Maybe_Anycast;
|
||||
|
||||
bool MsgAddressInt::validate_skip(vm::CellSlice& cs, bool weak) const {
|
||||
bool MsgAddressInt::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const {
|
||||
if (!cs.have(3)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -265,14 +265,14 @@ Ref<vm::CellSlice> MsgAddressInt::pack_std_address(ton::WorkchainId workchain, c
|
|||
|
||||
const MsgAddressInt t_MsgAddressInt;
|
||||
|
||||
bool MsgAddress::validate_skip(vm::CellSlice& cs, bool weak) const {
|
||||
bool MsgAddress::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const {
|
||||
switch (get_tag(cs)) {
|
||||
case addr_none:
|
||||
case addr_ext:
|
||||
return t_MsgAddressExt.validate_skip(cs, weak);
|
||||
return t_MsgAddressExt.validate_skip(ops, cs, weak);
|
||||
case addr_std:
|
||||
case addr_var:
|
||||
return t_MsgAddressInt.validate_skip(cs, weak);
|
||||
return t_MsgAddressInt.validate_skip(ops, cs, weak);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -284,7 +284,7 @@ bool VarUInteger::skip(vm::CellSlice& cs) const {
|
|||
return len >= 0 && len < n && cs.advance(len * 8);
|
||||
}
|
||||
|
||||
bool VarUInteger::validate_skip(vm::CellSlice& cs, bool weak) const {
|
||||
bool VarUInteger::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const {
|
||||
int len = (int)cs.fetch_ulong(ln);
|
||||
return len >= 0 && len < n && (!len || cs.prefetch_ulong(8)) && cs.advance(len * 8);
|
||||
}
|
||||
|
@ -325,7 +325,7 @@ bool VarUIntegerPos::skip(vm::CellSlice& cs) const {
|
|||
return len > 0 && len < n && cs.advance(len * 8);
|
||||
}
|
||||
|
||||
bool VarUIntegerPos::validate_skip(vm::CellSlice& cs, bool weak) const {
|
||||
bool VarUIntegerPos::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const {
|
||||
int len = (int)cs.fetch_ulong(ln);
|
||||
return len > 0 && len < n && cs.prefetch_ulong(8) && cs.advance(len * 8);
|
||||
}
|
||||
|
@ -360,7 +360,7 @@ bool VarInteger::skip(vm::CellSlice& cs) const {
|
|||
return len >= 0 && len < n && cs.advance(len * 8);
|
||||
}
|
||||
|
||||
bool VarInteger::validate_skip(vm::CellSlice& cs, bool weak) const {
|
||||
bool VarInteger::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const {
|
||||
int len = (int)cs.fetch_ulong(ln);
|
||||
return len >= 0 && len < n && (!len || !redundant_int(cs)) && cs.advance(len * 8);
|
||||
}
|
||||
|
@ -386,7 +386,7 @@ bool VarIntegerNz::skip(vm::CellSlice& cs) const {
|
|||
return len > 0 && len < n && cs.advance(len * 8);
|
||||
}
|
||||
|
||||
bool VarIntegerNz::validate_skip(vm::CellSlice& cs, bool weak) const {
|
||||
bool VarIntegerNz::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const {
|
||||
int len = (int)cs.fetch_ulong(ln);
|
||||
return len > 0 && len < n && !redundant_int(cs) && cs.advance(len * 8);
|
||||
}
|
||||
|
@ -409,8 +409,8 @@ bool VarIntegerNz::store_integer_value(vm::CellBuilder& cb, const td::BigInt256&
|
|||
cb.store_int256_bool(value, (k + 7) & -8, true);
|
||||
}
|
||||
|
||||
bool Grams::validate_skip(vm::CellSlice& cs, bool weak) const {
|
||||
return t_VarUInteger_16.validate_skip(cs, weak);
|
||||
bool Grams::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const {
|
||||
return t_VarUInteger_16.validate_skip(ops, cs, weak);
|
||||
}
|
||||
|
||||
td::RefInt256 Grams::as_integer_skip(vm::CellSlice& cs) const {
|
||||
|
@ -464,15 +464,15 @@ bool HashmapNode::skip(vm::CellSlice& cs) const {
|
|||
return n ? cs.advance_refs(2) : value_type.skip(cs);
|
||||
}
|
||||
|
||||
bool HashmapNode::validate_skip(vm::CellSlice& cs, bool weak) const {
|
||||
bool HashmapNode::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const {
|
||||
assert(n >= 0);
|
||||
if (!n) {
|
||||
// hmn_leaf
|
||||
return value_type.validate_skip(cs, weak);
|
||||
return value_type.validate_skip(ops, cs, weak);
|
||||
} else {
|
||||
// hmn_fork
|
||||
Hashmap branch_type{n - 1, value_type};
|
||||
return branch_type.validate_ref(cs.fetch_ref(), weak) && branch_type.validate_ref(cs.fetch_ref(), weak);
|
||||
return branch_type.validate_ref(ops, cs.fetch_ref(), weak) && branch_type.validate_ref(ops, cs.fetch_ref(), weak);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -481,9 +481,9 @@ bool Hashmap::skip(vm::CellSlice& cs) const {
|
|||
return HmLabel{n}.skip(cs, l) && HashmapNode{n - l, value_type}.skip(cs);
|
||||
}
|
||||
|
||||
bool Hashmap::validate_skip(vm::CellSlice& cs, bool weak) const {
|
||||
bool Hashmap::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const {
|
||||
int l;
|
||||
return HmLabel{n}.validate_skip(cs, weak, l) && HashmapNode{n - l, value_type}.validate_skip(cs, weak);
|
||||
return HmLabel{n}.validate_skip(cs, weak, l) && HashmapNode{n - l, value_type}.validate_skip(ops, cs, weak);
|
||||
}
|
||||
|
||||
int HashmapE::get_size(const vm::CellSlice& cs) const {
|
||||
|
@ -491,9 +491,9 @@ int HashmapE::get_size(const vm::CellSlice& cs) const {
|
|||
return (tag >= 0 ? (tag > 0 ? 0x10001 : 1) : -1);
|
||||
}
|
||||
|
||||
bool HashmapE::validate(const vm::CellSlice& cs, bool weak) const {
|
||||
bool HashmapE::validate(int* ops, const vm::CellSlice& cs, bool weak) const {
|
||||
int tag = get_tag(cs);
|
||||
return tag <= 0 ? !tag : root_type.validate_ref(cs.prefetch_ref(), weak);
|
||||
return tag <= 0 ? !tag : root_type.validate_ref(ops, cs.prefetch_ref(), weak);
|
||||
}
|
||||
|
||||
bool HashmapE::add_values(vm::CellBuilder& cb, vm::CellSlice& cs1, vm::CellSlice& cs2) const {
|
||||
|
@ -583,8 +583,8 @@ bool HashmapE::store_ref(vm::CellBuilder& cb, Ref<vm::Cell> arg) const {
|
|||
|
||||
const ExtraCurrencyCollection t_ExtraCurrencyCollection;
|
||||
|
||||
bool CurrencyCollection::validate_skip(vm::CellSlice& cs, bool weak) const {
|
||||
return t_Grams.validate_skip(cs, weak) && t_ExtraCurrencyCollection.validate_skip(cs, weak);
|
||||
bool CurrencyCollection::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const {
|
||||
return t_Grams.validate_skip(ops, cs, weak) && t_ExtraCurrencyCollection.validate_skip(ops, cs, weak);
|
||||
}
|
||||
|
||||
bool CurrencyCollection::skip(vm::CellSlice& cs) const {
|
||||
|
@ -641,25 +641,25 @@ bool CurrencyCollection::pack(vm::CellBuilder& cb, const block::CurrencyCollecti
|
|||
|
||||
const CurrencyCollection t_CurrencyCollection;
|
||||
|
||||
bool CommonMsgInfo::validate_skip(vm::CellSlice& cs, bool weak) const {
|
||||
bool CommonMsgInfo::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const {
|
||||
int tag = get_tag(cs);
|
||||
switch (tag) {
|
||||
case int_msg_info:
|
||||
return cs.advance(4) // int_msg_info$0 ihr_disabled:Bool bounce:Bool bounced:Bool
|
||||
&& t_MsgAddressInt.validate_skip(cs, weak) // src
|
||||
&& t_MsgAddressInt.validate_skip(cs, weak) // dest
|
||||
&& t_CurrencyCollection.validate_skip(cs, weak) // value
|
||||
&& t_Grams.validate_skip(cs, weak) // ihr_fee
|
||||
&& t_Grams.validate_skip(cs, weak) // fwd_fee
|
||||
&& cs.advance(64 + 32); // created_lt:uint64 created_at:uint32
|
||||
return cs.advance(4) // int_msg_info$0 ihr_disabled:Bool bounce:Bool bounced:Bool
|
||||
&& t_MsgAddressInt.validate_skip(ops, cs, weak) // src
|
||||
&& t_MsgAddressInt.validate_skip(ops, cs, weak) // dest
|
||||
&& t_CurrencyCollection.validate_skip(ops, cs, weak) // value
|
||||
&& t_Grams.validate_skip(ops, cs, weak) // ihr_fee
|
||||
&& t_Grams.validate_skip(ops, cs, weak) // fwd_fee
|
||||
&& cs.advance(64 + 32); // created_lt:uint64 created_at:uint32
|
||||
case ext_in_msg_info:
|
||||
return cs.advance(2) && t_MsgAddressExt.validate_skip(cs, weak) // src
|
||||
&& t_MsgAddressInt.validate_skip(cs, weak) // dest
|
||||
&& t_Grams.validate_skip(cs, weak); // import_fee
|
||||
return cs.advance(2) && t_MsgAddressExt.validate_skip(ops, cs, weak) // src
|
||||
&& t_MsgAddressInt.validate_skip(ops, cs, weak) // dest
|
||||
&& t_Grams.validate_skip(ops, cs, weak); // import_fee
|
||||
case ext_out_msg_info:
|
||||
return cs.advance(2) && t_MsgAddressInt.validate_skip(cs, weak) // src
|
||||
&& t_MsgAddressExt.validate_skip(cs, weak) // dest
|
||||
&& cs.advance(64 + 32); // created_lt:uint64 created_at:uint32
|
||||
return cs.advance(2) && t_MsgAddressInt.validate_skip(ops, cs, weak) // src
|
||||
&& t_MsgAddressExt.validate_skip(ops, cs, weak) // dest
|
||||
&& cs.advance(64 + 32); // created_lt:uint64 created_at:uint32
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -721,28 +721,29 @@ const CommonMsgInfo t_CommonMsgInfo;
|
|||
const TickTock t_TickTock;
|
||||
const RefAnything t_RefCell;
|
||||
|
||||
bool StateInit::validate_skip(vm::CellSlice& cs, bool weak) const {
|
||||
return Maybe<UInt>{5}.validate_skip(cs, weak) // split_depth:(Maybe (## 5))
|
||||
&& Maybe<TickTock>{}.validate_skip(cs, weak) // special:(Maybe TickTock)
|
||||
&& Maybe<RefAnything>{}.validate_skip(cs, weak) // code:(Maybe ^Cell)
|
||||
&& Maybe<RefAnything>{}.validate_skip(cs, weak) // data:(Maybe ^Cell)
|
||||
&& Maybe<RefAnything>{}.validate_skip(cs, weak); // library:(Maybe ^Cell)
|
||||
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))
|
||||
&& 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)
|
||||
&& Maybe<RefAnything>{}.validate_skip(ops, cs, weak); // library:(Maybe ^Cell)
|
||||
}
|
||||
|
||||
bool StateInit::get_ticktock(vm::CellSlice& cs, int& ticktock) const {
|
||||
bool have_tt;
|
||||
ticktock = 0;
|
||||
return Maybe<UInt>{5}.validate_skip(cs) && cs.fetch_bool_to(have_tt) && (!have_tt || cs.fetch_uint_to(2, ticktock));
|
||||
return Maybe<UInt>{5}.validate_skip_upto(1, cs) && cs.fetch_bool_to(have_tt) &&
|
||||
(!have_tt || cs.fetch_uint_to(2, ticktock));
|
||||
}
|
||||
|
||||
const StateInit t_StateInit;
|
||||
|
||||
bool Message::validate_skip(vm::CellSlice& cs, bool weak) const {
|
||||
bool Message::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const {
|
||||
static const Maybe<Either<StateInit, RefTo<StateInit>>> init_type;
|
||||
static const Either<Anything, RefAnything> body_type;
|
||||
return t_CommonMsgInfo.validate_skip(cs, weak) // info:CommonMsgInfo
|
||||
&& init_type.validate_skip(cs, weak) // init:(Maybe (Either StateInit ^StateInit))
|
||||
&& body_type.validate_skip(cs, weak); // body:(Either X ^X)
|
||||
return t_CommonMsgInfo.validate_skip(ops, cs, weak) // info:CommonMsgInfo
|
||||
&& init_type.validate_skip(ops, cs, weak) // init:(Maybe (Either StateInit ^StateInit))
|
||||
&& body_type.validate_skip(ops, cs, weak); // body:(Either X ^X)
|
||||
}
|
||||
|
||||
bool Message::extract_info(vm::CellSlice& cs) const {
|
||||
|
@ -760,7 +761,7 @@ bool Message::is_internal(Ref<vm::Cell> ref) const {
|
|||
const Message t_Message;
|
||||
const RefTo<Message> t_Ref_Message;
|
||||
|
||||
bool IntermediateAddress::validate_skip(vm::CellSlice& cs, bool weak) const {
|
||||
bool IntermediateAddress::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const {
|
||||
switch (get_tag(cs)) {
|
||||
case interm_addr_regular:
|
||||
return cs.advance(1) && cs.fetch_ulong(7) <= 96U;
|
||||
|
@ -795,12 +796,12 @@ int IntermediateAddress::get_size(const vm::CellSlice& cs) const {
|
|||
|
||||
const IntermediateAddress t_IntermediateAddress;
|
||||
|
||||
bool MsgEnvelope::validate_skip(vm::CellSlice& cs, bool weak) const {
|
||||
return cs.fetch_ulong(4) == 4 // msg_envelope#4
|
||||
&& t_IntermediateAddress.validate_skip(cs, weak) // cur_addr:IntermediateAddress
|
||||
&& t_IntermediateAddress.validate_skip(cs, weak) // next_addr:IntermediateAddress
|
||||
&& t_Grams.validate_skip(cs, weak) // fwd_fee_remaining:Grams
|
||||
&& t_Ref_Message.validate_skip(cs, weak); // msg:^Message
|
||||
bool MsgEnvelope::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const {
|
||||
return cs.fetch_ulong(4) == 4 // msg_envelope#4
|
||||
&& t_IntermediateAddress.validate_skip(ops, cs, weak) // cur_addr:IntermediateAddress
|
||||
&& t_IntermediateAddress.validate_skip(ops, cs, weak) // next_addr:IntermediateAddress
|
||||
&& t_Grams.validate_skip(ops, cs, weak) // fwd_fee_remaining:Grams
|
||||
&& t_Ref_Message.validate_skip(ops, cs, weak); // msg:^Message
|
||||
}
|
||||
|
||||
bool MsgEnvelope::skip(vm::CellSlice& cs) const {
|
||||
|
@ -849,10 +850,10 @@ bool MsgEnvelope::get_created_lt(const vm::CellSlice& cs, unsigned long long& cr
|
|||
const MsgEnvelope t_MsgEnvelope;
|
||||
const RefTo<MsgEnvelope> t_Ref_MsgEnvelope;
|
||||
|
||||
bool StorageUsed::validate_skip(vm::CellSlice& cs, bool weak) const {
|
||||
return t_VarUInteger_7.validate_skip(cs, weak) // cells:(VarUInteger 7)
|
||||
&& t_VarUInteger_7.validate_skip(cs, weak) // bits:(VarUInteger 7)
|
||||
&& t_VarUInteger_7.validate_skip(cs, weak); // public_cells:(VarUInteger 7)
|
||||
bool StorageUsed::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const {
|
||||
return t_VarUInteger_7.validate_skip(ops, cs, weak) // cells:(VarUInteger 7)
|
||||
&& t_VarUInteger_7.validate_skip(ops, cs, weak) // bits:(VarUInteger 7)
|
||||
&& t_VarUInteger_7.validate_skip(ops, cs, weak); // public_cells:(VarUInteger 7)
|
||||
}
|
||||
|
||||
bool StorageUsed::skip(vm::CellSlice& cs) const {
|
||||
|
@ -863,9 +864,9 @@ bool StorageUsed::skip(vm::CellSlice& cs) const {
|
|||
|
||||
const StorageUsed t_StorageUsed;
|
||||
|
||||
bool StorageUsedShort::validate_skip(vm::CellSlice& cs, bool weak) const {
|
||||
return t_VarUInteger_7.validate_skip(cs, weak) // cells:(VarUInteger 7)
|
||||
&& t_VarUInteger_7.validate_skip(cs, weak); // bits:(VarUInteger 7)
|
||||
bool StorageUsedShort::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const {
|
||||
return t_VarUInteger_7.validate_skip(ops, cs, weak) // cells:(VarUInteger 7)
|
||||
&& t_VarUInteger_7.validate_skip(ops, cs, weak); // bits:(VarUInteger 7)
|
||||
}
|
||||
|
||||
bool StorageUsedShort::skip(vm::CellSlice& cs) const {
|
||||
|
@ -883,22 +884,22 @@ bool StorageInfo::skip(vm::CellSlice& cs) const {
|
|||
&& t_Maybe_Grams.skip(cs); // due_payment:(Maybe Grams)
|
||||
}
|
||||
|
||||
bool StorageInfo::validate_skip(vm::CellSlice& cs, bool weak) const {
|
||||
return t_StorageUsed.validate_skip(cs, weak) // used:StorageUsed
|
||||
&& cs.advance(32) // last_paid:uint32
|
||||
&& t_Maybe_Grams.validate_skip(cs, weak); // due_payment:(Maybe Grams)
|
||||
bool StorageInfo::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const {
|
||||
return t_StorageUsed.validate_skip(ops, cs, weak) // used:StorageUsed
|
||||
&& cs.advance(32) // last_paid:uint32
|
||||
&& t_Maybe_Grams.validate_skip(ops, cs, weak); // due_payment:(Maybe Grams)
|
||||
}
|
||||
|
||||
const StorageInfo t_StorageInfo;
|
||||
|
||||
bool AccountState::validate_skip(vm::CellSlice& cs, bool weak) const {
|
||||
bool AccountState::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const {
|
||||
switch (get_tag(cs)) {
|
||||
case account_uninit:
|
||||
return cs.advance(2);
|
||||
case account_frozen:
|
||||
return cs.advance(2 + 256);
|
||||
case account_active:
|
||||
return cs.advance(1) && t_StateInit.validate_skip(cs, weak);
|
||||
return cs.advance(1) && t_StateInit.validate_skip(ops, cs, weak);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -921,8 +922,9 @@ bool AccountStorage::skip_copy_balance(vm::CellBuilder& cb, vm::CellSlice& cs) c
|
|||
return cs.advance(64) && t_CurrencyCollection.skip_copy(cb, cs) && t_AccountState.skip(cs);
|
||||
}
|
||||
|
||||
bool AccountStorage::validate_skip(vm::CellSlice& cs, bool weak) const {
|
||||
return cs.advance(64) && t_CurrencyCollection.validate_skip(cs, weak) && t_AccountState.validate_skip(cs, weak);
|
||||
bool AccountStorage::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const {
|
||||
return cs.advance(64) && t_CurrencyCollection.validate_skip(ops, cs, weak) &&
|
||||
t_AccountState.validate_skip(ops, cs, weak);
|
||||
}
|
||||
|
||||
const AccountStorage t_AccountStorage;
|
||||
|
@ -940,15 +942,15 @@ bool Account::skip(vm::CellSlice& cs) const {
|
|||
return false;
|
||||
}
|
||||
|
||||
bool Account::validate_skip(vm::CellSlice& cs, bool weak) const {
|
||||
bool Account::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const {
|
||||
switch (get_tag(cs)) {
|
||||
case account_none:
|
||||
return allow_empty && cs.advance(1);
|
||||
case account:
|
||||
return cs.advance(1) // account$1
|
||||
&& t_MsgAddressInt.validate_skip(cs, weak) // addr:MsgAddressInt
|
||||
&& t_StorageInfo.validate_skip(cs, weak) // storage_stat:StorageInfo
|
||||
&& t_AccountStorage.validate_skip(cs, weak); // storage:AccountStorage
|
||||
return cs.advance(1) // account$1
|
||||
&& t_MsgAddressInt.validate_skip(ops, cs, weak) // addr:MsgAddressInt
|
||||
&& t_StorageInfo.validate_skip(ops, cs, weak) // storage_stat:StorageInfo
|
||||
&& t_AccountStorage.validate_skip(ops, cs, weak); // storage:AccountStorage
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -1032,19 +1034,19 @@ bool HashmapAugNode::skip(vm::CellSlice& cs) const {
|
|||
}
|
||||
}
|
||||
|
||||
bool HashmapAugNode::validate_skip(vm::CellSlice& cs, bool weak) const {
|
||||
bool HashmapAugNode::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const {
|
||||
if (n < 0) {
|
||||
return false;
|
||||
}
|
||||
if (!n) {
|
||||
// ahmn_leaf
|
||||
vm::CellSlice cs_extra{cs};
|
||||
if (!aug.extra_type.validate_skip(cs, weak)) {
|
||||
if (!aug.extra_type.validate_skip(ops, cs, weak)) {
|
||||
return false;
|
||||
}
|
||||
cs_extra.cut_tail(cs);
|
||||
vm::CellSlice cs_value{cs};
|
||||
if (!aug.value_type.validate_skip(cs, weak)) {
|
||||
if (!aug.value_type.validate_skip(ops, cs, weak)) {
|
||||
return false;
|
||||
}
|
||||
cs_value.cut_tail(cs);
|
||||
|
@ -1055,13 +1057,14 @@ bool HashmapAugNode::validate_skip(vm::CellSlice& cs, bool weak) const {
|
|||
return false;
|
||||
}
|
||||
HashmapAug branch_type{n - 1, aug};
|
||||
if (!branch_type.validate_ref(cs.prefetch_ref(0), weak) || !branch_type.validate_ref(cs.prefetch_ref(1), weak)) {
|
||||
if (!branch_type.validate_ref(ops, cs.prefetch_ref(0), weak) ||
|
||||
!branch_type.validate_ref(ops, cs.prefetch_ref(1), weak)) {
|
||||
return false;
|
||||
}
|
||||
auto cs_left = load_cell_slice(cs.fetch_ref());
|
||||
auto cs_right = load_cell_slice(cs.fetch_ref());
|
||||
vm::CellSlice cs_extra{cs};
|
||||
if (!aug.extra_type.validate_skip(cs, weak)) {
|
||||
if (!aug.extra_type.validate_skip(ops, cs, weak)) {
|
||||
return false;
|
||||
}
|
||||
cs_extra.cut_tail(cs);
|
||||
|
@ -1074,9 +1077,9 @@ bool HashmapAug::skip(vm::CellSlice& cs) const {
|
|||
return HmLabel{n}.skip(cs, l) && HashmapAugNode{n - l, aug}.skip(cs);
|
||||
}
|
||||
|
||||
bool HashmapAug::validate_skip(vm::CellSlice& cs, bool weak) const {
|
||||
bool HashmapAug::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const {
|
||||
int l;
|
||||
return HmLabel{n}.validate_skip(cs, weak, l) && HashmapAugNode{n - l, aug}.validate_skip(cs, weak);
|
||||
return HmLabel{n}.validate_skip(cs, weak, l) && HashmapAugNode{n - l, aug}.validate_skip(ops, cs, weak);
|
||||
}
|
||||
|
||||
bool HashmapAug::extract_extra(vm::CellSlice& cs) const {
|
||||
|
@ -1084,20 +1087,20 @@ bool HashmapAug::extract_extra(vm::CellSlice& cs) const {
|
|||
return HmLabel{n}.skip(cs, l) && (l == n || cs.advance_refs(2)) && aug.extra_type.extract(cs);
|
||||
}
|
||||
|
||||
bool HashmapAugE::validate_skip(vm::CellSlice& cs, bool weak) const {
|
||||
bool HashmapAugE::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const {
|
||||
Ref<vm::CellSlice> extra;
|
||||
switch (get_tag(cs)) {
|
||||
case ahme_empty:
|
||||
return cs.advance(1) && (extra = root_type.aug.extra_type.validate_fetch(cs, weak)).not_null() &&
|
||||
return cs.advance(1) && (extra = root_type.aug.extra_type.validate_fetch(ops, cs, weak)).not_null() &&
|
||||
root_type.aug.check_empty(extra.unique_write());
|
||||
case ahme_root:
|
||||
if (cs.advance(1) && root_type.validate_ref(cs.prefetch_ref(), weak)) {
|
||||
if (cs.advance(1) && root_type.validate_ref(ops, cs.prefetch_ref(), weak)) {
|
||||
bool special;
|
||||
auto cs_root = load_cell_slice_special(cs.fetch_ref(), special);
|
||||
if (special) {
|
||||
return weak;
|
||||
}
|
||||
return (extra = root_type.aug.extra_type.validate_fetch(cs, weak)).not_null() &&
|
||||
return (extra = root_type.aug.extra_type.validate_fetch(ops, cs, weak)).not_null() &&
|
||||
root_type.extract_extra(cs_root) && extra->contents_equal(cs_root);
|
||||
}
|
||||
break;
|
||||
|
@ -1121,9 +1124,10 @@ bool DepthBalanceInfo::skip(vm::CellSlice& cs) const {
|
|||
cs); // depth_balance$_ split_depth:(#<= 30) balance:CurrencyCollection = DepthBalanceInfo;
|
||||
}
|
||||
|
||||
bool DepthBalanceInfo::validate_skip(vm::CellSlice& cs, bool weak) const {
|
||||
return cs.fetch_ulong(5) <= 30 && t_CurrencyCollection.validate_skip(
|
||||
cs, weak); // depth_balance$_ split_depth:(#<= 30) balance:CurrencyCollection
|
||||
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
|
||||
}
|
||||
|
||||
bool DepthBalanceInfo::null_value(vm::CellBuilder& cb) const {
|
||||
|
@ -1159,10 +1163,10 @@ bool TrStoragePhase::skip(vm::CellSlice& cs) const {
|
|||
&& t_AccStatusChange.skip(cs); // status_change:AccStatusChange
|
||||
}
|
||||
|
||||
bool TrStoragePhase::validate_skip(vm::CellSlice& cs, bool weak) const {
|
||||
return t_Grams.validate_skip(cs, weak) // storage_fees_collected:Grams
|
||||
&& t_Maybe_Grams.validate_skip(cs, weak) // storage_fees_due:Grams
|
||||
&& t_AccStatusChange.validate_skip(cs, weak); // status_change:AccStatusChange
|
||||
bool TrStoragePhase::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const {
|
||||
return t_Grams.validate_skip(ops, cs, weak) // storage_fees_collected:Grams
|
||||
&& t_Maybe_Grams.validate_skip(ops, cs, weak) // storage_fees_due:Grams
|
||||
&& t_AccStatusChange.validate_skip(ops, cs, weak); // status_change:AccStatusChange
|
||||
}
|
||||
|
||||
bool TrStoragePhase::get_storage_fees(vm::CellSlice& cs, td::RefInt256& storage_fees) const {
|
||||
|
@ -1186,9 +1190,9 @@ bool TrCreditPhase::skip(vm::CellSlice& cs) const {
|
|||
&& t_CurrencyCollection.skip(cs); // credit:CurrencyCollection
|
||||
}
|
||||
|
||||
bool TrCreditPhase::validate_skip(vm::CellSlice& cs, bool weak) const {
|
||||
return t_Maybe_Grams.validate_skip(cs, weak) // due_fees_collected:(Maybe Grams)
|
||||
&& t_CurrencyCollection.validate_skip(cs, weak); // credit:CurrencyCollection
|
||||
bool TrCreditPhase::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const {
|
||||
return t_Maybe_Grams.validate_skip(ops, cs, weak) // due_fees_collected:(Maybe Grams)
|
||||
&& t_CurrencyCollection.validate_skip(ops, cs, weak); // credit:CurrencyCollection
|
||||
}
|
||||
|
||||
const TrCreditPhase t_TrCreditPhase;
|
||||
|
@ -1204,15 +1208,15 @@ bool TrComputeInternal1::skip(vm::CellSlice& cs) const {
|
|||
// vm_final_state_hash:uint256
|
||||
}
|
||||
|
||||
bool TrComputeInternal1::validate_skip(vm::CellSlice& cs, bool weak) const {
|
||||
return t_VarUInteger_7.validate_skip(cs, weak) // gas_used:(VarUInteger 7)
|
||||
&& t_VarUInteger_7.validate_skip(cs, weak) // gas_limit:(VarUInteger 7)
|
||||
&& Maybe<VarUInteger>{3}.validate_skip(cs, weak) // gas_credit:(Maybe (VarUInteger 3))
|
||||
&& cs.advance(8 + 32) // mode:int8 exit_code:int32
|
||||
&& Maybe<Int>{32}.validate_skip(cs, weak) // exit_arg:(Maybe int32)
|
||||
&& cs.advance(32 + 256 + 256); // vm_steps:uint32
|
||||
// vm_init_state_hash:uint256
|
||||
// vm_final_state_hash:uint256
|
||||
bool TrComputeInternal1::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const {
|
||||
return t_VarUInteger_7.validate_skip(ops, cs, weak) // gas_used:(VarUInteger 7)
|
||||
&& t_VarUInteger_7.validate_skip(ops, cs, weak) // gas_limit:(VarUInteger 7)
|
||||
&& Maybe<VarUInteger>{3}.validate_skip(ops, cs, weak) // gas_credit:(Maybe (VarUInteger 3))
|
||||
&& cs.advance(8 + 32) // mode:int8 exit_code:int32
|
||||
&& Maybe<Int>{32}.validate_skip(ops, cs, weak) // exit_arg:(Maybe int32)
|
||||
&& cs.advance(32 + 256 + 256); // vm_steps:uint32
|
||||
// vm_init_state_hash:uint256
|
||||
// vm_final_state_hash:uint256
|
||||
}
|
||||
|
||||
const TrComputeInternal1 t_TrComputeInternal1;
|
||||
|
@ -1231,14 +1235,14 @@ bool TrComputePhase::skip(vm::CellSlice& cs) const {
|
|||
return false;
|
||||
}
|
||||
|
||||
bool TrComputePhase::validate_skip(vm::CellSlice& cs, bool weak) const {
|
||||
bool TrComputePhase::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const {
|
||||
switch (get_tag(cs)) {
|
||||
case tr_phase_compute_skipped:
|
||||
return cs.advance(1) && t_ComputeSkipReason.validate_skip(cs, weak);
|
||||
return cs.advance(1) && t_ComputeSkipReason.validate_skip(ops, cs, weak);
|
||||
case tr_phase_compute_vm:
|
||||
return cs.advance(1 + 3) // tr_phase_compute_vm$1 success:Bool msg_state_used:Bool account_activated:Bool
|
||||
&& t_Grams.validate_skip(cs, weak) // gas_fees:Grams
|
||||
&& t_Ref_TrComputeInternal1.validate_skip(cs, weak); // ^[ gas_used:(..) .. ]
|
||||
&& t_Grams.validate_skip(ops, cs, weak) // gas_fees:Grams
|
||||
&& t_Ref_TrComputeInternal1.validate_skip(ops, cs, weak); // ^[ gas_used:(..) .. ]
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -1258,17 +1262,17 @@ bool TrActionPhase::skip(vm::CellSlice& cs) const {
|
|||
&& t_StorageUsedShort.skip(cs); // tot_msg_size:StorageUsedShort
|
||||
}
|
||||
|
||||
bool TrActionPhase::validate_skip(vm::CellSlice& cs, bool weak) const {
|
||||
return cs.advance(3) // success:Bool valid:Bool no_funds:Bool
|
||||
&& t_AccStatusChange.validate_skip(cs, weak) // status_change:AccStatusChange
|
||||
&& t_Maybe_Grams.validate_skip(cs, weak) // total_fwd_fees:(Maybe Grams)
|
||||
&& t_Maybe_Grams.validate_skip(cs, weak) // total_action_fees:(Maybe Grams)
|
||||
&& cs.advance(32) // result_code:int32
|
||||
&& Maybe<Int>{32}.validate_skip(cs, weak) // result_arg:(Maybe int32)
|
||||
&& cs.advance(16 * 4 + 256) // tot_actions:uint16 spec_actions:uint16
|
||||
// skipped_actions:uint16 msgs_created:uint16
|
||||
// action_list_hash:uint256
|
||||
&& t_StorageUsedShort.validate_skip(cs, weak); // tot_msg_size:StorageUsed
|
||||
bool TrActionPhase::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const {
|
||||
return cs.advance(3) // success:Bool valid:Bool no_funds:Bool
|
||||
&& t_AccStatusChange.validate_skip(ops, cs, weak) // status_change:AccStatusChange
|
||||
&& t_Maybe_Grams.validate_skip(ops, cs, weak) // total_fwd_fees:(Maybe Grams)
|
||||
&& t_Maybe_Grams.validate_skip(ops, cs, weak) // total_action_fees:(Maybe Grams)
|
||||
&& cs.advance(32) // result_code:int32
|
||||
&& Maybe<Int>{32}.validate_skip(ops, cs, weak) // result_arg:(Maybe int32)
|
||||
&& cs.advance(16 * 4 + 256) // tot_actions:uint16 spec_actions:uint16
|
||||
// skipped_actions:uint16 msgs_created:uint16
|
||||
// action_list_hash:uint256
|
||||
&& t_StorageUsedShort.validate_skip(ops, cs, weak); // tot_msg_size:StorageUsed
|
||||
}
|
||||
|
||||
const TrActionPhase t_TrActionPhase;
|
||||
|
@ -1290,19 +1294,19 @@ bool TrBouncePhase::skip(vm::CellSlice& cs) const {
|
|||
return false;
|
||||
}
|
||||
|
||||
bool TrBouncePhase::validate_skip(vm::CellSlice& cs, bool weak) const {
|
||||
bool TrBouncePhase::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const {
|
||||
switch (get_tag(cs)) {
|
||||
case tr_phase_bounce_negfunds:
|
||||
return cs.advance(2); // tr_phase_bounce_negfunds$00
|
||||
case tr_phase_bounce_nofunds:
|
||||
return cs.advance(2) // tr_phase_bounce_nofunds$01
|
||||
&& t_StorageUsedShort.validate_skip(cs, weak) // msg_size:StorageUsedShort
|
||||
&& t_Grams.validate_skip(cs, weak); // req_fwd_fees:Grams
|
||||
return cs.advance(2) // tr_phase_bounce_nofunds$01
|
||||
&& t_StorageUsedShort.validate_skip(ops, cs, weak) // msg_size:StorageUsedShort
|
||||
&& t_Grams.validate_skip(ops, cs, weak); // req_fwd_fees:Grams
|
||||
case tr_phase_bounce_ok:
|
||||
return cs.advance(1) // tr_phase_bounce_ok$1
|
||||
&& t_StorageUsedShort.validate_skip(cs, weak) // msg_size:StorageUsedShort
|
||||
&& t_Grams.validate_skip(cs, weak) // msg_fees:Grams
|
||||
&& t_Grams.validate_skip(cs, weak); // fwd_fees:Grams
|
||||
return cs.advance(1) // tr_phase_bounce_ok$1
|
||||
&& t_StorageUsedShort.validate_skip(ops, cs, weak) // msg_size:StorageUsedShort
|
||||
&& t_Grams.validate_skip(ops, cs, weak) // msg_fees:Grams
|
||||
&& t_Grams.validate_skip(ops, cs, weak); // fwd_fees:Grams
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -1322,7 +1326,7 @@ bool SplitMergeInfo::skip(vm::CellSlice& cs) const {
|
|||
return cs.advance(6 + 6 + 256 + 256);
|
||||
}
|
||||
|
||||
bool SplitMergeInfo::validate_skip(vm::CellSlice& cs, bool weak) const {
|
||||
bool SplitMergeInfo::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const {
|
||||
if (!cs.have(6 + 6 + 256 + 256)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -1392,52 +1396,52 @@ bool TransactionDescr::skip(vm::CellSlice& cs) const {
|
|||
return false;
|
||||
}
|
||||
|
||||
bool TransactionDescr::validate_skip(vm::CellSlice& cs, bool weak) const {
|
||||
bool TransactionDescr::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const {
|
||||
switch (get_tag(cs)) {
|
||||
case trans_ord:
|
||||
return cs.advance(4 + 1) // trans_ord$0000 credit_first:Bool
|
||||
&& Maybe<TrStoragePhase>{}.validate_skip(cs, weak) // storage_ph:(Maybe TrStoragePhase)
|
||||
&& Maybe<TrCreditPhase>{}.validate_skip(cs, weak) // credit_ph:(Maybe TrCreditPhase)
|
||||
&& t_TrComputePhase.validate_skip(cs, weak) // compute_ph:TrComputePhase
|
||||
&& Maybe<RefTo<TrActionPhase>>{}.validate_skip(cs, weak) // action:(Maybe ^TrActionPhase)
|
||||
&& cs.advance(1) // aborted:Bool
|
||||
&& Maybe<TrBouncePhase>{}.validate_skip(cs, weak) // bounce:(Maybe TrBouncePhase)
|
||||
&& cs.advance(1); // destroyed:Bool
|
||||
return cs.advance(4 + 1) // trans_ord$0000 credit_first:Bool
|
||||
&& Maybe<TrStoragePhase>{}.validate_skip(ops, cs, weak) // storage_ph:(Maybe TrStoragePhase)
|
||||
&& Maybe<TrCreditPhase>{}.validate_skip(ops, cs, weak) // credit_ph:(Maybe TrCreditPhase)
|
||||
&& t_TrComputePhase.validate_skip(ops, cs, weak) // compute_ph:TrComputePhase
|
||||
&& Maybe<RefTo<TrActionPhase>>{}.validate_skip(ops, cs, weak) // action:(Maybe ^TrActionPhase)
|
||||
&& cs.advance(1) // aborted:Bool
|
||||
&& Maybe<TrBouncePhase>{}.validate_skip(ops, cs, weak) // bounce:(Maybe TrBouncePhase)
|
||||
&& cs.advance(1); // destroyed:Bool
|
||||
case trans_storage:
|
||||
return cs.advance(4) // trans_storage$0001
|
||||
&& t_TrStoragePhase.validate_skip(cs, weak); // storage_ph:TrStoragePhase
|
||||
return cs.advance(4) // trans_storage$0001
|
||||
&& t_TrStoragePhase.validate_skip(ops, cs, weak); // storage_ph:TrStoragePhase
|
||||
case trans_tick_tock:
|
||||
return cs.advance(4) // trans_tick_tock$001 is_tock:Bool
|
||||
&& t_TrStoragePhase.validate_skip(cs, weak) // storage_ph:TrStoragePhase
|
||||
&& t_TrComputePhase.validate_skip(cs, weak) // compute_ph:TrComputePhase
|
||||
&& Maybe<RefTo<TrActionPhase>>{}.validate_skip(cs, weak) // action:(Maybe ^TrActionPhase)
|
||||
&& cs.advance(2); // aborted:Bool destroyed:Bool
|
||||
return cs.advance(4) // trans_tick_tock$001 is_tock:Bool
|
||||
&& t_TrStoragePhase.validate_skip(ops, cs, weak) // storage_ph:TrStoragePhase
|
||||
&& t_TrComputePhase.validate_skip(ops, cs, weak) // compute_ph:TrComputePhase
|
||||
&& Maybe<RefTo<TrActionPhase>>{}.validate_skip(ops, cs, weak) // action:(Maybe ^TrActionPhase)
|
||||
&& cs.advance(2); // aborted:Bool destroyed:Bool
|
||||
case trans_split_prepare:
|
||||
return cs.advance(4) // trans_split_prepare$0100
|
||||
&& t_SplitMergeInfo.validate_skip(cs, weak) // split_info:SplitMergeInfo
|
||||
&& Maybe<TrStoragePhase>{}.validate_skip(cs, weak) // storage_ph:(Maybe TrStoragePhase)
|
||||
&& t_TrComputePhase.validate_skip(cs, weak) // compute_ph:TrComputePhase
|
||||
&& Maybe<RefTo<TrActionPhase>>{}.validate_skip(cs, weak) // action:(Maybe ^TrActionPhase)
|
||||
&& cs.advance(2); // aborted:Bool destroyed:Bool
|
||||
return cs.advance(4) // trans_split_prepare$0100
|
||||
&& t_SplitMergeInfo.validate_skip(ops, cs, weak) // split_info:SplitMergeInfo
|
||||
&& Maybe<TrStoragePhase>{}.validate_skip(ops, cs, weak) // storage_ph:(Maybe TrStoragePhase)
|
||||
&& t_TrComputePhase.validate_skip(ops, cs, weak) // compute_ph:TrComputePhase
|
||||
&& Maybe<RefTo<TrActionPhase>>{}.validate_skip(ops, cs, weak) // action:(Maybe ^TrActionPhase)
|
||||
&& cs.advance(2); // aborted:Bool destroyed:Bool
|
||||
case trans_split_install:
|
||||
return cs.advance(4) // trans_split_install$0101
|
||||
&& t_SplitMergeInfo.validate_skip(cs, weak) // split_info:SplitMergeInfo
|
||||
&& t_Ref_Transaction.validate_skip(cs, weak) // prepare_transaction:^Transaction
|
||||
&& cs.advance(1); // installed:Bool
|
||||
return cs.advance(4) // trans_split_install$0101
|
||||
&& t_SplitMergeInfo.validate_skip(ops, cs, weak) // split_info:SplitMergeInfo
|
||||
&& t_Ref_Transaction.validate_skip(ops, cs, weak) // prepare_transaction:^Transaction
|
||||
&& cs.advance(1); // installed:Bool
|
||||
case trans_merge_prepare:
|
||||
return cs.advance(4) // trans_merge_prepare$0110
|
||||
&& t_SplitMergeInfo.validate_skip(cs, weak) // split_info:SplitMergeInfo
|
||||
&& t_TrStoragePhase.validate_skip(cs, weak) // storage_ph:TrStoragePhase
|
||||
&& cs.advance(1); // aborted:Bool
|
||||
return cs.advance(4) // trans_merge_prepare$0110
|
||||
&& t_SplitMergeInfo.validate_skip(ops, cs, weak) // split_info:SplitMergeInfo
|
||||
&& t_TrStoragePhase.validate_skip(ops, cs, weak) // storage_ph:TrStoragePhase
|
||||
&& cs.advance(1); // aborted:Bool
|
||||
case trans_merge_install:
|
||||
return cs.advance(4) // trans_merge_install$0111
|
||||
&& t_SplitMergeInfo.validate_skip(cs, weak) // split_info:SplitMergeInfo
|
||||
&& t_Ref_Transaction.validate_skip(cs, weak) // prepare_transaction:^Transaction
|
||||
&& Maybe<TrStoragePhase>{}.validate_skip(cs, weak) // storage_ph:(Maybe TrStoragePhase)
|
||||
&& Maybe<TrCreditPhase>{}.validate_skip(cs, weak) // credit_ph:(Maybe TrCreditPhase)
|
||||
&& Maybe<TrComputePhase>{}.validate_skip(cs, weak) // compute_ph:TrComputePhase
|
||||
&& Maybe<RefTo<TrActionPhase>>{}.validate_skip(cs, weak) // action:(Maybe ^TrActionPhase)
|
||||
&& cs.advance(2); // aborted:Bool destroyed:Bool
|
||||
return cs.advance(4) // trans_merge_install$0111
|
||||
&& t_SplitMergeInfo.validate_skip(ops, cs, weak) // split_info:SplitMergeInfo
|
||||
&& t_Ref_Transaction.validate_skip(ops, cs, weak) // prepare_transaction:^Transaction
|
||||
&& Maybe<TrStoragePhase>{}.validate_skip(ops, cs, weak) // storage_ph:(Maybe TrStoragePhase)
|
||||
&& Maybe<TrCreditPhase>{}.validate_skip(ops, cs, weak) // credit_ph:(Maybe TrCreditPhase)
|
||||
&& Maybe<TrComputePhase>{}.validate_skip(ops, cs, weak) // compute_ph:TrComputePhase
|
||||
&& Maybe<RefTo<TrActionPhase>>{}.validate_skip(ops, cs, weak) // action:(Maybe ^TrActionPhase)
|
||||
&& cs.advance(2); // aborted:Bool destroyed:Bool
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -1501,9 +1505,9 @@ bool Transaction_aux::skip(vm::CellSlice& cs) const {
|
|||
&& HashmapE{15, t_Ref_Message}.skip(cs); // out_msgs:(HashmapE 15 ^Message)
|
||||
}
|
||||
|
||||
bool Transaction_aux::validate_skip(vm::CellSlice& cs, bool weak) const {
|
||||
return Maybe<RefTo<Message>>{}.validate_skip(cs, weak) // in_msg:(Maybe ^Message)
|
||||
&& HashmapE{15, t_Ref_Message}.validate_skip(cs, weak); // out_msgs:(HashmapE 15 ^Message)
|
||||
bool Transaction_aux::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const {
|
||||
return Maybe<RefTo<Message>>{}.validate_skip(ops, cs, weak) // in_msg:(Maybe ^Message)
|
||||
&& HashmapE{15, t_Ref_Message}.validate_skip(ops, cs, weak); // out_msgs:(HashmapE 15 ^Message)
|
||||
}
|
||||
|
||||
const Transaction_aux t_Transaction_aux;
|
||||
|
@ -1520,18 +1524,18 @@ bool Transaction::skip(vm::CellSlice& cs) const {
|
|||
&& RefTo<TransactionDescr>{}.skip(cs); // description:^TransactionDescr
|
||||
}
|
||||
|
||||
bool Transaction::validate_skip(vm::CellSlice& cs, bool weak) const {
|
||||
bool Transaction::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const {
|
||||
return cs.fetch_ulong(4) == 7 // transaction$0111
|
||||
&&
|
||||
cs.advance(
|
||||
256 + 64 + 256 + 64 + 32 +
|
||||
15) // account_addr:uint256 lt:uint64 prev_trans_hash:bits256 prev_trans_lt:uint64 now:uint32 outmsg_cnt:uint15
|
||||
&& t_AccountStatus.validate_skip(cs, weak) // orig_status:AccountStatus
|
||||
&& t_AccountStatus.validate_skip(cs, weak) // end_status:AccountStatus
|
||||
&& RefTo<Transaction_aux>{}.validate_skip(cs, weak) // ^[ in_msg:... out_msgs:... ]
|
||||
&& t_CurrencyCollection.validate_skip(cs, weak) // total_fees:CurrencyCollection
|
||||
&& t_Ref_HashUpdate.validate_skip(cs, weak) // state_update:^(HASH_UPDATE Account)
|
||||
&& RefTo<TransactionDescr>{}.validate_skip(cs, weak); // description:^TransactionDescr
|
||||
&& t_AccountStatus.validate_skip(ops, cs, weak) // orig_status:AccountStatus
|
||||
&& t_AccountStatus.validate_skip(ops, cs, weak) // end_status:AccountStatus
|
||||
&& RefTo<Transaction_aux>{}.validate_skip(ops, cs, weak) // ^[ in_msg:... out_msgs:... ]
|
||||
&& t_CurrencyCollection.validate_skip(ops, cs, weak) // total_fees:CurrencyCollection
|
||||
&& t_Ref_HashUpdate.validate_skip(ops, cs, weak) // state_update:^(HASH_UPDATE Account)
|
||||
&& RefTo<TransactionDescr>{}.validate_skip(ops, cs, weak); // description:^TransactionDescr
|
||||
}
|
||||
|
||||
bool Transaction::get_storage_fees(Ref<vm::Cell> cell, td::RefInt256& storage_fees) const {
|
||||
|
@ -1595,12 +1599,12 @@ bool AccountBlock::skip(vm::CellSlice& cs) const {
|
|||
&& cs.advance_refs(1); // state_update:^(HASH_UPDATE Account)
|
||||
}
|
||||
|
||||
bool AccountBlock::validate_skip(vm::CellSlice& cs, bool weak) const {
|
||||
bool AccountBlock::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const {
|
||||
return cs.fetch_ulong(4) == 5 // acc_trans#5
|
||||
&& cs.advance(256) // account_addr:bits256
|
||||
&&
|
||||
t_AccountTransactions.validate_skip(cs, weak) // transactions:(HashmapAug 64 ^Transaction CurrencyCollection)
|
||||
&& t_Ref_HashUpdate.validate_skip(cs, weak); // state_update:^(HASH_UPDATE Account)
|
||||
&& t_AccountTransactions.validate_skip(ops, cs,
|
||||
weak) // transactions:(HashmapAug 64 ^Transaction CurrencyCollection)
|
||||
&& t_Ref_HashUpdate.validate_skip(ops, cs, weak); // state_update:^(HASH_UPDATE Account)
|
||||
}
|
||||
|
||||
bool AccountBlock::get_total_fees(vm::CellSlice&& cs, block::CurrencyCollection& total_fees) const {
|
||||
|
@ -1620,8 +1624,8 @@ const Aug_ShardAccountBlocks aug_ShardAccountBlocks;
|
|||
const HashmapAugE t_ShardAccountBlocks{256,
|
||||
aug_ShardAccountBlocks}; // (HashmapAugE 256 AccountBlock CurrencyCollection)
|
||||
|
||||
bool ImportFees::validate_skip(vm::CellSlice& cs, bool weak) const {
|
||||
return t_Grams.validate_skip(cs, weak) && t_CurrencyCollection.validate_skip(cs, weak);
|
||||
bool ImportFees::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const {
|
||||
return t_Grams.validate_skip(ops, cs, weak) && t_CurrencyCollection.validate_skip(ops, cs, weak);
|
||||
}
|
||||
|
||||
bool ImportFees::skip(vm::CellSlice& cs) const {
|
||||
|
@ -1676,44 +1680,44 @@ bool InMsg::skip(vm::CellSlice& cs) const {
|
|||
return false;
|
||||
}
|
||||
|
||||
bool InMsg::validate_skip(vm::CellSlice& cs, bool weak) const {
|
||||
bool InMsg::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const {
|
||||
switch (get_tag(cs)) {
|
||||
case msg_import_ext:
|
||||
return cs.advance(3) // msg_import_ext$000
|
||||
&& t_Ref_Message.validate_skip(cs, weak) // msg:^Message
|
||||
&& t_Ref_Transaction.validate_skip(cs, weak); // transaction:^Transaction
|
||||
return cs.advance(3) // msg_import_ext$000
|
||||
&& t_Ref_Message.validate_skip(ops, cs, weak) // msg:^Message
|
||||
&& t_Ref_Transaction.validate_skip(ops, cs, weak); // transaction:^Transaction
|
||||
case msg_import_ihr:
|
||||
return cs.advance(3) // msg_import_ihr$010
|
||||
&& t_Ref_Message.validate_skip(cs, weak) // msg:^Message
|
||||
&& t_Ref_Transaction.validate_skip(cs, weak) // transaction:^Transaction
|
||||
&& t_Grams.validate_skip(cs, weak) // ihr_fee:Grams
|
||||
&& t_RefCell.validate_skip(cs, weak); // proof_created:^Cell
|
||||
return cs.advance(3) // msg_import_ihr$010
|
||||
&& t_Ref_Message.validate_skip(ops, cs, weak) // msg:^Message
|
||||
&& t_Ref_Transaction.validate_skip(ops, cs, weak) // transaction:^Transaction
|
||||
&& t_Grams.validate_skip(ops, cs, weak) // ihr_fee:Grams
|
||||
&& t_RefCell.validate_skip(ops, cs, weak); // proof_created:^Cell
|
||||
case msg_import_imm:
|
||||
return cs.advance(3) // msg_import_imm$011
|
||||
&& t_Ref_MsgEnvelope.validate_skip(cs, weak) // in_msg:^MsgEnvelope
|
||||
&& t_Ref_Transaction.validate_skip(cs, weak) // transaction:^Transaction
|
||||
&& t_Grams.validate_skip(cs, weak); // fwd_fee:Grams
|
||||
return cs.advance(3) // msg_import_imm$011
|
||||
&& t_Ref_MsgEnvelope.validate_skip(ops, cs, weak) // in_msg:^MsgEnvelope
|
||||
&& t_Ref_Transaction.validate_skip(ops, cs, weak) // transaction:^Transaction
|
||||
&& t_Grams.validate_skip(ops, cs, weak); // fwd_fee:Grams
|
||||
case msg_import_fin:
|
||||
return cs.advance(3) // msg_import_fin$100
|
||||
&& t_Ref_MsgEnvelope.validate_skip(cs, weak) // in_msg:^MsgEnvelope
|
||||
&& t_Ref_Transaction.validate_skip(cs, weak) // transaction:^Transaction
|
||||
&& t_Grams.validate_skip(cs, weak); // fwd_fee:Grams
|
||||
return cs.advance(3) // msg_import_fin$100
|
||||
&& t_Ref_MsgEnvelope.validate_skip(ops, cs, weak) // in_msg:^MsgEnvelope
|
||||
&& t_Ref_Transaction.validate_skip(ops, cs, weak) // transaction:^Transaction
|
||||
&& t_Grams.validate_skip(ops, cs, weak); // fwd_fee:Grams
|
||||
case msg_import_tr:
|
||||
return cs.advance(3) // msg_import_tr$101
|
||||
&& t_Ref_MsgEnvelope.validate_skip(cs, weak) // in_msg:^MsgEnvelope
|
||||
&& t_Ref_MsgEnvelope.validate_skip(cs, weak) // out_msg:^MsgEnvelope
|
||||
&& t_Grams.validate_skip(cs, weak); // transit_fee:Grams
|
||||
return cs.advance(3) // msg_import_tr$101
|
||||
&& t_Ref_MsgEnvelope.validate_skip(ops, cs, weak) // in_msg:^MsgEnvelope
|
||||
&& t_Ref_MsgEnvelope.validate_skip(ops, cs, weak) // out_msg:^MsgEnvelope
|
||||
&& t_Grams.validate_skip(ops, cs, weak); // transit_fee:Grams
|
||||
case msg_discard_fin:
|
||||
return cs.advance(3) // msg_discard_fin$110
|
||||
&& t_Ref_MsgEnvelope.validate_skip(cs, weak) // in_msg:^MsgEnvelope
|
||||
&& cs.advance(64) // transaction_id:uint64
|
||||
&& t_Grams.validate_skip(cs, weak); // fwd_fee:Grams
|
||||
return cs.advance(3) // msg_discard_fin$110
|
||||
&& t_Ref_MsgEnvelope.validate_skip(ops, cs, weak) // in_msg:^MsgEnvelope
|
||||
&& cs.advance(64) // transaction_id:uint64
|
||||
&& t_Grams.validate_skip(ops, cs, weak); // fwd_fee:Grams
|
||||
case msg_discard_tr:
|
||||
return cs.advance(3) // msg_discard_tr$111
|
||||
&& t_Ref_MsgEnvelope.validate_skip(cs, weak) // in_msg:^MsgEnvelope
|
||||
&& cs.advance(64) // transaction_id:uint64
|
||||
&& t_Grams.validate_skip(cs, weak) // fwd_fee:Grams
|
||||
&& t_RefCell.validate_skip(cs, weak); // proof_delivered:^Cell
|
||||
return cs.advance(3) // msg_discard_tr$111
|
||||
&& t_Ref_MsgEnvelope.validate_skip(ops, cs, weak) // in_msg:^MsgEnvelope
|
||||
&& cs.advance(64) // transaction_id:uint64
|
||||
&& t_Grams.validate_skip(ops, cs, weak) // fwd_fee:Grams
|
||||
&& t_RefCell.validate_skip(ops, cs, weak); // proof_delivered:^Cell
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -1851,37 +1855,37 @@ bool OutMsg::skip(vm::CellSlice& cs) const {
|
|||
return false;
|
||||
}
|
||||
|
||||
bool OutMsg::validate_skip(vm::CellSlice& cs, bool weak) const {
|
||||
bool OutMsg::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const {
|
||||
switch (get_tag(cs)) {
|
||||
case msg_export_ext:
|
||||
return cs.advance(3) // msg_export_ext$000
|
||||
&& t_Ref_Message.validate_skip(cs, weak) // msg:^Message
|
||||
&& t_Ref_Transaction.validate_skip(cs, weak); // transaction:^Transaction
|
||||
return cs.advance(3) // msg_export_ext$000
|
||||
&& t_Ref_Message.validate_skip(ops, cs, weak) // msg:^Message
|
||||
&& t_Ref_Transaction.validate_skip(ops, cs, weak); // transaction:^Transaction
|
||||
case msg_export_imm:
|
||||
return cs.advance(3) // msg_export_imm$010
|
||||
&& t_Ref_MsgEnvelope.validate_skip(cs, weak) // out_msg:^MsgEnvelope
|
||||
&& t_Ref_Transaction.validate_skip(cs, weak) // transaction:^Transaction
|
||||
&& RefTo<InMsg>{}.validate_skip(cs, weak); // reimport:^InMsg
|
||||
return cs.advance(3) // msg_export_imm$010
|
||||
&& t_Ref_MsgEnvelope.validate_skip(ops, cs, weak) // out_msg:^MsgEnvelope
|
||||
&& t_Ref_Transaction.validate_skip(ops, cs, weak) // transaction:^Transaction
|
||||
&& RefTo<InMsg>{}.validate_skip(ops, cs, weak); // reimport:^InMsg
|
||||
case msg_export_new:
|
||||
return cs.advance(3) // msg_export_new$001
|
||||
&& t_Ref_MsgEnvelope.validate_skip(cs, weak) // out_msg:^MsgEnvelope
|
||||
&& t_Ref_Transaction.validate_skip(cs, weak); // transaction:^Transaction
|
||||
return cs.advance(3) // msg_export_new$001
|
||||
&& t_Ref_MsgEnvelope.validate_skip(ops, cs, weak) // out_msg:^MsgEnvelope
|
||||
&& t_Ref_Transaction.validate_skip(ops, cs, weak); // transaction:^Transaction
|
||||
case msg_export_tr:
|
||||
return cs.advance(3) // msg_export_tr$011
|
||||
&& t_Ref_MsgEnvelope.validate_skip(cs, weak) // out_msg:^MsgEnvelope
|
||||
&& RefTo<InMsg>{}.validate_skip(cs, weak); // imported:^InMsg
|
||||
return cs.advance(3) // msg_export_tr$011
|
||||
&& t_Ref_MsgEnvelope.validate_skip(ops, cs, weak) // out_msg:^MsgEnvelope
|
||||
&& RefTo<InMsg>{}.validate_skip(ops, cs, weak); // imported:^InMsg
|
||||
case msg_export_deq_imm:
|
||||
return cs.advance(3) // msg_export_deq_imm$100
|
||||
&& t_Ref_MsgEnvelope.validate_skip(cs, weak) // out_msg:^MsgEnvelope
|
||||
&& RefTo<InMsg>{}.validate_skip(cs, weak); // reimport:^InMsg
|
||||
return cs.advance(3) // msg_export_deq_imm$100
|
||||
&& t_Ref_MsgEnvelope.validate_skip(ops, cs, weak) // out_msg:^MsgEnvelope
|
||||
&& RefTo<InMsg>{}.validate_skip(ops, cs, weak); // reimport:^InMsg
|
||||
case msg_export_deq:
|
||||
return cs.advance(3) // msg_export_deq$110
|
||||
&& t_Ref_MsgEnvelope.validate_skip(cs, weak) // out_msg:^MsgEnvelope
|
||||
&& cs.advance(64); // import_block_lt:uint64
|
||||
return cs.advance(3) // msg_export_deq$110
|
||||
&& t_Ref_MsgEnvelope.validate_skip(ops, cs, weak) // out_msg:^MsgEnvelope
|
||||
&& cs.advance(64); // import_block_lt:uint64
|
||||
case msg_export_tr_req:
|
||||
return cs.advance(3) // msg_export_tr_req$111
|
||||
&& t_Ref_MsgEnvelope.validate_skip(cs, weak) // out_msg:^MsgEnvelope
|
||||
&& RefTo<InMsg>{}.validate_skip(cs, weak); // imported:^InMsg
|
||||
return cs.advance(3) // msg_export_tr_req$111
|
||||
&& t_Ref_MsgEnvelope.validate_skip(ops, cs, weak) // out_msg:^MsgEnvelope
|
||||
&& RefTo<InMsg>{}.validate_skip(ops, cs, weak); // imported:^InMsg
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -1954,8 +1958,8 @@ const OutMsg t_OutMsg;
|
|||
const Aug_OutMsgDescr aug_OutMsgDescr;
|
||||
const OutMsgDescr t_OutMsgDescr;
|
||||
|
||||
bool EnqueuedMsg::validate_skip(vm::CellSlice& cs, bool weak) const {
|
||||
return cs.advance(64) && t_Ref_MsgEnvelope.validate_skip(cs, weak);
|
||||
bool EnqueuedMsg::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const {
|
||||
return cs.advance(64) && t_Ref_MsgEnvelope.validate_skip(ops, cs, weak);
|
||||
}
|
||||
|
||||
const EnqueuedMsg t_EnqueuedMsg;
|
||||
|
@ -1989,9 +1993,9 @@ bool OutMsgQueueInfo::skip(vm::CellSlice& cs) const {
|
|||
return t_OutMsgQueue.skip(cs) && t_ProcessedInfo.skip(cs) && t_IhrPendingInfo.skip(cs);
|
||||
}
|
||||
|
||||
bool OutMsgQueueInfo::validate_skip(vm::CellSlice& cs, bool weak) const {
|
||||
return t_OutMsgQueue.validate_skip(cs, weak) && t_ProcessedInfo.validate_skip(cs, weak) &&
|
||||
t_IhrPendingInfo.validate_skip(cs, weak);
|
||||
bool OutMsgQueueInfo::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const {
|
||||
return t_OutMsgQueue.validate_skip(ops, cs, weak) && t_ProcessedInfo.validate_skip(ops, cs, weak) &&
|
||||
t_IhrPendingInfo.validate_skip(ops, cs, weak);
|
||||
}
|
||||
|
||||
const OutMsgQueueInfo t_OutMsgQueueInfo;
|
||||
|
@ -2047,7 +2051,7 @@ bool ExtBlkRef::pack_to(Ref<vm::Cell>& cell, const ton::BlockIdExt& blkid, ton::
|
|||
const ExtBlkRef t_ExtBlkRef;
|
||||
const BlkMasterInfo t_BlkMasterInfo;
|
||||
|
||||
bool ShardIdent::validate_skip(vm::CellSlice& cs, bool weak) const {
|
||||
bool ShardIdent::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const {
|
||||
int shard_pfx_len, workchain_id;
|
||||
unsigned long long shard_pfx;
|
||||
if (cs.fetch_ulong(2) == 0 && cs.fetch_uint_to(6, shard_pfx_len) && cs.fetch_int_to(32, workchain_id) &&
|
||||
|
@ -2112,8 +2116,8 @@ bool ShardIdent::pack(vm::CellBuilder& cb, ton::ShardIdFull data) const {
|
|||
|
||||
const ShardIdent t_ShardIdent;
|
||||
|
||||
bool BlockIdExt::validate_skip(vm::CellSlice& cs, bool weak) const {
|
||||
return t_ShardIdent.validate_skip(cs, weak) && cs.advance(32 + 256 * 2);
|
||||
bool BlockIdExt::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const {
|
||||
return t_ShardIdent.validate_skip(ops, cs, weak) && cs.advance(32 + 256 * 2);
|
||||
}
|
||||
|
||||
bool BlockIdExt::unpack(vm::CellSlice& cs, ton::BlockIdExt& data) const {
|
||||
|
@ -2146,21 +2150,21 @@ bool ShardState::skip(vm::CellSlice& cs) const {
|
|||
&& Maybe<RefTo<McStateExtra>>{}.skip(cs); // custom:(Maybe ^McStateExtra)
|
||||
}
|
||||
|
||||
bool ShardState::validate_skip(vm::CellSlice& cs, bool weak) const {
|
||||
bool ShardState::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const {
|
||||
int seq_no;
|
||||
return get_tag(cs) == shard_state && cs.advance(64) // shard_state#9023afe2 blockchain_id:int32
|
||||
&& t_ShardIdent.validate_skip(cs, weak) // shard_id:ShardIdent
|
||||
&& t_ShardIdent.validate_skip(ops, cs, weak) // shard_id:ShardIdent
|
||||
&& cs.fetch_int_to(32, seq_no) // seq_no:int32
|
||||
&& seq_no >= -1 // { seq_no >= -1 }
|
||||
&& cs.advance(32 + 32 + 64 + 32) // vert_seq_no:# gen_utime:uint32 gen_lt:uint64 min_ref_mc_seqno:uint32
|
||||
&& t_Ref_OutMsgQueueInfo.validate_skip(cs, weak) // out_msg_queue_info:^OutMsgQueueInfo
|
||||
&& cs.advance(1) // before_split:Bool
|
||||
&& t_ShardAccounts.validate_skip_ref(cs, weak) // accounts:^ShardAccounts
|
||||
&& t_Ref_OutMsgQueueInfo.validate_skip(ops, cs, weak) // out_msg_queue_info:^OutMsgQueueInfo
|
||||
&& cs.advance(1) // before_split:Bool
|
||||
&& t_ShardAccounts.validate_skip_ref(ops, cs, weak) // accounts:^ShardAccounts
|
||||
&&
|
||||
t_ShardState_aux.validate_skip_ref(
|
||||
cs,
|
||||
ops, cs,
|
||||
weak) // ^[ total_balance:CurrencyCollection total_validator_fees:CurrencyCollection libraries:(HashmapE 256 LibDescr) master_ref:(Maybe BlkMasterInfo) ]
|
||||
&& Maybe<RefTo<McStateExtra>>{}.validate_skip(cs, weak); // custom:(Maybe ^McStateExtra)
|
||||
&& Maybe<RefTo<McStateExtra>>{}.validate_skip(ops, cs, weak); // custom:(Maybe ^McStateExtra)
|
||||
}
|
||||
|
||||
const ShardState t_ShardState;
|
||||
|
@ -2173,12 +2177,12 @@ bool ShardState_aux::skip(vm::CellSlice& cs) const {
|
|||
&& Maybe<BlkMasterInfo>{}.skip(cs); // master_ref:(Maybe BlkMasterInfo)
|
||||
}
|
||||
|
||||
bool ShardState_aux::validate_skip(vm::CellSlice& cs, bool weak) const {
|
||||
return cs.advance(128) // overload_history:uint64 underload_history:uint64
|
||||
&& t_CurrencyCollection.validate_skip(cs, weak) // total_balance:CurrencyCollection
|
||||
&& t_CurrencyCollection.validate_skip(cs, weak) // total_validator_fees:CurrencyCollection
|
||||
&& HashmapE{256, t_LibDescr}.validate_skip(cs, weak) // libraries:(HashmapE 256 LibDescr)
|
||||
&& Maybe<BlkMasterInfo>{}.validate_skip(cs, weak); // master_ref:(Maybe BlkMasterInfo)
|
||||
bool ShardState_aux::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const {
|
||||
return cs.advance(128) // overload_history:uint64 underload_history:uint64
|
||||
&& t_CurrencyCollection.validate_skip(ops, cs, weak) // total_balance:CurrencyCollection
|
||||
&& t_CurrencyCollection.validate_skip(ops, cs, weak) // total_validator_fees:CurrencyCollection
|
||||
&& HashmapE{256, t_LibDescr}.validate_skip(ops, cs, weak) // libraries:(HashmapE 256 LibDescr)
|
||||
&& Maybe<BlkMasterInfo>{}.validate_skip(ops, cs, weak); // master_ref:(Maybe BlkMasterInfo)
|
||||
}
|
||||
|
||||
const ShardState_aux t_ShardState_aux;
|
||||
|
@ -2189,10 +2193,10 @@ bool LibDescr::skip(vm::CellSlice& cs) const {
|
|||
&& Hashmap{256, t_True}.skip(cs); // publishers:(Hashmap 256 False)
|
||||
}
|
||||
|
||||
bool LibDescr::validate_skip(vm::CellSlice& cs, bool weak) const {
|
||||
return get_tag(cs) == shared_lib_descr && cs.advance(2) // shared_lib_descr$00
|
||||
&& cs.fetch_ref().not_null() // lib:^Cell
|
||||
&& Hashmap{256, t_True}.validate_skip(cs, weak); // publishers:(Hashmap 256 False)
|
||||
bool LibDescr::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const {
|
||||
return get_tag(cs) == shared_lib_descr && cs.advance(2) // shared_lib_descr$00
|
||||
&& cs.fetch_ref().not_null() // lib:^Cell
|
||||
&& Hashmap{256, t_True}.validate_skip(ops, cs, weak); // publishers:(Hashmap 256 False)
|
||||
}
|
||||
|
||||
const LibDescr t_LibDescr;
|
||||
|
@ -2202,9 +2206,9 @@ bool BlkPrevInfo::skip(vm::CellSlice& cs) const {
|
|||
&& (!merged || t_ExtBlkRef.skip(cs)); // prev_alt:merged?ExtBlkRef
|
||||
}
|
||||
|
||||
bool BlkPrevInfo::validate_skip(vm::CellSlice& cs, bool weak) const {
|
||||
return t_ExtBlkRef.validate_skip(cs, weak) // prev_blk_info$_ {merged:#} prev:ExtBlkRef
|
||||
&& (!merged || t_ExtBlkRef.validate_skip(cs, weak)); // prev_alt:merged?ExtBlkRef
|
||||
bool BlkPrevInfo::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const {
|
||||
return t_ExtBlkRef.validate_skip(ops, cs, weak) // prev_blk_info$_ {merged:#} prev:ExtBlkRef
|
||||
&& (!merged || t_ExtBlkRef.validate_skip(ops, cs, weak)); // prev_alt:merged?ExtBlkRef
|
||||
}
|
||||
|
||||
const BlkPrevInfo t_BlkPrevInfo_0{0};
|
||||
|
@ -2213,8 +2217,8 @@ bool McStateExtra::skip(vm::CellSlice& cs) const {
|
|||
return block::gen::t_McStateExtra.skip(cs);
|
||||
}
|
||||
|
||||
bool McStateExtra::validate_skip(vm::CellSlice& cs, bool weak) const {
|
||||
return block::gen::t_McStateExtra.validate_skip(cs, weak); // ??
|
||||
bool McStateExtra::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const {
|
||||
return block::gen::t_McStateExtra.validate_skip(ops, cs, weak); // ??
|
||||
}
|
||||
|
||||
const McStateExtra t_McStateExtra;
|
||||
|
@ -2241,8 +2245,8 @@ bool ShardFeeCreated::skip(vm::CellSlice& cs) const {
|
|||
return t_CurrencyCollection.skip(cs) && t_CurrencyCollection.skip(cs);
|
||||
}
|
||||
|
||||
bool ShardFeeCreated::validate_skip(vm::CellSlice& cs, bool weak) const {
|
||||
return t_CurrencyCollection.validate_skip(cs, weak) && t_CurrencyCollection.validate_skip(cs, weak);
|
||||
bool ShardFeeCreated::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const {
|
||||
return t_CurrencyCollection.validate_skip(ops, cs, weak) && t_CurrencyCollection.validate_skip(ops, cs, weak);
|
||||
}
|
||||
|
||||
bool ShardFeeCreated::null_value(vm::CellBuilder& cb) const {
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with TON Blockchain Library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Copyright 2017-2019 Telegram Systems LLP
|
||||
Copyright 2017-2020 Telegram Systems LLP
|
||||
*/
|
||||
#pragma once
|
||||
#include "common/refcnt.hpp"
|
||||
|
@ -59,7 +59,7 @@ struct VarUInteger final : TLB_Complex {
|
|||
ln = 32 - td::count_leading_zeroes32(n - 1);
|
||||
}
|
||||
bool skip(vm::CellSlice& cs) const override;
|
||||
bool validate_skip(vm::CellSlice& cs, bool weak = false) const override;
|
||||
bool validate_skip(int* ops, vm::CellSlice& cs, bool weak = false) const override;
|
||||
td::RefInt256 as_integer_skip(vm::CellSlice& cs) const override;
|
||||
unsigned long long as_uint(const vm::CellSlice& cs) const override;
|
||||
bool null_value(vm::CellBuilder& cb) const override {
|
||||
|
@ -78,7 +78,7 @@ struct VarUIntegerPos final : TLB_Complex {
|
|||
ln = 32 - td::count_leading_zeroes32(n - 1);
|
||||
}
|
||||
bool skip(vm::CellSlice& cs) const override;
|
||||
bool validate_skip(vm::CellSlice& cs, bool weak = false) const override;
|
||||
bool validate_skip(int* ops, vm::CellSlice& cs, bool weak = false) const override;
|
||||
td::RefInt256 as_integer_skip(vm::CellSlice& cs) const override;
|
||||
unsigned long long as_uint(const vm::CellSlice& cs) const override;
|
||||
bool store_integer_value(vm::CellBuilder& cb, const td::BigInt256& value) const override;
|
||||
|
@ -92,7 +92,7 @@ struct VarInteger final : TLB_Complex {
|
|||
ln = 32 - td::count_leading_zeroes32(n - 1);
|
||||
}
|
||||
bool skip(vm::CellSlice& cs) const override;
|
||||
bool validate_skip(vm::CellSlice& cs, bool weak = false) const override;
|
||||
bool validate_skip(int* ops, vm::CellSlice& cs, bool weak = false) const override;
|
||||
td::RefInt256 as_integer_skip(vm::CellSlice& cs) const override;
|
||||
long long as_int(const vm::CellSlice& cs) const override;
|
||||
bool null_value(vm::CellBuilder& cb) const override {
|
||||
|
@ -107,7 +107,7 @@ struct VarIntegerNz final : TLB_Complex {
|
|||
ln = 32 - td::count_leading_zeroes32(n - 1);
|
||||
}
|
||||
bool skip(vm::CellSlice& cs) const override;
|
||||
bool validate_skip(vm::CellSlice& cs, bool weak = false) const override;
|
||||
bool validate_skip(int* ops, vm::CellSlice& cs, bool weak = false) const override;
|
||||
td::RefInt256 as_integer_skip(vm::CellSlice& cs) const override;
|
||||
long long as_int(const vm::CellSlice& cs) const override;
|
||||
bool store_integer_value(vm::CellBuilder& cb, const td::BigInt256& value) const override;
|
||||
|
@ -123,13 +123,13 @@ struct Unary final : TLB {
|
|||
bool skip(vm::CellSlice& cs, int& n) const {
|
||||
return validate_skip(cs, false, n);
|
||||
}
|
||||
bool validate_skip(vm::CellSlice& cs, bool weak = false) const override {
|
||||
return cs.advance(get_size(cs));
|
||||
bool validate_skip(int* ops, vm::CellSlice& cs, bool weak = false) const override {
|
||||
return skip(cs);
|
||||
}
|
||||
bool skip(vm::CellSlice& cs) const override {
|
||||
return validate_skip(cs);
|
||||
return cs.advance(get_size(cs));
|
||||
}
|
||||
bool validate(const vm::CellSlice& cs, bool weak = false) const override {
|
||||
bool validate(int* ops, const vm::CellSlice& cs, bool weak = false) const override {
|
||||
return cs.have(get_size(cs));
|
||||
}
|
||||
};
|
||||
|
@ -149,7 +149,7 @@ struct HmLabel final : TLB_Complex {
|
|||
int n;
|
||||
return skip(cs, n);
|
||||
}
|
||||
bool validate_skip(vm::CellSlice& cs, bool weak = false) const override {
|
||||
bool validate_skip(int* ops, vm::CellSlice& cs, bool weak = false) const override {
|
||||
int n;
|
||||
return validate_skip(cs, weak, n);
|
||||
}
|
||||
|
@ -162,7 +162,7 @@ struct Hashmap final : TLB_Complex {
|
|||
Hashmap(int _n, const TLB& _val_type) : value_type(_val_type), n(_n) {
|
||||
}
|
||||
bool skip(vm::CellSlice& cs) const override;
|
||||
bool validate_skip(vm::CellSlice& cs, bool weak = false) const override;
|
||||
bool validate_skip(int* ops, vm::CellSlice& cs, bool weak = false) const override;
|
||||
};
|
||||
|
||||
struct HashmapNode final : TLB_Complex {
|
||||
|
@ -173,7 +173,7 @@ struct HashmapNode final : TLB_Complex {
|
|||
}
|
||||
int get_size(const vm::CellSlice& cs) const override;
|
||||
bool skip(vm::CellSlice& cs) const override;
|
||||
bool validate_skip(vm::CellSlice& cs, bool weak = false) const override;
|
||||
bool validate_skip(int* ops, vm::CellSlice& cs, bool weak = false) const override;
|
||||
int get_tag(const vm::CellSlice& cs) const override {
|
||||
return n > 0 ? hmn_fork : n;
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ struct HashmapE final : TLB {
|
|||
HashmapE(int _n, const TLB& _val_type) : root_type(_n, _val_type) {
|
||||
}
|
||||
int get_size(const vm::CellSlice& cs) const override;
|
||||
bool validate(const vm::CellSlice& cs, bool weak = false) const override;
|
||||
bool validate(int* ops, const vm::CellSlice& cs, bool weak = false) const override;
|
||||
int get_tag(const vm::CellSlice& cs) const override {
|
||||
return (int)cs.prefetch_ulong(1);
|
||||
}
|
||||
|
@ -221,7 +221,7 @@ struct HashmapAug final : TLB_Complex {
|
|||
HashmapAug(int _n, const AugmentationCheckData& _aug) : aug(_aug), n(_n) {
|
||||
}
|
||||
bool skip(vm::CellSlice& cs) const override;
|
||||
bool validate_skip(vm::CellSlice& cs, bool weak = false) const override;
|
||||
bool validate_skip(int* ops, vm::CellSlice& cs, bool weak = false) const override;
|
||||
bool extract_extra(vm::CellSlice& cs) const;
|
||||
};
|
||||
|
||||
|
@ -232,7 +232,7 @@ struct HashmapAugNode final : TLB_Complex {
|
|||
HashmapAugNode(int _n, const AugmentationCheckData& _aug) : aug(_aug), n(_n) {
|
||||
}
|
||||
bool skip(vm::CellSlice& cs) const override;
|
||||
bool validate_skip(vm::CellSlice& cs, bool weak = false) const override;
|
||||
bool validate_skip(int* ops, vm::CellSlice& cs, bool weak = false) const override;
|
||||
int get_tag(const vm::CellSlice& cs) const override {
|
||||
return n > 0 ? ahmn_fork : n;
|
||||
}
|
||||
|
@ -244,7 +244,7 @@ struct HashmapAugE final : TLB_Complex {
|
|||
HashmapAugE(int _n, const AugmentationCheckData& _aug) : root_type(_n, std::move(_aug)) {
|
||||
}
|
||||
bool skip(vm::CellSlice& cs) const override;
|
||||
bool validate_skip(vm::CellSlice& cs, bool weak = false) const override;
|
||||
bool validate_skip(int* ops, vm::CellSlice& cs, bool weak = false) const override;
|
||||
bool extract_extra(vm::CellSlice& cs) const;
|
||||
int get_tag(const vm::CellSlice& cs) const override {
|
||||
return (int)cs.prefetch_ulong(1);
|
||||
|
@ -252,7 +252,7 @@ struct HashmapAugE final : TLB_Complex {
|
|||
};
|
||||
|
||||
struct Grams final : TLB_Complex {
|
||||
bool validate_skip(vm::CellSlice& cs, bool weak = false) const override;
|
||||
bool validate_skip(int* ops, vm::CellSlice& cs, bool weak = false) const override;
|
||||
td::RefInt256 as_integer_skip(vm::CellSlice& cs) const override;
|
||||
bool null_value(vm::CellBuilder& cb) const override;
|
||||
bool store_integer_value(vm::CellBuilder& cb, const td::BigInt256& value) const override;
|
||||
|
@ -264,7 +264,7 @@ extern const Grams t_Grams;
|
|||
|
||||
struct MsgAddressInt final : TLB_Complex {
|
||||
enum { addr_std = 2, addr_var = 3 };
|
||||
bool validate_skip(vm::CellSlice& cs, bool weak = false) const override;
|
||||
bool validate_skip(int* ops, vm::CellSlice& cs, bool weak = false) const override;
|
||||
int get_tag(const vm::CellSlice& cs) const override {
|
||||
return (int)cs.prefetch_ulong(2);
|
||||
}
|
||||
|
@ -303,7 +303,7 @@ extern const MsgAddressExt t_MsgAddressExt;
|
|||
|
||||
struct MsgAddress final : TLB_Complex {
|
||||
enum { addr_none = 0, addr_ext = 1, addr_std = 2, addr_var = 3 };
|
||||
bool validate_skip(vm::CellSlice& cs, bool weak = false) const override;
|
||||
bool validate_skip(int* ops, vm::CellSlice& cs, bool weak = false) const override;
|
||||
int get_tag(const vm::CellSlice& cs) const override {
|
||||
return (int)cs.prefetch_ulong(2);
|
||||
}
|
||||
|
@ -318,8 +318,8 @@ struct ExtraCurrencyCollection final : TLB {
|
|||
int get_size(const vm::CellSlice& cs) const override {
|
||||
return dict_type.get_size(cs);
|
||||
}
|
||||
bool validate(const vm::CellSlice& cs, bool weak) const override {
|
||||
return dict_type.validate(cs, weak);
|
||||
bool validate(int* ops, const vm::CellSlice& cs, bool weak) const override {
|
||||
return dict_type.validate(ops, cs, weak);
|
||||
}
|
||||
bool null_value(vm::CellBuilder& cb) const override {
|
||||
return cb.store_zeroes_bool(1);
|
||||
|
@ -348,7 +348,7 @@ extern const ExtraCurrencyCollection t_ExtraCurrencyCollection;
|
|||
|
||||
struct CurrencyCollection final : TLB_Complex {
|
||||
bool skip(vm::CellSlice& cs) const override;
|
||||
bool validate_skip(vm::CellSlice& cs, bool weak = false) const override;
|
||||
bool validate_skip(int* ops, vm::CellSlice& cs, bool weak = false) const override;
|
||||
td::RefInt256 as_integer_skip(vm::CellSlice& cs) const override;
|
||||
bool null_value(vm::CellBuilder& cb) const override {
|
||||
return cb.store_bits_same_bool(1 + 4, false);
|
||||
|
@ -371,7 +371,7 @@ extern const CurrencyCollection t_CurrencyCollection;
|
|||
struct CommonMsgInfo final : TLB_Complex {
|
||||
enum { int_msg_info = 0, ext_in_msg_info = 2, ext_out_msg_info = 3 };
|
||||
bool skip(vm::CellSlice& cs) const override;
|
||||
bool validate_skip(vm::CellSlice& cs, bool weak = false) const override;
|
||||
bool validate_skip(int* ops, vm::CellSlice& cs, bool weak = false) const override;
|
||||
int get_tag(const vm::CellSlice& cs) const override {
|
||||
int v = (int)cs.prefetch_ulong(2);
|
||||
return v == 1 ? int_msg_info : v;
|
||||
|
@ -402,14 +402,14 @@ struct TickTock final : TLB {
|
|||
extern const TickTock t_TickTock;
|
||||
|
||||
struct StateInit final : TLB_Complex {
|
||||
bool validate_skip(vm::CellSlice& cs, bool weak = false) const override;
|
||||
bool validate_skip(int* ops, vm::CellSlice& cs, bool weak = false) const override;
|
||||
bool get_ticktock(vm::CellSlice& cs, int& ticktock) const;
|
||||
};
|
||||
|
||||
extern const StateInit t_StateInit;
|
||||
|
||||
struct Message final : TLB_Complex {
|
||||
bool validate_skip(vm::CellSlice& cs, bool weak = false) const override;
|
||||
bool validate_skip(int* ops, vm::CellSlice& cs, bool weak = false) const override;
|
||||
bool extract_info(vm::CellSlice& cs) const;
|
||||
bool get_created_lt(vm::CellSlice& cs, unsigned long long& created_lt) const;
|
||||
bool is_internal(const vm::CellSlice& cs) const {
|
||||
|
@ -425,7 +425,7 @@ struct IntermediateAddress final : TLB_Complex {
|
|||
enum { interm_addr_regular = 0, interm_addr_simple = 2, interm_addr_ext = 3 };
|
||||
int get_size(const vm::CellSlice& cs) const override;
|
||||
bool skip(vm::CellSlice& cs) const override;
|
||||
bool validate_skip(vm::CellSlice& cs, bool weak = false) const override;
|
||||
bool validate_skip(int* ops, vm::CellSlice& cs, bool weak = false) const override;
|
||||
bool fetch_regular(vm::CellSlice& cs, int& use_dst_bits) const {
|
||||
return cs.fetch_uint_to(8, use_dst_bits) && use_dst_bits <= 96;
|
||||
}
|
||||
|
@ -439,7 +439,7 @@ extern const IntermediateAddress t_IntermediateAddress;
|
|||
|
||||
struct MsgEnvelope final : TLB_Complex {
|
||||
bool skip(vm::CellSlice& cs) const override;
|
||||
bool validate_skip(vm::CellSlice& cs, bool weak = false) const override;
|
||||
bool validate_skip(int* ops, vm::CellSlice& cs, bool weak = false) const override;
|
||||
bool extract_fwd_fees_remaining(vm::CellSlice& cs) const;
|
||||
struct Record {
|
||||
typedef MsgEnvelope type_class;
|
||||
|
@ -463,28 +463,28 @@ extern const RefTo<MsgEnvelope> t_Ref_MsgEnvelope;
|
|||
|
||||
struct StorageUsed final : TLB_Complex {
|
||||
bool skip(vm::CellSlice& cs) const override;
|
||||
bool validate_skip(vm::CellSlice& cs, bool weak = false) const override;
|
||||
bool validate_skip(int* ops, vm::CellSlice& cs, bool weak = false) const override;
|
||||
};
|
||||
|
||||
extern const StorageUsed t_StorageUsed;
|
||||
|
||||
struct StorageUsedShort final : TLB_Complex {
|
||||
bool skip(vm::CellSlice& cs) const override;
|
||||
bool validate_skip(vm::CellSlice& cs, bool weak = false) const override;
|
||||
bool validate_skip(int* ops, vm::CellSlice& cs, bool weak = false) const override;
|
||||
};
|
||||
|
||||
extern const StorageUsedShort t_StorageUsedShort;
|
||||
|
||||
struct StorageInfo final : TLB_Complex {
|
||||
bool skip(vm::CellSlice& cs) const override;
|
||||
bool validate_skip(vm::CellSlice& cs, bool weak = false) const override;
|
||||
bool validate_skip(int* ops, vm::CellSlice& cs, bool weak = false) const override;
|
||||
};
|
||||
|
||||
extern const StorageInfo t_StorageInfo;
|
||||
|
||||
struct AccountState final : TLB_Complex {
|
||||
enum { account_uninit = 0, account_frozen = 1, account_active = 2 };
|
||||
bool validate_skip(vm::CellSlice& cs, bool weak = false) const override;
|
||||
bool validate_skip(int* ops, vm::CellSlice& cs, bool weak = false) const override;
|
||||
int get_tag(const vm::CellSlice& cs) const override {
|
||||
int t = (int)cs.prefetch_ulong(2);
|
||||
return t == 3 ? account_active : t;
|
||||
|
@ -496,7 +496,7 @@ extern const AccountState t_AccountState;
|
|||
|
||||
struct AccountStorage final : TLB_Complex {
|
||||
bool skip(vm::CellSlice& cs) const override;
|
||||
bool validate_skip(vm::CellSlice& cs, bool weak = false) const override;
|
||||
bool validate_skip(int* ops, vm::CellSlice& cs, bool weak = false) const override;
|
||||
bool skip_copy_balance(vm::CellBuilder& cb, vm::CellSlice& cs) const;
|
||||
};
|
||||
|
||||
|
@ -508,7 +508,7 @@ struct Account final : TLB_Complex {
|
|||
Account(bool _allow_empty = false) : allow_empty(_allow_empty) {
|
||||
}
|
||||
bool skip(vm::CellSlice& cs) const override;
|
||||
bool validate_skip(vm::CellSlice& cs, bool weak = false) const override;
|
||||
bool validate_skip(int* ops, vm::CellSlice& cs, bool weak = false) const override;
|
||||
// Ref<vm::CellSlice> get_balance(const vm::CellSlice& cs) const;
|
||||
bool skip_copy_balance(vm::CellBuilder& cb, vm::CellSlice& cs) const;
|
||||
bool skip_copy_depth_balance(vm::CellBuilder& cb, vm::CellSlice& cs) const;
|
||||
|
@ -553,8 +553,8 @@ struct ShardAccount final : TLB_Complex {
|
|||
bool skip(vm::CellSlice& cs) const override {
|
||||
return cs.advance_ext(0x140, 1);
|
||||
}
|
||||
bool validate_skip(vm::CellSlice& cs, bool weak = false) const override {
|
||||
return cs.advance(0x140) && t_Ref_Account.validate_skip(cs, weak);
|
||||
bool validate_skip(int* ops, vm::CellSlice& cs, bool weak = false) const override {
|
||||
return cs.advance(0x140) && t_Ref_Account.validate_skip(ops, cs, weak);
|
||||
}
|
||||
static bool unpack(vm::CellSlice& cs, Record& info) {
|
||||
return info.unpack(cs);
|
||||
|
@ -569,7 +569,7 @@ extern const ShardAccount t_ShardAccount;
|
|||
|
||||
struct DepthBalanceInfo final : TLB_Complex {
|
||||
bool skip(vm::CellSlice& cs) const override;
|
||||
bool validate_skip(vm::CellSlice& cs, bool weak = false) const override;
|
||||
bool validate_skip(int* ops, vm::CellSlice& cs, bool weak = false) const override;
|
||||
bool null_value(vm::CellBuilder& cb) const override;
|
||||
bool add_values(vm::CellBuilder& cb, vm::CellSlice& cs1, vm::CellSlice& cs2) const override;
|
||||
};
|
||||
|
@ -590,8 +590,8 @@ struct ShardAccounts final : TLB_Complex {
|
|||
bool skip(vm::CellSlice& cs) const override {
|
||||
return dict_type.skip(cs);
|
||||
}
|
||||
bool validate_skip(vm::CellSlice& cs, bool weak = false) const override {
|
||||
return dict_type.validate_skip(cs, weak);
|
||||
bool validate_skip(int* ops, vm::CellSlice& cs, bool weak = false) const override {
|
||||
return dict_type.validate_skip(ops, cs, weak);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -615,7 +615,7 @@ extern const AccStatusChange t_AccStatusChange;
|
|||
|
||||
struct TrStoragePhase final : TLB_Complex {
|
||||
bool skip(vm::CellSlice& cs) const override;
|
||||
bool validate_skip(vm::CellSlice& cs, bool weak = false) const override;
|
||||
bool validate_skip(int* ops, vm::CellSlice& cs, bool weak = false) const override;
|
||||
bool get_storage_fees(vm::CellSlice& cs, td::RefInt256& storage_fees) const;
|
||||
bool maybe_get_storage_fees(vm::CellSlice& cs, td::RefInt256& storage_fees) const;
|
||||
};
|
||||
|
@ -624,14 +624,14 @@ extern const TrStoragePhase t_TrStoragePhase;
|
|||
|
||||
struct TrCreditPhase final : TLB_Complex {
|
||||
bool skip(vm::CellSlice& cs) const override;
|
||||
bool validate_skip(vm::CellSlice& cs, bool weak = false) const override;
|
||||
bool validate_skip(int* ops, vm::CellSlice& cs, bool weak = false) const override;
|
||||
};
|
||||
|
||||
extern const TrCreditPhase t_TrCreditPhase;
|
||||
|
||||
struct TrComputeInternal1 final : TLB_Complex {
|
||||
bool skip(vm::CellSlice& cs) const override;
|
||||
bool validate_skip(vm::CellSlice& cs, bool weak = false) const override;
|
||||
bool validate_skip(int* ops, vm::CellSlice& cs, bool weak = false) const override;
|
||||
};
|
||||
|
||||
struct ComputeSkipReason final : TLB {
|
||||
|
@ -639,7 +639,7 @@ struct ComputeSkipReason final : TLB {
|
|||
int get_size(const vm::CellSlice& cs) const override {
|
||||
return 2;
|
||||
}
|
||||
bool validate_skip(vm::CellSlice& cs, bool weak = false) const override {
|
||||
bool validate_skip(int* ops, vm::CellSlice& cs, bool weak = false) const override {
|
||||
return get_tag(cs) >= 0 && cs.advance(2);
|
||||
}
|
||||
int get_tag(const vm::CellSlice& cs) const override {
|
||||
|
@ -653,7 +653,7 @@ extern const ComputeSkipReason t_ComputeSkipReason;
|
|||
struct TrComputePhase final : TLB_Complex {
|
||||
enum { tr_phase_compute_skipped = 0, tr_phase_compute_vm = 1 };
|
||||
bool skip(vm::CellSlice& cs) const override;
|
||||
bool validate_skip(vm::CellSlice& cs, bool weak = false) const override;
|
||||
bool validate_skip(int* ops, vm::CellSlice& cs, bool weak = false) const override;
|
||||
int get_tag(const vm::CellSlice& cs) const override {
|
||||
return (int)cs.prefetch_ulong(1);
|
||||
}
|
||||
|
@ -663,7 +663,7 @@ extern const TrComputePhase t_TrComputePhase;
|
|||
|
||||
struct TrActionPhase final : TLB_Complex {
|
||||
bool skip(vm::CellSlice& cs) const override;
|
||||
bool validate_skip(vm::CellSlice& cs, bool weak = false) const override;
|
||||
bool validate_skip(int* ops, vm::CellSlice& cs, bool weak = false) const override;
|
||||
};
|
||||
|
||||
extern const TrActionPhase t_TrActionPhase;
|
||||
|
@ -671,7 +671,7 @@ extern const TrActionPhase t_TrActionPhase;
|
|||
struct TrBouncePhase final : TLB_Complex {
|
||||
enum { tr_phase_bounce_negfunds = 0, tr_phase_bounce_nofunds = 1, tr_phase_bounce_ok = 2 };
|
||||
bool skip(vm::CellSlice& cs) const override;
|
||||
bool validate_skip(vm::CellSlice& cs, bool weak = false) const override;
|
||||
bool validate_skip(int* ops, vm::CellSlice& cs, bool weak = false) const override;
|
||||
int get_tag(const vm::CellSlice& cs) const override;
|
||||
};
|
||||
|
||||
|
@ -679,7 +679,7 @@ extern const TrBouncePhase t_TrBouncePhase;
|
|||
|
||||
struct SplitMergeInfo final : TLB_Complex {
|
||||
bool skip(vm::CellSlice& cs) const override;
|
||||
bool validate_skip(vm::CellSlice& cs, bool weak = false) const override;
|
||||
bool validate_skip(int* ops, vm::CellSlice& cs, bool weak = false) const override;
|
||||
};
|
||||
|
||||
extern const SplitMergeInfo t_SplitMergeInfo;
|
||||
|
@ -695,7 +695,7 @@ struct TransactionDescr final : TLB_Complex {
|
|||
trans_merge_install = 7
|
||||
};
|
||||
bool skip(vm::CellSlice& cs) const override;
|
||||
bool validate_skip(vm::CellSlice& cs, bool weak = false) const override;
|
||||
bool validate_skip(int* ops, vm::CellSlice& cs, bool weak = false) const override;
|
||||
int get_tag(const vm::CellSlice& cs) const override;
|
||||
bool skip_to_storage_phase(vm::CellSlice& cs, bool& found) const;
|
||||
bool get_storage_fees(Ref<vm::Cell> cell, td::RefInt256& storage_fees) const;
|
||||
|
@ -705,14 +705,14 @@ extern const TransactionDescr t_TransactionDescr;
|
|||
|
||||
struct Transaction_aux final : TLB_Complex {
|
||||
bool skip(vm::CellSlice& cs) const override;
|
||||
bool validate_skip(vm::CellSlice& cs, bool weak = false) const override;
|
||||
bool validate_skip(int* ops, vm::CellSlice& cs, bool weak = false) const override;
|
||||
};
|
||||
|
||||
extern const Transaction_aux t_Transaction_aux;
|
||||
|
||||
struct Transaction final : TLB_Complex {
|
||||
bool skip(vm::CellSlice& cs) const override;
|
||||
bool validate_skip(vm::CellSlice& cs, bool weak = false) const override;
|
||||
bool validate_skip(int* ops, vm::CellSlice& cs, bool weak = false) const override;
|
||||
bool get_total_fees(vm::CellSlice&& cs, block::CurrencyCollection& total_fees) const;
|
||||
bool get_descr(Ref<vm::Cell> cell, Ref<vm::Cell>& tdescr) const;
|
||||
bool get_descr(vm::CellSlice& cs, Ref<vm::Cell>& tdescr) const;
|
||||
|
@ -735,7 +735,7 @@ struct HashUpdate final : TLB_Complex {
|
|||
bool skip(vm::CellSlice& cs) const override {
|
||||
return cs.advance(8 + 256 * 2);
|
||||
}
|
||||
bool validate_skip(vm::CellSlice& cs, bool weak = false) const override {
|
||||
bool validate_skip(int* ops, vm::CellSlice& cs, bool weak = false) const override {
|
||||
return cs.fetch_ulong(8) == 0x72 && cs.advance(256 * 2);
|
||||
}
|
||||
};
|
||||
|
@ -745,7 +745,7 @@ extern const RefTo<HashUpdate> t_Ref_HashUpdate;
|
|||
|
||||
struct AccountBlock final : TLB_Complex {
|
||||
bool skip(vm::CellSlice& cs) const override;
|
||||
bool validate_skip(vm::CellSlice& cs, bool weak = false) const override;
|
||||
bool validate_skip(int* ops, vm::CellSlice& cs, bool weak = false) const override;
|
||||
bool get_total_fees(vm::CellSlice&& cs, block::CurrencyCollection& total_fees) const;
|
||||
};
|
||||
|
||||
|
@ -762,7 +762,7 @@ extern const HashmapAugE t_ShardAccountBlocks; // (HashmapAugE 256 AccountBlock
|
|||
|
||||
struct ImportFees final : TLB_Complex {
|
||||
bool skip(vm::CellSlice& cs) const override;
|
||||
bool validate_skip(vm::CellSlice& cs, bool weak = false) const override;
|
||||
bool validate_skip(int* ops, vm::CellSlice& cs, bool weak = false) const override;
|
||||
bool null_value(vm::CellBuilder& cb) const override {
|
||||
return cb.store_bits_same_bool(4 + 4 + 1, false);
|
||||
}
|
||||
|
@ -782,7 +782,7 @@ struct InMsg final : TLB_Complex {
|
|||
msg_discard_tr = 7
|
||||
};
|
||||
bool skip(vm::CellSlice& cs) const override;
|
||||
bool validate_skip(vm::CellSlice& cs, bool weak = false) const override;
|
||||
bool validate_skip(int* ops, vm::CellSlice& cs, bool weak = false) const override;
|
||||
int get_tag(const vm::CellSlice& cs) const override {
|
||||
return (int)cs.prefetch_ulong(3);
|
||||
}
|
||||
|
@ -802,7 +802,7 @@ struct OutMsg final : TLB_Complex {
|
|||
msg_export_tr_req = 7
|
||||
};
|
||||
bool skip(vm::CellSlice& cs) const override;
|
||||
bool validate_skip(vm::CellSlice& cs, bool weak = false) const override;
|
||||
bool validate_skip(int* ops, vm::CellSlice& cs, bool weak = false) const override;
|
||||
int get_tag(const vm::CellSlice& cs) const override {
|
||||
return (int)cs.prefetch_ulong(3);
|
||||
}
|
||||
|
@ -830,8 +830,8 @@ struct InMsgDescr final : TLB_Complex {
|
|||
bool skip(vm::CellSlice& cs) const override {
|
||||
return dict_type.skip(cs);
|
||||
}
|
||||
bool validate_skip(vm::CellSlice& cs, bool weak = false) const override {
|
||||
return dict_type.validate_skip(cs, weak);
|
||||
bool validate_skip(int* ops, vm::CellSlice& cs, bool weak = false) const override {
|
||||
return dict_type.validate_skip(ops, cs, weak);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -853,8 +853,8 @@ struct OutMsgDescr final : TLB_Complex {
|
|||
bool skip(vm::CellSlice& cs) const override {
|
||||
return dict_type.skip(cs);
|
||||
}
|
||||
bool validate_skip(vm::CellSlice& cs, bool weak = false) const override {
|
||||
return dict_type.validate_skip(cs, weak);
|
||||
bool validate_skip(int* ops, vm::CellSlice& cs, bool weak = false) const override {
|
||||
return dict_type.validate_skip(ops, cs, weak);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -867,7 +867,7 @@ struct EnqueuedMsg final : TLB_Complex {
|
|||
bool skip(vm::CellSlice& cs) const override {
|
||||
return cs.advance_ext(0x10040);
|
||||
}
|
||||
bool validate_skip(vm::CellSlice& cs, bool weak = false) const override;
|
||||
bool validate_skip(int* ops, vm::CellSlice& cs, bool weak = false) const override;
|
||||
bool unpack(vm::CellSlice& cs, EnqueuedMsgDescr& descr) const {
|
||||
return descr.unpack(cs);
|
||||
}
|
||||
|
@ -891,8 +891,8 @@ struct OutMsgQueue final : TLB_Complex {
|
|||
bool skip(vm::CellSlice& cs) const override {
|
||||
return dict_type.skip(cs);
|
||||
}
|
||||
bool validate_skip(vm::CellSlice& cs, bool weak = false) const override {
|
||||
return dict_type.validate_skip(cs, weak);
|
||||
bool validate_skip(int* ops, vm::CellSlice& cs, bool weak = false) const override {
|
||||
return dict_type.validate_skip(ops, cs, weak);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -910,7 +910,7 @@ extern const HashmapE t_IhrPendingInfo;
|
|||
|
||||
struct OutMsgQueueInfo final : TLB_Complex {
|
||||
bool skip(vm::CellSlice& cs) const override;
|
||||
bool validate_skip(vm::CellSlice& cs, bool weak = false) const override;
|
||||
bool validate_skip(int* ops, vm::CellSlice& cs, bool weak = false) const override;
|
||||
};
|
||||
|
||||
extern const OutMsgQueueInfo t_OutMsgQueueInfo;
|
||||
|
@ -946,7 +946,7 @@ struct ShardIdent final : TLB_Complex {
|
|||
bool skip(vm::CellSlice& cs) const override {
|
||||
return cs.advance(get_size(cs));
|
||||
}
|
||||
bool validate_skip(vm::CellSlice& cs, bool weak = false) const override;
|
||||
bool validate_skip(int* ops, vm::CellSlice& cs, bool weak = false) const override;
|
||||
int get_tag(const vm::CellSlice& cs) const override {
|
||||
return 0;
|
||||
}
|
||||
|
@ -985,7 +985,7 @@ struct BlockIdExt final : TLB_Complex {
|
|||
bool skip(vm::CellSlice& cs) const override {
|
||||
return cs.advance(get_size(cs));
|
||||
}
|
||||
bool validate_skip(vm::CellSlice& cs, bool weak = false) const override;
|
||||
bool validate_skip(int* ops, vm::CellSlice& cs, bool weak = false) const override;
|
||||
bool unpack(vm::CellSlice& cs, ton::BlockIdExt& data) const;
|
||||
bool pack(vm::CellBuilder& cb, const ton::BlockIdExt& data) const;
|
||||
};
|
||||
|
@ -995,7 +995,7 @@ extern const BlockIdExt t_BlockIdExt;
|
|||
struct ShardState final : TLB_Complex {
|
||||
enum { shard_state = (int)0x9023afe2, split_state = 0x5f327da5 };
|
||||
bool skip(vm::CellSlice& cs) const override;
|
||||
bool validate_skip(vm::CellSlice& cs, bool weak = false) const override;
|
||||
bool validate_skip(int* ops, vm::CellSlice& cs, bool weak = false) const override;
|
||||
int get_tag(const vm::CellSlice& cs) const override {
|
||||
return (int)cs.prefetch_ulong(32) == shard_state ? shard_state : -1;
|
||||
}
|
||||
|
@ -1005,7 +1005,7 @@ extern const ShardState t_ShardState;
|
|||
|
||||
struct ShardState_aux final : TLB_Complex {
|
||||
bool skip(vm::CellSlice& cs) const override;
|
||||
bool validate_skip(vm::CellSlice& cs, bool weak = false) const override;
|
||||
bool validate_skip(int* ops, vm::CellSlice& cs, bool weak = false) const override;
|
||||
int get_tag(const vm::CellSlice& cs) const override {
|
||||
return 0;
|
||||
}
|
||||
|
@ -1016,7 +1016,7 @@ extern const ShardState_aux t_ShardState_aux;
|
|||
struct LibDescr final : TLB_Complex {
|
||||
enum { shared_lib_descr = 0 };
|
||||
bool skip(vm::CellSlice& cs) const override;
|
||||
bool validate_skip(vm::CellSlice& cs, bool weak = false) const override;
|
||||
bool validate_skip(int* ops, vm::CellSlice& cs, bool weak = false) const override;
|
||||
int get_tag(const vm::CellSlice& cs) const override {
|
||||
return (int)cs.prefetch_ulong(2);
|
||||
}
|
||||
|
@ -1029,7 +1029,7 @@ struct BlkPrevInfo final : TLB_Complex {
|
|||
BlkPrevInfo(bool _merged) : merged(_merged) {
|
||||
}
|
||||
bool skip(vm::CellSlice& cs) const override;
|
||||
bool validate_skip(vm::CellSlice& cs, bool weak = false) const override;
|
||||
bool validate_skip(int* ops, vm::CellSlice& cs, bool weak = false) const override;
|
||||
};
|
||||
|
||||
extern const BlkPrevInfo t_BlkPrevInfo_0;
|
||||
|
@ -1037,7 +1037,7 @@ extern const BlkPrevInfo t_BlkPrevInfo_0;
|
|||
struct McStateExtra final : TLB_Complex {
|
||||
enum { masterchain_state_extra = 0xcc26 };
|
||||
bool skip(vm::CellSlice& cs) const override;
|
||||
bool validate_skip(vm::CellSlice& cs, bool weak = false) const override;
|
||||
bool validate_skip(int* ops, vm::CellSlice& cs, bool weak = false) const override;
|
||||
};
|
||||
|
||||
extern const McStateExtra t_McStateExtra;
|
||||
|
@ -1074,7 +1074,7 @@ extern const Aug_OldMcBlocksInfo aug_OldMcBlocksInfo;
|
|||
|
||||
struct ShardFeeCreated final : TLB_Complex {
|
||||
bool skip(vm::CellSlice& cs) const override;
|
||||
bool validate_skip(vm::CellSlice& cs, bool weak = false) const override;
|
||||
bool validate_skip(int* ops, vm::CellSlice& cs, bool weak = false) const override;
|
||||
bool null_value(vm::CellBuilder& cb) const override;
|
||||
bool add_values(vm::CellBuilder& cb, vm::CellSlice& cs1, vm::CellSlice& cs2) const override;
|
||||
};
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with TON Blockchain Library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Copyright 2017-2019 Telegram Systems LLP
|
||||
Copyright 2017-2020 Telegram Systems LLP
|
||||
*/
|
||||
#include "td/utils/bits.h"
|
||||
#include "block/block.h"
|
||||
|
@ -813,11 +813,11 @@ td::Status ShardState::unpack_out_msg_queue_info(Ref<vm::Cell> out_msg_queue_inf
|
|||
LOG(DEBUG) << "unpacking ProcessedUpto of our previous block " << id_.to_str();
|
||||
block::gen::t_ProcessedInfo.print(std::cerr, qinfo.proc_info);
|
||||
}
|
||||
if (!block::gen::t_ProcessedInfo.validate_csr(qinfo.proc_info)) {
|
||||
if (!block::gen::t_ProcessedInfo.validate_csr(1024, qinfo.proc_info)) {
|
||||
return td::Status::Error(
|
||||
-666, "ProcessedInfo in the state of "s + id_.to_str() + " is invalid according to automated validity checks");
|
||||
}
|
||||
if (!block::gen::t_IhrPendingInfo.validate_csr(qinfo.ihr_pending)) {
|
||||
if (!block::gen::t_IhrPendingInfo.validate_csr(1024, qinfo.ihr_pending)) {
|
||||
return td::Status::Error(
|
||||
-666, "IhrPendingInfo in the state of "s + id_.to_str() + " is invalid according to automated validity checks");
|
||||
}
|
||||
|
@ -1036,7 +1036,7 @@ td::Status ShardState::split(ton::ShardIdFull subshard) {
|
|||
LOG(DEBUG) << "splitting total_balance";
|
||||
auto old_total_balance = total_balance_;
|
||||
auto accounts_extra = account_dict_->get_root_extra();
|
||||
if (!(accounts_extra.write().advance(5) && total_balance_.validate_unpack(accounts_extra))) {
|
||||
if (!(accounts_extra.write().advance(5) && total_balance_.validate_unpack(accounts_extra, 1024))) {
|
||||
LOG(ERROR) << "cannot unpack CurrencyCollection from the root of newly-split accounts dictionary";
|
||||
return td::Status::Error(
|
||||
-666, "error splitting total balance in account dictionary of shardchain state "s + id_.to_str());
|
||||
|
@ -1085,16 +1085,16 @@ int filter_out_msg_queue(vm::AugmentedDictionary& out_queue, ton::ShardIdFull ol
|
|||
});
|
||||
}
|
||||
|
||||
bool CurrencyCollection::validate() const {
|
||||
return is_valid() && td::sgn(grams) >= 0 && validate_extra();
|
||||
bool CurrencyCollection::validate(int max_cells) const {
|
||||
return is_valid() && td::sgn(grams) >= 0 && validate_extra(max_cells);
|
||||
}
|
||||
|
||||
bool CurrencyCollection::validate_extra() const {
|
||||
bool CurrencyCollection::validate_extra(int max_cells) const {
|
||||
if (extra.is_null()) {
|
||||
return true;
|
||||
}
|
||||
vm::CellBuilder cb;
|
||||
return cb.store_maybe_ref(extra) && block::tlb::t_ExtraCurrencyCollection.validate_ref(cb.finalize());
|
||||
return cb.store_maybe_ref(extra) && block::tlb::t_ExtraCurrencyCollection.validate_ref(max_cells, cb.finalize());
|
||||
}
|
||||
|
||||
bool CurrencyCollection::add(const CurrencyCollection& a, const CurrencyCollection& b, CurrencyCollection& c) {
|
||||
|
@ -1265,8 +1265,8 @@ bool CurrencyCollection::unpack(Ref<vm::CellSlice> csr) {
|
|||
return unpack_CurrencyCollection(std::move(csr), grams, extra) || invalidate();
|
||||
}
|
||||
|
||||
bool CurrencyCollection::validate_unpack(Ref<vm::CellSlice> csr) {
|
||||
return (csr.not_null() && block::tlb::t_CurrencyCollection.validate(*csr) &&
|
||||
bool CurrencyCollection::validate_unpack(Ref<vm::CellSlice> csr, int max_cells) {
|
||||
return (csr.not_null() && block::tlb::t_CurrencyCollection.validate_upto(max_cells, *csr) &&
|
||||
unpack_CurrencyCollection(std::move(csr), grams, extra)) ||
|
||||
invalidate();
|
||||
}
|
||||
|
@ -1593,7 +1593,7 @@ bool check_one_config_param(Ref<vm::CellSlice> cs_ref, td::ConstBitPtr key, td::
|
|||
} else if (idx < 0) {
|
||||
return true;
|
||||
}
|
||||
bool ok = block::gen::ConfigParam{idx}.validate_ref(std::move(cell));
|
||||
bool ok = block::gen::ConfigParam{idx}.validate_ref(1024, std::move(cell));
|
||||
if (!ok) {
|
||||
LOG(ERROR) << "configuration parameter #" << idx << " is invalid";
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with TON Blockchain Library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Copyright 2017-2019 Telegram Systems LLP
|
||||
Copyright 2017-2020 Telegram Systems LLP
|
||||
*/
|
||||
#pragma once
|
||||
#include "common/refcnt.hpp"
|
||||
|
@ -323,8 +323,8 @@ struct CurrencyCollection {
|
|||
grams.clear();
|
||||
return false;
|
||||
}
|
||||
bool validate() const;
|
||||
bool validate_extra() const;
|
||||
bool validate(int max_cells = 1024) const;
|
||||
bool validate_extra(int max_cells = 1024) const;
|
||||
bool operator==(const CurrencyCollection& other) const;
|
||||
bool operator!=(const CurrencyCollection& other) const {
|
||||
return !operator==(other);
|
||||
|
@ -360,7 +360,7 @@ struct CurrencyCollection {
|
|||
bool fetch(vm::CellSlice& cs);
|
||||
bool fetch_exact(vm::CellSlice& cs);
|
||||
bool unpack(Ref<vm::CellSlice> csr);
|
||||
bool validate_unpack(Ref<vm::CellSlice> csr);
|
||||
bool validate_unpack(Ref<vm::CellSlice> csr, int max_cells = 1024);
|
||||
Ref<vm::CellSlice> pack() const;
|
||||
bool pack_to(Ref<vm::CellSlice>& csr) const {
|
||||
return (csr = pack()).not_null();
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
exception statement from your version. If you delete this exception statement
|
||||
from all source files in the program, then also delete it here.
|
||||
|
||||
Copyright 2017-2019 Telegram Systems LLP
|
||||
Copyright 2017-2020 Telegram Systems LLP
|
||||
*/
|
||||
#include <cassert>
|
||||
#include <algorithm>
|
||||
|
@ -697,7 +697,7 @@ void interpret_tlb_skip(vm::Stack& stack) {
|
|||
void interpret_tlb_validate_skip(vm::Stack& stack) {
|
||||
auto tp = pop_tlb_type(stack);
|
||||
auto cs = stack.pop_cellslice();
|
||||
bool ok = (*tp)->validate_skip(cs.write());
|
||||
bool ok = (*tp)->validate_skip_upto(1048576, cs.write());
|
||||
if (ok) {
|
||||
stack.push(std::move(cs));
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
exception statement from your version. If you delete this exception statement
|
||||
from all source files in the program, then also delete it here.
|
||||
|
||||
Copyright 2017-2019 Telegram Systems LLP
|
||||
Copyright 2017-2020 Telegram Systems LLP
|
||||
*/
|
||||
#include "block/block.h"
|
||||
#include "vm/boc.h"
|
||||
|
@ -98,7 +98,7 @@ void test1() {
|
|||
|
||||
block::tlb::ShardIdent::Record shard_id;
|
||||
for (int i = 0; i < 3; i++) {
|
||||
std::cout << "ShardIdent.validate() = " << block::tlb::t_ShardIdent.validate(csl) << std::endl;
|
||||
std::cout << "ShardIdent.validate() = " << block::tlb::t_ShardIdent.validate_upto(1024, csl) << std::endl;
|
||||
csl.print_rec(std::cerr);
|
||||
csl.dump(std::cerr, 7);
|
||||
std::cout << "ShardIdent.unpack() = " << block::tlb::t_ShardIdent.unpack(csl, shard_id) << std::endl;
|
||||
|
@ -107,9 +107,9 @@ void test1() {
|
|||
<< " shard_prefix:" << shard_id.shard_prefix << std::endl;
|
||||
}
|
||||
}
|
||||
std::cout << "ShardIdent.skip_validate() = " << block::tlb::t_ShardIdent.validate_skip(csl) << std::endl;
|
||||
std::cout << "ShardIdent.skip_validate() = " << block::tlb::t_ShardIdent.validate_skip(csl) << std::endl;
|
||||
std::cout << "ShardIdent.skip_validate() = " << block::tlb::t_ShardIdent.validate_skip(csl) << std::endl;
|
||||
std::cout << "ShardIdent.skip_validate() = " << block::tlb::t_ShardIdent.validate_skip_upto(1024, csl) << std::endl;
|
||||
std::cout << "ShardIdent.skip_validate() = " << block::tlb::t_ShardIdent.validate_skip_upto(1024, csl) << std::endl;
|
||||
std::cout << "ShardIdent.skip_validate() = " << block::tlb::t_ShardIdent.validate_skip_upto(1024, csl) << std::endl;
|
||||
using namespace td::literals;
|
||||
std::cout << "Grams.store_intval(239) = " << block::tlb::t_Grams.store_integer_value(cb, "239"_i256) << std::endl;
|
||||
std::cout << "Grams.store_intval(17239) = " << block::tlb::t_Grams.store_integer_value(cb, "17239"_i256) << std::endl;
|
||||
|
@ -120,13 +120,13 @@ void test1() {
|
|||
std::cout << "Grams.store_intval(666) = " << block::tlb::t_Grams.store_integer_value(cb, "666"_i256) << std::endl;
|
||||
std::cout << cb << std::endl;
|
||||
cs2 = td::Ref<vm::CellSlice>{true, cb.finalize()};
|
||||
std::cout << "Grams.validate(cs) = " << block::tlb::t_Grams.validate(*cs) << std::endl;
|
||||
std::cout << "Grams.validate(cs2) = " << block::tlb::t_Grams.validate(*cs2) << std::endl;
|
||||
std::cout << "Grams.validate(cs) = " << block::tlb::t_Grams.validate_upto(1024, *cs) << std::endl;
|
||||
std::cout << "Grams.validate(cs2) = " << block::tlb::t_Grams.validate_upto(1024, *cs2) << std::endl;
|
||||
//
|
||||
block::gen::SplitMergeInfo::Record data;
|
||||
block::gen::Grams::Record data2;
|
||||
std::cout << "block::gen::Grams.validate(cs) = " << block::gen::t_Grams.validate(*cs) << std::endl;
|
||||
std::cout << "block::gen::Grams.validate(cs2) = " << block::gen::t_Grams.validate(*cs2) << std::endl;
|
||||
std::cout << "block::gen::Grams.validate(cs) = " << block::gen::t_Grams.validate_upto(1024, *cs) << std::endl;
|
||||
std::cout << "block::gen::Grams.validate(cs2) = " << block::gen::t_Grams.validate_upto(1024, *cs2) << std::endl;
|
||||
std::cout << "[cs = " << cs << "]" << std::endl;
|
||||
bool ok = tlb::csr_unpack_inexact(cs, data);
|
||||
std::cout << "block::gen::SplitMergeInfo.unpack(cs, data) = " << ok << std::endl;
|
||||
|
@ -182,12 +182,12 @@ void test1() {
|
|||
}
|
||||
|
||||
void test2(vm::CellSlice& cs) {
|
||||
std::cout << "Bool.validate() = " << block::tlb::t_Bool.validate(cs) << std::endl;
|
||||
std::cout << "UInt16.validate() = " << block::tlb::t_uint16.validate(cs) << std::endl;
|
||||
std::cout << "HashmapE(32,UInt16).validate() = " << block::tlb::HashmapE(32, block::tlb::t_uint16).validate(cs)
|
||||
<< std::endl;
|
||||
std::cout << "Bool.validate() = " << block::tlb::t_Bool.validate_upto(1024, cs) << std::endl;
|
||||
std::cout << "UInt16.validate() = " << block::tlb::t_uint16.validate_upto(1024, cs) << std::endl;
|
||||
std::cout << "HashmapE(32,UInt16).validate() = "
|
||||
<< block::tlb::HashmapE(32, block::tlb::t_uint16).validate_upto(1024, cs) << std::endl;
|
||||
std::cout << "block::gen::HashmapE(32,UInt16).validate() = "
|
||||
<< block::gen::HashmapE{32, block::gen::t_uint16}.validate(cs) << std::endl;
|
||||
<< block::gen::HashmapE{32, block::gen::t_uint16}.validate_upto(1024, cs) << std::endl;
|
||||
}
|
||||
|
||||
void usage() {
|
||||
|
@ -249,7 +249,7 @@ int main(int argc, char* const argv[]) {
|
|||
}
|
||||
type->print_ref(std::cout, boc);
|
||||
std::cout << std::endl;
|
||||
bool ok = type->validate_ref(boc);
|
||||
bool ok = type->validate_ref(1048576, boc);
|
||||
std::cout << "(" << (ok ? "" : "in") << "valid " << *type << ")" << std::endl;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1239,7 +1239,7 @@ bool ShardConfig::new_workchain(ton::WorkchainId workchain, ton::BlockSeqno reg_
|
|||
cb.store_zeroes_bool(
|
||||
1 + 5 +
|
||||
5) // split_merge_at:FutureSplitMerge fees_collected:CurrencyCollection funds_created:CurrencyCollection
|
||||
&& cb.finalize_to(cell) && block::gen::t_BinTree_ShardDescr.validate_ref(cell) &&
|
||||
&& cb.finalize_to(cell) && block::gen::t_BinTree_ShardDescr.validate_ref(1024, cell) &&
|
||||
shard_hashes_dict_->set_ref(td::BitArray<32>{workchain}, std::move(cell), vm::Dictionary::SetMode::Add);
|
||||
}
|
||||
|
||||
|
@ -1469,7 +1469,7 @@ static bool btree_set(Ref<vm::Cell>& root, ton::ShardId shard, Ref<vm::Cell> val
|
|||
}
|
||||
|
||||
bool ShardConfig::set_shard_info(ton::ShardIdFull shard, Ref<vm::Cell> value) {
|
||||
if (!gen::t_BinTree_ShardDescr.validate_ref(value)) {
|
||||
if (!gen::t_BinTree_ShardDescr.validate_ref(1024, value)) {
|
||||
LOG(ERROR) << "attempting to store an invalid (BinTree ShardDescr) at shard configuration position "
|
||||
<< shard.to_str();
|
||||
gen::t_BinTree_ShardDescr.print_ref(std::cerr, value);
|
||||
|
|
|
@ -150,7 +150,7 @@ bool Account::unpack_storage_info(vm::CellSlice& cs) {
|
|||
return false;
|
||||
}
|
||||
} else {
|
||||
due_payment = td::RefInt256{true, 0};
|
||||
due_payment = td::zero_refint();
|
||||
}
|
||||
unsigned long long u = 0;
|
||||
u |= storage_stat.cells = block::tlb::t_VarUInteger_7.as_uint(*used.cells);
|
||||
|
@ -369,7 +369,7 @@ bool Account::init_new(ton::UnixTime now) {
|
|||
now_ = now;
|
||||
last_paid = 0;
|
||||
storage_stat.clear();
|
||||
due_payment = td::RefInt256{true, 0};
|
||||
due_payment = td::zero_refint();
|
||||
balance.set_zero();
|
||||
if (my_addr_exact.is_null()) {
|
||||
vm::CellBuilder cb;
|
||||
|
@ -473,6 +473,9 @@ Transaction::Transaction(const Account& _account, int ttype, ton::LogicalTime re
|
|||
start_lt = std::max(req_start_lt, account.last_trans_end_lt_);
|
||||
end_lt = start_lt + 1;
|
||||
acc_status = (account.status == Account::acc_nonexist ? Account::acc_uninit : account.status);
|
||||
if (acc_status == Account::acc_frozen) {
|
||||
frozen_hash = account.state_hash;
|
||||
}
|
||||
}
|
||||
|
||||
bool Transaction::unpack_input_msg(bool ihr_delivered, const ActionPhaseConfig* cfg) {
|
||||
|
@ -504,7 +507,7 @@ bool Transaction::unpack_input_msg(bool ihr_delivered, const ActionPhaseConfig*
|
|||
if (ihr_delivered) {
|
||||
in_fwd_fee = std::move(ihr_fee);
|
||||
} else {
|
||||
in_fwd_fee = td::RefInt256{true, 0};
|
||||
in_fwd_fee = td::zero_refint();
|
||||
msg_balance_remaining += std::move(ihr_fee);
|
||||
}
|
||||
if (info.created_lt >= start_lt) {
|
||||
|
@ -544,7 +547,7 @@ bool Transaction::unpack_input_msg(bool ihr_delivered, const ActionPhaseConfig*
|
|||
LOG(DEBUG) << "computed fwd fees set to zero for special account";
|
||||
fees_c.first = fees_c.second = 0;
|
||||
}
|
||||
in_fwd_fee = td::RefInt256{true, fees_c.first};
|
||||
in_fwd_fee = td::make_refint(fees_c.first);
|
||||
if (balance.grams < in_fwd_fee) {
|
||||
LOG(DEBUG) << "cannot pay for importing this external message";
|
||||
return false;
|
||||
|
@ -616,19 +619,19 @@ bool Transaction::prepare_storage_phase(const StoragePhaseConfig& cfg, bool forc
|
|||
res->is_special = account.is_special;
|
||||
last_paid = res->last_paid_updated = (res->is_special ? 0 : now);
|
||||
if (to_pay.is_null() || sgn(to_pay) == 0) {
|
||||
res->fees_collected = res->fees_due = td::RefInt256{true, 0};
|
||||
res->fees_collected = res->fees_due = td::zero_refint();
|
||||
} else if (to_pay <= balance.grams) {
|
||||
res->fees_collected = to_pay;
|
||||
res->fees_due = td::RefInt256{true, 0};
|
||||
res->fees_due = td::zero_refint();
|
||||
balance -= std::move(to_pay);
|
||||
} else if (acc_status == Account::acc_frozen && !force_collect && to_pay + due_payment < cfg.delete_due_limit) {
|
||||
// do not collect fee
|
||||
res->last_paid_updated = (res->is_special ? 0 : account.last_paid);
|
||||
res->fees_collected = res->fees_due = td::RefInt256{true, 0};
|
||||
res->fees_collected = res->fees_due = td::zero_refint();
|
||||
} else {
|
||||
res->fees_collected = balance.grams;
|
||||
res->fees_due = std::move(to_pay) - std::move(balance.grams);
|
||||
balance.grams = td::RefInt256{true, 0};
|
||||
balance.grams = td::zero_refint();
|
||||
if (!res->is_special) {
|
||||
auto total_due = res->fees_due + due_payment;
|
||||
switch (acc_status) {
|
||||
|
@ -707,8 +710,8 @@ bool ComputePhaseConfig::parse_GasLimitsPrices_internal(Ref<vm::CellSlice> cs, t
|
|||
special_gas_limit = spec_limit;
|
||||
gas_credit = r.gas_credit;
|
||||
gas_price = r.gas_price;
|
||||
freeze_due_limit = td::RefInt256{true, r.freeze_due_limit};
|
||||
delete_due_limit = td::RefInt256{true, r.delete_due_limit};
|
||||
freeze_due_limit = td::make_refint(r.freeze_due_limit);
|
||||
delete_due_limit = td::make_refint(r.delete_due_limit);
|
||||
};
|
||||
block::gen::GasLimitsPrices::Record_gas_prices_ext rec;
|
||||
if (tlb::csr_unpack(cs, rec)) {
|
||||
|
@ -728,10 +731,10 @@ bool ComputePhaseConfig::parse_GasLimitsPrices_internal(Ref<vm::CellSlice> cs, t
|
|||
}
|
||||
|
||||
void ComputePhaseConfig::compute_threshold() {
|
||||
gas_price256 = td::RefInt256{true, gas_price};
|
||||
gas_price256 = td::make_refint(gas_price);
|
||||
if (gas_limit > flat_gas_limit) {
|
||||
max_gas_threshold =
|
||||
td::rshift(gas_price256 * (gas_limit - flat_gas_limit), 16, 1) + td::make_refint(flat_gas_price);
|
||||
td::rshift(gas_price256 * (gas_limit - flat_gas_limit), 16, 1) + td::make_bigint(flat_gas_price);
|
||||
} else {
|
||||
max_gas_threshold = td::make_refint(flat_gas_price);
|
||||
}
|
||||
|
@ -828,8 +831,8 @@ Ref<vm::Tuple> Transaction::prepare_vm_c7(const ComputePhaseConfig& cfg) const {
|
|||
}
|
||||
auto tuple = vm::make_tuple_ref(
|
||||
td::make_refint(0x076ef1ea), // [ magic:0x076ef1ea
|
||||
td::make_refint(0), // actions:Integer
|
||||
td::make_refint(0), // msgs_sent:Integer
|
||||
td::zero_refint(), // actions:Integer
|
||||
td::zero_refint(), // msgs_sent:Integer
|
||||
td::make_refint(now), // unixtime:Integer
|
||||
td::make_refint(account.block_lt), // block_lt:Integer
|
||||
td::make_refint(start_lt), // trans_lt:Integer
|
||||
|
@ -1012,7 +1015,7 @@ bool Transaction::prepare_compute_phase(const ComputePhaseConfig& cfg) {
|
|||
}
|
||||
if (cp.accepted) {
|
||||
if (account.is_special) {
|
||||
cp.gas_fees = td::RefInt256{true, 0};
|
||||
cp.gas_fees = td::zero_refint();
|
||||
} else {
|
||||
cp.gas_fees = cfg.compute_gas_price(cp.gas_used);
|
||||
total_fees += cp.gas_fees;
|
||||
|
@ -1040,8 +1043,8 @@ bool Transaction::prepare_action_phase(const ActionPhaseConfig& cfg) {
|
|||
ap.action_list_hash = list->get_hash().bits();
|
||||
ap.remaining_balance = balance;
|
||||
ap.end_lt = end_lt;
|
||||
ap.total_fwd_fees = td::RefInt256{true, 0};
|
||||
ap.total_action_fees = td::RefInt256{true, 0};
|
||||
ap.total_fwd_fees = td::zero_refint();
|
||||
ap.total_action_fees = td::zero_refint();
|
||||
ap.reserved_balance.set_zero();
|
||||
|
||||
int n = 0;
|
||||
|
@ -1429,7 +1432,7 @@ int Transaction::try_action_send_msg(const vm::CellSlice& cs0, ActionPhase& ap,
|
|||
info.ihr_disabled = true;
|
||||
info.bounce = false;
|
||||
info.bounced = false;
|
||||
fwd_fee = ihr_fee = td::RefInt256{true, 0};
|
||||
fwd_fee = ihr_fee = td::zero_refint();
|
||||
} else {
|
||||
// int_msg_info$0 constructor
|
||||
if (!tlb::csr_unpack(msg.info, info) || !block::tlb::t_CurrencyCollection.validate_csr(info.value)) {
|
||||
|
@ -1482,10 +1485,10 @@ int Transaction::try_action_send_msg(const vm::CellSlice& cs0, ActionPhase& ap,
|
|||
|
||||
// set fees to computed values
|
||||
if (fwd_fee->unsigned_fits_bits(63) && fwd_fee->to_long() < (long long)fees_c.first) {
|
||||
fwd_fee = td::RefInt256{true, fees_c.first};
|
||||
fwd_fee = td::make_refint(fees_c.first);
|
||||
}
|
||||
if (fees_c.second && ihr_fee->unsigned_fits_bits(63) && ihr_fee->to_long() < (long long)fees_c.second) {
|
||||
ihr_fee = td::RefInt256{true, fees_c.second};
|
||||
ihr_fee = td::make_refint(fees_c.second);
|
||||
}
|
||||
|
||||
Ref<vm::Cell> new_msg;
|
||||
|
@ -1502,7 +1505,7 @@ int Transaction::try_action_send_msg(const vm::CellSlice& cs0, ActionPhase& ap,
|
|||
}
|
||||
if (info.ihr_disabled) {
|
||||
// if IHR is disabled, IHR fees will be always zero
|
||||
ihr_fee = td::RefInt256{true, 0};
|
||||
ihr_fee = td::zero_refint();
|
||||
}
|
||||
// extract value to be carried by the message
|
||||
block::CurrencyCollection req;
|
||||
|
@ -1757,10 +1760,10 @@ bool Transaction::prepare_bounce_phase(const ActionPhaseConfig& cfg) {
|
|||
balance -= msg_balance;
|
||||
CHECK(balance.is_valid());
|
||||
// debit total forwarding fees from the message's balance, then split forwarding fees into our part and remaining part
|
||||
msg_balance -= td::RefInt256{true, bp.fwd_fees};
|
||||
msg_balance -= td::make_refint(bp.fwd_fees);
|
||||
bp.fwd_fees_collected = msg_prices.get_first_part(bp.fwd_fees);
|
||||
bp.fwd_fees -= bp.fwd_fees_collected;
|
||||
total_fees += td::RefInt256{true, bp.fwd_fees_collected};
|
||||
total_fees += td::make_refint(bp.fwd_fees_collected);
|
||||
// serialize outbound message
|
||||
info.created_lt = end_lt++;
|
||||
info.created_at = now;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue