Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
a89cafb
Move limit for storage dict hash to config
SpyCheese Jul 9, 2025
a969178
BTOS opcode; decrease gas usage for HASHSU
SpyCheese Jul 9, 2025
07f2565
HASHBU opcode
SpyCheese Jul 9, 2025
298db54
New account size limit for masterchain
SpyCheese Jul 9, 2025
126ac76
New bounce format
SpyCheese Jul 23, 2025
2736637
Change exit codes for compute phase skip reason in bounce msg
SpyCheese Jul 25, 2025
8c7a5a6
"Skip public msg send" flag for custom overlays (#1757)
SpyCheese Jul 31, 2025
7d1995e
Improve portable linux binaries (#1759)
neodix42 Jul 31, 2025
3d49e8b
Fix selecting shard overlays after decreasing monitor_min_split (#1756)
SpyCheese Jul 31, 2025
4ec6711
Bind tolk-stdlib to tolk release... (#1752)
neodix42 Jul 31, 2025
76144d4
Session stats improvements (#1746)
SpyCheese Jul 31, 2025
0326fc5
Improve block compression (#1710)
Mustang98 Aug 1, 2025
f4468b8
Send broadcasts earlier in AcceptBlock
SpyCheese Aug 1, 2025
d2cc797
Optimistic block generation
SpyCheese Aug 4, 2025
dd13096
Don't wait for storing state to celldb in most cases
SpyCheese Aug 4, 2025
6cbae03
Refactor CollatorNode
SpyCheese Aug 5, 2025
badc4fd
Enable optimistic collation in proto version 6
SpyCheese Aug 6, 2025
f9a5afd
Merge pull request #1767 from ton-blockchain/optimize-collate
EmelyanenkoK Aug 6, 2025
677961a
Merge pull request #1768 from ton-blockchain/master
EmelyanenkoK Aug 6, 2025
8a49651
Allow hostnames instead of IPs for liteservers (#1771)
SpyCheese Aug 7, 2025
501790f
Optimistic collation on collator nodes
SpyCheese Aug 7, 2025
e173f11
Wait for block in validator-session.cpp
SpyCheese Aug 7, 2025
90616d8
Fix compilation error
SpyCheese Aug 7, 2025
038db1b
Bugfixes in storage daemon
SpyCheese Aug 11, 2025
37f10de
Change new bounce format: include full or partial original body
SpyCheese Aug 12, 2025
c7b6c25
Use rldp2 for downloading candidates in validator session
SpyCheese Aug 12, 2025
a70bdfb
Disable optimistic generation in masterchain
SpyCheese Aug 12, 2025
3f216b6
Fix returning error in wait block state
SpyCheese Aug 14, 2025
c48413a
Fix error processing in Collator::process_optimistic_prev_block
SpyCheese Aug 16, 2025
e169659
Blockchain explorer: fix search by utime
SpyCheese Aug 18, 2025
f416812
Optimistic validation
SpyCheese Aug 19, 2025
ff010ef
More session stats for collation/validation time
SpyCheese Aug 19, 2025
7810271
Merge pull request #1779 from ton-blockchain/optimize-collate
EmelyanenkoK Aug 20, 2025
760c439
Add logs for stack entry
tvorogme Aug 20, 2025
da37096
Merge pull request #1774 from ton-blockchain/storage-patch
EmelyanenkoK Sep 10, 2025
d268ac0
Set block id in ConfigInfo::extract_config (#1780)
SpyCheese Sep 10, 2025
635bbd0
[Tolk] Refactor: IR generation of complex built-ins like T.toCell
tolk-vm Jul 29, 2025
5756e73
[Tolk] Don't emit unused functions to Fift code
tolk-vm Jul 29, 2025
6f60419
[Tolk] Prevent exponential explosion while evaluating constants
tolk-vm Jul 31, 2025
08c61df
[Tolk] Fix createMessage() with a dynamic union destination
tolk-vm Aug 4, 2025
7b89b2a
[Tolk] Stricter type aliases and equal_to for types
tolk-vm Aug 7, 2025
4d59949
[Tolk] Enhance overload resolution rules for method receivers
tolk-vm Aug 7, 2025
3c10903
Send validator telemetry from all nodes in fast-sync overlay (#1798)
SpyCheese Sep 15, 2025
a7c0010
Ban collator node when it returns invalid block (#1797)
SpyCheese Sep 15, 2025
41849db
avoid touching packfiles on startup (#1793)
mkiesel Sep 15, 2025
3765697
[Tolk] Built-in map<K,V> as a high-level wrapper over TVM dicts
tolk-vm Aug 8, 2025
36fe5fd
[Tolk] Modify stdlib for rendering, add built-in types
tolk-vm Aug 8, 2025
6e9ce41
[Tolk] Fix overflow detection on constant storeUint
tolk-vm Aug 18, 2025
1ebdc0a
[Tolk] Support numeric enums similar to TypeScript and C++
tolk-vm Aug 13, 2025
0fb8c1c
[Tolk] Support serialization for enums
tolk-vm Aug 18, 2025
b175341
[Tolk] Fix parsing sequential `as` operator
tolk-vm Aug 28, 2025
a0e8316
[Tolk] Readonly fields in structs
tolk-vm Sep 1, 2025
c08958e
[Tolk] Private fields in structs
tolk-vm Sep 1, 2025
82ae5d9
[Tolk] Ensure that compiled wasm passes all tests
tolk-vm Sep 14, 2025
4c62653
[Tolk] Auto-infer `never` for always-throwing functions
tolk-vm Sep 14, 2025
506273c
[Tolk] Bump version to v1.1
tolk-vm Sep 14, 2025
b8c8780
Fix compilation error (#1801)
SpyCheese Sep 16, 2025
743deba
Fix failing Github MacOS actions due to updated XCode (#1800)
neodix42 Sep 16, 2025
fe5e873
Fix failing Github MacOS actions due to updated XCode (#1800)
neodix42 Sep 16, 2025
b40c28f
Merge pull request #1805 from ton-blockchain/build-fixes
EmelyanenkoK Sep 18, 2025
1382059
Merge pull request #1795 from ton-blockchain/tolk-v1.1
EmelyanenkoK Sep 18, 2025
05bea13
Force jammy llvm-toolchain usage on Ubuntu 22.04 ARM github images (#…
neodix42 Sep 19, 2025
228c489
Merge branch 'testnet' into version-12
EmelyanenkoK Sep 25, 2025
36285ad
Merge pull request #1765 from ton-blockchain/version-12
EmelyanenkoK Sep 25, 2025
bb0af68
Set default global version to SUPPORTED_VERSION for getmethods in emu…
EmelyanenkoK Sep 25, 2025
e25bd31
Leave HASHSU gas coas as is (#1818)
EmelyanenkoK Oct 2, 2025
bca9c48
test-smartcont: decrease number of keys in multisig
SpyCheese Oct 6, 2025
9f328c1
Merge pull request #1823 from ton-blockchain/version-12
EmelyanenkoK Oct 6, 2025
8194beb
Limit ttl and number of values in DHT (#1826)
SpyCheese Oct 8, 2025
1d2260c
Merge pull request #1827 from ton-blockchain/master
EmelyanenkoK Oct 8, 2025
34823b1
Add changelog
EmelyanenkoK Oct 8, 2025
3aaefe6
Fix segfault on incorrect types
tvorogme Oct 9, 2025
6e8beb1
Merge master
tvorogme Oct 9, 2025
63c0c90
Merge testnet
tvorogme Oct 9, 2025
eccef66
Update packages on mac
tvorogme Oct 9, 2025
f3776e0
Fix cmake version in blockchain-indexer
tvorogme Oct 9, 2025
3fe0998
Update pybind11 to latest
tvorogme Oct 9, 2025
7c15dc0
Fix cmake version in tvm-python
tvorogme Oct 9, 2025
5a16c68
use macos clang instead of llvm
tvorogme Oct 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .github/workflows/build-universal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,7 @@ jobs:
if: runner.os == 'macOS'
run: |
brew install ninja pkg-config automake coreutils libtool autoconf \
texinfo wget ccache llvm@16 boost jemalloc
env:
HOMEBREW_NO_AUTO_UPDATE: 1
texinfo wget ccache boost jemalloc cmake

- name: Setup Python
uses: actions/setup-python@v5
Expand Down
4 changes: 0 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@
[submodule "third-party/cppkafka"]
path = third-party/cppkafka
url = https://github.com/mfontanini/cppkafka.git
[submodule "third-party/pybind11"]
path = third-party/pybind11
url = https://github.com/pybind/pybind11.git
branch = stable
[submodule "third-party/blst"]
path = third-party/blst
url = https://github.com/supranational/blst.git
Expand Down
12 changes: 12 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
## 2025.10 Update

1. [TVM version v12](./doc/GlobalVersions.md): full bounces, new `BTOS` and `HASHBU` instuctions, limit on contract size in masterchain.
2. Optimistic collation/validation: allow nodes to generate and check block candidates before previous block is fully signed (not fully activated yet).
3. Introduced custom block compression algorithm.
4. Overlay improvements: improved overlay discovery on shard configuration update, private externals in custom overlays.
5. Various improvements: session stats, telemetry in fast-sync overlay, earlier block broadcasts, limiting ttl for values in DHT, fixing search by utime in native blockexplorer, faster downloading candidates in validator session, parallelization of storing to cell_db, avoiding touching packfiles on startup.

Besides the work of the core team, this update is based on the efforts of the Tonstudio team: @hacker-volodya @Shvandre; and @mkiesel (avoiding touching packfiles on startup).



## 2025.07 Accelerator Update

Separation of validation and collation processes that allows to host them on independent machines and achieve full horizontal scaling. [More details in documentation](https://docs.ton.org/v3/documentation/infra/nodes/validation/collators)
Expand Down
14 changes: 14 additions & 0 deletions adnl/adnl-ext-client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ void AdnlExtClientImpl::alarm() {
next_create_at_ = td::Timestamp::in(next_alarm_);
alarm_timestamp() = next_create_at_;

if (!dst_host_.empty()) {
auto S = dst_addr_.init_host_port(dst_host_);
if (S.is_error()) {
LOG(INFO) << "failed to connect to " << dst_host_ << ": " << S;
return;
}
LOG(DEBUG) << "resolved " << dst_host_ << " -> " << dst_addr_;
}
auto fd = td::SocketFd::open(dst_addr_);
if (fd.is_error()) {
LOG(INFO) << "failed to connect to " << dst_addr_ << ": " << fd.move_as_error();
Expand Down Expand Up @@ -166,6 +174,12 @@ td::actor::ActorOwn<AdnlExtClient> AdnlExtClient::create(AdnlNodeIdFull dst, td:
return td::actor::create_actor<AdnlExtClientImpl>("extclient", std::move(dst), dst_addr, std::move(callback));
}

td::actor::ActorOwn<AdnlExtClient> AdnlExtClient::create(AdnlNodeIdFull dst, std::string dst_host,
std::unique_ptr<AdnlExtClient::Callback> callback) {
return td::actor::create_actor<AdnlExtClientImpl>("extclient", std::move(dst), std::move(dst_host),
std::move(callback));
}

td::actor::ActorOwn<AdnlExtClient> AdnlExtClient::create(AdnlNodeIdFull dst, PrivateKey local_id,
td::IPAddress dst_addr,
std::unique_ptr<AdnlExtClient::Callback> callback) {
Expand Down
2 changes: 2 additions & 0 deletions adnl/adnl-ext-client.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ class AdnlExtClient : public td::actor::Actor {
td::Promise<td::BufferSlice> promise) = 0;
static td::actor::ActorOwn<AdnlExtClient> create(AdnlNodeIdFull dst, td::IPAddress dst_addr,
std::unique_ptr<AdnlExtClient::Callback> callback);
static td::actor::ActorOwn<AdnlExtClient> create(AdnlNodeIdFull dst, std::string dst_host,
std::unique_ptr<AdnlExtClient::Callback> callback);
static td::actor::ActorOwn<AdnlExtClient> create(AdnlNodeIdFull dst, PrivateKey local_id, td::IPAddress dst_addr,
std::unique_ptr<AdnlExtClient::Callback> callback);
};
Expand Down
4 changes: 4 additions & 0 deletions adnl/adnl-ext-client.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ class AdnlExtClientImpl : public AdnlExtClient {
AdnlExtClientImpl(AdnlNodeIdFull dst_id, td::IPAddress dst_addr, std::unique_ptr<Callback> callback)
: dst_(std::move(dst_id)), dst_addr_(dst_addr), callback_(std::move(callback)) {
}
AdnlExtClientImpl(AdnlNodeIdFull dst_id, std::string dst_host, std::unique_ptr<Callback> callback)
: dst_(std::move(dst_id)), dst_host_(std::move(dst_host)), callback_(std::move(callback)) {
}
AdnlExtClientImpl(AdnlNodeIdFull dst_id, PrivateKey local_id, td::IPAddress dst_addr,
std::unique_ptr<Callback> callback)
: dst_(std::move(dst_id)), local_id_(local_id), dst_addr_(dst_addr), callback_(std::move(callback)) {
Expand Down Expand Up @@ -138,6 +141,7 @@ class AdnlExtClientImpl : public AdnlExtClient {
AdnlNodeIdFull dst_;
PrivateKey local_id_;
td::IPAddress dst_addr_;
std::string dst_host_;

std::unique_ptr<Callback> callback_;

Expand Down
7 changes: 4 additions & 3 deletions assembly/native/build-universal-static.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@ rm -rf .ninja* CMakeCache.txt CMakeFiles
# Detect OS and set compiler
# ----------------------
if [[ "$OSTYPE" == "darwin"* ]]; then
echo "Detected macOS"
export CC="$(brew --prefix llvm@16)/bin/clang"
export CXX="$(brew --prefix llvm@16)/bin/clang++"
echo "CC=$(xcrun -find clang)" >> $GITHUB_ENV
echo "CXX=$(xcrun -find clang++)" >> $GITHUB_ENV
# export CC="$(brew --prefix llvm@16)/bin/clang"
# export CXX="$(brew --prefix llvm@16)/bin/clang++"
export OPENSSL_LIBS="$OPENSSL_PATH/lib/libcrypto.a"
else
echo "Detected Linux"
Expand Down
10 changes: 5 additions & 5 deletions blockchain-explorer/blockchain-explorer-query.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -525,8 +525,8 @@ HttpQueryBlockSearch::HttpQueryBlockSearch(std::map<std::string, std::string> op
}
if (opts.count("utime") == 1) {
try {
seqno_ = static_cast<td::uint32>(std::stoull(opts["utime"]));
mode_ = 1;
utime_ = static_cast<td::uint32>(std::stoull(opts["utime"]));
mode_ = 4;
} catch (...) {
error_ = td::Status::Error("cannot parse utime");
return;
Expand Down Expand Up @@ -1429,10 +1429,10 @@ void HttpQueryStatus::finish_query() {
A << "<td>" << static_cast<td::int32>(x->ts_.at_unix()) << "</td>";
}
A << "</tr>\n";
for (td::uint32 i = 0; i < results_.ips.size(); i++) {
for (td::uint32 i = 0; i < results_.addrs.size(); i++) {
A << "<tr>";
if (results_.ips[i].is_valid()) {
A << "<td>" << results_.ips[i].get_ip_str() << ":" << results_.ips[i].get_port() << "</td>";
if (!results_.addrs[i].empty()) {
A << "<td>" << results_.addrs[i] << "</td>";
} else {
A << "<td>hidden</td>";
}
Expand Down
8 changes: 4 additions & 4 deletions blockchain-explorer/blockchain-explorer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ class CoreActor : public CoreActorInterface {
std::mutex queue_mutex_;
std::mutex res_mutex_;
std::map<td::int32, std::shared_ptr<RemoteNodeStatus>> results_;
std::vector<td::IPAddress> addrs_;
std::vector<std::string> addrs_;
static CoreActor* instance_;
td::actor::ActorId<CoreActor> self_id_;

Expand Down Expand Up @@ -220,7 +220,7 @@ class CoreActor : public CoreActorInterface {
}
void get_results(td::uint32 max, td::Promise<RemoteNodeStatusList> promise) override {
RemoteNodeStatusList r;
r.ips = hide_ips_ ? std::vector<td::IPAddress>{addrs_.size()} : addrs_;
r.addrs = hide_ips_ ? std::vector<std::string>{addrs_.size()} : addrs_;
auto it = results_.rbegin();
while (it != results_.rend() && r.results.size() < max) {
r.results.push_back(it->second);
Expand Down Expand Up @@ -445,14 +445,14 @@ class CoreActor : public CoreActorInterface {
r_servers.ensure();
servers = r_servers.move_as_ok();
for (const auto& serv : servers) {
addrs_.push_back(serv.addr);
addrs_.push_back(serv.hostname);
}
} else {
if (!remote_addr_.is_valid()) {
LOG(FATAL) << "remote addr not set";
}
addrs_.push_back(remote_addr_);
servers.push_back(liteclient::LiteServerConfig{ton::adnl::AdnlNodeIdFull{remote_public_key_}, remote_addr_});
addrs_.push_back(servers.back().hostname);
}
n_servers_ = servers.size();
client_ = liteclient::ExtClient::create(std::move(servers), make_callback(), true);
Expand Down
2 changes: 1 addition & 1 deletion blockchain-explorer/blockchain-explorer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class CoreActorInterface : public td::actor::Actor {
};

struct RemoteNodeStatusList {
std::vector<td::IPAddress> ips;
std::vector<std::string> addrs;
std::vector<std::shared_ptr<RemoteNodeStatus>> results;
};
virtual ~CoreActorInterface() = default;
Expand Down
2 changes: 1 addition & 1 deletion blockchain-indexer/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR)
cmake_minimum_required(VERSION 3.16 FATAL_ERROR)


if (NOT OPENSSL_FOUND)
Expand Down
10 changes: 1 addition & 9 deletions blockchain-indexer/indexer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1224,7 +1224,7 @@ class IndexerWorker : public td::actor::Actor {
*/

auto in_msg_dict = std::make_unique<vm::AugmentedDictionary>(vm::load_cell_slice_ref(extra.in_msg_descr), 256,
block::tlb::aug_InMsgDescr);
block::tlb::aug_InMsgDescrDefault);

// std::vector<json> in_msgs_json;
// while (!in_msg_dict->is_empty()) {
Expand Down Expand Up @@ -1985,10 +1985,6 @@ class Indexer : public td::actor::Actor {
// td::actor::send_closure(id_, &FullNodeImpl::new_key_block, std::move(handle));
}

void send_validator_telemetry(ton::PublicKeyHash key,
ton::tl_object_ptr<ton::ton_api::validator_telemetry> telemetry) override {
}

Callback(td::actor::ActorId<Indexer> id) : id_(id) {
}

Expand Down Expand Up @@ -2268,10 +2264,6 @@ class IndexerSimple : public td::actor::Actor {
// td::actor::send_closure(id_, &FullNodeImpl::new_key_block, std::move(handle));
}

void send_validator_telemetry(ton::PublicKeyHash key,
ton::tl_object_ptr<ton::ton_api::validator_telemetry> telemetry) override {
}

Callback(td::actor::ActorId<IndexerSimple> id) : id_(id) {
}

Expand Down
2 changes: 1 addition & 1 deletion blockchain-indexer/json-utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ json parse_message(Ref<vm::Cell> message_any) {
{"grams", block::tlb::t_Grams.as_integer(value_cc.grams)->to_dec_string()},
{"extra", value_cc.other->have_refs() ? parse_extra_currency(value_cc.other->prefetch_ref()) : dummy}};

answer["ihr_fee"] = block::tlb::t_Grams.as_integer(msg.ihr_fee.write())->to_dec_string();
answer["extra_flags"] = block::tlb::t_Grams.as_integer(msg.extra_flags.write())->to_dec_string();
answer["fwd_fee"] = block::tlb::t_Grams.as_integer(msg.fwd_fee.write())->to_dec_string();
answer["created_lt"] = msg.created_lt;
answer["created_at"] = msg.created_at;
Expand Down
2 changes: 1 addition & 1 deletion common/global-version.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
namespace ton {

// See doc/GlobalVersions.md
constexpr int SUPPORTED_VERSION = 11;
constexpr int SUPPORTED_VERSION = 12;

}
3 changes: 0 additions & 3 deletions create-hardfork/create-hardfork.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,9 +280,6 @@ class HardforkCreator : public td::actor::Actor {

void new_key_block(ton::validator::BlockHandle handle) override {
}
void send_validator_telemetry(ton::PublicKeyHash key,
ton::tl_object_ptr<ton::ton_api::validator_telemetry> telemetry) override {
}
};

td::actor::send_closure(validator_manager_, &ton::validator::ValidatorManagerInterface::install_callback,
Expand Down
2 changes: 2 additions & 0 deletions crypto/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ set(TON_CRYPTO_CORE_SOURCE
openssl/residue.cpp
openssl/rand.cpp
vm/boc.cpp
vm/boc-compression.cpp
vm/large-boc-serializer.cpp
tl/tlblib.cpp

Expand Down Expand Up @@ -109,6 +110,7 @@ set(TON_CRYPTO_SOURCE
vm/arithops.h
vm/atom.h
vm/boc.h
vm/boc-compression.h
vm/boc-writers.h
vm/box.hpp
vm/cellops.h
Expand Down
46 changes: 19 additions & 27 deletions crypto/block/block-parse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ bool CommonMsgInfo::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const
&& t_MsgAddressInt.validate_skip(ops, cs, weak) // src
&& t_MsgAddressInt.validate_skip(ops, cs, weak) // dest
&& t_CurrencyCollection.validate_skip(ops, cs, weak) // value
&& t_Grams.validate_skip(ops, cs, weak) // ihr_fee
&& t_Grams.validate_skip(ops, cs, weak) // extra_flags
&& t_Grams.validate_skip(ops, cs, weak) // fwd_fee
&& cs.advance(64 + 32); // created_lt:uint64 created_at:uint32
case ext_in_msg_info:
Expand All @@ -684,7 +684,7 @@ bool CommonMsgInfo::unpack(vm::CellSlice& cs, CommonMsgInfo::Record_int_msg_info
return get_tag(cs) == int_msg_info && cs.advance(1) && cs.fetch_bool_to(data.ihr_disabled) &&
cs.fetch_bool_to(data.bounce) && cs.fetch_bool_to(data.bounced) && t_MsgAddressInt.fetch_to(cs, data.src) &&
t_MsgAddressInt.fetch_to(cs, data.dest) && t_CurrencyCollection.fetch_to(cs, data.value) &&
t_Grams.fetch_to(cs, data.ihr_fee) && t_Grams.fetch_to(cs, data.fwd_fee) &&
t_Grams.fetch_to(cs, data.extra_flags) && t_Grams.fetch_to(cs, data.fwd_fee) &&
cs.fetch_uint_to(64, data.created_lt) && cs.fetch_uint_to(32, data.created_at);
}

Expand All @@ -696,7 +696,7 @@ bool CommonMsgInfo::skip(vm::CellSlice& cs) const {
&& t_MsgAddressInt.skip(cs) // src
&& t_MsgAddressInt.skip(cs) // dest
&& t_CurrencyCollection.skip(cs) // value
&& t_Grams.skip(cs) // ihr_fee
&& t_Grams.skip(cs) // extra_flags
&& t_Grams.skip(cs) // fwd_fee
&& cs.advance(64 + 32); // created_lt:uint64 created_at:uint32
case ext_in_msg_info:
Expand All @@ -718,7 +718,7 @@ bool CommonMsgInfo::get_created_lt(vm::CellSlice& cs, unsigned long long& create
&& t_MsgAddressInt.skip(cs) // src
&& t_MsgAddressInt.skip(cs) // dest
&& t_CurrencyCollection.skip(cs) // value
&& t_Grams.skip(cs) // ihr_fee
&& t_Grams.skip(cs) // extra_flags
&& t_Grams.skip(cs) // fwd_fee
&& cs.fetch_ulong_bool(64, created_lt) // created_lt:uint64
&& cs.advance(32); // created_at:uint32
Expand Down Expand Up @@ -1843,26 +1843,18 @@ bool InMsg::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const {
return false;
}

bool InMsg::get_import_fees(vm::CellBuilder& cb, vm::CellSlice& cs) const {
static td::RefInt256 get_ihr_fee(const CommonMsgInfo::Record_int_msg_info &info, int global_version) {
// Legacy: extra_flags was previously ihr_fee
return global_version >= 12 ? td::zero_refint() : t_Grams.as_integer(std::move(info.extra_flags));
}

bool InMsg::get_import_fees(vm::CellBuilder& cb, vm::CellSlice& cs, int global_version) const {
int tag = get_tag(cs);
switch (tag) {
case msg_import_ext: // inbound external message
return t_ImportFees.null_value(cb); // external messages have no value and no import fees
case msg_import_ihr: // IHR-forwarded internal message to its final destination
if (cs.advance(3) && cs.size_refs() >= 3) {
auto msg_cs = load_cell_slice(cs.fetch_ref());
CommonMsgInfo::Record_int_msg_info msg_info;
td::RefInt256 ihr_fee;
vm::CellBuilder aux;
// sort of Prolog-style in C++
return t_Message.extract_info(msg_cs) && t_CommonMsgInfo.unpack(msg_cs, msg_info) &&
cs.fetch_ref().not_null() && (ihr_fee = t_Grams.as_integer_skip(cs)).not_null() &&
cs.fetch_ref().not_null() && !cmp(ihr_fee, t_Grams.as_integer(*msg_info.ihr_fee)) &&
cb.append_cellslice_bool(msg_info.ihr_fee) // fees_collected := ihr_fee
&& aux.append_cellslice_bool(msg_info.ihr_fee) && t_ExtraCurrencyCollection.null_value(aux) &&
t_CurrencyCollection.add_values(cb, aux.as_cellslice_ref().write(),
msg_info.value.write()); // value_imported := ihr_fee + value
}
// IHR is not implemented
return false;
case msg_import_imm: // internal message re-imported from this very block
if (cs.advance(3) && cs.size_refs() >= 2) {
Expand All @@ -1888,7 +1880,7 @@ bool InMsg::get_import_fees(vm::CellBuilder& cb, vm::CellSlice& cs) const {
return t_Message.extract_info(msg_cs) && t_CommonMsgInfo.unpack(msg_cs, msg_info) &&
cb.append_cellslice_bool(in_msg.fwd_fee_remaining) // fees_collected := fwd_fee_remaining
&& t_Grams.as_integer_skip_to(msg_info.value.write(), value_grams) &&
(ihr_fee = t_Grams.as_integer(std::move(msg_info.ihr_fee))).not_null() &&
(ihr_fee = get_ihr_fee(msg_info, global_version)).not_null() &&
t_Grams.store_integer_ref(cb, value_grams + ihr_fee + fwd_fee_remaining) &&
cb.append_cellslice_bool(
msg_info.value.write()); // value_imported = msg.value + msg.ihr_fee + fwd_fee_remaining
Expand All @@ -1911,7 +1903,7 @@ bool InMsg::get_import_fees(vm::CellBuilder& cb, vm::CellSlice& cs) const {
return t_Message.extract_info(msg_cs) && t_CommonMsgInfo.unpack(msg_cs, msg_info) &&
t_Grams.store_integer_ref(cb, std::move(transit_fee)) // fees_collected := transit_fees
&& t_Grams.as_integer_skip_to(msg_info.value.write(), value_grams) &&
(ihr_fee = t_Grams.as_integer(std::move(msg_info.ihr_fee))).not_null() &&
(ihr_fee = get_ihr_fee(msg_info, global_version)).not_null() &&
t_Grams.store_integer_ref(cb, value_grams + ihr_fee + fwd_fee_remaining) &&
cb.append_cellslice_bool(
msg_info.value.write()); // value_imported = msg.value + msg.ihr_fee + fwd_fee_remaining
Expand Down Expand Up @@ -1941,8 +1933,8 @@ bool InMsg::get_import_fees(vm::CellBuilder& cb, vm::CellSlice& cs) const {

const InMsg t_InMsg;

const Aug_InMsgDescr aug_InMsgDescr;
const InMsgDescr t_InMsgDescr;
const Aug_InMsgDescr aug_InMsgDescrDefault(ton::SUPPORTED_VERSION);
const InMsgDescr t_InMsgDescrDefault(ton::SUPPORTED_VERSION);

bool OutMsg::skip(vm::CellSlice& cs) const {
switch (get_tag(cs)) {
Expand Down Expand Up @@ -2038,7 +2030,7 @@ bool OutMsg::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const {
return false;
}

bool OutMsg::get_export_value(vm::CellBuilder& cb, vm::CellSlice& cs) const {
bool OutMsg::get_export_value(vm::CellBuilder& cb, vm::CellSlice& cs, int global_version) const {
auto tag = get_tag(cs);
switch (tag) {
case msg_export_ext: // external outbound message carries no value
Expand Down Expand Up @@ -2071,7 +2063,7 @@ bool OutMsg::get_export_value(vm::CellBuilder& cb, vm::CellSlice& cs) const {
td::RefInt256 value_grams, ihr_fee, fwd_fee_remaining;
return t_Message.extract_info(msg_cs) && t_CommonMsgInfo.unpack(msg_cs, msg_info) &&
(value_grams = t_Grams.as_integer_skip(msg_info.value.write())).not_null() &&
(ihr_fee = t_Grams.as_integer(std::move(msg_info.ihr_fee))).not_null() &&
(ihr_fee = get_ihr_fee(msg_info, global_version)).not_null() &&
(fwd_fee_remaining = t_Grams.as_integer(out_msg.fwd_fee_remaining)).not_null() &&
t_Grams.store_integer_ref(cb, value_grams + ihr_fee + fwd_fee_remaining) &&
cb.append_cellslice_bool(std::move(msg_info.value));
Expand Down Expand Up @@ -2112,8 +2104,8 @@ bool OutMsg::get_emitted_lt(vm::CellSlice& cs, unsigned long long& emitted_lt) c

const OutMsg t_OutMsg;

const Aug_OutMsgDescr aug_OutMsgDescr;
const OutMsgDescr t_OutMsgDescr;
const Aug_OutMsgDescr aug_OutMsgDescrDefault(ton::SUPPORTED_VERSION);
const OutMsgDescr t_OutMsgDescrDefault(ton::SUPPORTED_VERSION);

bool EnqueuedMsg::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const {
return cs.advance(64) && t_Ref_MsgEnvelope.validate_skip(ops, cs, weak);
Expand Down
Loading
Loading