Skip to content

Commit 918911c

Browse files
committed
Initial commit
0 parents  commit 918911c

414 files changed

Lines changed: 132915 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.cargo/config.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[alias]
2+
x = "run --package tempo-xtask --"
3+
xtask = "run --package tempo-xtask --"
4+
docs = "doc --workspace --all-features --no-deps"
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
name: zones-deploy-debug
3+
description: Deploy Tempo Zones, start zone nodes, validate router swap-and-deposit flows, and debug zone sync, portal ingestion, withdrawal, sequencer key, and generated zone artifact issues in this repository. Use when working with just deploy-zone, zone-up, deploy-router, demo-swap-and-deposit, or generated/<name>/zone.json.
4+
---
5+
6+
# Zones Deploy Debug
7+
8+
Use this skill for repo-local zone deployment, smoke tests, and sync debugging.
9+
10+
## Start here
11+
12+
1. If the zone already exists, read `generated/<name>/zone.json` first.
13+
2. For real smoke tests, prefer `release` for `tempo-zone`.
14+
3. Use the `Justfile` and `docs/ZONES.md` as the source of truth for user-facing commands.
15+
4. Read `references/commands.md` for concrete command patterns and troubleshooting checks.
16+
17+
## Preferred workflow
18+
19+
1. Build `tempo-zone` in release before judging sync speed.
20+
2. Deploy a fresh zone if you need a clean test surface.
21+
3. Start the zone node and confirm `http://localhost:8546` is answering.
22+
4. For a direct bridge smoke test, run `just max-approve-portal`, `just send-deposit`, `just max-approve-outbox`, then `just send-withdrawal`.
23+
5. Deploy the router for that zone.
24+
6. Run the same-zone swap-and-deposit demo.
25+
7. If the demo stalls, compare the L1 block of the relevant tx with the latest `l1_block=` in the zone log before assuming the router flow is broken.
26+
27+
## What to inspect
28+
29+
- `generated/<name>/zone.json`
30+
- `Justfile`
31+
- `docs/ZONES.md`
32+
- `/tmp/tempo-zone-<name>*/logs/*/reth.log`
33+
34+
## Known sharp edges
35+
36+
- Fresh `dev` nodes can look broken because they are still compiling and replaying L1; use `release` for meaningful validation.
37+
- Direct deposit/withdraw validation needs both approvals: `just max-approve-portal` before depositing and `just max-approve-outbox` before withdrawing.
38+
- The demo's first real wait point is token enablement on L2. If the zone is still replaying older L1 blocks, `demo-swap-and-deposit` can time out before the `TokenEnabled` event appears.
39+
- The current `just demo-swap-and-deposit` recipe takes optional overrides positionally, not as `amount=... tick=...`.
40+
- If a restarted zone crashes while seeding `transferPolicyId` for a temporary token, check `crates/tempo-zone/src/l1_state/tip403/cache.rs` and consider retesting with a fresh zone.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
interface:
2+
display_name: "Zones Deploy Debug"
3+
short_description: "Deploy Tempo Zones and debug sync issues"
4+
default_prompt: "Use $zones-deploy-debug to deploy a zone, validate router flows, or debug zone sync and portal issues."
Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
# Zone Commands
2+
3+
## Release-first smoke test
4+
5+
```bash
6+
cargo build --bin tempo-zone --release
7+
```
8+
9+
Create a fresh zone when you need a clean router test:
10+
11+
```bash
12+
just deploy-zone my-zone
13+
```
14+
15+
That recipe creates the zone, stores `sequencerKey` in `generated/my-zone/zone.json`, and starts the node immediately. If you need tighter control, run:
16+
17+
```bash
18+
target/debug/tempo-xtask create-zone --output generated/my-zone --l1-rpc-url "$HTTP_RPC" --sequencer "$SEQUENCER_ADDR" --private-key "$SEQUENCER_KEY"
19+
target/debug/tempo-xtask set-encryption-key --l1-rpc-url "$HTTP_RPC" --portal "$PORTAL" --private-key "$SEQUENCER_KEY"
20+
```
21+
22+
## Start a zone in release
23+
24+
```bash
25+
RUST_LOG=warn just zone-up my-zone false release
26+
```
27+
28+
Health check:
29+
30+
```bash
31+
cast block-number --rpc-url http://localhost:8546
32+
```
33+
34+
Read deployment metadata:
35+
36+
```bash
37+
jq '{zoneId, portal, tempoAnchorBlock, zoneFactory, swapAndDepositRouter, sequencerAddress}' generated/my-zone/zone.json
38+
```
39+
40+
## Direct deposit + withdrawal validation
41+
42+
Set the active portal first:
43+
44+
```bash
45+
export L1_PORTAL_ADDRESS="$(jq -r '.portal' generated/my-zone/zone.json)"
46+
```
47+
48+
Approve the L1 portal before depositing:
49+
50+
```bash
51+
just max-approve-portal
52+
```
53+
54+
Send a deposit to the zone:
55+
56+
```bash
57+
just send-deposit 1000000
58+
```
59+
60+
Approve the L2 outbox before withdrawing:
61+
62+
```bash
63+
just max-approve-outbox
64+
```
65+
66+
Request a withdrawal back to L1:
67+
68+
```bash
69+
just send-withdrawal 400000
70+
```
71+
72+
`just send-withdrawal` only waits for L1 finalization if both `L1_RPC_URL` and `L1_PORTAL_ADDRESS` are set.
73+
74+
## Router validation flow
75+
76+
Deploy the router:
77+
78+
```bash
79+
just deploy-router my-zone
80+
```
81+
82+
Run the demo with defaults:
83+
84+
```bash
85+
just demo-swap-and-deposit my-zone
86+
```
87+
88+
If you need overrides, pass them positionally because the current recipe treats them as positional args:
89+
90+
```bash
91+
just demo-swap-and-deposit my-zone 100000000 0 http://localhost:8546
92+
```
93+
94+
Direct xtask equivalent:
95+
96+
```bash
97+
target/debug/tempo-xtask demo-swap-and-deposit \
98+
--zone-dir generated/my-zone \
99+
--l1-rpc-url "$HTTP_RPC" \
100+
--zone-rpc-url http://localhost:8546 \
101+
--private-key "$PRIVATE_KEY" \
102+
--amount 100000000 \
103+
--tick 0
104+
```
105+
106+
## Sync debugging
107+
108+
Tail the zone log:
109+
110+
```bash
111+
tail -f /tmp/tempo-zone-my-zone*/logs/*/reth.log
112+
```
113+
114+
Useful patterns:
115+
116+
```bash
117+
rg -n "Prepared L1 block deposits|Including advanceTempo|TokenEnabled|DepositProcessed|WithdrawalProcessed" /tmp/tempo-zone-my-zone*/logs/*/reth.log
118+
```
119+
120+
When `demo-swap-and-deposit` stalls at token enablement:
121+
122+
1. Get the L1 tx block for the `enableToken` tx:
123+
124+
```bash
125+
cast receipt <tx-hash> --rpc-url "$HTTP_RPC"
126+
```
127+
128+
2. Compare it with the latest processed L1 block in the log:
129+
130+
```bash
131+
tail -n 200 /tmp/tempo-zone-my-zone*/logs/*/reth.log | rg "Prepared L1 block deposits|Including advanceTempo"
132+
```
133+
134+
If the zone is still behind the tx block, wait longer or rerun the test with a `release` node.
135+
136+
## Known failure modes
137+
138+
- `swapAndDepositRouter not found`: run `just deploy-router <name>` or pass `--router`.
139+
- Missing sequencer key: read `sequencerKey` from `generated/<name>/zone.json` or set `SEQUENCER_KEY`.
140+
- Timeout waiting for `TokenEnabled`: the zone is usually still catching up.
141+
- Restart crash with `failed to seed transferPolicyId ... Uninitialized`: inspect `crates/tempo-zone/src/l1_state/tip403/cache.rs` and prefer a fresh zone for smoke tests involving temporary tokens.

.config/nextest.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[profile.ci]
2+
fail-fast = false
3+
retries = 2
4+
test-threads = "num-cpus"
5+
6+
# Integration tests spin up full reth nodes — limit concurrency to avoid
7+
# resource contention and flaky timeouts on CI runners.
8+
[[profile.ci.overrides]]
9+
filter = "test(/^(e2e|l1_e2e|restart_e2e)::/) | test(advance_tempo)"
10+
threads-required = 8

.config/zepter.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
version:
2+
format: 1
3+
# Minimum zepter version that is expected to work. This is just for printing a nice error
4+
# message when someone tries to use an older version.
5+
binary: 0.13.2
6+
7+
# The examples in the following comments assume crate `A` to have a dependency on crate `B`.
8+
workflows:
9+
check:
10+
- [
11+
"lint",
12+
# Check that `A` activates the features of `B`.
13+
"propagate-feature",
14+
# These are the features to check:
15+
"--features=std,op,asm-keccak,jemalloc,jemalloc-prof,serde-bincode-compat,serde,test-utils,arbitrary,bench,reth-codec,min-error-logs,min-warn-logs,min-info-logs,min-debug-logs,min-trace-logs,otlp,js-tracer",
16+
# Do not try to add a new section to `[features]` of `A` only because `B` exposes that feature. There are edge-cases where this is still needed, but we can add them manually.
17+
"--left-side-feature-missing=ignore",
18+
# Ignore the case that `A` is outside of the workspace. Otherwise it will report errors in external dependencies that we have no influence on.
19+
"--left-side-outside-workspace=ignore",
20+
# Auxiliary flags:
21+
"--offline",
22+
"--locked",
23+
"--show-path",
24+
"--quiet",
25+
]
26+
default:
27+
# Running `zepter` with no subcommand will check & fix.
28+
- [$check.0, "--fix"]
29+
30+
# Will be displayed when any workflow fails:
31+
help:
32+
text: |
33+
Tempo uses the Zepter CLI to detect abnormalities in Cargo features, e.g. missing propagation.
34+
35+
It looks like one or more checks failed; please check the console output.
36+
37+
You can try to automatically address them by installing zepter (`cargo install zepter --locked`) and simply running `zepter` in the workspace root.
38+
links:
39+
- "https://github.com/ggwpez/zepter"

.dockerignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
**/.git
2+
contrib/
3+
docs/
4+
localnet/
5+
scripts/

.envrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export AMP_TOOLBOX=".amp/tools"

.gitattributes

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
* text=auto
2+
.gitattributes !filter !diff
3+
4+
.env.example linguist-language=Dotenv
5+
Dockerfile.* linguist-language=Dockerfile
6+
biome.json linguist-language=JSON-with-Comments

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @mattsse @0xKitsune

0 commit comments

Comments
 (0)