AGENT SKILL

estimate-cross-domain-message-latency

Use when an SLA or retry budget depends on how long an L1-to-L2 or L2-to-L1 message takes, which differs by orders of magnitude by direction.

License 许可
MIT
最近更新
2026-11-15
Stars
★ 81
Forks
17

01 前言 Front Matter

name
estimate-cross-domain-message-latency
description
Use when an SLA or retry budget depends on how long an L1-to-L2 or L2-to-L1 message takes, which differs by orders of magnitude by direction.

02 资源文件 3

03 SKILL.md 正文

Estimate cross-domain message latency

L1 to L2 is fast — minutes — while L2 to L1 waits out the rollup's settlement and challenge window, so a single "cross-chain latency" number is always wrong in one direction.

Procedure

  1. Split by direction before estimating anything.

    • L1 to L2 (deposits, retryables): bounded by L2 block times once the sequencer is healthy — roughly a minute to minutes on OP Stack, and ~10 minutes to create-and-execute on Arbitrum.
    • L2 to L1 (withdrawals, sendTxToL1): must wait for the output/assertion to post on L1 and then the challenge window before a claim — 7 days (OP) or ~6.4 days (Arbitrum).
  2. Read the settlement cadence, which governs the L2-to-L1 leg more than any fixed constant:

    cast call $L2_OUTPUT_ORACLE "L2_BLOCK_TIME()(uint256)" --rpc-url $L1RPC
    cast logs --address $L2_OUTPUT_ORACLE "OutputProposed(bytes32,uint256,uint256,uint256)" --rpc-url $L1RPC --from-block $RECENT
    
  3. For a live message, measure rather than model: take the source SentMessage (or deposit) event timestamp and the destination execution timestamp, and subtract.

    case: src_ts=$(cast receipt $SRC_TX --rpc-url $SRC_RPC --field blockNumber) -> block timestamp
          dst_ts=$(cast receipt $DST_TX --rpc-url $DST_RPC --field blockNumber) -> block timestamp
    latency = dst_ts - src_ts
    
  4. For a budget, use the pessimistic branch. L1 to L2 under a healthy sequencer is minutes, but under an outage it is the forced-inclusion window (Arbitrum delayed inbox 24 h). L2 to L1 is always at least the challenge period unless you use a third-party bridge with its own liquidity model.

  5. Convert block-counted windows to time with the live L1 block time, not the nominal 12 s, and fold in the source-chain confirmation requirement (an L1 message is not actionable until it is final enough for the bridge's config).

  6. Present a table: direction, mechanism, best-case, expected, worst-case, and the on-chain parameter backing the window. Mark any figure you pulled from docs rather than chain.

Pitfalls

  • Reusing the L1-to-L2 number for L2-to-L1; the challenge window dominates and the estimate is off by a week.
  • Assuming L1-to-L2 is instant because deposits "always work" — during a sequencer outage they queue.
  • Measuring a warm sample that happened to post right before an output root landed and reading that as typical; the challenge window still applies to L2-to-L1.
  • Ignoring that a fast third-party bridge quotes minutes precisely because it is not the canonical path and carries its own trust cost.
  • Forgetting source-chain finality before the destination processes the message.

Verification

SRC_TS=$(cast block $(cast receipt $SRC_TX --rpc-url $SRC_RPC --field blockNumber) --rpc-url $SRC_RPC --field timestamp)
DST_TS=$(cast block $(cast receipt $DST_TX --rpc-url $DST_RPC --field blockNumber) --rpc-url $DST_RPC --field timestamp)
echo "latency_seconds=$((DST_TS - SRC_TS))"

Report the direction, the best/expected/worst case with the on-chain window source, and the measured latency for any live message — labelled measured versus modelled.

04 同仓库更多 Skills

jiayaoqijia
jiayaoqijia/cryptoskill

troves

Deposit and withdraw from Troves DeFi yield vault strategies on Starknet. View available strategies, check positions, and manage vault deposits. Use this skill when the user mentions Troves, vault, yield vault, DeFi vault, strategy, yield farming, vault deposit, vault withdraw, earning yield through vaults, passive yield strategies, or wants to deposit into or withdraw from a yield strategy — even if they don't say "Troves" explicitly.

★ 81
jiayaoqijia
jiayaoqijia/cryptoskill

trade

Swap tokens on Starknet via Fibrous DEX aggregator. Supports per-provider selection (avnu, ekubo, or auto to race all). Use this skill when the user wants to swap, exchange, trade, convert, buy, or sell one token for another on Starknet. Also use when the user asks about token prices, exchange rates, DEX routing, best swap route, or wants to check how much they would receive for a given amount — even if they don't explicitly say "swap".

★ 81
jiayaoqijia
jiayaoqijia/cryptoskill

staking

Stake, unstake, claim, and compound rewards for STRK, WBTC, tBTC, SolvBTC, and LBTC on Starknet. View validators, pools, and staking positions. Use this skill when the user mentions staking, delegating, validators, staking pools, rewards, compounding, unstaking, earning yield, passive income on crypto, or wants to earn on their STRK or BTC tokens — even if they don't say "stake" explicitly.

★ 81
jiayaoqijia
jiayaoqijia/cryptoskill

send

Send STRK, ETH, or any ERC-20 token to a Starknet address. Supports simulation (dry-run) before execution. Use this skill when the user wants to send, transfer, pay, tip, or move tokens to another wallet address on Starknet. Also trigger when the user mentions sending funds to someone, making a payment, transferring assets, or moving crypto to a specific address — even if they just say "pay 10 STRK to 0x...".

★ 81
jiayaoqijia
jiayaoqijia/cryptoskill

portfolio

View a comprehensive DeFi portfolio dashboard and optimize portfolio allocation via automated rebalancing. Use this skill when the user wants an overview, summary, dashboard, total value, net worth, portfolio rebalancing, target allocation, or wants to see all their DeFi positions across Starknet at once. Also trigger when the user asks "what do I have", "show me everything", "how much am I worth", "my positions", "my investments", "rebalance my portfolio", "I want 50% ETH", "optimize my holdings", or any request for a holistic view of their Starknet holdings — even if they don't explicitly say "portfolio".

★ 81
jiayaoqijia
jiayaoqijia/cryptoskill

multi-swap

Execute multiple token swaps in a single Starknet transaction via Fibrous (default). Supports per-provider selection (avnu, ekubo, or auto to race all). Supports 2-3 swap pairs bundled into one multicall. Use this skill when the user wants to swap multiple token pairs at once, do batch swaps, execute several trades simultaneously, perform parallel swaps, or do bulk trading in one transaction. Also trigger when the user mentions "two swaps", "three swaps", "swap X and Y at the same time", or wants to convert multiple tokens in a single call.

★ 81