Skip to content

Dynamic RPC validation sidecar#26161

Open
mystenmark wants to merge 6 commits intomainfrom
mlogan-validation-sidecar
Open

Dynamic RPC validation sidecar#26161
mystenmark wants to merge 6 commits intomainfrom
mlogan-validation-sidecar

Conversation

@mystenmark
Copy link
Copy Markdown
Contributor

@mystenmark mystenmark commented Apr 8, 2026

The intent of this system is that it is supposed to "fail open" and make it very difficult to bring down the network by shipping a broken fix (provided the "fix" doesn't do something like "reject all transactions no matter what"). There will be a lot of testing needed to make sure the implementation lives up to that intent. This is an early preview

Summary

  • Adds the sui-dynamic-rpc-validator crate plus the framework wiring (config, network validation layer, sui-core integration) for a dynamic RPC validation sidecar (see DYNAMIC_RPC_VALIDATION_PRD.md).
  • Introduces an RpcValidator trait and macro for building sidecar validators safely, plus a parsing validator implementation.
  • Includes test infrastructure and E2E tests covering PRD Section 5.

Test plan

  • cargo check -p sui-core -p sui-node -p sui-dynamic-rpc-validator
  • cargo nextest run -p sui-dynamic-rpc-validator
  • cargo simtest -p sui-e2e-tests for the dynamic RPC validation tests

🤖 Generated with Claude Code

mystenmark and others added 6 commits April 8, 2026 18:38
Implement a demo validation target that parses incoming RPC requests
and returns true if parsing succeeds. This validates message structure
using the appropriate serialization format for each RPC type:

- Protobuf (prost): SubmitTransaction, WaitForEffects, ValidatorHealth
- BCS: ObjectInfo, TransactionInfo, Checkpoint, SystemState

For SubmitTransaction, also validates that inner transaction bytes
can be BCS-decoded as Transaction objects.

The parsing validator builds to a 1.4MB dylib (vs 17KB for the
reference validator) due to sui-types dependencies.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implements test infrastructure for the dynamic RPC validation system:

- Add ValidatorInfo struct with index and authority_name
- Add ValidatorLibraryCallback type and global test callback registry
- Add with_validator_library_callback() to TestClusterBuilder
- Add reject_zero_sender test validator example
- Create E2E test scaffolding for validation library testing

The callback mechanism allows tests to provide different validation
libraries to different validators based on their index or identity.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implements full transaction execution in E2E tests:
- test_all_validators_with_library_accepts_normal_sender: verifies
  transactions from non-zero-ending addresses succeed
- test_all_validators_with_library_rejects_zero_sender: verifies
  transactions from zero-ending addresses are rejected
- test_single_validator_with_library: verifies quorum still accepts
  when only one validator rejects

Tests now fund addresses, build transactions with custom keypairs,
and verify actual acceptance/rejection behavior.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Refactor the validation sidecar to separate safe Rust validation logic
from the unsafe FFI boundary:

- Add sidecar.rs with RpcValidator trait for safe validation methods
- Add implement_validator_exports\! macro to generate extern C functions
- Refactor reference_impl, parsing_validator, and reject_zero_sender
  examples to use the new trait/macro pattern

This allows implementors to write validation logic entirely in safe Rust
while the macro handles the unsafe pointer-to-slice conversion.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 8, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
sui-docs Ready Ready Preview, Comment Apr 8, 2026 6:44pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
multisig-toolkit Ignored Ignored Preview Apr 8, 2026 6:44pm
sui-kiosk Ignored Ignored Preview Apr 8, 2026 6:44pm

Request Review

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.

2 participants