test(vrf): add e2e test with real paymaster and VRF services#518
Draft
test(vrf): add e2e test with real paymaster and VRF services#518
Conversation
Sets up a VRF e2e test that spins up a Katana node, declares and deploys the vrng_test Simple contract, and verifies deployment via RPC assertions. Includes a build script to compile the Cairo contracts with scarb. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Update Cairo contract to accept VRF provider address via constructor - Add full test flow: node startup, paymaster/VRF bootstrap, sidecar startup, contract deployment, and outside execution submission - Fix missing signature length prefix in VRF client's SignedOutsideExecution → Call conversion (was causing "Failed to deserialize param #2") - Whitelist VRF and estimate accounts on AVNU forwarder WIP: signature verification on VRF account's execute_from_outside_v2 still fails ("SRC9: invalid signature"). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Fix three bugs discovered during e2e testing: 1. Fix chain_id format sent to VRF server (rpc-server/cartridge/vrf.rs): Was sending hex string (e.g. "0x534e5f5345504f4c4941") but VRF server expects Cairo short string (e.g. "SN_SEPOLIA"). This caused signature hash mismatch → "SRC9: invalid signature". 2. Fix missing signature length prefix (cartridge/vrf/client.rs): The SignedOutsideExecution→Call conversion was missing the Span<felt252> length prefix before signature elements, causing "Failed to deserialize param #2" in the VRF account contract. 3. Deploy SRC9-compatible player account for VRF flow: The VRF flow wraps player calls in execute_from_outside_v2, which requires the player account to support SRC9. Genesis OZ accounts don't, so we deploy a CartridgeVrfAccount instance as the player. Additional setup needed for e2e: - Whitelist VRF and estimate accounts on AVNU forwarder - Pre-allocate RPC port so VRF server gets correct RPC URL - Sign outside execution with SNIP-12 using player's private key Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Use abigen! macro to generate typed contract bindings for SimpleVrfApp, replacing manual RPC call construction. Add initial state assertion and reorder dependencies. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace manual PaymasterServiceConfigBuilder and VrfServer setup with the existing bootstrap_paymaster and bootstrap_vrf helpers from the katana-cli sidecar module, which handle genesis account extraction and config building internally. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Document the type hashes, struct hash computation steps, and link to the SNIP-12 specification. Note the account_sdk dependency conflict that prevents reusing MessageHashRev1 directly. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…igning" This reverts commit 6f72cea.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
paymaster-serviceandvrf-serversidecar binariesSpan<felt252>length prefix inSignedOutsideExecution→Callconversion (caused deserialization failure)vrng_test::Simplecontract with constructor-based VRF provider addressbuild.rsthat compiles the Cairo contracts with scarbTest plan
cargo run -p vrf-e2e-testpasses locally (requiresvrf-serverandpaymaster-servicebinaries in PATH, built from revs insidecar-versions.toml)cartridge_vrfmock-based tests🤖 Generated with Claude Code