From 6ebee38e7277dc05a7bf6e2ecedbf0466873fa23 Mon Sep 17 00:00:00 2001 From: Nicholas Ward Date: Mon, 15 May 2023 11:02:21 -0700 Subject: [PATCH 1/4] fix --- evm/src/cpu/kernel/asm/hash/ripemd/update.asm | 2 +- evm/src/cpu/kernel/asm/memory/core.asm | 20 +++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/evm/src/cpu/kernel/asm/hash/ripemd/update.asm b/evm/src/cpu/kernel/asm/hash/ripemd/update.asm index 63d3cff8..c5783cc7 100644 --- a/evm/src/cpu/kernel/asm/hash/ripemd/update.asm +++ b/evm/src/cpu/kernel/asm/hash/ripemd/update.asm @@ -117,7 +117,7 @@ buffer_update: DUP2 DUP2 // stack: get, set, get , set , times , retdest - %mupdate_kernel_general + %mupdate_current_general // stack: get , set , times , retdest %increment SWAP1 diff --git a/evm/src/cpu/kernel/asm/memory/core.asm b/evm/src/cpu/kernel/asm/memory/core.asm index bdaac62e..41d4927b 100644 --- a/evm/src/cpu/kernel/asm/memory/core.asm +++ b/evm/src/cpu/kernel/asm/memory/core.asm @@ -194,6 +194,16 @@ // stack: (empty) %endmacro +// set offset i to offset j in kernel general +%macro mupdate_current_general + // stack: j, i + %mload_current_general + // stack: x, i + SWAP1 + %mstore_current_general + // stack: (empty) +%endmacro + // Load a single value from the given segment of kernel (context 0) memory. %macro mload_kernel(segment) // stack: offset @@ -409,16 +419,6 @@ %mstore_kernel_u32(@SEGMENT_KERNEL_GENERAL) %endmacro -// set offset i to offset j in kernel general -%macro mupdate_kernel_general - // stack: j, i - %mload_kernel_general - // stack: x, i - SWAP1 - %mstore_kernel_general - // stack: (empty) -%endmacro - // Load a single value from kernel general 2 memory. %macro mload_kernel_general_2 // stack: offset From 14f92f7bfa37ce62dd29d529e73e1fa9feb108b9 Mon Sep 17 00:00:00 2001 From: Nicholas Ward Date: Mon, 15 May 2023 11:59:50 -0700 Subject: [PATCH 2/4] Cargo.toml change for testing --- evm/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/evm/Cargo.toml b/evm/Cargo.toml index 63f4ec0c..40bf4230 100644 --- a/evm/Cargo.toml +++ b/evm/Cargo.toml @@ -26,7 +26,7 @@ num-bigint = "0.4.3" once_cell = "1.13.0" pest = "2.1.3" pest_derive = "2.1.0" -plonky2 = { version = "0.1.2", default-features = false, features = ["timing"] } +plonky2 = { path = "../plonky2", default-features = false, features = ["timing"] } plonky2_util = { version = "0.1.0" } rand = "0.8.5" rand_chacha = "0.3.1" From 3a77c5a05d01e15864bf9f9d1117006c6edfc06b Mon Sep 17 00:00:00 2001 From: Nicholas Ward Date: Mon, 15 May 2023 12:23:55 -0700 Subject: [PATCH 3/4] fix --- evm/src/cpu/kernel/asm/core/precompiles/rip160.asm | 4 ++-- evm/src/cpu/kernel/asm/core/precompiles/sha256.asm | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/evm/src/cpu/kernel/asm/core/precompiles/rip160.asm b/evm/src/cpu/kernel/asm/core/precompiles/rip160.asm index 8444088c..31cf8da1 100644 --- a/evm/src/cpu/kernel/asm/core/precompiles/rip160.asm +++ b/evm/src/cpu/kernel/asm/core/precompiles/rip160.asm @@ -27,7 +27,7 @@ global precompile_rip160: // // %stack (ctx, size) -> // ( - // 0, @SEGMENT_KERNEL_GENERAL, 200, // DST + // ctx, @SEGMENT_KERNEL_GENERAL, 200, // DST // ctx, @SEGMENT_CALLDATA, 0, // SRC // size, ripemd, // count, retdest // 200, size, rip160_contd // ripemd input: virt, num_bytes, retdest @@ -42,7 +42,7 @@ global precompile_rip160: SWAP6 PUSH 200 PUSH @SEGMENT_KERNEL_GENERAL - PUSH 0 + DUP3 %jump(memcpy) diff --git a/evm/src/cpu/kernel/asm/core/precompiles/sha256.asm b/evm/src/cpu/kernel/asm/core/precompiles/sha256.asm index 61be27fc..8cdb8fee 100644 --- a/evm/src/cpu/kernel/asm/core/precompiles/sha256.asm +++ b/evm/src/cpu/kernel/asm/core/precompiles/sha256.asm @@ -31,7 +31,7 @@ global precompile_sha256: // // %stack (ctx, size) -> // ( - // 0, @SEGMENT_KERNEL_GENERAL, 1, // DST + // ctx, @SEGMENT_KERNEL_GENERAL, 1, // DST // ctx, @SEGMENT_CALLDATA, 0, // SRC // size, sha2, // count, retdest // 0, size, sha256_contd // sha2 input: virt, num_bytes, retdest @@ -47,7 +47,7 @@ global precompile_sha256: SWAP6 PUSH 1 PUSH @SEGMENT_KERNEL_GENERAL - PUSH 0 + DUP3 %jump(memcpy) From e5b0fce6c67d2351799055480997aebb9e3810f8 Mon Sep 17 00:00:00 2001 From: Nicholas Ward Date: Mon, 15 May 2023 14:07:09 -0700 Subject: [PATCH 4/4] revert testing changes --- evm/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/evm/Cargo.toml b/evm/Cargo.toml index 40bf4230..63f4ec0c 100644 --- a/evm/Cargo.toml +++ b/evm/Cargo.toml @@ -26,7 +26,7 @@ num-bigint = "0.4.3" once_cell = "1.13.0" pest = "2.1.3" pest_derive = "2.1.0" -plonky2 = { path = "../plonky2", default-features = false, features = ["timing"] } +plonky2 = { version = "0.1.2", default-features = false, features = ["timing"] } plonky2_util = { version = "0.1.0" } rand = "0.8.5" rand_chacha = "0.3.1"