From 6aa02acc3d7ed24c4036e5623f64deda900623a9 Mon Sep 17 00:00:00 2001 From: Hannes Karppila Date: Mon, 7 Oct 2024 20:49:26 +0300 Subject: [PATCH 1/3] Clarify padding behavior --- src/fuel-vm/instruction-set.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fuel-vm/instruction-set.md b/src/fuel-vm/instruction-set.md index 480fd40b..a0120951 100644 --- a/src/fuel-vm/instruction-set.md +++ b/src/fuel-vm/instruction-set.md @@ -1804,7 +1804,7 @@ Panic if: | Operation | `code = match imm { 0 => contract_code(mem[$rA,32]), 1 => blob_payload(mem[$rA,32]), 2 => mem[$ra, ..] }; MEM[$ssp, $rC] = code[$rB, $rC];` | | Syntax | `ldc $rA, $rB, $rC, imm` | | Encoding | `0x00 rA rB rC imm` | -| Notes | If `$rC` is greater than the code size, zero bytes are filled in. | +| Notes | If `$rC` is greater than the code size, zero bytes are filled in. Length final is always padded to word boundary. | Object type from `imm` determines the source for loading as follows: From 697d0eb07d42763e3e80bf65d6c0c280f13d32f5 Mon Sep 17 00:00:00 2001 From: Hannes Karppila <2204863+Dentosal@users.noreply.github.com> Date: Tue, 8 Oct 2024 13:46:53 +0300 Subject: [PATCH 2/3] Update src/fuel-vm/instruction-set.md Co-authored-by: Brandon Kite --- src/fuel-vm/instruction-set.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fuel-vm/instruction-set.md b/src/fuel-vm/instruction-set.md index a0120951..bddf7520 100644 --- a/src/fuel-vm/instruction-set.md +++ b/src/fuel-vm/instruction-set.md @@ -1804,7 +1804,7 @@ Panic if: | Operation | `code = match imm { 0 => contract_code(mem[$rA,32]), 1 => blob_payload(mem[$rA,32]), 2 => mem[$ra, ..] }; MEM[$ssp, $rC] = code[$rB, $rC];` | | Syntax | `ldc $rA, $rB, $rC, imm` | | Encoding | `0x00 rA rB rC imm` | -| Notes | If `$rC` is greater than the code size, zero bytes are filled in. Length final is always padded to word boundary. | +| Notes | If `$rC` is greater than the code size, zero bytes are filled in. Final length is always padded to word boundary. | Object type from `imm` determines the source for loading as follows: From e4ee95b01c286d58230c0c89e621ffe685dc1165 Mon Sep 17 00:00:00 2001 From: Hannes Karppila <2204863+Dentosal@users.noreply.github.com> Date: Tue, 8 Oct 2024 13:47:05 +0300 Subject: [PATCH 3/3] Update src/fuel-vm/instruction-set.md --- src/fuel-vm/instruction-set.md | 1 + 1 file changed, 1 insertion(+) diff --git a/src/fuel-vm/instruction-set.md b/src/fuel-vm/instruction-set.md index bddf7520..47bb3d8c 100644 --- a/src/fuel-vm/instruction-set.md +++ b/src/fuel-vm/instruction-set.md @@ -1822,6 +1822,7 @@ Panic if: - `$ssp + $rC >= $hp` - `imm == 0` and `$rC > CONTRACT_MAX_SIZE` - `imm == 0` and contract with ID `MEM[$rA, 32]` is not in `tx.inputs` +- `imm == 0` and context is a predicate - `imm == 1` and blob with ID `MEM[$rA, 32]` is not found in the chain state - `imm == 2` and `$rA + $rB + $rC` overflows or `> VM_MAX_RAM` - `imm >= 3` (reserved value)