Merge pull request #1038 from mir-protocol/tests-memory-context-fix

Fix to hash precompile so EVM tests pass
This commit is contained in:
Nicholas Ward 2023-05-16 08:46:56 -07:00 committed by GitHub
commit ce6ac9f888
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 15 deletions

View File

@ -27,7 +27,7 @@ global precompile_rip160:
// //
// %stack (ctx, size) -> // %stack (ctx, size) ->
// ( // (
// 0, @SEGMENT_KERNEL_GENERAL, 200, // DST // ctx, @SEGMENT_KERNEL_GENERAL, 200, // DST
// ctx, @SEGMENT_CALLDATA, 0, // SRC // ctx, @SEGMENT_CALLDATA, 0, // SRC
// size, ripemd, // count, retdest // size, ripemd, // count, retdest
// 200, size, rip160_contd // ripemd input: virt, num_bytes, retdest // 200, size, rip160_contd // ripemd input: virt, num_bytes, retdest
@ -42,7 +42,7 @@ global precompile_rip160:
SWAP6 SWAP6
PUSH 200 PUSH 200
PUSH @SEGMENT_KERNEL_GENERAL PUSH @SEGMENT_KERNEL_GENERAL
PUSH 0 DUP3
%jump(memcpy) %jump(memcpy)

View File

@ -31,7 +31,7 @@ global precompile_sha256:
// //
// %stack (ctx, size) -> // %stack (ctx, size) ->
// ( // (
// 0, @SEGMENT_KERNEL_GENERAL, 1, // DST // ctx, @SEGMENT_KERNEL_GENERAL, 1, // DST
// ctx, @SEGMENT_CALLDATA, 0, // SRC // ctx, @SEGMENT_CALLDATA, 0, // SRC
// size, sha2, // count, retdest // size, sha2, // count, retdest
// 0, size, sha256_contd // sha2 input: virt, num_bytes, retdest // 0, size, sha256_contd // sha2 input: virt, num_bytes, retdest
@ -47,7 +47,7 @@ global precompile_sha256:
SWAP6 SWAP6
PUSH 1 PUSH 1
PUSH @SEGMENT_KERNEL_GENERAL PUSH @SEGMENT_KERNEL_GENERAL
PUSH 0 DUP3
%jump(memcpy) %jump(memcpy)

View File

@ -117,7 +117,7 @@ buffer_update:
DUP2 DUP2
DUP2 DUP2
// stack: get, set, get , set , times , retdest // stack: get, set, get , set , times , retdest
%mupdate_kernel_general %mupdate_current_general
// stack: get , set , times , retdest // stack: get , set , times , retdest
%increment %increment
SWAP1 SWAP1

View File

@ -194,6 +194,16 @@
// stack: (empty) // stack: (empty)
%endmacro %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. // Load a single value from the given segment of kernel (context 0) memory.
%macro mload_kernel(segment) %macro mload_kernel(segment)
// stack: offset // stack: offset
@ -409,16 +419,6 @@
%mstore_kernel_u32(@SEGMENT_KERNEL_GENERAL) %mstore_kernel_u32(@SEGMENT_KERNEL_GENERAL)
%endmacro %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. // Load a single value from kernel general 2 memory.
%macro mload_kernel_general_2 %macro mload_kernel_general_2
// stack: offset // stack: offset