From 4a04a48ac72d9820ada0e1fc93ccba6cff02ec15 Mon Sep 17 00:00:00 2001 From: Kartik <4983318+Slokh@users.noreply.github.com> Date: Tue, 1 Dec 2026 16:13:32 +0000 Subject: [PATCH] docs(zones): document transaction outcomes, error messages and fee inputs --- .../transactions/spec-tempo-transaction.mdx | 1 + src/pages/docs/protocol/zones/execution.mdx | 23 ++++++++++++++++ src/pages/docs/protocol/zones/rpc.mdx | 26 +++++++++++++++++++ src/pages/docs/zones/withdraw.mdx | 2 +- 4 files changed, 51 insertions(+), 1 deletion(-) diff --git a/src/pages/docs/protocol/transactions/spec-tempo-transaction.mdx b/src/pages/docs/protocol/transactions/spec-tempo-transaction.mdx index 1e6c9f7be..b21ba69e5 100644 --- a/src/pages/docs/protocol/transactions/spec-tempo-transaction.mdx +++ b/src/pages/docs/protocol/transactions/spec-tempo-transaction.mdx @@ -402,6 +402,7 @@ fee_payer_hash = keccak256(0x78 || rlp([ // Note: 0x78 magic byte - Use the specific fee token 3. **Domain Separation**: Different magic bytes (`0x76` vs `0x78`) prevent signature reuse attacks between sender and fee payer roles 4. **Deterministic Fee Payer**: The fee payer address is statically recoverable from the transaction via secp256k1 signature recovery +5. **Independent Signatures**: Neither hash includes the other party's signature. Once the transaction fields are final, the sender and fee payer can sign in parallel. #### Validation Rules diff --git a/src/pages/docs/protocol/zones/execution.mdx b/src/pages/docs/protocol/zones/execution.mdx index 728882259..b7e44d64a 100644 --- a/src/pages/docs/protocol/zones/execution.mdx +++ b/src/pages/docs/protocol/zones/execution.mdx @@ -36,6 +36,14 @@ fee = FIXED_DEPOSIT_GAS × zoneGasRate Deposits must also cover the bounce-back fee. The Zone deducts it when a [failed deposit](/docs/protocol/zones/bridging#encrypted-deposits) is refunded to Tempo. To read both amounts, call `calculateDepositFee()` and `calculateBouncebackFee()` on the portal. +The bounce-back fee depends on the current Tempo base fee: + +```text +fee = ceil(bouncebackGas × baseFee / 10^12) +``` + +An `eth_call` without a gas price runs with a base fee of 0, so `calculateBouncebackFee()` returns 0 through it. Compute the fee from `bouncebackGas()` and the latest Tempo block's base fee instead. + ## Withdrawal Fees Withdrawals charge a processing fee in the withdrawn token: @@ -48,6 +56,21 @@ fee = (WITHDRAWAL_BASE_GAS + gasLimit) × tempoGasRate The sequencer, which orders Zone blocks and submits them to the portal, sets `tempoGasRate` through `ZoneOutbox.setTempoGasRate()`. It can't exceed the `maxTempoGasRate` that the portal admin sets. Call `calculateWithdrawalFee(gasLimit)` to read the fee. The withdrawal fee is charged on top of the requested withdrawal amount. It's separate from the Zone transaction gas fee. +## Fee Changes + +Each fee input has one owner and one event that announces a change: + +| Input | Set by | Event | +|-------|--------|-------| +| `zoneGasRate` | Portal admin | `ZoneGasRateUpdated` on the Tempo portal | +| `bouncebackGas` | Portal admin | `BouncebackGasUpdated` on the Tempo portal | +| `maxTempoGasRate` | Portal admin | `MaxTempoGasRateUpdated` on the Tempo portal | +| `tempoGasRate` | Sequencer | `TempoGasRateUpdated` on the Zone outbox | + +Cache the deposit fee until the portal emits one of its events. The Zone RPC [filters out](/docs/protocol/zones/rpc#event-filtering) outbox events, so read `calculateWithdrawalFee(gasLimit)` before each withdrawal. The Tempo base fee changes between blocks, so read it whenever you price a bounce-back. + +The Zone's own base fee is 0 in every block. You don't need to read it before sending a transaction. + ## Fixed Gas Costs On a Zone, each public TIP-20 transfer and approval function in the table charges a fixed 100,000 gas. This charge is separate from transaction intrinsic gas. Fixed charges prevent gas-based information leaks tied to storage state. On a standard EVM chain, gas varies when a transfer writes to a previously empty storage slot. That reveals whether the recipient has received tokens before. diff --git a/src/pages/docs/protocol/zones/rpc.mdx b/src/pages/docs/protocol/zones/rpc.mdx index 9fc26da49..98bbe043b 100644 --- a/src/pages/docs/protocol/zones/rpc.mdx +++ b/src/pages/docs/protocol/zones/rpc.mdx @@ -131,6 +131,18 @@ Returned events are restricted to those where the authenticated account is a rel All other event topics, such as system, role, and configuration events, are filtered out. Visible `logIndex` values restart at zero for each transaction, hiding the number of preceding private events. +## Submitting Transactions + +`eth_sendRawTransaction` returns the transaction hash once the Zone's pool accepts the transaction. Any error means the pool didn't add that submission. The exception is `already known`, which means the pool already holds the same transaction. + +`eth_sendRawTransactionSync` returns the filtered receipt once a Zone block includes the transaction. Use it when you need the outcome before you respond, such as when approving a card authorization. It waits 30 seconds by default, and operators can change the limit. A timeout means the pool accepted the transaction but no block included it in time. Read the outcome later with `eth_getTransactionReceipt`. + +The sender and fee payer signatures don't depend on each other, so a sponsored transaction can be [signed by both in parallel](/docs/protocol/transactions/spec-tempo-transaction#key-properties). + +## Batch Requests + +The Zone RPC accepts JSON-RPC batches of up to 100 requests. Every request in a batch uses the batch's authorization token. A hosted gateway in front of the Zone RPC can apply its own limits. + ## Zone-Specific RPC Methods | Method | Access | Description | @@ -159,6 +171,20 @@ Authenticated requests can return: | `-32006` | Method disabled | Method is not available on Zones | | `-32601` | Method not found | Method is outside the redacted RPC allowlist | | `-32602` | Invalid params | Unsupported filter, state override, or other invalid argument | +| `-32603` | Varies | Pool refusal, reverted simulation, sync timeout, or internal error | + +Several distinct failures share `-32603`. Tell them apart by the message: + +| Failure | Message | +|---------|---------| +| Pool refused the signing key, such as a revoked or unknown access key | Starts with `keychain validation failed` | +| Sender holds no enabled Zone token, on Zones that require one | `sender must hold a nonzero balance of an enabled zone token` | +| Fee payer can't cover the fee | `insufficient funds for gas * price + value` | +| Pool already holds the transaction | `already known` | +| `eth_sendRawTransactionSync` timed out | Contains `was added to the mempool but wasn't confirmed` | +| `eth_call` or `eth_estimateGas` reverted | Starts with `execution reverted` | + +A reverted `eth_call` or `eth_estimateGas` doesn't return revert data in `data`. The message includes the decoded revert reason when the Zone can decode it. ## Related diff --git a/src/pages/docs/zones/withdraw.mdx b/src/pages/docs/zones/withdraw.mdx index bd2c8d74b..3713c10e7 100644 --- a/src/pages/docs/zones/withdraw.mdx +++ b/src/pages/docs/zones/withdraw.mdx @@ -39,7 +39,7 @@ A callback is a contract call on Tempo that runs with the withdrawal, such as a #### Calculate Withdrawal Fees -Read `calculateWithdrawalFee(gasLimit)` from the deployed outbox. `gasLimit` is the gas you reserve for a callback, and `0` for a plain withdrawal. Reserve this fee and the Zone transaction fee on top of the amount withdrawn. The [withdrawal fee rules](/docs/protocol/zones/execution#withdrawal-fees) define the calculation. +Read `calculateWithdrawalFee(gasLimit)` from the deployed outbox. `gasLimit` is the gas you reserve for a callback, and `0` for a plain withdrawal. Reserve this fee and the Zone transaction fee on top of the amount withdrawn. The [withdrawal fee rules](/docs/protocol/zones/execution#withdrawal-fees) define the calculation. Read the fee before each withdrawal, because the Zone RPC doesn't expose the event that announces [a rate change](/docs/protocol/zones/execution#fee-changes).