mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
integrating the existing state of TON Storage / TON Payments / CPS Fift development branches
This commit is contained in:
parent
040df63c98
commit
4e2624459b
153 changed files with 10760 additions and 1695 deletions
|
@ -48,7 +48,7 @@ Cell::LoadedCell load_cell_nothrow(const Ref<Cell>& ref) {
|
|||
auto res = ref->load_cell();
|
||||
if (res.is_ok()) {
|
||||
auto ld = res.move_as_ok();
|
||||
CHECK(ld.virt.get_virtualization() == 0 || ld.data_cell->special_type() != Cell::SpecialType::PrunnedBranch);
|
||||
//CHECK(ld.virt.get_virtualization() == 0 || ld.data_cell->special_type() != Cell::SpecialType::PrunnedBranch);
|
||||
return ld;
|
||||
}
|
||||
return {};
|
||||
|
@ -58,7 +58,7 @@ Cell::LoadedCell load_cell_nothrow(const Ref<Cell>& ref, int mode) {
|
|||
auto res = ref->load_cell();
|
||||
if (res.is_ok()) {
|
||||
auto ld = res.move_as_ok();
|
||||
CHECK(ld.virt.get_virtualization() == 0 || ld.data_cell->special_type() != Cell::SpecialType::PrunnedBranch);
|
||||
//CHECK(ld.virt.get_virtualization() == 0 || ld.data_cell->special_type() != Cell::SpecialType::PrunnedBranch);
|
||||
if ((mode >> (ld.data_cell->is_special() ? 1 : 0)) & 1) {
|
||||
return ld;
|
||||
}
|
||||
|
|
|
@ -79,6 +79,19 @@ td::Result<td::string> CellString::load(CellSlice &cs, unsigned int top_bits) {
|
|||
CHECK(to.offs == (int)size);
|
||||
return res;
|
||||
}
|
||||
td::Result<td::Ref<vm::Cell>> CellString::create(td::Slice slice, unsigned int top_bits) {
|
||||
vm::CellBuilder cb;
|
||||
TRY_STATUS(store(cb, slice, top_bits));
|
||||
return cb.finalize();
|
||||
}
|
||||
bool CellString::fetch_to(CellSlice &cs, std::string &res, unsigned int top_bits) {
|
||||
auto r_str = load(cs, top_bits);
|
||||
if (r_str.is_error()) {
|
||||
return false;
|
||||
}
|
||||
res = r_str.move_as_ok();
|
||||
return true;
|
||||
}
|
||||
|
||||
td::Status CellText::store(CellBuilder &cb, td::Slice slice, unsigned int top_bits) {
|
||||
td::uint32 size = td::narrow_cast<td::uint32>(slice.size() * 8);
|
||||
|
@ -154,4 +167,17 @@ td::Result<td::string> CellText::load(CellSlice &cs) {
|
|||
CHECK(to.offs == (int)size);
|
||||
return res;
|
||||
}
|
||||
td::Result<td::Ref<vm::Cell>> CellText::create(td::Slice slice, unsigned int top_bits) {
|
||||
vm::CellBuilder cb;
|
||||
TRY_STATUS(store(cb, slice, top_bits));
|
||||
return cb.finalize();
|
||||
}
|
||||
bool CellText::fetch_to(CellSlice &cs, std::string &res) {
|
||||
auto r_str = load(cs);
|
||||
if (r_str.is_error()) {
|
||||
return false;
|
||||
}
|
||||
res = r_str.move_as_ok();
|
||||
return true;
|
||||
}
|
||||
} // namespace vm
|
||||
|
|
|
@ -31,11 +31,8 @@ class CellString {
|
|||
static td::Status store(CellBuilder &cb, td::Slice slice, unsigned int top_bits = Cell::max_bits);
|
||||
static td::Status store(CellBuilder &cb, td::BitSlice slice, unsigned int top_bits = Cell::max_bits);
|
||||
static td::Result<td::string> load(CellSlice &cs, unsigned int top_bits = Cell::max_bits);
|
||||
static td::Result<td::Ref<vm::Cell>> create(td::Slice slice, unsigned int top_bits = Cell::max_bits) {
|
||||
vm::CellBuilder cb;
|
||||
TRY_STATUS(store(cb, slice, top_bits));
|
||||
return cb.finalize();
|
||||
}
|
||||
static td::Result<td::Ref<vm::Cell>> create(td::Slice slice, unsigned int top_bits = Cell::max_bits);
|
||||
static bool fetch_to(CellSlice &cs, std::string &res, unsigned int top_bits = Cell::max_bits);
|
||||
|
||||
private:
|
||||
template <class F>
|
||||
|
@ -50,11 +47,8 @@ class CellText {
|
|||
static td::Status store(CellBuilder &cb, td::Slice slice, unsigned int top_bits = Cell::max_bits);
|
||||
static td::Status store(CellBuilder &cb, td::BitSlice slice, unsigned int top_bits = Cell::max_bits);
|
||||
static td::Result<td::string> load(CellSlice &cs);
|
||||
static td::Result<td::Ref<vm::Cell>> create(td::Slice slice, unsigned int top_bits = Cell::max_bits) {
|
||||
vm::CellBuilder cb;
|
||||
TRY_STATUS(store(cb, slice, top_bits));
|
||||
return cb.finalize();
|
||||
}
|
||||
static td::Result<td::Ref<vm::Cell>> create(td::Slice slice, unsigned int top_bits = Cell::max_bits);
|
||||
static bool fetch_to(CellSlice &cs, std::string &res);
|
||||
|
||||
private:
|
||||
template <class F>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue