From dab61fe6ca023ffdc3cc8462892a5b6e95eafd22 Mon Sep 17 00:00:00 2001 From: Valerii Reutov Date: Tue, 13 Aug 2024 12:41:15 +0300 Subject: [PATCH 1/3] feat(docs): gas-in-iota.mdx was corrected --- .../about-iota/tokenomics/gas-in-iota.mdx | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/docs/content/about-iota/tokenomics/gas-in-iota.mdx b/docs/content/about-iota/tokenomics/gas-in-iota.mdx index 133eabde7a1..1b99bd99bc8 100644 --- a/docs/content/about-iota/tokenomics/gas-in-iota.mdx +++ b/docs/content/about-iota/tokenomics/gas-in-iota.mdx @@ -32,24 +32,14 @@ Gas units include both Different IOTA transactions require varying amounts of computational time for processing and execution. IOTA translates these varying operational loads into transaction fees by measuring each transaction in terms of computation units. In general, more complex transactions require more computation units. -Importantly, though, IOTA computation gas schedule is built coarsely with a bucketing approach. Two relatively similar transactions translate into the exact same amount of computation units if they are in the same bucket, whereas two relatively different transactions translate into different amounts of computation units if they fall in separate buckets. The smallest bucket maps into 1,000 computation units, meaning that all transactions that fall into the smallest bucket cost 1,000 computation units. The largest bucket maps into 5,000,000 computation units; if a transaction requires more computation units, it aborts. +Importantly, though, IOTA computation gas schedule is built with a bucketing/step approach. Two reasonably similar transactions translate into the exact same amount of computation units if they are in the same bucket, whereas two relatively different transactions translate into different amounts of computation units if they fall in separate buckets. The smallest bucket maps into 1,000 computation units, meaning that all transactions that fall into the smallest bucket cost 1,000 computation units. The largest bucket maps into 5,000,000 computation units; if a transaction requires more computation units, it aborts. Buckets move by a 1000 computation unit steps. -Using coarse bucketing accomplishes two important goals: +Using bucketing accomplishes two important goals: - Frees users from optimizing their smart contracts to deliver marginal gains in gas costs via "gas golfing" — instead, they can focus on step-function improvements in their products and services. - Gives users the freedom to adjust per-instruction gas costs and experiment with new gas metering schemes without creating significant development disruption. This can happen frequently, so it's important that they do not rely on per-instruction gas costs remaining stable over time. -| Bucket Lower Threshold | Bucket Upper Threshold | Computation Units | -| ---------------------- | ---------------------- | ---------------------- | -| 0 | 1,000 | 1,000 | -| 1,001 | 5,000 | 5,000 | -| 5,001 | 10,000 | 10,000 | -| 10,001 | 20,000 | 20,000 | -| 20,001 | 50,000 | 50,000 | -| 50,001 | 200,000 | 200,000 | -| 200,001 | 1,000,000 | 1,000,000 | -| 1,000,001 | 5,000,000 | 5,000,000 | -| 5,000,001 | Infinity | transaction will abort | +Buckets start at 1000 units and increment with step of 1000 units (effectively rounding to the nearest 1000) up to 5,000,000 units which is the max amount of computation allowed at this time. ### Storage units {#storage} @@ -69,7 +59,7 @@ If the gas budget does not fulfill this condition, then the transaction fails an Ultimately, a successful transaction requires the end user to pay the transaction's `total_gas_fees`. However, since it is challenging to perfectly forecast computation time before the transaction is processed, the `gas_budget` condition also requires the `gas_budget` to be at least as large as the transaction's `computation_fees` in case the transaction aborts. In some cases -- especially in the presence of high storage rebates, and, thus negative net storage fees -- the gas budget might be higher than the total gas fees the user pays. -Importantly, the minimum gas budget is 1000 NANOS (.000001 IOTA). This ensures validators are compensated with at least 1,000 NANOS even if the gas budget is incorrectly specified and the transaction aborts. Additionally, this protects the IOTA network from being spammed with a large number of transactions with minimal gas budgets. The maximum gas budget is 50 billion NANOS or 50 IOTA. This protects the network against overflow of internal multiplications and gas limits for denial of service attacks. +Importantly, the minimum gas budget is 1000 NANOS (.000001 IOTA). This protects the IOTA network from being spammed with a large number of transactions with minimal gas budgets. The maximum gas budget is 50 billion NANOS or 50 IOTA. This protects the network against overflow of internal multiplications and gas limits for denial of service attacks. As mentioned previously, the storage rebate is 100% of the originally paid storage fees. Because the gas budget applies to the totality of gas fees, it is often the case that a transaction only goes through if the gas budget is considerably higher than the net gas fees that a user ultimately pays. From 8a24e0f81c89018329fdddbe1ae2307eaa9e1330 Mon Sep 17 00:00:00 2001 From: Valerii Reutov Date: Tue, 13 Aug 2024 15:17:01 +0300 Subject: [PATCH 2/3] fix(docs): review comments were corrected --- docs/content/about-iota/tokenomics/gas-in-iota.mdx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/content/about-iota/tokenomics/gas-in-iota.mdx b/docs/content/about-iota/tokenomics/gas-in-iota.mdx index 1b99bd99bc8..a0d4f440da5 100644 --- a/docs/content/about-iota/tokenomics/gas-in-iota.mdx +++ b/docs/content/about-iota/tokenomics/gas-in-iota.mdx @@ -32,14 +32,14 @@ Gas units include both Different IOTA transactions require varying amounts of computational time for processing and execution. IOTA translates these varying operational loads into transaction fees by measuring each transaction in terms of computation units. In general, more complex transactions require more computation units. -Importantly, though, IOTA computation gas schedule is built with a bucketing/step approach. Two reasonably similar transactions translate into the exact same amount of computation units if they are in the same bucket, whereas two relatively different transactions translate into different amounts of computation units if they fall in separate buckets. The smallest bucket maps into 1,000 computation units, meaning that all transactions that fall into the smallest bucket cost 1,000 computation units. The largest bucket maps into 5,000,000 computation units; if a transaction requires more computation units, it aborts. Buckets move by a 1000 computation unit steps. +Importantly, though, IOTA computation gas schedule is built with a bucketing/step approach. Two reasonably similar transactions translate into the exact same amount of computation units if they are in the same bucket, whereas two relatively different transactions translate into different amounts of computation units if they fall in separate buckets. The smallest bucket maps into 1,000 computation units, meaning that all transactions that fall into the smallest bucket cost 1,000 computation units. The largest bucket maps into 5,000,000 computation units; if a transaction requires more computation units, it aborts. Buckets move by a 1000 computation unit step. Using bucketing accomplishes two important goals: - Frees users from optimizing their smart contracts to deliver marginal gains in gas costs via "gas golfing" — instead, they can focus on step-function improvements in their products and services. - Gives users the freedom to adjust per-instruction gas costs and experiment with new gas metering schemes without creating significant development disruption. This can happen frequently, so it's important that they do not rely on per-instruction gas costs remaining stable over time. -Buckets start at 1000 units and increment with step of 1000 units (effectively rounding to the nearest 1000) up to 5,000,000 units which is the max amount of computation allowed at this time. +Buckets start at 1000 units and increment in steps of 1000 units (effectively rounding to the nearest 1000) up to 5,000,000 units which is the max amount of computation allowed at this time. ### Storage units {#storage} @@ -59,7 +59,7 @@ If the gas budget does not fulfill this condition, then the transaction fails an Ultimately, a successful transaction requires the end user to pay the transaction's `total_gas_fees`. However, since it is challenging to perfectly forecast computation time before the transaction is processed, the `gas_budget` condition also requires the `gas_budget` to be at least as large as the transaction's `computation_fees` in case the transaction aborts. In some cases -- especially in the presence of high storage rebates, and, thus negative net storage fees -- the gas budget might be higher than the total gas fees the user pays. -Importantly, the minimum gas budget is 1000 NANOS (.000001 IOTA). This protects the IOTA network from being spammed with a large number of transactions with minimal gas budgets. The maximum gas budget is 50 billion NANOS or 50 IOTA. This protects the network against overflow of internal multiplications and gas limits for denial of service attacks. +Importantly, the minimum gas budget is 1000 NANOS (.000001 IOTA). This protects the IOTA network from being spammed with a large number of transactions with minimal gas budgets. The maximum gas budget is 50 billion NANOS or 50 IOTA. This protects the network against overflow of internal multiplications and prevents excessively large gas budgets being used for denial of service attacks. As mentioned previously, the storage rebate is 100% of the originally paid storage fees. Because the gas budget applies to the totality of gas fees, it is often the case that a transaction only goes through if the gas budget is considerably higher than the net gas fees that a user ultimately pays. From 58251fdee8f5d7c57985d7f5204f296fc31a4a1a Mon Sep 17 00:00:00 2001 From: Valerii Reutov Date: Wed, 14 Aug 2024 10:46:26 +0300 Subject: [PATCH 3/3] fix(docs): review comments were fixed --- docs/content/about-iota/tokenomics/gas-in-iota.mdx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/content/about-iota/tokenomics/gas-in-iota.mdx b/docs/content/about-iota/tokenomics/gas-in-iota.mdx index a0d4f440da5..ebdd6c00b42 100644 --- a/docs/content/about-iota/tokenomics/gas-in-iota.mdx +++ b/docs/content/about-iota/tokenomics/gas-in-iota.mdx @@ -32,15 +32,15 @@ Gas units include both Different IOTA transactions require varying amounts of computational time for processing and execution. IOTA translates these varying operational loads into transaction fees by measuring each transaction in terms of computation units. In general, more complex transactions require more computation units. -Importantly, though, IOTA computation gas schedule is built with a bucketing/step approach. Two reasonably similar transactions translate into the exact same amount of computation units if they are in the same bucket, whereas two relatively different transactions translate into different amounts of computation units if they fall in separate buckets. The smallest bucket maps into 1,000 computation units, meaning that all transactions that fall into the smallest bucket cost 1,000 computation units. The largest bucket maps into 5,000,000 computation units; if a transaction requires more computation units, it aborts. Buckets move by a 1000 computation unit step. +Importantly, though, IOTA computation gas schedule is built with a bucketing/step approach. Two reasonably similar transactions translate into the exact same amount of computation units if they are in the same bucket, whereas two relatively different transactions translate into different amounts of computation units if they fall in separate buckets. The smallest bucket maps into 1,000 computation units, meaning that all transactions that fall into the smallest bucket cost 1,000 computation units. The largest bucket maps into 5,000,000 computation units; if a transaction requires more computation units, it aborts. + +Buckets start at 1000 units and increment in steps up to 5,000,000, where the step value is set as a protocol parameter (currently the step is equal to 1000, effectively rounding up to the nearest 1000). Using bucketing accomplishes two important goals: - Frees users from optimizing their smart contracts to deliver marginal gains in gas costs via "gas golfing" — instead, they can focus on step-function improvements in their products and services. - Gives users the freedom to adjust per-instruction gas costs and experiment with new gas metering schemes without creating significant development disruption. This can happen frequently, so it's important that they do not rely on per-instruction gas costs remaining stable over time. -Buckets start at 1000 units and increment in steps of 1000 units (effectively rounding to the nearest 1000) up to 5,000,000 units which is the max amount of computation allowed at this time. - ### Storage units {#storage} Similarly, IOTA transactions vary depending on the amount of new data written into on-chain storage. The variable storage units capture these differences by mapping the amount of bytes held in storage into storage units. The current IOTA schedule is linear and maps each byte into 100 storage units. So, for example, a transaction that stores 25 bytes costs 2,500 storage units, while a transaction that stores 75 bytes costs 7,500 units.