mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
updated tonlib
- updated tonlib - updated validator - updated documentation - first version of http over rldp proxy
This commit is contained in:
parent
53ec9684bd
commit
77842f9b63
128 changed files with 10555 additions and 2285 deletions
|
@ -567,6 +567,21 @@ td::Result<GasLimitsPrices> Config::do_get_gas_limits_prices(td::Ref<vm::Cell> c
|
|||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
td::Result<ton::StdSmcAddress> Config::get_dns_root_addr() const {
|
||||
auto cell = get_config_param(4);
|
||||
if (cell.is_null()) {
|
||||
return td::Status::Error(PSLICE() << "configuration parameter " << 4 << " with dns root address is absent");
|
||||
}
|
||||
auto cs = vm::load_cell_slice(std::move(cell));
|
||||
if (cs.size() != 0x100) {
|
||||
return td::Status::Error(PSLICE() << "configuration parameter " << 4 << " with dns root address has wrong size");
|
||||
}
|
||||
ton::StdSmcAddress res;
|
||||
CHECK(cs.fetch_bits_to(res));
|
||||
return res;
|
||||
}
|
||||
|
||||
td::Result<GasLimitsPrices> Config::get_gas_limits_prices(bool is_masterchain) const {
|
||||
auto id = is_masterchain ? 20 : 21;
|
||||
auto cell = get_config_param(id);
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
You should have received a copy of the GNU General Public License
|
||||
along with TON Blockchain. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Copyright 2017-2019 Telegram Systems LLP
|
||||
Copyright 2017-2020 Telegram Systems LLP
|
||||
*/
|
||||
#pragma once
|
||||
#include "common/refcnt.hpp"
|
||||
|
@ -534,6 +534,7 @@ class Config {
|
|||
bool create_stats_enabled() const {
|
||||
return has_capability(ton::capCreateStatsEnabled);
|
||||
}
|
||||
td::Result<ton::StdSmcAddress> get_dns_root_addr() const;
|
||||
bool set_block_id_ext(const ton::BlockIdExt& block_id_ext);
|
||||
td::Result<std::vector<ton::StdSmcAddress>> get_special_smartcontracts(bool without_config = false) const;
|
||||
bool is_special_smartcontract(const ton::StdSmcAddress& addr) const;
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with TON Blockchain Library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Copyright 2017-2019 Telegram Systems LLP
|
||||
Copyright 2017-2020 Telegram Systems LLP
|
||||
*/
|
||||
#include "block/transaction.h"
|
||||
#include "block/block.h"
|
||||
|
@ -23,7 +23,7 @@
|
|||
#include "td/utils/bits.h"
|
||||
#include "td/utils/uint128.h"
|
||||
#include "ton/ton-shard.h"
|
||||
#include "vm/continuation.h"
|
||||
#include "vm/vm.h"
|
||||
|
||||
namespace block {
|
||||
using td::Ref;
|
||||
|
@ -691,12 +691,16 @@ bool ComputePhaseConfig::parse_GasLimitsPrices(Ref<vm::CellSlice> cs, td::RefInt
|
|||
}
|
||||
block::gen::GasLimitsPrices::Record_gas_flat_pfx flat;
|
||||
if (tlb::csr_unpack(cs, flat)) {
|
||||
bool ok = parse_GasLimitsPrices(std::move(flat.other), freeze_due_limit, delete_due_limit);
|
||||
flat_gas_limit = flat.flat_gas_limit;
|
||||
flat_gas_price = flat.flat_gas_price;
|
||||
return ok;
|
||||
return parse_GasLimitsPrices_internal(std::move(flat.other), freeze_due_limit, delete_due_limit,
|
||||
flat.flat_gas_limit, flat.flat_gas_price);
|
||||
} else {
|
||||
return parse_GasLimitsPrices_internal(std::move(cs), freeze_due_limit, delete_due_limit);
|
||||
}
|
||||
flat_gas_limit = flat_gas_price = 0;
|
||||
}
|
||||
|
||||
bool ComputePhaseConfig::parse_GasLimitsPrices_internal(Ref<vm::CellSlice> cs, td::RefInt256& freeze_due_limit,
|
||||
td::RefInt256& delete_due_limit, td::uint64 _flat_gas_limit,
|
||||
td::uint64 _flat_gas_price) {
|
||||
auto f = [&](const auto& r, td::uint64 spec_limit) {
|
||||
gas_limit = r.gas_limit;
|
||||
special_gas_limit = spec_limit;
|
||||
|
@ -716,6 +720,8 @@ bool ComputePhaseConfig::parse_GasLimitsPrices(Ref<vm::CellSlice> cs, td::RefInt
|
|||
return false;
|
||||
}
|
||||
}
|
||||
flat_gas_limit = _flat_gas_limit;
|
||||
flat_gas_price = _flat_gas_price;
|
||||
compute_threshold();
|
||||
return true;
|
||||
}
|
||||
|
@ -1010,10 +1016,9 @@ bool Transaction::prepare_compute_phase(const ComputePhaseConfig& cfg) {
|
|||
total_fees += cp.gas_fees;
|
||||
balance -= cp.gas_fees;
|
||||
}
|
||||
if (verbosity > 2) {
|
||||
std::cerr << "gas fees: " << cp.gas_fees << " = " << cfg.gas_price256 << " * " << cp.gas_used
|
||||
<< " /2^16 ; price=" << cfg.gas_price << "; remaining balance=" << balance << std::endl;
|
||||
}
|
||||
LOG(DEBUG) << "gas fees: " << cp.gas_fees->to_dec_string() << " = " << cfg.gas_price256->to_dec_string() << " * "
|
||||
<< cp.gas_used << " /2^16 ; price=" << cfg.gas_price << "; flat rate=[" << cfg.flat_gas_price << " for "
|
||||
<< cfg.flat_gas_limit << "]; remaining balance=" << balance.to_str();
|
||||
CHECK(td::sgn(balance.grams) >= 0);
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with TON Blockchain Library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Copyright 2017-2019 Telegram Systems LLP
|
||||
Copyright 2017-2020 Telegram Systems LLP
|
||||
*/
|
||||
#pragma once
|
||||
#include "common/refcnt.hpp"
|
||||
|
@ -130,6 +130,11 @@ struct ComputePhaseConfig {
|
|||
}
|
||||
bool parse_GasLimitsPrices(Ref<vm::CellSlice> cs, td::RefInt256& freeze_due_limit, td::RefInt256& delete_due_limit);
|
||||
bool parse_GasLimitsPrices(Ref<vm::Cell> cell, td::RefInt256& freeze_due_limit, td::RefInt256& delete_due_limit);
|
||||
|
||||
private:
|
||||
bool parse_GasLimitsPrices_internal(Ref<vm::CellSlice> cs, td::RefInt256& freeze_due_limit,
|
||||
td::RefInt256& delete_due_limit, td::uint64 flat_gas_limit = 0,
|
||||
td::uint64 flat_gas_price = 0);
|
||||
};
|
||||
|
||||
struct ActionPhaseConfig {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue