test: add comprehensive test coverage for transaction scanning refactoring#239
Draft
ulissesferreira wants to merge 3 commits intomainfrom
Draft
test: add comprehensive test coverage for transaction scanning refactoring#239ulissesferreira wants to merge 3 commits intomainfrom
ulissesferreira wants to merge 3 commits intomainfrom
Conversation
dfb3b46 to
9dad3b7
Compare
f5ea0c1 to
69f4ef4
Compare
9dad3b7 to
a1ff63e
Compare
69f4ef4 to
f4f393c
Compare
a1ff63e to
48d2e57
Compare
f4f393c to
f13bc68
Compare
48d2e57 to
b17aa50
Compare
f13bc68 to
2136255
Compare
b17aa50 to
6c584d8
Compare
2136255 to
df13481
Compare
Tron transactions must contain exactly one contract per the protocol spec. This adds isTransactionWellFormed and assertTransactionStructure to validate this at every deserialization entry point, rejecting malformed payloads early with InvalidParamsError. Uses @metamask/superstruct to define TransactionRawDataStruct with custom validation logic. The single-contract assumption is now documented in JSDoc with protocol references.
The Security Alerts API only supports simulation for TransferContract, CreateSmartContract, and TriggerSmartContract. Previously all transactions were sent for simulation, causing incorrect alerts that blocked user flows. Introduces a SimulationStatus enum (Completed, Skipped, Failed), moves contract type checking into SecurityAlertsApiClient, refactors the scan pipeline to accept raw transaction data directly, and updates the UI to show "unsupported contract for simulation" instead of blocking the user.
…oring - Add dedicated TransactionScanService unit test suite - Add tests for isTransactionWellFormed type consistency validation - Add tests for assertTransactionStructure - Add tests for SecurityAlertsApiClient.isContractTypeSupported - Update all render/confirmation tests for SimulationStatus expectations - Update coverage thresholds
6c584d8 to
69bbf90
Compare
df13481 to
9932565
Compare
4 tasks
69bbf90 to
e465a02
Compare
e465a02 to
1c14162
Compare
Base automatically changed from
NEB-475-disable-scanning-unsupported-transactions
to
main
March 19, 2026 13:51
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.
Explanation
Comprehensive test coverage for the NEB-475 changes. This PR:
TransactionScanServiceunit test suite covering: malformed transactions, unsupported contracts, API success/error, analytics tracking, origin replacement, asset diff mappingSimulationStatusexpectations andassertTransactionStructurereferencesisTransactionWellFormedtype consistency validationassertTransactionStructure(valid, multiple contracts, empty contracts)SecurityAlertsApiClient.isContractTypeSupported(all supported + unsupported types)buildTransactionRawData(TransferContract, TriggerSmartContract, round-trip)MOCK_TRANSACTION_RAW_DATA,WELL_FORMED_DESERIALIZED_TRANSACTION)References
Checklist