2461 Commits

Author SHA1 Message Date
wborgeaud
e09e6c3ebb
Merge pull request #634 from mir-protocol/fix_fixed_base_constant
Fix bug where `constant_affine_point` is called on zero
2022-07-25 10:33:34 +02:00
Sebastien La Duca
e48bfa837f fmt 2022-07-24 18:06:03 -04:00
Sebastien La Duca
c9d610ec10 use maybe_rayon in starky and evm 2022-07-24 17:47:14 -04:00
Daniel Lubarov
2aad4658d2
Merge pull request #637 from mir-protocol/move_storage
Move storage asm
2022-07-24 14:03:01 -07:00
Daniel Lubarov
1db5b7374d Move storage asm 2022-07-24 08:42:06 -07:00
Daniel Lubarov
cddc749a7e Fix comparison 2022-07-24 08:06:02 -07:00
Daniel Lubarov
0e5dd59d35 Use a fixed input buffer size in Challenger.
Alternate implementation of #633, using `SPONGE_RATE` as the buffer size.
2022-07-23 22:29:45 -07:00
Daniel Lubarov
544c84b420 Transaction (RLP) parsing
Will add tests once we have the interpreter support for other segmnets.
2022-07-23 21:39:01 -07:00
wborgeaud
ee979428f4 Start implementing context and segments in interpreter 2022-07-23 15:35:48 +02:00
wborgeaud
927cad3acd Collect prover inputs 2022-07-23 13:03:43 +02:00
wborgeaud
1e02fd0236 Oh Clippy... 2022-07-23 12:58:29 +02:00
wborgeaud
9dacbe0ff6 Comments 2022-07-23 12:52:45 +02:00
wborgeaud
cafae8b818 Add run_with_kernel fn 2022-07-23 12:36:03 +02:00
wborgeaud
19e6725cfa Working 2022-07-23 11:56:52 +02:00
wborgeaud
0c539795fa Implement prover input fns 2022-07-23 11:47:10 +02:00
wborgeaud
ec97f8497f Modify parser 2022-07-23 11:16:45 +02:00
wborgeaud
bbc2ff27ab Fix minor bug where constant_affine_point is called on zero 2022-07-23 09:18:41 +02:00
wborgeaud
0afe98525b Minor 2022-07-22 19:25:06 +02:00
wborgeaud
e93235d07e Modify inverse asm 2022-07-22 18:26:15 +02:00
Sebastien La Duca
81e14bf5b3 fmt 2022-07-21 17:02:03 -04:00
Sebastien La Duca
529add1c0a switch rest of names back 2022-07-21 17:01:21 -04:00
Sebastien La Duca
a281e28d54 add rayon shim 2022-07-21 16:59:20 -04:00
Daniel Lubarov
60227b9828
Merge pull request #626 from mir-protocol/asm_fixes
A few ASM fixes
2022-07-20 15:28:01 -07:00
Daniel Lubarov
47ea00d6c7 A few ASM fixes 2022-07-20 15:05:09 -07:00
Daniel Lubarov
90f7e8a181
Merge pull request #623 from mir-protocol/prover_input_instruction
`PROVER_INPUT` instruction
2022-07-20 11:47:34 -07:00
Daniel Lubarov
63a86a36f5 Merge branch 'main' into prover_input_instruction 2022-07-20 11:46:18 -07:00
Daniel Lubarov
676e833215
Merge pull request #625 from mir-protocol/stack_manipulation
Stack manipulation macro
2022-07-20 09:47:53 -07:00
Daniel Lubarov
c7ba4eb6ee Feedback 2022-07-20 09:45:05 -07:00
Daniel Lubarov
78fb34a9b6 Minor 2022-07-20 00:10:52 -07:00
Daniel Lubarov
1a0d6f4413 Pruning 2022-07-19 23:43:29 -07:00
Daniel Lubarov
05a1fbfbae Stack manipulation macro
Uses a variant of Dijkstra's, with a few pruning mechanics, to find a path of instructions between the two stack states. We don't explicitly store the graph though.

The Dijkstra implementation is somewhat inspired by the `pathfinding` crate. That crate doesn't quite fit our needs though.

If we need to make it faster later, there are a lot of allocations and clones that we could probably eliminate.
2022-07-19 22:59:56 -07:00
Daniel Lubarov
e3f7cc21c1
Merge pull request #624 from mir-protocol/mload_kernel_code_u32
Add a `mload_kernel_code_u32` macro
2022-07-19 12:18:15 -07:00
Daniel Lubarov
3dc79274a8 Add a mload_kernel_code_u32 macro
Intended for loading constants in SHA2, and maybe RIPEMD.

Sample usage
```
// Loads the i'th K256 constant.
%macro k256
  // stack: i
  %mul_const(4)
  // stack: 4*i
  PUSH k256_data
  // stack: k256_data, 4*i
  ADD
  // stack: k256_data + 4*i
  %mload_kernel_code_u32
  // stack: K256[4*i]
%endmacro

k256_data:
    BYTES 0x42, 0x8a, 0x2f, 0x98
    BYTES 0x71, 0x37, 0x44, 0x91
    ...
```

Untested for now since our interpreter doesn't have the needed memory support quite yet.
2022-07-19 10:36:18 -07:00
Daniel Lubarov
71db231c59
Merge pull request #622 from mir-protocol/memcpy
Implement memcpy
2022-07-19 07:21:15 -07:00
Daniel Lubarov
5b1f564039 Feedback 2022-07-19 07:20:57 -07:00
wborgeaud
1a5134e4b9
Merge pull request #620 from mir-protocol/sha3_interpreter_ecrecover
Implement SHA3 in interpreter and use it in ecrecover
2022-07-19 16:04:25 +02:00
Daniel Lubarov
b9b3c24cf9 PROVER_INPUT instruction 2022-07-19 06:55:23 -07:00
wborgeaud
a8ce2a6073 Import fix 2022-07-19 15:27:51 +02:00
wborgeaud
54629a0ef9 Merge branch 'main' into sha3_interpreter_ecrecover
# Conflicts:
#	evm/src/cpu/kernel/interpreter.rs
#	evm/src/cpu/kernel/tests/ecrecover.rs
2022-07-19 15:24:28 +02:00
wborgeaud
e7dbba8d7b s/sha3/keccak256 2022-07-19 15:21:44 +02:00
Daniel Lubarov
539364c87a clippy 2022-07-18 21:53:31 -07:00
Daniel Lubarov
80d32f89b6 fixes 2022-07-18 15:58:12 -07:00
Daniel Lubarov
6610ec4487 Implement memcpy
This can be used, for example, to copy `CALL` data (which is a slice of the caller's main memory) to the callee's `CALLDATA` segment.
2022-07-18 14:55:15 -07:00
Daniel Lubarov
50144a638f Enable assertions, now working 2022-07-18 13:48:51 -07:00
Daniel Lubarov
6ee2e4fcd8 move 2022-07-18 12:21:29 -07:00
Daniel Lubarov
49a785f2bd rename 2022-07-18 12:21:00 -07:00
Daniel Lubarov
3d83d63f0b Shared CPU columns
I was thinking we could have two sets of shared columns:
- First, a set of "core" columns which would contain instruction decoding registers during an execution cycle, or some counter data during a kernel bootloading cycle.
- Second, a set of "general" columns which would be more general-purpose. For now it could contain "looking" columns for most CTLs (Keccak, arithmetic and logic; NOT memory since memory can be used simultaneously with the others). It could potentially be reused for other things too, such as the registers used for `EQ` and `IS_ZERO` (but I know it's nontrivial to share those since we would need to use lower-degree constraints, so I wouldn't bother for now).

This PR implements just the latter. If it looks good I'll proceed with the former afterward.
2022-07-18 12:15:41 -07:00
Daniel Lubarov
cbdf2a66a1
Merge pull request #619 from mir-protocol/add_priviledged_opcodes
Add custom opcodes
2022-07-18 10:55:56 -07:00
Daniel Lubarov
799d333a90 fix 2022-07-18 10:40:02 -07:00
Daniel Lubarov
71b9705a0d
Merge pull request #618 from mir-protocol/asm_assertions
More basic ASM macros
2022-07-18 09:31:34 -07:00