Skip to content

Commit

Permalink
Merge pull request #1303 from topos-protocol/amortize_receipt_reset
Browse files Browse the repository at this point in the history
  • Loading branch information
Nashtare authored Oct 23, 2023
2 parents 595dfa6 + 6d2586e commit 9607a41
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions evm/src/cpu/kernel/asm/core/create_receipt.asm
Original file line number Diff line number Diff line change
Expand Up @@ -203,17 +203,23 @@ process_receipt_after_write:
DUP5
%mpt_insert_receipt_trie
// stack: new_cum_gas, txn_nb, num_nibbles, retdest
// Now, we set the Bloom filter back to 0.
// Now, we set the Bloom filter back to 0. We proceed by chunks of 32 bytes.
PUSH 32
PUSH 0
%rep 256
// stack: counter, new_cum_gas, txn_nb, num_nibbles, retdest
PUSH 0 DUP2
// stack: counter, 0, counter, new_cum_gas, txn_nb, num_nibbles, retdest
%mstore_kernel(@SEGMENT_TXN_BLOOM)
// stack: counter, new_cum_gas, txn_nb, num_nibbles, retdest
%increment
%rep 8
// stack: counter, 32, new_cum_gas, txn_nb, num_nibbles, retdest
DUP2
PUSH 0 // we will fill the memory segment with zeroes
DUP2
PUSH @SEGMENT_TXN_BLOOM
DUP3 // kernel context is 0
// stack: ctx, segment, counter, 0, 32, counter, 32, new_cum_gas, txn_nb, num_nibbles, retdest
MSTORE_32BYTES
// stack: counter, 32, new_cum_gas, txn_nb, num_nibbles, retdest
DUP2
ADD
%endrep
POP
%pop2
// stack: new_cum_gas, txn_nb, num_nibbles, retdest
%stack (new_cum_gas, txn_nb, num_nibbles, retdest) -> (retdest, new_cum_gas)
JUMP
Expand Down

0 comments on commit 9607a41

Please sign in to comment.