mirror of
https://github.com/logos-storage/plonky2.git
synced 2026-04-14 07:33:12 +00:00
fixes
This commit is contained in:
parent
c24af37288
commit
6a31a4b7ec
@ -6,6 +6,8 @@ global sha2_store:
|
||||
push 0
|
||||
// stack: addr=0, num_bytes, num_bytes, x[0], x[1], ..., x[num_bytes - 1], retdest
|
||||
%mstore_kernel_general
|
||||
// stack: num_bytes, x[0], x[1], ..., x[num_bytes - 1], retdest
|
||||
dup1
|
||||
// stack: num_bytes, num_bytes, x[0], x[1], ..., x[num_bytes - 1], retdest
|
||||
push 1
|
||||
// stack: addr=1, counter=num_bytes, x[0], x[1], x[2], ... , x[num_bytes-1], retdest
|
||||
@ -21,8 +23,6 @@ sha2_store_loop:
|
||||
%mstore_kernel_general
|
||||
// stack: counter, addr, ... , x[num_bytes-1], retdest
|
||||
dup1
|
||||
%eq_const(6)
|
||||
%jumpi(sha2_stop)
|
||||
%decrement
|
||||
// stack: counter-1, addr, ... , x[num_bytes-1], retdest
|
||||
iszero
|
||||
@ -36,6 +36,7 @@ sha2_store_end:
|
||||
JUMPDEST
|
||||
// stack: counter=0, addr, retdest
|
||||
%pop2
|
||||
STOP
|
||||
JUMP
|
||||
sha2_stop:
|
||||
JUMPDEST
|
||||
|
||||
@ -242,8 +242,7 @@
|
||||
|
||||
%macro increment
|
||||
push 1
|
||||
swap1
|
||||
sub
|
||||
add
|
||||
%endmacro
|
||||
|
||||
%macro decrement
|
||||
|
||||
@ -13,7 +13,7 @@ fn test_sha2_store() -> Result<()> {
|
||||
let kernel = combined_kernel();
|
||||
let sha2_store = kernel.global_labels["sha2_store"];
|
||||
let mut rng = thread_rng();
|
||||
let num_bytes = rng.gen_range(0..20);
|
||||
let num_bytes = rng.gen_range(1..17);
|
||||
let mut bytes: Vec<U256> = Vec::with_capacity(num_bytes);
|
||||
for _ in 0..num_bytes {
|
||||
let byte: u8 = rng.gen();
|
||||
@ -28,6 +28,7 @@ fn test_sha2_store() -> Result<()> {
|
||||
|
||||
let mut initial_stack = vec![U256::from(num_bytes)];
|
||||
initial_stack.extend(bytes);
|
||||
initial_stack.push(U256::from_str("0xdeadbeef").unwrap());
|
||||
dbg!(initial_stack.clone());
|
||||
let stack_with_kernel = run(&kernel.code, sha2_store, initial_stack)?.stack;
|
||||
dbg!(stack_with_kernel);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user