Advanced Analysis of TON Blockchain's Highload-Wallet Version 2
Introduction
The TON Blockchain’s highload-wallet-v2
represents a significant advancement in the realm of blockchain technology, catering to high-volume transactions typical for cryptocurrency exchanges. This analysis delves into the wallet’s technical nuances and critically examines associated risks, including a recent crisis that has impacted the TON mainnet.
Technical Overview
The highload-wallet-v2
is designed to handle a large volume of internal messages - up to 254 transfers in a single external message. This efficiency and scalability feature sets it apart. However, it has recently faced a critical issue due to the insufficient gas limit, leading to a mainnet crisis. The inability to clean up outdated queries, caused by this gas limit issue, led to funds becoming trapped, highlighting the importance of rigorous testing and risk management in blockchain implementations.
Key Functions
- Handling External Messages: The
recv_external
function processes incoming external messages with signature verification and subwallet ID checks. -
Message Processing: The contract processes both internal and external messages, with a focus on external message processing.
- Query Management: Efficient query and expiration management are crucial. However, the recent crisis showed how exceeding the gas limit can lead to severe operational issues.
Risk Analysis
-
Storage Size Limit: Exceeding the 65,535 cell limit leads to transaction failure, a risk highlighted by the recent mainnet issue.
-
Gas Limit: The current gas limit of 1,000,000 units proved insufficient, causing the contract to become unresponsive. This limitation was a critical factor in the recent crisis.
-
Expiration Date Setting: Incorrect settings can lead to an excessive number of queries, exacerbating issues like those recently experienced.
-
Contract Complexity: The recent crisis underscores the need for thorough understanding and careful management of the contract’s complexities.
Recent Crisis and Response
The TON mainnet encountered a severe problem when its high-load wallet became unresponsive due to an insufficient gas limit. This issue prevented the cleanup of outdated queries, trapping user funds. Although these funds constitute a minor portion of overall assets, the incident has potential trust and user experience implications within TON.
In response, TON Status indicated that an update planned for January 18 will include changes to address this issue. The proposed solution involves a temporary elevation of the gas limit for affected user accounts. This measure, along with ongoing improvements in contracts, guidelines, tools, and documentation, aims to prevent similar situations in the future.
Conclusion
The TON Blockchain’s highload-wallet-v2
marks a significant step in handling large-scale transactions in blockchain space. However, the recent crisis highlights the inherent risks and the need for careful management and deep technical understanding. Developers and users must remain aware of these risks to ensure smooth and secure operations. This incident serves as a reminder of the importance of continual improvement and adaptation in the rapidly evolving field of blockchain technology. The TON team’s commitment to collaborating with ecosystem projects and improving node software demonstrates their dedication to enhancing user experience and maintaining robust monetary policies. Such initiatives are vital for the long-term stability and trust in blockchain platforms like TON.
flowchart TD
A[Start] --> B{Receive Message}
B -- External --> C[Process External Message]
B -- Internal --> D[Ignore Internal Message]
C --> E{Check Signature}
E -- Valid --> F[Verify Subwallet ID]
E -- Invalid --> G[Reject Message]
F -- Matches --> H[Check Query ID]
F -- Does not Match --> G
H -- New --> I[Process Transaction]
H -- Exists --> G
I --> J{Check Storage Size}
J -- Within Limit --> K[Manage Queries]
J -- Exceeds Limit --> L[Transaction Failure]
K --> M{Check Gas Limit}
M -- Within Limit --> N[Clean Expired Queries]
M -- Exceeds Limit --> O[Contract Stuck]
N --> P[End Transaction]
O --> P
L --> P
Explanation of the Mermaid Code:
- Start and End Transaction mark the beginning and end of the process.
- Receive Message: Determines if the message is internal or external.
- Process External Message: Handles the external message.
- Ignore Internal Message: Internal messages are not processed.
- Check Signature: Verifies the signature of the external message.
- Verify Subwallet ID: Ensures the subwallet ID matches.
- Check Query ID: Checks if the query ID is new or already exists.
- Process Transaction: Processes the valid transaction.
- Check Storage Size: Ensures storage size is within the limit.
- Manage Queries: Manages the storage of query IDs.
- Check Gas Limit: Ensures gas usage is within the limit.
- Clean Expired Queries: Removes expired queries to manage storage.
- Transaction Failure and Contract Stuck: Represents possible failure scenarios.
Enjoy Reading This Article?
Here are some more articles you might like to read next: