Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
23 changes: 23 additions & 0 deletions src/pages/docs/protocol/zones/execution.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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.
Expand Down
26 changes: 26 additions & 0 deletions src/pages/docs/protocol/zones/rpc.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/pages/docs/zones/withdraw.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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).

<span id="submit-through-the-zone-outbox" />
<span id="request-a-withdrawal" />
Expand Down
Loading