1
0
Fork 0
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:
EmelyanenkoK 2023-05-03 14:18:18 +03:00 committed by GitHub
parent 24ed85b155
commit a78adf3062
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 63 additions and 10 deletions

View file

@ -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