feat: Add metadata to sentinel requests#24507
Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
There was a problem hiding this comment.
I approve as I understand that we want to move fast with this but I have some concerns about the overall approach of sending the full TxMeta to sentinel:
- We certainly do not need everything so we are not really following the principle of sharing the minimum. We could have PII in there and until now the txMeta was living in the client.
- I sound like a broken record 😅 , but I think that we are creating a system that is different from bridge-api (metametrics event) and that will be only half satisfying because we will miss some non smart-transactions and it will be very hard to reconcile data between preset, mixpanel,...
| chainId: Hex; | ||
| data: Hex; | ||
| to: Hex; | ||
| txMeta?: TransactionMeta; |
There was a problem hiding this comment.
This is a massive object, with tons and tons of data, I'd strongly recommend sending the minimum payload required with explicit fields for what is actually required, via a new dedicated type.
| // Get transactionMeta based on the last transaction ID | ||
| const lastTransaction = transactions[transactions.length - 1]; | ||
| // Find the first non-approval transaction in the batch | ||
| const approvalTypes = [ |
There was a problem hiding this comment.
This could be moved into some util function, e.g. getFirstNonApprovalTransaction
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #24507 +/- ##
==========================================
- Coverage 79.61% 79.60% -0.02%
==========================================
Files 4191 4201 +10
Lines 107856 108359 +503
Branches 22185 22318 +133
==========================================
+ Hits 85873 86256 +383
- Misses 15987 16071 +84
- Partials 5996 6032 +36 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
I have read the CLA Document and I hereby sign the CLA |
7d5b623
Cal-L
left a comment
There was a problem hiding this comment.
LGTM. Let's make sure to follow up with a PR to apply these to the core repo and remove this patch once that's done.
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsThe changes add transaction type metadata (txType) to smart transaction submissions and EIP-7702 delegation relay requests. Key changes:
The changes are additive (adding metadata for tracking/analytics) rather than modifying core transaction logic, which reduces risk. However, they touch critical transaction submission paths:
No direct E2E tests exist for smart-transactions or delegation-7702 specifically, but the functionality is exercised through swap/bridge flows and confirmation flows. |
|



Description
This PR adds transaction metadata context to Sentinel relay transactions and Smart Transactions controller requests. This enables the backend services to have access to transaction type information when processing relay and batch transactions for improved analytics and handling.
Changes:
metadatafield (withtxType) toRelaySubmitRequestinterface and included it in delegation-7702 publish relay requests@metamask/smart-transactions-controllerto:SentinelMetaandSignedTransactionWithMetadatasubmitSignedTransactionsto acceptsignedTransactionsWithMetadatarawTxsWithMetadatain the batch submit payload sent to the STX APIsmart-publish-hook.tsto buildsignedTransactionsWithMetadataarray with each transaction's type from its metadataChangelog
CHANGELOG entry: null
Related issues
Fixes:
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Introduces transaction metadata to Sentinel and STX flows for better context on backend processing.
@metamask/smart-transactions-controllerto acceptsignedTransactionsWithMetadataand sendrawTxsWithMetadatain submit payload; export newtypes(SentinelMeta,SignedTransactionWithMetadata)smart-publish-hook.tsto buildsignedTransactionsWithMetadata(derivingtxTypefrom each transaction) and pass alongsidesignedTransactionsmetadatatoRelaySubmitRequestand include{ txType }indelegation-7702-publish.tsrelay requests; importSentinelMetaintransaction-relay.tspackage.jsonandyarn.lockto apply the controller changesWritten by Cursor Bugbot for commit 10568c3. This will update automatically on new commits. Configure here.