Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add new ZK opcodes #870

Merged
merged 31 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
56e31f5
Add boilerplate new opcodes
AurelienFT Nov 14, 2024
87dd242
Format
AurelienFT Nov 14, 2024
9705f6d
Update changelog
AurelienFT Nov 14, 2024
d53e060
Add more boilerplate
AurelienFT Nov 14, 2024
273ffda
Add code for ec add and ec mul
AurelienFT Nov 14, 2024
deac347
Update reserved_registers
AurelienFT Nov 14, 2024
59aae8e
Add source code pairing
AurelienFT Nov 15, 2024
d455d86
use alloc vec
AurelienFT Nov 15, 2024
cc22760
Add gas costs charge
AurelienFT Nov 15, 2024
bd193f2
Add tests for new zk opcodes
AurelienFT Nov 15, 2024
09f62c8
remove forget dbg
AurelienFT Nov 15, 2024
6615559
Add more test case for zk opcodes
AurelienFT Nov 15, 2024
0d41300
Remove old todo
AurelienFT Nov 15, 2024
c8b88ee
Fix clippy in tests
AurelienFT Nov 15, 2024
d59b18d
Change elliptic curve point error variant
AurelienFT Nov 18, 2024
c0a14ff
Change gas costs to v5 because v4 is already released
AurelienFT Nov 19, 2024
4cf15da
format
AurelienFT Nov 19, 2024
c8bc192
Update ec pairing to ouput directly in the register and fix the test
AurelienFT Nov 19, 2024
519e8f3
Update comments on opcodes
AurelienFT Nov 19, 2024
b25ef51
Update zk opcode to match the new spec
AurelienFT Nov 20, 2024
edc190f
Update EPAR prototype
AurelienFT Nov 22, 2024
d12b6fb
update gas costs functions
AurelienFT Nov 23, 2024
c83a7a1
Update default gas ecop based on benches
AurelienFT Nov 23, 2024
00ffd60
Add tests with instructions
AurelienFT Nov 25, 2024
04b8d30
Change gas epar
AurelienFT Nov 25, 2024
4493b33
Fomat
AurelienFT Nov 25, 2024
1741110
Update fuel-vm/src/interpreter/crypto.rs
AurelienFT Nov 28, 2024
ff0bbf7
cleanup for add zk opcodes PR (#874)
Dentosal Nov 28, 2024
498395c
Add some doc about the usage of operation symbols + and *
AurelienFT Nov 28, 2024
5f8b8e8
Add memory overflow tests
AurelienFT Nov 28, 2024
003ade7
fix clippy
AurelienFT Nov 28, 2024
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

### Added
- [870](https://github.com/FuelLabs/fuel-vm/pull/870): Add 3 new ZK-related opcodes: eadd (ecAdd on EVM), emul (ecMul on EVM), epar (ecPairing on EVM)

### Fixed
- [860](https://github.com/FuelLabs/fuel-vm/pull/860): Fixed missing fuzzing coverage report in CI.

Expand Down
9 changes: 6 additions & 3 deletions fuel-asm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,10 @@ impl_instructions! {
0xba BSIZ bsiz [dst: RegId blob_id_ptr: RegId]
"Load blob as data"
0xbb BLDD bldd [dst_ptr: RegId blob_id_ptr: RegId offset: RegId len: RegId]
"Given some curve, performs an operation on points"
0xbc ECOP ecop [dst: RegId curve_id: RegId operation_type: RegId points_ptr: RegId]
"Given some curve, performs a pairing on groups of points"
0xbe EPAR epar [success: RegId curve_id: RegId number_elements: RegId points_ptr: RegId]
}

impl Instruction {
Expand Down Expand Up @@ -701,9 +705,8 @@ impl Opcode {
| K256 | S256 | NOOP | FLAG | ADDI | ANDI | DIVI | EXPI | MODI | MULI
| MLDV | ORI | SLLI | SRLI | SUBI | XORI | JNEI | LB | LW | SB | SW
| MCPI | MCLI | GM | MOVI | JNZI | JI | JMP | JNE | JMPF | JMPB | JNZF
| JNZB | JNEF | JNEB | CFEI | CFSI | CFE | CFS | GTF | LDC | BSIZ | BLDD => {
true
}
| JNZB | JNEF | JNEB | CFEI | CFSI | CFE | CFS | GTF | LDC | BSIZ | BLDD
| ECOP | EPAR => true,
_ => false,
}
}
Expand Down
7 changes: 7 additions & 0 deletions fuel-asm/src/panic_reason.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,13 @@ enum_from! {
BlobIdAlreadyUploaded = 0x37,
/// Active gas costs do not define the cost for this instruction.
GasCostNotDefined = 0x38,
/// The curve id is not supported.
UnsupportedCurveId = 0x39,
/// The operation type is not supported.
UnsupportedOperationType = 0x3a,
/// Read alt_bn_128 curve point is invalid.
InvalidEllipticCurvePoint = 0x3b,

}
}

Expand Down
Loading
Loading