agents/skills/sui/temporal-parameter-staleness/SKILL.md
Trigger Pattern TEMPORAL flag (required) - Inject Into Breadth agents, depth-state-trace
npx skillsauth add plamentsv/plamen temporal-parameter-stalenessInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Trigger Pattern: TEMPORAL flag (required) Inject Into: Breadth agents, depth-state-trace Purpose: Analyze cached parameters in multi-step operations on Sui for staleness when capability holders change them mid-operation. Time source on Sui is the shared Clock object at address 0x6.
epoch|period|duration|delay|cooldown|lock_period|timelock|
unbonding_period|claim_delay|withdraw_delay|maturity_time|
clock::timestamp_ms|tx_context::epoch
Find all operations that span multiple transactions:
| Operation | Step 1 (Initiate) | Wait Condition | Step N (Complete) | |-----------|-------------------|----------------|-------------------| | {op_name} | {module::initiate_fn}() | {wait_condition} | {module::complete_fn}() |
Sui-specific multi-step patterns:
Time sources on Sui:
clock::timestamp_ms(clock: &Clock): Real-time milliseconds. Shared object at 0x6. Monotonically increasing. Used for time-based delays.tx_context::epoch(ctx: &TxContext): Epoch number. Incremented roughly every 24 hours. Used for epoch-based staking/unstaking.For each multi-step operation:
For each parameter used across steps:
| Parameter | Stored In | Read At Step | Cached? | Admin-Changeable? | Re-Validated At Completion? | |-----------|----------|-------------|---------|-------------------|----------------------------| | {param} | Shared config object | initiate() L{N} | YES/NO | YES/NO (requires {CapType}) | YES/NO | | {delay_param} | User's receipt object | initiate() L{N} | YES (in receipt) | YES/NO | YES/NO |
Sui caching patterns:
Red flags: Parameter is cached at Step 1 AND changeable via admin capability AND NOT re-validated at Step N.
For each cached parameter that can become stale:
Scenario A: Parameter INCREASES between steps
1. User initiates at Step 1 with param = X (stored in receipt)
2. Admin (via AdminCap) changes param to X + delta in shared config
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
2. Admin changes param to X - delta
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.
Sui-specific staleness vectors:
PTB bypass check (CRITICAL): Can Steps 1 and N both be executed within a single PTB?
clock::timestamp_ms comparisons): bypassed -- same Clock timestamp within a PTBtx_context::epoch comparisons): bypassed -- same epoch within a PTBFor each parameter updated from an external source:
clock::timestamp_ms (continuous) vs tx_context::epoch (discrete)? Is the choice appropriate?clock::timestamp_ms() returns milliseconds; external sources (Pyth publish_time, cross-chain timestamps) typically use seconds. Any comparison or subtraction without ×1000 conversion → 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.
Sui-specific retroactive patterns:
For each staleness issue:
Severity factors specific to Sui:
{CONTRACTS} -- Move modules to analyze
{MULTI_STEP_OPS} -- Identified multi-step operations
{CACHED_PARAMS} -- Parameters cached at initiation
{ADMIN_PARAMS} -- Admin-changeable parameters (via capability)
{DELAY_PARAMS} -- Delay/cooldown parameters (clock or epoch based)
{FEE_PARAMS} -- Fee/rate parameters that may apply retroactively
{CLOCK_USAGE} -- Functions using clock::timestamp_ms
{EPOCH_USAGE} -- Functions using tx_context::epoch
| 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 | | 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 | | | | 3 (PTB bypass check) | YES | | Can Steps 1+N execute in same PTB? | | 3b. Update Source Audit | YES | | | | 4. Retroactive Application Analysis | YES | | | | 5. Assess Severity | YES | | |
After Step 2: If cached parameters are admin-changeable via capability -> MUST complete Step 3 with BOTH increase and decrease scenarios.
After Step 3 (PTB bypass): If PTB bypass is possible -> escalate severity (time controls are ineffective). Only hot-potato receipts enforce multi-transaction separation.
After Step 4: Cross-reference with SEMI_TRUSTED_ROLES.md for capability holders that change these parameters -- is the parameter change within or outside the role's stated trust boundary?
development
Prepare Solidity projects for a security audit — test coverage, test quality, NatSpec docs, code hygiene, dependency health, best-practice enforcement, deployment readiness, and project documentation checks. Generates a scored Audit Readiness Report and optionally runs static analysis. Trigger on: "prepare for audit", "audit readiness", "pre-audit check", "audit prep", "NatSpec check", or any request to review a Solidity codebase before a security review.
development
Launch the Plamen deterministic Web3 security audit pipeline
development
Run the Plamen smart-contract audit wizard in Codex
testing
Launch the Plamen deterministic L1 infrastructure audit pipeline