mirror of
https://github.com/logos-storage/plonky2.git
synced 2026-01-11 10:13:09 +00:00
fixes
This commit is contained in:
parent
baa4bd4ea1
commit
c24af37288
@ -20,6 +20,9 @@ sha2_store_loop:
|
||||
// stack: addr, x[num_bytes-counter], counter, addr, ... , x[num_bytes-1], retdest
|
||||
%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
|
||||
@ -30,9 +33,13 @@ sha2_store_loop:
|
||||
// stack: addr+1, counter-1, ... , x[num_bytes-1], retdest
|
||||
%jump(sha2_store_loop)
|
||||
sha2_store_end:
|
||||
JUMPDEST
|
||||
// stack: counter=0, addr, retdest
|
||||
%pop2
|
||||
JUMP
|
||||
sha2_stop:
|
||||
JUMPDEST
|
||||
STOP
|
||||
|
||||
|
||||
// Precodition: input is in memory, starting at 0 of kernel general segment, of the form
|
||||
@ -40,6 +47,7 @@ sha2_store_end:
|
||||
// Postcodition: output is in memory, starting at 0, of the form
|
||||
// num_blocks, block0[0], ..., block0[63], block1[0], ..., blocklast[63]
|
||||
global sha2_pad:
|
||||
JUMPDEST
|
||||
// stack: retdest
|
||||
push 0
|
||||
%mload_kernel_general
|
||||
|
||||
@ -258,11 +258,6 @@
|
||||
div
|
||||
%endmacro
|
||||
|
||||
%macro eq(x)
|
||||
push $x
|
||||
eq
|
||||
%endmacro
|
||||
|
||||
%macro lt(x)
|
||||
push $x
|
||||
swap1
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
use core::num;
|
||||
use std::str::FromStr;
|
||||
|
||||
use anyhow::Result;
|
||||
@ -22,9 +23,14 @@ fn test_sha2_store() -> Result<()> {
|
||||
bytes.push(U256::from(v2));
|
||||
}
|
||||
|
||||
dbg!(num_bytes);
|
||||
dbg!(bytes.clone());
|
||||
|
||||
let mut initial_stack = vec![U256::from(num_bytes)];
|
||||
initial_stack.extend(bytes);
|
||||
dbg!(initial_stack.clone());
|
||||
let stack_with_kernel = run(&kernel.code, sha2_store, initial_stack)?.stack;
|
||||
dbg!(stack_with_kernel);
|
||||
|
||||
// let expected_stack = todo!();
|
||||
// assert_eq!(stack_with_kernel, expected_stack);
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
#![allow(clippy::type_complexity)]
|
||||
#![feature(let_chains)]
|
||||
#![feature(generic_const_exprs)]
|
||||
#![feature(let_chains)]
|
||||
|
||||
pub mod all_stark;
|
||||
pub mod arithmetic;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user