Skip to content

test(saya-tee): settle blocks carrying cross-chain messages - #581

Merged
kariy merged 2 commits into
mainfrom
test/saya-messaging-settlement-regression
May 31, 2026
Merged

test(saya-tee): settle blocks carrying cross-chain messages#581
kariy merged 2 commits into
mainfrom
test/saya-messaging-settlement-regression

Conversation

@kariy

@kariy kariy commented May 29, 2026

Copy link
Copy Markdown
Member

What

Adds a regression phase to the persistent-TEE e2e (tests/saya-tee) that settles blocks which actually carry cross-chain messages — in both directions.

The existing harness only drives plain transfer blocks, so its messages_commitment is always over an empty message set. That's why a real bug went uncaught: saya hashed L1→L2 messages with the Ethereum keccak256 formula instead of the Poseidon hash Katana commits to, so any settled block that consumes an L1→L2 message is rejected by piltover with 'tee: invalid messages' and settlement stalls.

How

After the existing plain-block loop, the test:

  1. declares + deploys the contract_msg_starknet l1-handler on the appchain;
  2. L1→L2: calls send_message_to_appchain on the L2 piltover core, lets the appchain messaging collector relay it into an l1-handler tx, then asserts the block settles;
  3. L2→L1: emits send_message_to_l1 from the appchain, then asserts the block settles.

Supporting harness changes: enable the messaging collector on the L3 node (config.messaging), and raise the L2 node's max_event_page_size (the collector queries with chunk_size = 200; test_config capped it at 100).

Verification

  • Green against a Poseidon-hashing saya-tee: both message blocks settle, test passes.
  • Red against a keccak-hashing saya-tee: the L1→L2 message block fails 'tee: invalid messages', piltover stalls, the settlement assertion times out.

Note

This guards the fix in saya (dojoengine/saya#77). Until that lands, building saya-tee from saya main (pre-fix) makes this test correctly fail — so this should merge after the saya fix is available to CI.

The persistent-TEE e2e only settled plain transfer blocks, so it never built
a `messages_commitment` over a real message — the exact path that broke when
saya hashed L1->L2 messages with the Ethereum keccak formula instead of the
Poseidon hash Katana commits to (piltover rejects such a block with
'tee: invalid messages', stalling settlement).

Add a phase after the plain-block loop that drives a message in each direction
through a settled block:

- deploy the `contract_msg_starknet` l1-handler on the appchain;
- L1->L2: `send_message_to_appchain` on the L2 piltover core, relayed by the
  appchain messaging collector into an l1-handler tx, then assert the block
  settles;
- L2->L1: emit `send_message_to_l1` from the appchain, then assert the block
  settles.

Enables the messaging collector on the L3 node and raises the L2 node's
`max_event_page_size` to fit the collector's query. Verified red against a
keccak-hashing saya-tee (stalls at the L1->L2 block) and green against the
Poseidon fix.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@kariy
kariy force-pushed the test/saya-messaging-settlement-regression branch from 7a40a7a to 684dab2 Compare May 29, 2026 23:05
@kariy
kariy marked this pull request as ready for review May 29, 2026 23:05
@kariy

kariy commented May 29, 2026

Copy link
Copy Markdown
Member Author

Ran cargo +nightly-2025-02-20 fmt (clean) and cargo +nightly-2025-06-20 clippy -p saya-tee-e2e-test --all-targets with the repo's scripts/clippy.sh flags. The new code is lint-clean. clippy does surface 7 pre-existing lints in the harness (assertions.rs, bootstrap.rs, saya.rs, and untouched parts of main.rs/nodes.rs) — this crate isn't clippy-gated in CI (clippy.sh runs -p katana only), so they predate this PR. Left them out to keep the diff focused; happy to clean them up in a separate pass.

The `test` workflow (and its `saya-tee-e2e` job) is path-filtered to
`crates/**`/`bin/**`, so PRs that only touch integration-test crates under
`tests/**` (e.g. the saya-tee e2e) never trigger it — every workflow shows as
skipped. Add `tests/**/*.rs`, `tests/**/Cargo.toml`, and `Cargo.lock` to both
the workflow `paths` filter and the `detect-changes` `broader-rust` filter so
those changes run the workspace jobs.

Bump the saya pin the `saya-tee-e2e` job builds from `17c0ee0` to `v0.4.1`,
which includes the L1->L2 Poseidon message-hash fix (dojoengine/saya#77) the
new messaging regression test depends on.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@codecov

codecov Bot commented May 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.62%. Comparing base (9bde0ae) to head (b5311c0).
⚠️ Report is 429 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #581      +/-   ##
==========================================
- Coverage   73.32%   68.62%   -4.70%     
==========================================
  Files         209      321     +112     
  Lines       23132    45352   +22220     
==========================================
+ Hits        16961    31125   +14164     
- Misses       6171    14227    +8056     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@kariy
kariy merged commit eaac1f3 into main May 31, 2026
16 of 17 checks passed
@kariy
kariy deleted the test/saya-messaging-settlement-regression branch May 31, 2026 05:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant