From 9f1e97edc4586428144ed594f026b6ae7a33c396 Mon Sep 17 00:00:00 2001 From: Dmitry Vagner Date: Tue, 20 Sep 2022 10:11:45 -0700 Subject: [PATCH] fix bugs --- evm/src/cpu/kernel/aggregator.rs | 8 ++++---- evm/src/cpu/kernel/asm/ripemd/memory.asm | 16 ++++++++-------- evm/src/cpu/kernel/asm/ripemd/ripemd.asm | 12 ++++++------ 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/evm/src/cpu/kernel/aggregator.rs b/evm/src/cpu/kernel/aggregator.rs index 115679ea..7d624b7a 100644 --- a/evm/src/cpu/kernel/aggregator.rs +++ b/evm/src/cpu/kernel/aggregator.rs @@ -38,12 +38,12 @@ pub(crate) fn combined_kernel() -> Kernel { include_str!("asm/memory/metadata.asm"), include_str!("asm/memory/packing.asm"), include_str!("asm/memory/txn_fields.asm"), - include_str!("asm/ripemd/compression.asm"), - include_str!("asm/ripemd/constants.asm"), + // include_str!("asm/ripemd/compression.asm"), + // include_str!("asm/ripemd/constants.asm"), include_str!("asm/ripemd/memory.asm"), include_str!("asm/ripemd/ripemd.asm"), - include_str!("asm/ripemd/subroutines.asm"), - include_str!("asm/ripemd/update.asm"), + // include_str!("asm/ripemd/subroutines.asm"), + // include_str!("asm/ripemd/update.asm"), include_str!("asm/rlp/encode.asm"), include_str!("asm/rlp/decode.asm"), include_str!("asm/rlp/read_to_memory.asm"), diff --git a/evm/src/cpu/kernel/asm/ripemd/memory.asm b/evm/src/cpu/kernel/asm/ripemd/memory.asm index 50169500..b9bfb422 100644 --- a/evm/src/cpu/kernel/asm/ripemd/memory.asm +++ b/evm/src/cpu/kernel/asm/ripemd/memory.asm @@ -22,9 +22,9 @@ store_size: // stack: ab %extract_and_store_byte(70) // stack: a - %mstore_ripemd(71) - // stack: 0x80 // padding has 0x80 in first position and zeros elsewhere - %mstore_ripemd(72) // store first padding term here so as to avoid extra label + %mstore_ripemd_offset(71) + // stack: 0x80 // padding has 0x80 in first position and zeros elsewhere + %mstore_ripemd_offset(72) // store first padding term here so as to avoid extra label %jump(store_padding) store_padding: @@ -107,26 +107,26 @@ store_input: DIV SWAP1 // stack: y, xs - %mstore_ripemd($offset) + %mstore_ripemd_offset($offset) // stack: xs %endmacro -%macro mstore_ripemd_offset($offset) +%macro mstore_ripemd_offset(offset) // stack: value PUSH $offset // stack: offset, value - %mstore_kernel(SEGMENT_RIPEMD) + %mstore_kernel(@SEGMENT_RIPEMD) // stack: %endmacro %macro mstore_ripemd // stack: offset, value - %mstore_kernel(SEGMENT_RIPEMD) + %mstore_kernel(@SEGMENT_RIPEMD) // stack: %endmacro %macro mload_ripemd - %mload_kernel(SEGMENT_RIPEMD) + %mload_kernel(@SEGMENT_RIPEMD) %endmacro // Load LE u32 from 4 contiguous bytes a, b, c, d in SEGMENT_RIPEMD diff --git a/evm/src/cpu/kernel/asm/ripemd/ripemd.asm b/evm/src/cpu/kernel/asm/ripemd/ripemd.asm index dc5dd7b8..1a126d9b 100644 --- a/evm/src/cpu/kernel/asm/ripemd/ripemd.asm +++ b/evm/src/cpu/kernel/asm/ripemd/ripemd.asm @@ -35,7 +35,7 @@ ripemd_init: // stack: length %stack (length) -> ( 0, length, 136, ripemd_1, ripemd_2, process) // stack: count = 0, length, virt = 136, ripemd_1, ripemd_2, process - %stack (c, l, o, l1, l2, l3) -> (0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0, c, l, o, l1, l2, l3) + %stack (c, l, o, l1, l2, l3) -> (0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0, c, l, o, l1, l2, l3) // stack: 0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0, count, length, virt, *labels %jump(ripemd_update) ripemd_1: @@ -59,26 +59,26 @@ process: %flip_bytes_u32 // stack: a', b, c, d, e, *vars SWAP1 - %flip_bytes_32 + %flip_bytes_u32 %shl_const(32) OR // stack: b' a', c, d, e, *vars SWAP1 - %flip_bytes_32 + %flip_bytes_u32 %shl_const(64) OR // stack: c' b' a', d, e, *vars SWAP1 - %flip_bytes_32 + %flip_bytes_u32 %shl_const(96) OR // stack: d' c' b' a', e, *vars SWAP1 - %flip_bytes_32 + %flip_bytes_u32 %shl_const(96) OR // stack: e' d' c' b' a', *vars - %stack (result, x, y, z) -> result + %stack (result, x, y, z) -> (result) // stack: result