Skip to content
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

action fee changes #854

Merged
merged 3 commits into from
Nov 26, 2024
Merged

Conversation

Alexey-Ostrovsky
Copy link
Contributor

No description provided.


## Forward fees

Internal messages define an `ihr_fee` in Toncoins, which is subtracted from the value attached to the message and awarded to the validators of the destination shardchain if they include the message through the IHR mechanism. The `fwd_fee` is the original total forwarding fee paid for using the HR mechanism; it is automatically computed from the [24 and 25 configuration parameters](/v3/documentation/network/configs/blockchain-configs#param-24-and-25) and the size of the message at the time the message is generated. Note that the total value carried by a newly created internal outbound message equals the sum of the value, `ihr_fee`, and `fwd_fee`. This sum is deducted from the balance of the source account. Of these components, only the value is always credited to the destination account upon message delivery. The `fwd_fee` is collected by the validators on the HR path from the source to the destination, and the `ihr_fee` is either collected by the validators of the destination shardchain (if the message is delivered via IHR) or credited to the destination account.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Однако сейчас ihr не имплементирован, и если выставить его ненулевым, то ihr fee просто добавится к value сообщения при получении

Copy link
Contributor Author

@Alexey-Ostrovsky Alexey-Ostrovsky Nov 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Is either collected by the validators of the destination shardchain (if the message is delivered via IHR) or credited to the destination account."

I guess there is no contradiction here, but if you want so, i can add a tip.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, there are no contradictions, but considering that ihr is not working now, and ihr_fee can still be set, I would add a tip with the clarification that this is the state as of October 2024

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tip added.

## Action fee

Action fee is deducted from the balance of the source account during processing action list which is perfomed after Computing phase.
These are the actions that lead to pay fees:
The action fee is deducted from the balance of the source account during the processing of the action list, which occurs after the Computing phase. Practically, the only action for which you pay an action fee is `SENDRAWMSG`. Other actions, such as `RAWRESERVE` or `SETCODE`, do not incur any fee during the action phase.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Формально за SENDMSG тоже нужно платить action_fee, но я думаю это не столь обязательно уточнять

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is SENDMSG action? I see only SENDRAWMSG both in TVM whitepapers - https://docs.ton.org/tvm.pdf,
and in official implementation transaction.cpp - https://github.com/ton-blockchain/ton/blob/master/crypto/block/transaction.cpp

Copy link
Contributor Author

@Alexey-Ostrovsky Alexey-Ostrovsky Nov 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess the misconception here is the existence of two TVM instructions - SENDMSG and SENDRAWMSG, that create output actions. Nevertheless, in relation to the c5 register and action phase, we are talking about actions
themselves, one of which is the namesake SENDRAWMSG. Those are different entities. But if you think this will be a widespread misconception, we can add a WARN section describing that.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, my bad, indeed, I mixed up action and tvm instruction. I think there is no need to add anything here

* `CHANGELIB` creates an output action similarly to `SETLIBCODE`, but instead of the library code accepts its hash.
* `FB08–FB3F` reserved for output action primitives.
```cpp
action_fee = ceil((msg_fwd_fees * first_frac)/ 2^16); //internal

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

@Alexey-Ostrovsky Alexey-Ostrovsky Nov 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, my bad, fixed.

@reveloper reveloper merged commit a705861 into ton-community:main Nov 26, 2024
1 check passed
github-actions bot pushed a commit to TownSquareXYZ/ton-docs that referenced this pull request Nov 27, 2024
* action fee changes

* floor fix

* Adding not-implemented IHR tip & join 2 warning sections
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants