Minor fixes to context creation (#961)

This commit is contained in:
wborgeaud 2023-04-08 09:06:02 +02:00 committed by GitHub
parent 7a65b1d4df
commit ab692252ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 11 deletions

View File

@ -18,7 +18,6 @@ global sys_call:
%address %set_new_ctx_caller
DUP5 %set_new_ctx_value
DUP5 DUP5 %address %transfer_eth
%set_new_ctx_parent_ctx
%set_new_ctx_parent_pc(after_call_instruction)
// TODO: Copy memory[args_offset..args_offset + args_size] CALLDATA
@ -49,7 +48,6 @@ global sys_callcode:
%address %set_new_ctx_caller
DUP5 %set_new_ctx_value
DUP5 DUP5 %address %transfer_eth
%set_new_ctx_parent_ctx
%set_new_ctx_parent_pc(after_call_instruction)
// stack: new_ctx, kexit_info, gas, address, value, args_offset, args_size, ret_offset, ret_size
@ -79,7 +77,6 @@ global sys_staticcall:
DUP4 %set_new_ctx_addr
%address %set_new_ctx_caller
PUSH 0 %set_new_ctx_value
%set_new_ctx_parent_ctx
%set_new_ctx_parent_pc(after_call_instruction)
%stack (new_ctx, kexit_info, gas, address, args_offset, args_size, ret_offset, ret_size)
@ -105,7 +102,6 @@ global sys_delegatecall:
%address %set_new_ctx_addr
%caller %set_new_ctx_caller
%callvalue %set_new_ctx_value
%set_new_ctx_parent_ctx
%set_new_ctx_parent_pc(after_call_instruction)
%stack (new_ctx, kexit_info, gas, address, args_offset, args_size, ret_offset, ret_size)

View File

@ -1,13 +1,10 @@
// Return the next context ID, and record the old context ID in the new one's
// @CTX_METADATA_PARENT_CONTEXT field. Does not actually enter the new context.
%macro create_context
// stack: (empty)
%next_context_id
GET_CONTEXT
%stack (ctx, next_ctx)
-> (next_ctx, @SEGMENT_NORMALIZED_TXN, @CTX_METADATA_PARENT_CONTEXT,
ctx, next_ctx)
MSTORE_GENERAL
// stack: next_ctx
%set_new_ctx_parent_ctx
// stack: new_ctx
%endmacro
// Get and increment @GLOBAL_METADATA_LARGEST_CONTEXT to determine the next context ID.

View File

@ -132,7 +132,7 @@ impl Segment {
Segment::KernelGeneral2 => 256,
Segment::KernelAccountCode => 8,
Segment::TxnFields => 256,
Segment::TxnData => 256,
Segment::TxnData => 8,
Segment::RlpRaw => 8,
Segment::TrieData => 256,
Segment::TrieEncodedChild => 256,