feat: Read State - #300
Open
Aman035 wants to merge 56 commits into
Open
Conversation
- decode EvmQueryEnvelope (AccountBalance / ERC20Balance / ContractCall / StorageSlot) and SolanaQueryEnvelope (LamportBalance / SPLTokenAccount / RawAccountData) from ReadSpec.query - ExecuteRead on each chain client: deterministic pinned-height queries, canonical result encoding for identical-bytes ballot voting - new RPC methods: GetBalanceAt / GetStorageAt / GetHeaderByNumber (EVM), GetBalanceWithSlot / GetAccountInfoWithSlot (SVM)
- pushwatcher listener polls pending reads via gRPC and routes each READ_REQUEST event into the target chain's DB (Chains.GetStore) - EventProcessor gains a READ_REQUEST branch: execute on the chain's own reader -> vote -> COMPLETED; corrupt/expired -> REVERTED; transient -> retry - signer narrowed to consumer-side VoteSigner interface; evm/svm clients pass themselves as reader - implementation plan in docs/read-from-chains-implementation-plan.md
Chain clients own writes to their DB: pushwatcher resolves the target client via GetClient (same as tss consumers) and hands it the event, instead of writing into the chain's store directly. Drops the ExternalChainStoreResolver interface and the chainDBs bookkeeping in the chains manager.
ChainReader moves next to its consumer (EventProcessor), the uint256 canonical encoder moves to types.go, and the near-no-op bytes32 encoder is inlined at its single call site.
All query types plus failure modes: eth_call revert, invalid envelopes, transient RPC failures, slot/height constraints, SPL account validation.
compat/orm-api/module matched the module-dir scan, so it was moved into api/ and removed, breaking the go.mod replace and failing go mod tidy.
Generated with spawn, ORM scaffolding removed to match the other modules which all use collections. Genesis moved to keeper/genesis.go.
UniversalRead, ReadRequest and ReadResult. ReadRequest mirrors the fields universalClient expects; ReadResult carries no error text so ERROR ballots converge. Aggregates reserved for v2 median support.
Brings the universalClient read-from-chains work (pushwatcher read event handling, evm/svm/web2 read executors, SSRF-guarded web2 fetch) together with the core x/ucallback module.
Wire VoteReadResult to a voteReadResult builder that broadcasts MsgVoteReadResult through the AuthZ vote path, and register the ucallback message interface for encoding. Covered by TestVoteReadResult.
Add /ucallback.v1.MsgVoteReadResult to the validator's required grant set so read-result voting is verified at startup like every other vote.
Add a ucallback query client to pushcore and wire GetAllPendingReadRequests to AllPendingReadRequests, unwrapping UniversalRead.Request from the response. Covered by TestClient_GetAllPendingReadRequests.
Swap the temporary uread types for the generated ucallback types across the read listener, parser, and event processor. Key the read event on the on-chain requestId directly (a unique incrementing nonce) instead of hashing it. Adds TestConvertReadRequestEvent.
Adopt the generated ucallback ReadRequest/ReadResult across the evm, svm, and web2 read executors and the shared ReadRequestHandler interface, with a common NewReadErrorResult helper for votable ERROR observations.
The read path now uses the generated x/ucallback types, so the uread proto-mirror is no longer referenced.
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
Brief description of changes.
References
Changes
Testing
go test ./...Checklist