mirror of
https://github.com/ton-blockchain/ton
synced 2025-02-15 04:32:21 +00:00
Merge branch 'testnet' into block-generation
This commit is contained in:
commit
8143eb074e
9 changed files with 28 additions and 16 deletions
|
@ -19,6 +19,6 @@
|
||||||
namespace ton {
|
namespace ton {
|
||||||
|
|
||||||
// See doc/GlobalVersions.md
|
// See doc/GlobalVersions.md
|
||||||
const int SUPPORTED_VERSION = 6;
|
const int SUPPORTED_VERSION = 7;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -898,6 +898,9 @@ bool Transaction::prepare_storage_phase(const StoragePhaseConfig& cfg, bool forc
|
||||||
res->fees_collected = to_pay;
|
res->fees_collected = to_pay;
|
||||||
res->fees_due = td::zero_refint();
|
res->fees_due = td::zero_refint();
|
||||||
balance -= std::move(to_pay);
|
balance -= std::move(to_pay);
|
||||||
|
if (cfg.global_version >= 7) {
|
||||||
|
due_payment = td::zero_refint();
|
||||||
|
}
|
||||||
} else if (acc_status == Account::acc_frozen && !force_collect && to_pay < cfg.delete_due_limit) {
|
} else if (acc_status == Account::acc_frozen && !force_collect && to_pay < cfg.delete_due_limit) {
|
||||||
// do not collect fee
|
// do not collect fee
|
||||||
res->last_paid_updated = (res->is_special ? 0 : account.last_paid);
|
res->last_paid_updated = (res->is_special ? 0 : account.last_paid);
|
||||||
|
@ -1318,7 +1321,7 @@ Ref<vm::Tuple> Transaction::prepare_vm_c7(const ComputePhaseConfig& cfg) const {
|
||||||
vm::StackEntry::maybe(cfg.global_config) // global_config:(Maybe Cell) ] = SmartContractInfo;
|
vm::StackEntry::maybe(cfg.global_config) // global_config:(Maybe Cell) ] = SmartContractInfo;
|
||||||
};
|
};
|
||||||
if (cfg.global_version >= 4) {
|
if (cfg.global_version >= 4) {
|
||||||
tuple.push_back(new_code); // code:Cell
|
tuple.push_back(vm::StackEntry::maybe(new_code)); // code:Cell
|
||||||
if (msg_balance_remaining.is_valid()) {
|
if (msg_balance_remaining.is_valid()) {
|
||||||
tuple.push_back(msg_balance_remaining.as_vm_tuple()); // in_msg_value:[Integer (Maybe Cell)]
|
tuple.push_back(msg_balance_remaining.as_vm_tuple()); // in_msg_value:[Integer (Maybe Cell)]
|
||||||
} else {
|
} else {
|
||||||
|
@ -1335,11 +1338,10 @@ Ref<vm::Tuple> Transaction::prepare_vm_c7(const ComputePhaseConfig& cfg) const {
|
||||||
// Inside validator, collator and liteserver checking external message contexts
|
// Inside validator, collator and liteserver checking external message contexts
|
||||||
// prev_blocks_info is always not null, since get_prev_blocks_info()
|
// prev_blocks_info is always not null, since get_prev_blocks_info()
|
||||||
// may only return tuple or raise Error (See crypto/block/mc-config.cpp#2223)
|
// may only return tuple or raise Error (See crypto/block/mc-config.cpp#2223)
|
||||||
tuple.push_back(cfg.prev_blocks_info.not_null() ? vm::StackEntry(cfg.prev_blocks_info) : vm::StackEntry());
|
tuple.push_back(vm::StackEntry::maybe(cfg.prev_blocks_info));
|
||||||
}
|
}
|
||||||
if (cfg.global_version >= 6) {
|
if (cfg.global_version >= 6) {
|
||||||
tuple.push_back(cfg.unpacked_config_tuple.not_null() ? vm::StackEntry(cfg.unpacked_config_tuple)
|
tuple.push_back(vm::StackEntry::maybe(cfg.unpacked_config_tuple)); // unpacked_config_tuple:[...]
|
||||||
: vm::StackEntry()); // unpacked_config_tuple:[...]
|
|
||||||
tuple.push_back(due_payment.not_null() ? due_payment : td::zero_refint()); // due_payment:Integer
|
tuple.push_back(due_payment.not_null() ? due_payment : td::zero_refint()); // due_payment:Integer
|
||||||
tuple.push_back(compute_phase->precompiled_gas_usage
|
tuple.push_back(compute_phase->precompiled_gas_usage
|
||||||
? vm::StackEntry(td::make_refint(compute_phase->precompiled_gas_usage.value()))
|
? vm::StackEntry(td::make_refint(compute_phase->precompiled_gas_usage.value()))
|
||||||
|
@ -3668,6 +3670,7 @@ td::Status FetchConfigParams::fetch_config_params(
|
||||||
compute_phase_cfg->mc_gas_prices = std::move(mc_gas_prices);
|
compute_phase_cfg->mc_gas_prices = std::move(mc_gas_prices);
|
||||||
compute_phase_cfg->special_gas_full = config.get_global_version() >= 5;
|
compute_phase_cfg->special_gas_full = config.get_global_version() >= 5;
|
||||||
storage_phase_cfg->enable_due_payment = config.get_global_version() >= 4;
|
storage_phase_cfg->enable_due_payment = config.get_global_version() >= 4;
|
||||||
|
storage_phase_cfg->global_version = config.get_global_version();
|
||||||
compute_phase_cfg->block_rand_seed = *rand_seed;
|
compute_phase_cfg->block_rand_seed = *rand_seed;
|
||||||
compute_phase_cfg->max_vm_data_depth = size_limits.max_vm_data_depth;
|
compute_phase_cfg->max_vm_data_depth = size_limits.max_vm_data_depth;
|
||||||
compute_phase_cfg->global_config = config.get_root_cell();
|
compute_phase_cfg->global_config = config.get_root_cell();
|
||||||
|
|
|
@ -82,6 +82,7 @@ struct StoragePhaseConfig {
|
||||||
td::RefInt256 freeze_due_limit;
|
td::RefInt256 freeze_due_limit;
|
||||||
td::RefInt256 delete_due_limit;
|
td::RefInt256 delete_due_limit;
|
||||||
bool enable_due_payment{false};
|
bool enable_due_payment{false};
|
||||||
|
int global_version = 0;
|
||||||
StoragePhaseConfig() = default;
|
StoragePhaseConfig() = default;
|
||||||
StoragePhaseConfig(const std::vector<block::StoragePrices>* _pricing, td::RefInt256 freeze_limit = {},
|
StoragePhaseConfig(const std::vector<block::StoragePrices>* _pricing, td::RefInt256 freeze_limit = {},
|
||||||
td::RefInt256 delete_limit = {})
|
td::RefInt256 delete_limit = {})
|
||||||
|
|
|
@ -157,11 +157,11 @@ td::Ref<vm::Tuple> prepare_vm_c7(SmartContract::Args args, td::Ref<vm::Cell> cod
|
||||||
td::make_refint(0), //TODO: // trans_lt:Integer
|
td::make_refint(0), //TODO: // trans_lt:Integer
|
||||||
std::move(rand_seed_int), // rand_seed:Integer
|
std::move(rand_seed_int), // rand_seed:Integer
|
||||||
block::CurrencyCollection(args.balance).as_vm_tuple(), // balance_remaining:[Integer (Maybe Cell)]
|
block::CurrencyCollection(args.balance).as_vm_tuple(), // balance_remaining:[Integer (Maybe Cell)]
|
||||||
vm::load_cell_slice_ref(address), // myself:MsgAddressInt
|
vm::load_cell_slice_ref(address), // myself:MsgAddressInt
|
||||||
vm::StackEntry::maybe(config) //vm::StackEntry::maybe(td::Ref<vm::Cell>())
|
vm::StackEntry::maybe(config) // vm::StackEntry::maybe(td::Ref<vm::Cell>())
|
||||||
};
|
};
|
||||||
if (args.config && args.config.value()->get_global_version() >= 4) {
|
if (args.config && args.config.value()->get_global_version() >= 4) {
|
||||||
tuple.push_back(code.not_null() ? code : vm::StackEntry{}); // code:Cell
|
tuple.push_back(vm::StackEntry::maybe(code)); // code:Cell
|
||||||
tuple.push_back(block::CurrencyCollection::zero().as_vm_tuple()); // in_msg_value:[Integer (Maybe Cell)]
|
tuple.push_back(block::CurrencyCollection::zero().as_vm_tuple()); // in_msg_value:[Integer (Maybe Cell)]
|
||||||
tuple.push_back(td::zero_refint()); // storage_fees:Integer
|
tuple.push_back(td::zero_refint()); // storage_fees:Integer
|
||||||
|
|
||||||
|
@ -175,7 +175,10 @@ td::Ref<vm::Tuple> prepare_vm_c7(SmartContract::Args args, td::Ref<vm::Cell> cod
|
||||||
tuple.push_back(args.config.value()->get_unpacked_config_tuple(now)); // unpacked_config_tuple
|
tuple.push_back(args.config.value()->get_unpacked_config_tuple(now)); // unpacked_config_tuple
|
||||||
tuple.push_back(td::zero_refint()); // due_payment
|
tuple.push_back(td::zero_refint()); // due_payment
|
||||||
// precomiled_gas_usage:(Maybe Integer)
|
// precomiled_gas_usage:(Maybe Integer)
|
||||||
auto precompiled = args.config.value()->get_precompiled_contracts_config().get_contract(code->get_hash().bits());
|
td::optional<block::PrecompiledContractsConfig::Contract> precompiled;
|
||||||
|
if (code.not_null()) {
|
||||||
|
precompiled = args.config.value()->get_precompiled_contracts_config().get_contract(code->get_hash().bits());
|
||||||
|
}
|
||||||
tuple.push_back(precompiled ? td::make_refint(precompiled.value().gas_usage) : vm::StackEntry());
|
tuple.push_back(precompiled ? td::make_refint(precompiled.value().gas_usage) : vm::StackEntry());
|
||||||
}
|
}
|
||||||
auto tuple_ref = td::make_cnt_ref<std::vector<vm::StackEntry>>(std::move(tuple));
|
auto tuple_ref = td::make_cnt_ref<std::vector<vm::StackEntry>>(std::move(tuple));
|
||||||
|
|
|
@ -930,7 +930,7 @@ void ArchiveManager::alarm() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArchiveManager::run_gc(UnixTime mc_ts, UnixTime gc_ts, UnixTime archive_ttl) {
|
void ArchiveManager::run_gc(UnixTime mc_ts, UnixTime gc_ts, UnixTime archive_ttl) {
|
||||||
auto p = get_temp_package_id_by_unixtime(std::max(gc_ts, mc_ts - TEMP_PACKAGES_TTL));
|
auto p = get_temp_package_id_by_unixtime(mc_ts - TEMP_PACKAGES_TTL);
|
||||||
std::vector<PackageId> vec;
|
std::vector<PackageId> vec;
|
||||||
for (auto &x : temp_files_) {
|
for (auto &x : temp_files_) {
|
||||||
if (x.first < p) {
|
if (x.first < p) {
|
||||||
|
|
|
@ -226,7 +226,7 @@ class ArchiveManager : public td::actor::Actor {
|
||||||
|
|
||||||
void update_permanent_slices();
|
void update_permanent_slices();
|
||||||
|
|
||||||
static const td::uint32 TEMP_PACKAGES_TTL = 86400 * 7;
|
static const td::uint32 TEMP_PACKAGES_TTL = 3600;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace validator
|
} // namespace validator
|
||||||
|
|
|
@ -189,7 +189,7 @@ void FullNodeCustomOverlay::receive_broadcast(PublicKeyHash src, td::BufferSlice
|
||||||
}
|
}
|
||||||
|
|
||||||
void FullNodeCustomOverlay::send_external_message(td::BufferSlice data) {
|
void FullNodeCustomOverlay::send_external_message(td::BufferSlice data) {
|
||||||
if (config_.ext_messages_broadcast_disabled_) {
|
if (!inited_ || config_.ext_messages_broadcast_disabled_) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
LOG(FULL_NODE_DEBUG) << "Sending external message to private overlay \"" << name_ << "\"";
|
LOG(FULL_NODE_DEBUG) << "Sending external message to private overlay \"" << name_ << "\"";
|
||||||
|
@ -267,6 +267,7 @@ void FullNodeCustomOverlay::init() {
|
||||||
|
|
||||||
td::actor::send_closure(rldp_, &rldp::Rldp::add_id, local_id_);
|
td::actor::send_closure(rldp_, &rldp::Rldp::add_id, local_id_);
|
||||||
td::actor::send_closure(rldp2_, &rldp2::Rldp::add_id, local_id_);
|
td::actor::send_closure(rldp2_, &rldp2::Rldp::add_id, local_id_);
|
||||||
|
inited_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FullNodeCustomOverlay::tear_down() {
|
void FullNodeCustomOverlay::tear_down() {
|
||||||
|
|
|
@ -1419,7 +1419,7 @@ static td::Ref<vm::Tuple> prepare_vm_c7(ton::UnixTime now, ton::LogicalTime lt,
|
||||||
config ? config->get_root_cell() : vm::StackEntry() // global_config:(Maybe Cell) ] = SmartContractInfo;
|
config ? config->get_root_cell() : vm::StackEntry() // global_config:(Maybe Cell) ] = SmartContractInfo;
|
||||||
};
|
};
|
||||||
if (config && config->get_global_version() >= 4) {
|
if (config && config->get_global_version() >= 4) {
|
||||||
tuple.push_back(my_code); // code:Cell
|
tuple.push_back(vm::StackEntry::maybe(my_code)); // code:Cell
|
||||||
tuple.push_back(block::CurrencyCollection::zero().as_vm_tuple()); // in_msg_value:[Integer (Maybe Cell)]
|
tuple.push_back(block::CurrencyCollection::zero().as_vm_tuple()); // in_msg_value:[Integer (Maybe Cell)]
|
||||||
tuple.push_back(td::zero_refint()); // storage_fees:Integer
|
tuple.push_back(td::zero_refint()); // storage_fees:Integer
|
||||||
|
|
||||||
|
@ -1430,10 +1430,13 @@ static td::Ref<vm::Tuple> prepare_vm_c7(ton::UnixTime now, ton::LogicalTime lt,
|
||||||
tuple.push_back(info.is_ok() ? info.move_as_ok() : vm::StackEntry());
|
tuple.push_back(info.is_ok() ? info.move_as_ok() : vm::StackEntry());
|
||||||
}
|
}
|
||||||
if (config && config->get_global_version() >= 6) {
|
if (config && config->get_global_version() >= 6) {
|
||||||
tuple.push_back(config->get_unpacked_config_tuple(now)); // unpacked_config_tuple:[...]
|
tuple.push_back(vm::StackEntry::maybe(config->get_unpacked_config_tuple(now))); // unpacked_config_tuple:[...]
|
||||||
tuple.push_back(due_payment); // due_payment:Integer
|
tuple.push_back(due_payment); // due_payment:Integer
|
||||||
// precomiled_gas_usage:(Maybe Integer)
|
// precomiled_gas_usage:(Maybe Integer)
|
||||||
auto precompiled = config->get_precompiled_contracts_config().get_contract(my_code->get_hash().bits());
|
td::optional<block::PrecompiledContractsConfig::Contract> precompiled;
|
||||||
|
if (my_code.not_null()) {
|
||||||
|
precompiled = config->get_precompiled_contracts_config().get_contract(my_code->get_hash().bits());
|
||||||
|
}
|
||||||
tuple.push_back(precompiled ? td::make_refint(precompiled.value().gas_usage) : vm::StackEntry());
|
tuple.push_back(precompiled ? td::make_refint(precompiled.value().gas_usage) : vm::StackEntry());
|
||||||
}
|
}
|
||||||
auto tuple_ref = td::make_cnt_ref<std::vector<vm::StackEntry>>(std::move(tuple));
|
auto tuple_ref = td::make_cnt_ref<std::vector<vm::StackEntry>>(std::move(tuple));
|
||||||
|
|
|
@ -954,6 +954,7 @@ bool ValidateQuery::fetch_config_params() {
|
||||||
compute_phase_cfg_.mc_gas_prices = mc_gas_prices.move_as_ok();
|
compute_phase_cfg_.mc_gas_prices = mc_gas_prices.move_as_ok();
|
||||||
compute_phase_cfg_.special_gas_full = config_->get_global_version() >= 5;
|
compute_phase_cfg_.special_gas_full = config_->get_global_version() >= 5;
|
||||||
storage_phase_cfg_.enable_due_payment = config_->get_global_version() >= 4;
|
storage_phase_cfg_.enable_due_payment = config_->get_global_version() >= 4;
|
||||||
|
storage_phase_cfg_.global_version = config_->get_global_version();
|
||||||
compute_phase_cfg_.block_rand_seed = rand_seed_;
|
compute_phase_cfg_.block_rand_seed = rand_seed_;
|
||||||
compute_phase_cfg_.libraries = std::make_unique<vm::Dictionary>(config_->get_libraries_root(), 256);
|
compute_phase_cfg_.libraries = std::make_unique<vm::Dictionary>(config_->get_libraries_root(), 256);
|
||||||
compute_phase_cfg_.max_vm_data_depth = size_limits.max_vm_data_depth;
|
compute_phase_cfg_.max_vm_data_depth = size_limits.max_vm_data_depth;
|
||||||
|
|
Loading…
Reference in a new issue