1
0
Fork 0
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:
ton 2020-02-28 14:28:47 +04:00
parent 9e4816e7f6
commit e27fb1e09c
100 changed files with 3692 additions and 1299 deletions

View file

@ -114,38 +114,43 @@ bool TupleT::skip(vm::CellSlice& cs) const {
return !i;
}
bool TupleT::validate_skip(vm::CellSlice& cs, bool weak) const {
bool TupleT::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const {
int i = n;
for (; i > 0; --i) {
if (!X.validate_skip(cs, weak)) {
if (!X.validate_skip(ops, cs, weak)) {
break;
}
}
return !i;
}
bool TLB::validate_ref_internal(Ref<vm::Cell> cell_ref, bool weak) const {
bool TLB::validate_ref_internal(int* ops, Ref<vm::Cell> cell_ref, bool weak) const {
if (ops && --*ops < 0) {
return false;
}
bool is_special;
auto cs = load_cell_slice_special(std::move(cell_ref), is_special);
return always_special() ? is_special : (is_special ? weak : (validate_skip(cs) && cs.empty_ext()));
return always_special() ? is_special : (is_special ? weak : (validate_skip(ops, cs) && cs.empty_ext()));
}
bool TLB::print_skip(PrettyPrinter& pp, vm::CellSlice& cs) const {
pp.open("raw@");
pp << *this << ' ';
vm::CellSlice cs_copy{cs};
if (!validate_skip(cs) || !cs_copy.cut_tail(cs)) {
int size_limit = pp.limit;
if (!validate_skip(&size_limit, cs) || !cs_copy.cut_tail(cs)) {
return pp.fail("invalid value");
}
pp.raw_nl();
return cs_copy.print_rec(pp.os, &pp.limit, pp.indent) && pp.mkindent() && pp.close();
return (cs_copy.print_rec(pp.os, &pp.limit, pp.indent) && pp.mkindent() && pp.close()) ||
pp.fail("raw value too long");
}
bool TLB::print_special(PrettyPrinter& pp, vm::CellSlice& cs) const {
pp.open("raw@");
pp << *this << ' ';
pp.raw_nl();
return cs.print_rec(pp.os, &pp.limit, pp.indent) && pp.mkindent() && pp.close();
return (cs.print_rec(pp.os, &pp.limit, pp.indent) && pp.mkindent() && pp.close()) || pp.fail("raw value too long");
}
bool TLB::print_ref(PrettyPrinter& pp, Ref<vm::Cell> cell_ref) const {
@ -217,7 +222,7 @@ PrettyPrinter::~PrettyPrinter() {
}
bool PrettyPrinter::fail(std::string msg) {
os << "<FATAL: " << msg << ">";
os << "<FATAL: " << msg << ">" << std::endl;
failed = true;
return false;
}