-
Notifications
You must be signed in to change notification settings - Fork 345
Create non-disruptive_fee_updates.md #371
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
EmelyanenkoK
wants to merge
2
commits into
ton-blockchain:master
Choose a base branch
from
EmelyanenkoK:non-disruptive_fee_updates
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| - **TEP**: [370](https://github.com/ton-blockchain/TEPs/pull/370) *(don't change)* | ||
| - **title**: Transaction chains friendly fees update mechanism | ||
| - **status**: Draft | ||
| - **type**: Core | ||
| - **authors**: [Emelyanenko Kirill](https://github.com/EmelyanenkoK) | ||
| - **created**: 24.11.2024 | ||
| - **replaces**: - | ||
| - **replaced by**: - | ||
|
|
||
| # Summary | ||
|
|
||
| Propose a mechanism to update fees without disrupting currently executing chains of transactions. | ||
|
|
||
| # Motivation | ||
|
|
||
| Because execution on TON is asynchronous, updating network configurations can cause the conditions under which execution started to differ from those at the end of execution. This is critical in the case of transaction fee increases, as the funds reserved at the beginning of the transaction may become insufficient not only for proper completion but even for error handling. | ||
|
|
||
| # Specification | ||
|
|
||
| Modify the TON Virtual Machine (TVM) so that during fee calculation, it checks the `msg_envelope_v2` of the incoming message (see [Dispatch Queue](https://github.com/ton-blockchain/TEPs/blob/master/text/0160-dispatch-queue.md)) and retrieves the `initiator_lt` and `depth` parameters. | ||
|
|
||
| For messages with a limited depth (e.g., below `1024` to prevent intentionally infinite chains), fees are calculated according to the conditions that were in place when the chain started. This affects calculations at the TVM level, including special opcodes like `GETGASFEE` (see [TVM Upgrade 2024.04](https://docs.ton.org/v3/documentation/tvm/changelog/tvm-upgrade-2024-04#opcodes-to-process-config-parameters)) and gas-related configuration parameters available in `c7`. | ||
|
|
||
| While correct protocol execution still requires calculating necessary fees for operations according to the current configuration parameters, this approach eliminates the need to account for sudden changes in configuration parameters while operations are in process. | ||
|
|
||
| # Drawbacks | ||
|
|
||
| 1. **Validator Overhead**: Validators will need to remember and verify configuration parameters that existed in the past. Note that the chain depth limitation may not directly translate to a time limitation. | ||
|
|
||
| 2. **Complex Config Management**: Modifying certain configuration parameters in `c7` while keeping others (unrelated to gas) untouched during execution can be complex and may introduce potential errors. | ||
|
|
||
| # Alternatives | ||
|
|
||
| - **Static Gas Parameters**: Avoid changing gas parameters altogether to maintain consistency. | ||
|
|
||
| - **Config Update Mode**: Implement a "config update mode" for the blockchain—a period during which new external messages are not accepted, allowing all chains of reasonable length to finish. The configuration would be updated at the end, prior to starting new chains. | ||
|
|
||
| # Unresolved Questions | ||
|
|
||
| - **Storage of Old Config Params**: How and for how long should old configuration parameters be stored and proven (e.g., collator proves to validator in `collated_data`)? | ||
|
|
||
| - **Modification Scope**: Should we modify `c7`, or would it be better to only change TVM execution and the behavior of gas-related opcodes? | ||
|
|
||
| - **Chain Depth Limit**: What should the chain depth limit be for applying old fees? | ||
|
|
||
| - **Fee Decrease Scenario**: In the case of a fee decrease, do we want to keep the old (higher) fees for running chains? | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hopefully contracts do not mind that they get extra TON relative to what they expected. Given that there are no guides to nanoTON-precise fee management, this is a safe assumption.