1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-03-09 15:40:10 +00:00

updated submodules, bugfixes

- added new fift/func code for validator complaint creation
- bugfixes in validator
- updates in tonlib
- new versions of rocksdb/abseil
- hardfork support
This commit is contained in:
ton 2020-04-27 16:01:46 +04:00
parent 16a4566091
commit 9f008b129f
129 changed files with 8438 additions and 879 deletions

View file

@ -19,6 +19,7 @@
#include "vm/cells/CellSlice.h"
#include "vm/excno.hpp"
#include "td/utils/bits.h"
#include "td/utils/misc.h"
namespace vm {
@ -719,6 +720,10 @@ bool CellSlice::prefetch_bytes(unsigned char* buffer, unsigned bytes) const {
}
}
bool CellSlice::fetch_bytes(td::MutableSlice slice) {
return fetch_bytes(slice.ubegin(), td::narrow_cast<unsigned>(slice.size()));
}
bool CellSlice::fetch_bytes(unsigned char* buffer, unsigned bytes) {
if (prefetch_bytes(buffer, bytes)) {
advance(bytes * 8);
@ -728,6 +733,10 @@ bool CellSlice::fetch_bytes(unsigned char* buffer, unsigned bytes) {
}
}
bool CellSlice::prefetch_bytes(td::MutableSlice slice) const {
return prefetch_bytes(slice.ubegin(), td::narrow_cast<unsigned>(slice.size()));
}
Ref<Cell> CellSlice::prefetch_ref(unsigned offset) const {
if (offset < size_refs()) {
auto ref_id = refs_st + offset;

View file

@ -218,7 +218,9 @@ class CellSlice : public td::CntObject {
return prefetch_bits_to(buffer.bits(), n);
}
bool fetch_bytes(unsigned char* buffer, unsigned bytes);
bool fetch_bytes(td::MutableSlice slice);
bool prefetch_bytes(unsigned char* buffer, unsigned bytes) const;
bool prefetch_bytes(td::MutableSlice slice) const;
td::BitSlice as_bitslice() const {
return prefetch_bits(size());
}

View file

@ -148,6 +148,11 @@ class MerkleProofCombineFast {
MerkleProofCombineFast(Ref<Cell> a, Ref<Cell> b) : a_(std::move(a)), b_(std::move(b)) {
}
td::Result<Ref<Cell>> run() {
if (a_.is_null()) {
return b_;
} else if (b_.is_null()) {
return a_;
}
TRY_RESULT_ASSIGN(a_, unpack_proof(a_));
TRY_RESULT_ASSIGN(b_, unpack_proof(b_));
TRY_RESULT(res, run_raw());
@ -204,6 +209,11 @@ class MerkleProofCombine {
MerkleProofCombine(Ref<Cell> a, Ref<Cell> b) : a_(std::move(a)), b_(std::move(b)) {
}
td::Result<Ref<Cell>> run() {
if (a_.is_null()) {
return b_;
} else if (b_.is_null()) {
return a_;
}
TRY_RESULT_ASSIGN(a_, unpack_proof(a_));
TRY_RESULT_ASSIGN(b_, unpack_proof(b_));
TRY_RESULT(res, run_raw());
@ -323,6 +333,10 @@ Ref<Cell> MerkleProof::combine(Ref<Cell> a, Ref<Cell> b) {
return res.move_as_ok();
}
td::Result<Ref<Cell>> MerkleProof::combine_status(Ref<Cell> a, Ref<Cell> b) {
return MerkleProofCombine(std::move(a), std::move(b)).run();
}
Ref<Cell> MerkleProof::combine_fast(Ref<Cell> a, Ref<Cell> b) {
auto res = MerkleProofCombineFast(std::move(a), std::move(b)).run();
if (res.is_error()) {
@ -331,6 +345,10 @@ Ref<Cell> MerkleProof::combine_fast(Ref<Cell> a, Ref<Cell> b) {
return res.move_as_ok();
}
td::Result<Ref<Cell>> MerkleProof::combine_fast_status(Ref<Cell> a, Ref<Cell> b) {
return MerkleProofCombineFast(std::move(a), std::move(b)).run();
}
Ref<Cell> MerkleProof::combine_raw(Ref<Cell> a, Ref<Cell> b) {
auto res = MerkleProofCombine(std::move(a), std::move(b)).run_raw();
if (res.is_error()) {

View file

@ -38,7 +38,9 @@ class MerkleProof {
static Ref<Cell> virtualize(Ref<Cell> cell, int virtualization);
static Ref<Cell> combine(Ref<Cell> a, Ref<Cell> b);
static td::Result<Ref<Cell>> combine_status(Ref<Cell> a, Ref<Cell> b);
static Ref<Cell> combine_fast(Ref<Cell> a, Ref<Cell> b);
static td::Result<Ref<Cell>> combine_fast_status(Ref<Cell> a, Ref<Cell> b);
// works with upwrapped proofs
// works fine with cell of non-zero level, but this is not supported (yet?) in MerkeProof special cell