@@ -377,33 +377,41 @@ end
377377#!
378378#! Invocation: exec
379379proc verify_claim_amount
380- # Step 1: Load the faucet account ID from global memory
380+ # Step 1: Pad the stack explicitly for FPI call (get_scale takes no inputs)
381+ padw padw padw padw
382+ # => [pad(16)]
383+
384+ # Step 2: Load the faucet account ID from global memory
381385 mem_load.CLAIM_FAUCET_ID_SUFFIX_MEM_ADDR
382386 mem_load.CLAIM_FAUCET_ID_PREFIX_MEM_ADDR
383- # => [faucet_id_prefix, faucet_id_suffix]
387+ # => [faucet_id_prefix, faucet_id_suffix, pad(16) ]
384388
385- # Step 2 : FPI call to faucet's get_scale procedure
389+ # Step 3 : FPI call to faucet's get_scale procedure
386390 procref.agglayer_faucet::get_scale
387- # => [PROC_MAST_ROOT(4), faucet_id_prefix, faucet_id_suffix]
391+ # => [PROC_MAST_ROOT(4), faucet_id_prefix, faucet_id_suffix, pad(16) ]
388392
389393 movup.5 movup.5
390- # => [faucet_id_prefix, faucet_id_suffix, PROC_MAST_ROOT(4)]
394+ # => [faucet_id_prefix, faucet_id_suffix, PROC_MAST_ROOT(4), pad(16) ]
391395
392396 exec.tx::execute_foreign_procedure
397+ # => [scale, pad(15)]
398+
399+ # Clean up FPI output padding, keeping only scale
400+ movdn.15 dropw dropw dropw drop drop drop
393401 # => [scale]
394402
395- # Step 3 : Load the raw U256 amount from leaf data memory
403+ # Step 4 : Load the raw U256 amount from leaf data memory
396404 exec.get_raw_claim_amount
397405 # => [x7, x6, x5, x4, x3, x2, x1, x0, scale]
398406
399- # Step 4 : Load faucet_mint_amount (y) and position it for verification
407+ # Step 5 : Load faucet_mint_amount (y) and position it for verification
400408 mem_load.CLAIM_OUTPUT_NOTE_FAUCET_AMOUNT
401409 # => [y, x7, x6, x5, x4, x3, x2, x1, x0, scale]
402410
403411 movdn.9
404412 # => [x7, x6, x5, x4, x3, x2, x1, x0, scale, y]
405413
406- # Step 5 : Verify that y = floor(x / 10^scale)
414+ # Step 6 : Verify that y = floor(x / 10^scale)
407415 exec.asset_conversion::verify_u256_to_native_amount_conversion
408416 # => [y]
409417
0 commit comments