mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
Add DUEPAYMENT and some others + small fixes of new opcodes (#881)
* Changes in TVM v6 * Rename some opcodes * Add due payment to c7 * Add GETORIGINALFWDFEE, GETGASFEESIMPLE, GETFORWARDFEESIMPLE * Bugfix in GETGASFEE * Fix typo --------- Co-authored-by: SpyCheese <mikle98@yandex.ru>
This commit is contained in:
parent
51d30e2f2b
commit
a11ffb1637
6 changed files with 99 additions and 42 deletions
|
@ -58,23 +58,27 @@ See [this post](https://t.me/tonstatus/88) for details.
|
|||
## Version 6
|
||||
|
||||
### c7 tuple
|
||||
**c7** tuple extended from 14 to 15 elements. The new element is a tuple that contains some config parameters as cell slices.
|
||||
If the parameter is absent from the config, the value is null.
|
||||
* **0**: `StoragePrices` from `ConfigParam 18`. Not the whole dict, but only the one StoragePrices entry (one which corresponds to the current time).
|
||||
* **1**: `ConfigParam 19` (global id).
|
||||
* **2**: `ConfigParam 20` (mc gas prices).
|
||||
* **3**: `ConfigParam 21` (gas prices).
|
||||
* **4**: `ConfigParam 24` (mc fwd fees).
|
||||
* **5**: `ConfigParam 25` (fwd fees).
|
||||
* **6**: `ConfigParam 43` (size limits).
|
||||
**c7** tuple extended from 14 to 16 elements:
|
||||
* **14**: tuple that contains some config parameters as cell slices. If the parameter is absent from the config, the value is null. Asm opcode: `UNPACKEDCONFIGTUPLE`.
|
||||
* **0**: `StoragePrices` from `ConfigParam 18`. Not the whole dict, but only the one StoragePrices entry (one which corresponds to the current time).
|
||||
* **1**: `ConfigParam 19` (global id).
|
||||
* **2**: `ConfigParam 20` (mc gas prices).
|
||||
* **3**: `ConfigParam 21` (gas prices).
|
||||
* **4**: `ConfigParam 24` (mc fwd fees).
|
||||
* **5**: `ConfigParam 25` (fwd fees).
|
||||
* **6**: `ConfigParam 43` (size limits).
|
||||
* **15**: "[due payment](https://github.com/ton-blockchain/ton/blob/8a9ff339927b22b72819c5125428b70c406da631/crypto/block/block.tlb#L237)" - current debt for storage fee (nanotons). Asm opcode: `DUEPAYMENT`.
|
||||
|
||||
### New TVM instructions
|
||||
|
||||
#### Fee calculation
|
||||
* `GETEXECUTIONPRICE` (`gas_used is_mc - price`) - calculates gas fee.
|
||||
* `GETSTORAGEPRICE` (`cells bits seconds is_mc - price`) - calculates storage fees (only current StoragePrices entry is used).
|
||||
* `GETFORWARDPRICE` (`cells bits is_mc - price`) - calculates forward fee.
|
||||
* `GETGASFEE` (`gas_used is_mc - price`) - calculates gas fee.
|
||||
* `GETSTORAGEFEE` (`cells bits seconds is_mc - price`) - calculates storage fees (only current StoragePrices entry is used).
|
||||
* `GETFORWARDFEE` (`cells bits is_mc - price`) - calculates forward fee.
|
||||
* `GETPRECOMPILEDGAS` (`- null`) - reserved, currently returns `null`.
|
||||
* `GETORIGINALFWDFEE` (`fwd_fee is_mc - orig_fwd_fee`) - calculate `fwd_fee * 2^16 / first_frac`. Can be used to get the original `fwd_fee` of the message.
|
||||
* `GETGASFEESIMPLE` (`gas_used is_mc - price`) - same as `GETGASFEE`, but without flat price (just `(gas_used * price) / 2^16`).
|
||||
* `GETFORWARDFEESIMPLE` (`cells bits is_mc - price`) - same as `GETFORWARDFEE`, but without lump price (just `(bits*bit_price + cells*cell_price) / 2^16`).
|
||||
|
||||
`gas_used`, `cells`, `bits`, `time_delta` are integers in range `0..2^63-1`.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue