mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
slightly changed block format
- small change in block format - added config in blockchain explorer - bugfixes
This commit is contained in:
parent
7f3a22a217
commit
090e0c16eb
82 changed files with 1852 additions and 391 deletions
|
@ -662,12 +662,49 @@ int exec_set_code(VmState* st) {
|
|||
return install_output_action(st, cb.finalize());
|
||||
}
|
||||
|
||||
int exec_set_lib_code(VmState* st) {
|
||||
VM_LOG(st) << "execute SETLIBCODE";
|
||||
Stack& stack = st->get_stack();
|
||||
stack.check_underflow(2);
|
||||
int mode = stack.pop_smallint_range(2);
|
||||
auto code = stack.pop_cell();
|
||||
CellBuilder cb;
|
||||
if (!(cb.store_ref_bool(get_actions(st)) // out_list$_ {n:#} prev:^(OutList n)
|
||||
&& cb.store_long_bool(0x26fa1dd4, 32) // action_change_library#26fa1dd4
|
||||
&& cb.store_long_bool(mode * 2 + 1, 8) // mode:(## 7) { mode <= 2 }
|
||||
&& cb.store_ref_bool(std::move(code)))) { // libref:LibRef = OutAction;
|
||||
throw VmError{Excno::cell_ov, "cannot serialize new library code into an output action cell"};
|
||||
}
|
||||
return install_output_action(st, cb.finalize());
|
||||
}
|
||||
|
||||
int exec_change_lib(VmState* st) {
|
||||
VM_LOG(st) << "execute CHANGELIB";
|
||||
Stack& stack = st->get_stack();
|
||||
stack.check_underflow(2);
|
||||
int mode = stack.pop_smallint_range(2);
|
||||
auto hash = stack.pop_int_finite();
|
||||
if (!hash->unsigned_fits_bits(256)) {
|
||||
throw VmError{Excno::range_chk, "library hash must be non-negative"};
|
||||
}
|
||||
CellBuilder cb;
|
||||
if (!(cb.store_ref_bool(get_actions(st)) // out_list$_ {n:#} prev:^(OutList n)
|
||||
&& cb.store_long_bool(0x26fa1dd4, 32) // action_change_library#26fa1dd4
|
||||
&& cb.store_long_bool(mode * 2, 8) // mode:(## 7) { mode <= 2 }
|
||||
&& cb.store_int256_bool(hash, 256, false))) { // libref:LibRef = OutAction;
|
||||
throw VmError{Excno::cell_ov, "cannot serialize library hash into an output action cell"};
|
||||
}
|
||||
return install_output_action(st, cb.finalize());
|
||||
}
|
||||
|
||||
void register_ton_message_ops(OpcodeTable& cp0) {
|
||||
using namespace std::placeholders;
|
||||
cp0.insert(OpcodeInstr::mksimple(0xfb00, 16, "SENDRAWMSG", exec_send_raw_message))
|
||||
.insert(OpcodeInstr::mksimple(0xfb02, 16, "RESERVERAW", std::bind(exec_reserve_raw, _1, 0)))
|
||||
.insert(OpcodeInstr::mksimple(0xfb03, 16, "RESERVERAWX", std::bind(exec_reserve_raw, _1, 1)))
|
||||
.insert(OpcodeInstr::mksimple(0xfb04, 16, "SETCODE", exec_set_code));
|
||||
.insert(OpcodeInstr::mksimple(0xfb04, 16, "SETCODE", exec_set_code))
|
||||
.insert(OpcodeInstr::mksimple(0xfb06, 16, "SETLIBCODE", exec_set_lib_code))
|
||||
.insert(OpcodeInstr::mksimple(0xfb07, 16, "CHANGELIB", exec_change_lib));
|
||||
}
|
||||
|
||||
void register_ton_ops(OpcodeTable& cp0) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue