mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
Increase limit for t_Block.validate, simplify validating StateInit (#691)
Co-authored-by: SpyCheese <mikle98@yandex.ru>
This commit is contained in:
parent
24ed85b155
commit
a78adf3062
6 changed files with 63 additions and 10 deletions
|
@ -2292,5 +2292,37 @@ bool Aug_ShardFees::eval_leaf(vm::CellBuilder& cb, vm::CellSlice& cs) const {
|
|||
|
||||
const Aug_ShardFees aug_ShardFees;
|
||||
|
||||
bool validate_message_libs(const td::Ref<vm::Cell> &cell) {
|
||||
gen::Message::Record rec;
|
||||
if (!type_unpack_cell(cell, gen::t_Message_Any, rec)) {
|
||||
return false;
|
||||
}
|
||||
vm::CellSlice& state_init = rec.init.write();
|
||||
if (!state_init.fetch_long(1)) {
|
||||
return true;
|
||||
}
|
||||
if (state_init.fetch_long(1)) {
|
||||
return gen::t_StateInitWithLibs.validate_ref(state_init.prefetch_ref());
|
||||
} else {
|
||||
return gen::t_StateInitWithLibs.validate_csr(rec.init);
|
||||
}
|
||||
}
|
||||
|
||||
bool validate_message_relaxed_libs(const td::Ref<vm::Cell> &cell) {
|
||||
gen::MessageRelaxed::Record rec;
|
||||
if (!type_unpack_cell(cell, gen::t_MessageRelaxed_Any, rec)) {
|
||||
return false;
|
||||
}
|
||||
vm::CellSlice& state_init = rec.init.write();
|
||||
if (!state_init.fetch_long(1)) {
|
||||
return true;
|
||||
}
|
||||
if (state_init.fetch_long(1)) {
|
||||
return gen::t_StateInitWithLibs.validate_ref(state_init.prefetch_ref());
|
||||
} else {
|
||||
return gen::t_StateInitWithLibs.validate_csr(rec.init);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace tlb
|
||||
} // namespace block
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue