feat(vara-eth-api): validating injected tx promise, rename Injected -> InjectedTx#2281
Merged
osipov-mit merged 6 commits intomainfrom Jan 20, 2026
Merged
feat(vara-eth-api): validating injected tx promise, rename Injected -> InjectedTx#2281osipov-mit merged 6 commits intomainfrom
osipov-mit merged 6 commits intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors the injected transaction handling in the vara-eth API by renaming the Injected class to InjectedTx (maintaining backward compatibility) and introducing promise validation functionality. The key improvement is the addition of signature validation for transaction promises returned by validators.
- Introduced
InjectedTxPromiseclass with signature validation capability - Refactored injected transaction code into separate modules (
tx.tsandpromise.ts) - Updated the
IInjectedTransactionPromiseinterface with a flattened structure and proper types
Reviewed changes
Copilot reviewed 13 out of 14 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| apis/vara-eth/test/injected.test.ts | Added tests for promise hash generation, signature validation, and account recovery |
| apis/vara-eth/src/types/api/injected.ts | Flattened reply structure and changed value type from number to bigint, code to Hex |
| apis/vara-eth/src/eth/router.ts | Changed validators return type from readonly Hex[] to Address[] for type safety |
| apis/vara-eth/src/api/injected/tx.ts | Refactored to use new InjectedTxPromise class and updated RPC method names |
| apis/vara-eth/src/api/injected/promise.ts | New class implementing promise validation with hash computation and signature verification |
| apis/vara-eth/src/api/injected/index.ts | Added backward-compatible exports with deprecation markers |
| apis/vara-eth/src/api/index.ts | Updated exports to include new classes |
| apis/vara-eth/src/api/api.ts | Updated to use renamed InjectedTx class |
| apis/vara-eth/programs/injected/src/main.rs | Added promise generation logic for testing signature validation |
| apis/vara-eth/programs/injected/Cargo.toml | Added required dependencies for promise testing |
| apis/vara-eth/README.md | Updated documentation with promise validation example and deprecation notice |
| apis/vara-eth/Cargo.toml | Added workspace dependencies for gear-core libraries |
| apis/vara-eth/Cargo.lock | Updated dependency versions |
| apis/vara-eth/CHANGELOG.md | Documented new features and breaking changes |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
nikitayutanov
approved these changes
Jan 6, 2026
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.
resolves #2255
Added
InjectedTxPromiseclass for handling promise replies from injected transactions and validating promise signatureChanged
Injectedclass toInjectedTx(with backward-compatible alias)tx.tsandpromise.ts)IInjectedTransactionPromiseinterface: flattened reply structure, changedvaluefromnumbertobigint, changedcodetoHex