Skip to content

feat(institutional-snap-controller): Institutional Snap transaction handling #30180

Merged
shane-t merged 72 commits into
mainfrom
MMI-XXX-insto-snap-2
Apr 9, 2025
Merged

feat(institutional-snap-controller): Institutional Snap transaction handling #30180
shane-t merged 72 commits into
mainfrom
MMI-XXX-insto-snap-2

Conversation

@shane-t

@shane-t shane-t commented Feb 7, 2025

Copy link
Copy Markdown
Member

Description

Explanation
Relates to MetaMask/core#5045

References
Institutional Snap RAPID

The majority of our custodians are still on ECA-1 (or have APIs with an equivalent functionality).

This presents a limitation because the keyring API does not support a workflow where the keyring does not return a signature for publication.

We propose to repurpose the existing asynchronous transaction workflow that was used for MMI. Accordingly, we would bring a small amount of MMI logic (currently code-fenced) into MetaMask, and decide on publication at an account level.

We use the existing beforePublish hook in metamask-controller to read this custodianPublishesTransaction option (set at account level by the institutional snap and tell the transaction controller not to publish based on it. As a side effect, this hook also sets the hash of the transaction and marks it as submitted.

Additionally, custodians can change some transaction parameters. In order to update the params before they are compared with the signature, the InstitutionalSnapController fetches these parameters from the snap.

Open in GitHub Codespaces

Related issues

Fixes:

Manual testing steps

Screenshots/Recordings

Screen.Recording.2025-04-09.at.14.41.43.mov

Before

After

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

@metamaskbot metamaskbot added the team-identity-deprecated DEPRECATED: team no longer exists label Feb 7, 2025
@socket-security

socket-security Bot commented Feb 7, 2025

Copy link
Copy Markdown

No dependency changes detected. Learn more about Socket for GitHub ↗︎

👍 No dependency changes detected in pull request

@shane-t shane-t force-pushed the MMI-XXX-insto-snap-2 branch from b2c29d7 to dae6d7b Compare February 18, 2025 21:06
Comment thread app/scripts/controller-init/confirmations/transaction-controller-init.ts Outdated
Comment thread app/scripts/controller-init/confirmations/transaction-controller-init.ts Outdated
Comment thread app/scripts/lib/transaction/institutional-snap/deferred-publication-hooks.ts Outdated
Comment thread app/scripts/lib/transaction/institutional-snap/deferred-publication-hooks.ts Outdated
Comment thread app/scripts/lib/transaction/institutional-snap/deferred-publication-hooks.ts Outdated
Comment thread app/scripts/lib/transaction/institutional-snap/deferred-publication-hooks.ts Outdated
Comment thread app/scripts/lib/transaction/institutional-snap/deferred-publication-hooks.ts Outdated
Comment thread app/scripts/lib/transaction/institutional-snap/deferred-publication-hooks.ts Outdated
Comment thread app/scripts/lib/transaction/institutional-snap/deferred-publication-hooks.ts Outdated
Comment thread builds.yml Outdated
@metamaskbot

metamaskbot commented Apr 1, 2025

Copy link
Copy Markdown
Collaborator

✨ Files requiring CODEOWNER review ✨

✅ @MetaMask/confirmations

  • app/scripts/controller-init/confirmations/transaction-controller-init.ts

@shane-t shane-t changed the title Institutional snap feat(institutional-snap): Add preinstalled Institutional Snap to metamask Apr 1, 2025
@shane-t shane-t marked this pull request as ready for review April 2, 2025 10:29
@metamaskbot

Copy link
Copy Markdown
Collaborator
Builds ready [9ad3b9b]
UI Startup Metrics (1221 ± 58 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyHomeuiStartup1221111714085812611311
load10679231204641158994
domContentLoaded10619171197641185994
domInteractive16135251627
firstPaint7461321208418241982
backgroundConnect106243910
firstReactRender221380112447
getState12529768
initialActions001001
loadScripts81368194061858919
setupStore8435578
WebpackHomeuiStartup21521677265519622712459
load16911300205615517721981
domContentLoaded16831296201615017671946
domInteractive171260111450
firstPaint163663195523073
backgroundConnect3710317383563
firstReactRender172523521055587
getState2933386869
initialActions317135
loadScripts16731293198314517621915
setupStore18617818448
FirefoxBrowserifyHomeuiStartup14081224178811114641645
load12571065163311213261471
domContentLoaded12571064163311213261471
domInteractive10942193268498
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect2618163162549
firstReactRender22193832329
getState7436489
initialActions001001
loadScripts12321042161310913031436
setupStore1042342368
WebpackHomeuiStartup15641367200811916181845
load13431184164810513841586
domContentLoaded13431184164710513841585
domInteractive9767193239096
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect271887102848
firstReactRender37305964049
getState9434689
initialActions001011
loadScripts13201164161910313611550
setupStore9531589

matthewwalsh0
matthewwalsh0 previously approved these changes Apr 9, 2025
Comment thread app/scripts/controller-init/messengers/transaction-controller-messenger.ts Outdated
vinistevam
vinistevam previously approved these changes Apr 9, 2025
@shane-t shane-t dismissed stale reviews from vinistevam and matthewwalsh0 via 7925f3d April 9, 2025 14:05
@shane-t shane-t requested a review from a team as a code owner April 9, 2025 14:05
@metamaskbot

Copy link
Copy Markdown
Collaborator
Builds ready [7925f3d]
UI Startup Metrics (1219 ± 54 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyHomeuiStartup1219111414115412451310
load10699771209491126995
domContentLoaded10639731206491121993
domInteractive16126161629
firstPaint6411081158432235306
backgroundConnect9637499
firstReactRender19144342025
getState11531779
initialActions001001
loadScripts81671695648843904
setupStore7520278
WebpackHomeuiStartup21601678249919222892403
load17041255217317518081993
domContentLoaded16991250216817418041983
domInteractive171258111452
firstPaint164624166425180
backgroundConnect3511454454155
firstReactRender178533741126290
getState2343135079
initialActions317135
loadScripts16891243216316917971946
setupStore22618829328
FirefoxBrowserifyHomeuiStartup13341169180913313711633
load11961057169012712291466
domContentLoaded11961057169012712281466
domInteractive10140318419099
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect24165792450
firstReactRender22185052228
getState931891978
initialActions002001
loadScripts11731036167212712031440
setupStore7475767
WebpackHomeuiStartup16031385200213716791892
load13751190176111714461626
domContentLoaded13741190176111714461625
domInteractive9536218268896
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect27185262942
firstReactRender3829168144048
getState10460789
initialActions102111
loadScripts13501169173611614241595
setupStore1453464489

@shane-t shane-t enabled auto-merge April 9, 2025 15:58
@metamaskbot

Copy link
Copy Markdown
Collaborator
Builds ready [9f537d4]
UI Startup Metrics (1237 ± 60 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyHomeuiStartup1237112713996012751334
load10889811230581152987
domContentLoaded10829761224581149989
domInteractive17135371631
firstPaint7011331231434244288
backgroundConnect97242910
firstReactRender19154542027
getState14553978
initialActions003001
loadScripts83172496255860928
setupStore8418379
WebpackHomeuiStartup21631738259919322862453
load17141364220015917842026
domContentLoaded17041361219415517742014
domInteractive171266131456
firstPaint158693115224187
backgroundConnect4110407563463
firstReactRender165543611135890
getState2143135179
initialActions318135
loadScripts16921357219014517701966
setupStore2462504168
FirefoxBrowserifyHomeuiStartup13931194171711314551621
load12461072158211313151463
domContentLoaded12451071158211313141462
domInteractive10440289389297
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect25176692547
firstReactRender23195352431
getState8339589
initialActions002001
loadScripts12221055156311312951442
setupStore6411168
WebpackHomeuiStartup15531365200912316241810
load13341186177311514001541
domContentLoaded13341185177311513991541
domInteractive9446181238996
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect26188082843
firstReactRender37296274149
getState8427489
initialActions002111
loadScripts13111161174711513721517
setupStore8520289

@metamaskbot

Copy link
Copy Markdown
Collaborator
Builds ready [25335e1]
UI Startup Metrics (1241 ± 56 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyHomeuiStartup1241114014585612761321
load10839411261611139960
domContentLoaded10779351256611137980
domInteractive17136591631
firstPaint8131201266413177947
backgroundConnect106293910
firstReactRender20154962033
getState155699699
initialActions001001
loadScripts82669198859868911
setupStore9426479
WebpackHomeuiStartup21981762266419323182512
load17321314210217218062056
domContentLoaded17241308209716818012038
domInteractive171261111450
firstPaint163623385521173
backgroundConnect4411327513967
firstReactRender175533441086491
getState1742872868
initialActions317146
loadScripts17111299209216017881977
setupStore32638858358
FirefoxBrowserifyHomeuiStartup13911198184311614511642
load12491069157211013141504
domContentLoaded12491069157211013141503
domInteractive10337202249199
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect25167092739
firstReactRender22193732226
getState1042272389
initialActions001001
loadScripts12261051154311112941484
setupStore7436567
WebpackHomeuiStartup15451333193512316281829
load13331162165511313831593
domContentLoaded13321162165511313831593
domInteractive9652172238994
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect25174862636
firstReactRender35285153945
getState8464789
initialActions003111
loadScripts13101144163011213601572
setupStore9544589

@shane-t shane-t added this pull request to the merge queue Apr 9, 2025
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Apr 9, 2025
@shane-t shane-t enabled auto-merge April 9, 2025 20:03
@shane-t shane-t added this pull request to the merge queue Apr 9, 2025
Merged via the queue into main with commit 1afb03a Apr 9, 2025
@shane-t shane-t deleted the MMI-XXX-insto-snap-2 branch April 9, 2025 21:17
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 9, 2025
@metamaskbot metamaskbot added the release-12.17.0 Issue or pull request that will be included in release 12.17.0 label Apr 9, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-12.17.0 Issue or pull request that will be included in release 12.17.0 team-identity-deprecated DEPRECATED: team no longer exists

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants