Trigger Pattern TEMPORAL flag (required) - Inject Into Breadth agents, depth-state-trace
Trigger Pattern: TEMPORAL flag (required) Inject Into: Breadth agents, depth-state-trace Purpose: Analyze cached parameters in multi-step operations that can become stale when admin/capability holders change them mid-operation, and external state stored and relied upon without re-verification
epoch|period|duration|delay|cooldown|lock_period|timelock|
unbonding_period|claim_delay|withdraw_delay|maturity_time|
pending_|request_|fulfill_|complete_|finalize_
Find all operations that span multiple transactions:
| Operation | Step 1 (Initiate) | Wait Condition | Step N (Complete) | Resource Storing State |
|---|---|---|---|---|
| {op_name} | {initiate_fn}() | {wait_condition} | {complete_fn}() | {PendingRequest / similar} |
Aptos multi-step patterns:
request_withdraw() -> wait for epoch/time -> fulfill_withdraw()lock() -> cooldown expires -> unlock()propose() -> voting period -> execute()request_unstake() -> unbonding period -> claim()Table<address, PendingRequest> or SmartTable or per-user resourceFor each multi-step operation:
For each parameter used across steps:
| Parameter | Read At Step | Stored In | Admin-Changeable? | Re-Validated At Completion? |
|---|---|---|---|---|
| {param} | initiate() L{N} | {PendingRequest.field} | YES/NO | YES/NO |
| {param} | initiate() L{N} | Not stored (read at completion from resource) | YES/NO | YES (re-read) |
Red flags: Parameter is cached in pending resource at Step 1 AND admin-changeable AND NOT re-validated at Step N.
Aptos-specific caching patterns:
move_to at initiation, move_from at completion)Table entries keyed by user addressFor each cached parameter that can become stale:
Scenario A: Parameter INCREASES between steps
1. User initiates at Step 1 with param = X (cached in PendingRequest)
2. Admin/capability holder changes param to X + delta in config resource
3. User completes at Step N
4. Impact: {what happens with stale value X when current is X + delta}
Scenario B: Parameter DECREASES between steps
1. User initiates at Step 1 with param = X (cached in PendingRequest)
2. Admin/capability holder changes param to X - delta in config resource
3. User completes at Step N
4. Impact: {what happens with stale value X when current is X - delta}
BOTH directions are mandatory -- increase and decrease often have different impacts.
Common staleness impacts on Aptos:
For each parameter updated from an external source:
| Parameter | External Source | Read When | Stored Where | Re-Read At Use? | Staleness Window |
|---|---|---|---|---|---|
| {param} | {oracle / other module / timestamp} | {read_fn} | {resource.field} | YES/NO | {time between read and use} |
Analysis questions:
timestamp::now_seconds()) the correct representation of what this parameter tracks?timestamp::now_seconds() returns seconds; timestamp::now_microseconds() returns microseconds. Mixing these without ×1_000_000 conversion in comparisons, subtractions, or staleness checks → FINDING.For fee/rate parameters that apply to existing state:
| Parameter | Applies To | Retroactive? | Impact |
|---|---|---|---|
| {fee_param} | {what it affects} | YES/NO | {if retroactive: who is harmed} |
Pattern: Fee changes that affect already-accrued rewards or already-initiated operations are retroactive.
Aptos-specific retroactive risks:
For each staleness issue:
| Factor | Assessment |
|---|---|
| Who is affected? | {single user / all users with pending ops / protocol} |
| Is the impact bounded? | {capped by fee range / max delay / parameter bounds} |
| Can it be exploited intentionally? | {admin front-running / user timing manipulation} |
| Is there a recovery path? | {re-initiate / admin override / cancel pending} |
| Worst-case fund impact? | {quantified amount or percentage} |
{CONTRACTS} -- Move modules to analyze
{MULTI_STEP_OPS} -- Identified multi-step operations
{CACHED_PARAMS} -- Parameters cached at initiation (stored in pending resources)
{ADMIN_PARAMS} -- Admin-changeable parameters (in config resources)
{DELAY_PARAMS} -- Delay/cooldown parameters
{FEE_PARAMS} -- Fee/rate parameters that may apply retroactively
| Field | Required | Description |
|---|---|---|
| multi_step_ops | yes | List of multi-step operations found |
| cached_params | yes | Parameters cached across steps |
| staleness_vectors | yes | How cached params can become stale |
| external_staleness | yes | External state stored and relied upon without re-verification |
| retroactive_fees | yes | Fees applied retroactively |
| finding | yes | CONFIRMED / REFUTED / CONTESTED |
| evidence | yes | Code locations with line numbers |
| step_execution | yes | Status for each step |
| Step | Required | Completed? | Notes |
|---|---|---|---|
| 1. Enumerate Multi-Step Operations | YES | ||
| 2. Identify Cached Parameters | YES | ||
| 3. Model Staleness Impact (both directions) | YES | ||
| 3b. Update Source Audit (external state) | YES | ||
| 4. Retroactive Application Analysis | YES | ||
| 5. Assess Severity | YES |
After Step 2: If cached parameters are admin-changeable -> MUST complete Step 3 with BOTH increase and decrease scenarios.
After Step 3b: If external state is stored and re-used without re-verification -> cross-reference with ORACLE_ANALYSIS.md for oracle-sourced state.
After Step 4: Cross-reference with SEMI_TRUSTED_ROLES.md for admin functions that change these parameters and whether users can grief the parameter update mechanism.