Skip to content

Commit

Permalink
Some clarification after implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
xgreenx committed Nov 7, 2023
1 parent 1b3b772 commit 0eab75e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/fuel-vm/instruction-set.md
Original file line number Diff line number Diff line change
Expand Up @@ -2508,8 +2508,7 @@ Get [fields from the transaction](../tx-format/transaction.md).
| `GTF_OUTPUT_CONTRACT_CREATED_STATE_ROOT` | `0x308` | Memory address of `tx.outputs[$rB].stateRoot` |
| `GTF_WITNESS_DATA_LENGTH` | `0x400` | `tx.witnesses[$rB].dataLength` |
| `GTF_WITNESS_DATA` | `0x401` | Memory address of `tx.witnesses[$rB].data` |
| `GTF_POLICY_COUNT` | `0x500` | `count_ones(tx.policyTypes)` |
| `GTF_POLICY_TYPE` | `0x501` | `tx.policies[$rB].type` |
| `GTF_POLICY_TYPES` | `0x501` | `tx.policies.policyTypes` |
| `GTF_POLICY_GAS_PRICE` | `0x502` | `tx.policies[0x00].gasPrice` |
| `GTF_POLICY_WITNESS_LIMIT` | `0x504` | `tx.policies[count_ones(0b11 & tx.policyTypes) - 1].witnessLimit` |
| `GTF_POLICY_MATURITY` | `0x505` | `tx.policies[count_ones(0b111 & tx.policyTypes) - 1].maturity` |
Expand Down
3 changes: 2 additions & 1 deletion src/tx-format/transaction.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ enum ReceiptType : uint8 {
| `outputs` | [Output](./output.md)`[]` | List of outputs. |
| `witnesses` | [Witness](./witness.md)`[]` | List of witnesses. |

Given helper `max_gas()` returns the maximum gas that the transaction can use..
Given helper `len()` that returns the number of bytes of a field.
Given helper `count_ones()` that returns the number of ones in the binary representation of a field.
Given helper `count_variants()` that returns the number of variants in an enum.
Expand All @@ -84,7 +85,7 @@ Transaction is invalid if:
- `scriptDataLength > MAX_SCRIPT_DATA_LENGTH`
- `scriptLength * 4 != len(script)`
- `scriptDataLength != len(scriptData)`
- `gasLimit > MAX_GAS_PER_TX`
- `max_gas(tx) > MAX_GAS_PER_TX`
- No policy of type `PolicyType.GasPrice`
- `count_ones(policyTypes) > count_variants(PolicyType)`
- `policyTypes > sum_variants(PolicyType)`
Expand Down

0 comments on commit 0eab75e

Please sign in to comment.