2022-09-29 23:09:32 -07:00
|
|
|
global main:
|
2022-11-09 10:47:15 +11:00
|
|
|
// First, initialise the shift table
|
|
|
|
|
%shift_table_init
|
2022-12-01 16:23:39 -08:00
|
|
|
|
2022-11-09 10:47:15 +11:00
|
|
|
// Second, load all MPT data from the prover.
|
2022-12-01 16:23:39 -08:00
|
|
|
PUSH hash_initial_tries
|
2022-09-30 13:04:16 -07:00
|
|
|
%jump(load_all_mpts)
|
|
|
|
|
|
2023-03-06 21:57:51 -08:00
|
|
|
global hash_initial_tries:
|
2023-08-09 10:15:13 +02:00
|
|
|
%mpt_hash_state_trie %mload_global_metadata(@GLOBAL_METADATA_STATE_TRIE_DIGEST_BEFORE) %assert_eq
|
|
|
|
|
%mpt_hash_txn_trie %mload_global_metadata(@GLOBAL_METADATA_TXN_TRIE_DIGEST_BEFORE) %assert_eq
|
|
|
|
|
%mpt_hash_receipt_trie %mload_global_metadata(@GLOBAL_METADATA_RECEIPT_TRIE_DIGEST_BEFORE) %assert_eq
|
2022-09-30 13:04:16 -07:00
|
|
|
|
2023-05-04 09:57:02 +02:00
|
|
|
global start_txns:
|
|
|
|
|
// stack: (empty)
|
|
|
|
|
// Last mpt input is txn_nb.
|
|
|
|
|
PROVER_INPUT(mpt)
|
|
|
|
|
PUSH 0
|
|
|
|
|
// stack: init_used_gas, txn_nb
|
|
|
|
|
|
|
|
|
|
txn_loop:
|
2022-09-29 23:09:32 -07:00
|
|
|
// If the prover has no more txns for us to process, halt.
|
|
|
|
|
PROVER_INPUT(end_of_txns)
|
2022-09-30 13:04:16 -07:00
|
|
|
%jumpi(hash_final_tries)
|
2022-09-29 23:09:32 -07:00
|
|
|
|
2022-09-30 13:04:16 -07:00
|
|
|
// Call route_txn. When we return, continue the txn loop.
|
2023-05-04 09:57:02 +02:00
|
|
|
PUSH txn_loop_after
|
|
|
|
|
// stack: retdest, prev_used_gas, txn_nb
|
2022-09-29 23:09:32 -07:00
|
|
|
%jump(route_txn)
|
2022-09-30 13:04:16 -07:00
|
|
|
|
2023-05-04 09:57:02 +02:00
|
|
|
global txn_loop_after:
|
|
|
|
|
// stack: success, leftover_gas, cur_cum_gas, txn_nb
|
|
|
|
|
%process_receipt
|
|
|
|
|
// stack: new_cum_gas, txn_nb
|
|
|
|
|
SWAP1 %increment SWAP1
|
|
|
|
|
%jump(txn_loop)
|
|
|
|
|
|
2022-12-06 23:05:47 -08:00
|
|
|
global hash_final_tries:
|
2023-05-04 09:57:02 +02:00
|
|
|
// stack: cum_gas, txn_nb
|
|
|
|
|
%pop2
|
2023-08-09 10:15:13 +02:00
|
|
|
%mpt_hash_state_trie %mload_global_metadata(@GLOBAL_METADATA_STATE_TRIE_DIGEST_AFTER) %assert_eq
|
|
|
|
|
%mpt_hash_txn_trie %mload_global_metadata(@GLOBAL_METADATA_TXN_TRIE_DIGEST_AFTER) %assert_eq
|
|
|
|
|
%mpt_hash_receipt_trie %mload_global_metadata(@GLOBAL_METADATA_RECEIPT_TRIE_DIGEST_AFTER) %assert_eq
|
2022-09-30 13:04:16 -07:00
|
|
|
%jump(halt)
|