fix length zero input issue

This commit is contained in:
Dmitry Vagner 2022-09-23 17:56:28 -07:00
parent 85b88a1cde
commit 705b4a432f
2 changed files with 5 additions and 4 deletions

View File

@ -30,8 +30,8 @@ store_size:
store_padding:
// stack: i (init 63)
%store_zeros(136, store_padding)
%jump(store_input_alt)
%jumpi(store_input_alt)
%jump(ripemd_init)
store_input_alt:
// stack: rem, length, REM_INP

View File

@ -4,6 +4,7 @@ use ethereum_types::U256;
use crate::cpu::kernel::aggregator::combined_kernel;
use crate::cpu::kernel::interpreter::run_with_kernel;
fn make_input(word: &str) -> Vec<u8> {
let mut bytes: Vec<u8> = vec![word.len().try_into().unwrap()];
bytes.append(&mut word.as_bytes().to_vec());
@ -12,8 +13,8 @@ fn make_input(word: &str) -> Vec<u8> {
#[test]
fn test_ripemd() -> Result<()> {
let input: Vec<u8> = make_input("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789");
let expected = U256::from("0xb0e20b6e3116640286ed3a87a5713079b21f5189");
let input: Vec<u8> = make_input("");
let expected = U256::from("0x9c1185a5c5e9fc54612808977ee8f548b2258d31");
let kernel = combined_kernel();
let label = kernel.global_labels["ripemd_alt"];