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

change ed19 verify operator, to comply with ed spec #600

Merged
merged 7 commits into from
Jul 29, 2024
Merged
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/fuel-vm/instruction-set.md
Original file line number Diff line number Diff line change
Expand Up @@ -2229,7 +2229,7 @@ All these instructions advance the program counter `$pc` by `4` after performing
| Operation | ```MEM[$rA, 64] = ecrecover_k1(MEM[$rB, 64], MEM[$rC, 32]);``` |
| Syntax | `eck1 $rA, $rB, $rC` |
| Encoding | `0x00 rA rB rC -` |
| Notes | |
| Notes | Takes message hash as an input. You can use `S256` to hash the message if needed. |

Panic if:

Expand All @@ -2252,7 +2252,7 @@ To get the address from the public key, hash the public key with [SHA-2-256](../
| Operation | ```MEM[$rA, 64] = ecrecover_r1(MEM[$rB, 64], MEM[$rC, 32]);``` |
| Syntax | `ecr1 $rA, $rB, $rC` |
| Encoding | `0x00 rA rB rC -` |
| Notes | |
| Notes | Takes message hash as an input. You can use `S256` to hash the message if needed. |

Panic if:

Expand All @@ -2269,19 +2269,19 @@ To get the address from the public key, hash the public key with [SHA-2-256](../

### `ED19`: EdDSA curve25519 verification

| | |
|-------------|-----------------------------------------------------------------------------------------------------------------------------------------------------|
| Description | Verification recovered from 32-byte public key starting at `$rA` and 64-byte signature starting at `$rB` on 32-byte message hash starting at `$rC`. |
| Operation | ```ed19verify(MEM[$rA, 32], MEM[$rB, 64], MEM[$rC, 32]);``` |
| Syntax | `ed19 $rA, $rB, $rC` |
| Encoding | `0x00 rA rB rC -` |
| Notes | |
| | |
|-------------|-----------------------------------------------------------------------------------------------------------------------------|
| Description | Verification 64-byte signature at `$rB` with 32-byte public key at `$rA` for a message starting at `$rC` with length `$rD`. |
| Operation | ```ed19verify(MEM[$rA, 32], MEM[$rB, 64], MEM[$rC, $rD]);``` |
| Syntax | `ed19 $rA, $rB, $rC, $rD` |
| Encoding | `0x00 rA rB rC rD` |
| Notes | Takes message instead of hash. **For backwards compatibility reasons, if `$rD == 0`, it will be set treated as `32`.** |
mchristopher marked this conversation as resolved.
Show resolved Hide resolved

Panic if:

- `$rA + 32` overflows or `> VM_MAX_RAM`
- `$rB + 64` overflows or `> VM_MAX_RAM`
- `$rC + 32` overflows or `> VM_MAX_RAM`
- `$rC + $rD` overflows or `> VM_MAX_RAM`

Verification are specified [here](../protocol/cryptographic-primitives.md#eddsa-public-key-cryptography).

Expand Down
Loading