Skip to content

Commit

Permalink
refactor: add inline comments, change trace ids
Browse files Browse the repository at this point in the history
  • Loading branch information
Fumuran committed Apr 10, 2024
1 parent d3943e9 commit c823d82
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 17 deletions.
24 changes: 16 additions & 8 deletions miden-lib/asm/kernels/transaction/main.masm
Original file line number Diff line number Diff line change
Expand Up @@ -64,21 +64,24 @@ proc.main.1
# Prologue
# ---------------------------------------------------------------------------------------------

# add redundant instructions to make span non-empty
push.0 drop
trace.0
trace.131072

# execute the transaction prologue
exec.prologue::prepare_transaction
# => []

# add redundant instructions to make span non-empty
push.0 drop
trace.1
trace.131073

# Note Processing
# ---------------------------------------------------------------------------------------------

# add redundant instructions to make span non-empty
push.0 drop
trace.2
trace.131074

# get the total number of consumed notes
exec.memory::get_total_num_consumed_notes
Expand Down Expand Up @@ -118,14 +121,16 @@ proc.main.1
exec.note::note_processing_teardown
# => []

# add redundant instructions to make span non-empty
push.0 drop
trace.3
trace.131075

# Transaction Script Processing
# ---------------------------------------------------------------------------------------------

# add redundant instructions to make span non-empty
push.0 drop
trace.4
trace.131076

# execute the transaction script
exec.memory::get_tx_script_root
Expand All @@ -148,21 +153,24 @@ proc.main.1
# => []
end

# add redundant instructions to make span non-empty
push.0 drop
trace.5
trace.131077

# Epilogue
# ---------------------------------------------------------------------------------------------

# add redundant instructions to make span non-empty
push.0 drop
trace.6
trace.131078

# execute the transaction epilogue
exec.epilogue::finalize_transaction
# => [TX_SCRIPT_ROOT, CREATED_NOTES_COMMITMENT, FINAL_ACCOUNT_HASH]

# add redundant instructions to make span non-empty
push.0 drop
trace.7
trace.131079
end

begin
Expand Down
18 changes: 9 additions & 9 deletions miden-tx/tests/integration/bench/tx_benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ use vm_processor::{
// CONSTANTS
// ================================================================================================

const PROLOGUE_START: u8 = 0;
const PROLOGUE_END: u8 = 1;
const PROLOGUE_START: u32 = 0x2_0000; // 131072
const PROLOGUE_END: u32 = 0x2_0001; // 131073

const NOTE_PROCESSING_START: u8 = 2;
const NOTE_PROCESSING_END: u8 = 3;
const NOTE_PROCESSING_START: u32 = 0x2_0002; // 131074
const NOTE_PROCESSING_END: u32 = 0x2_0003; // 131075

const TX_SCRIPT_PROCESSING_START: u8 = 4;
const TX_SCRIPT_PROCESSING_END: u8 = 5;
const TX_SCRIPT_PROCESSING_START: u32 = 0x2_0004; // 131076
const TX_SCRIPT_PROCESSING_END: u32 = 0x2_0005; // 131077

const EPILOGUE_START: u8 = 6;
const EPILOGUE_END: u8 = 7;
const EPILOGUE_START: u32 = 0x2_0006; // 131078
const EPILOGUE_END: u32 = 0x2_0007; // 131079

const SPAN_CREATION_SHIFT: u32 = 2;

Expand Down Expand Up @@ -71,7 +71,7 @@ impl<A: AdviceProvider> Host for BenchHost<A> {
trace_id: u32,
) -> Result<HostResponse, ExecutionError> {
#[cfg(feature = "std")]
match trace_id as u8 {
match trace_id {
PROLOGUE_START => self.prologue_start = Some(process.clk()),
PROLOGUE_END => {
if let Some(prologue_start) = self.prologue_start {
Expand Down

0 comments on commit c823d82

Please sign in to comment.