Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add extend-runtime endowment #1624

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft

Conversation

david0xd
Copy link
Contributor

@david0xd david0xd commented Jul 20, 2023

Fixes: #1604
PR for extension: MetaMask/metamask-extension#20543

This PR will add implementation for a new endowment that will allow snaps to run computation-heavy => time consuming tasks for a longer time.

The approach for dynamic extension of a snap runtime to a certain levels is accomplished by setting up a new way of communication channel through the notification system between Execution Environment and Snap Controller.

@david0xd david0xd self-assigned this Jul 20, 2023
@codecov
Copy link

codecov bot commented Jul 21, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.06% 🎉

Comparison is base (0c52d61) 95.74% compared to head (ddcb9ec) 95.80%.
Report is 14 commits behind head on main.

❗ Current head ddcb9ec differs from pull request most recent head fe757b1. Consider uploading reports for the commit fe757b1 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1624      +/-   ##
==========================================
+ Coverage   95.74%   95.80%   +0.06%     
==========================================
  Files         239      241       +2     
  Lines        5410     5489      +79     
  Branches      837      853      +16     
==========================================
+ Hits         5180     5259      +79     
  Misses        230      230              
Files Changed Coverage Δ
...snaps-controllers/src/services/ExecutionService.ts 100.00% <ø> (ø)
...es/snaps-controllers/src/snaps/endowments/index.ts 100.00% <ø> (ø)
packages/snaps-utils/src/manifest/validation.ts 100.00% <ø> (ø)
...ntrollers/src/services/AbstractExecutionService.ts 89.58% <100.00%> (+0.14%) ⬆️
...ages/snaps-controllers/src/snaps/SnapController.ts 96.63% <100.00%> (+0.13%) ⬆️
...ges/snaps-controllers/src/snaps/endowments/enum.ts 100.00% <100.00%> (ø)
...controllers/src/snaps/endowments/extend-runtime.ts 100.00% <100.00%> (ø)
...cution-environments/src/common/BaseSnapExecutor.ts 88.66% <100.00%> (+0.23%) ⬆️
...nvironments/src/common/endowments/extendRuntime.ts 100.00% <100.00%> (ø)
...cution-environments/src/common/endowments/index.ts 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@david0xd david0xd changed the title Add longRunningJob endowment Add extend-runtime endowment Aug 21, 2023
@david0xd david0xd force-pushed the dd/long-running-endowment branch 2 times, most recently from d002508 to ece95a7 Compare August 22, 2023 09:10
@david0xd david0xd force-pushed the dd/long-running-endowment branch 2 times, most recently from 0e79062 to 951d6f1 Compare August 31, 2023 09:20
Update coverage

Add working proof of concept

Update coverage and tests

Refactor and fix tests

Add test to the SnapController.test.ts and refactor

Update coverage thresholds

Add endowment:extend-runtime specification builder

Update shasum of examples

Code refactoring and improvements (1)

Update coverage thresholds (increase)

Rename endowment (longRunningJob => extendRuntime)

Refactor the names of the timer events and similar

Update examples shasum

Minor endowment refactoring

Add mechanism for resuming the timer of snaps that does not return in time

Fix unit test

Add some security mechanisms to prevent multiple calls

Small refactoring

Update shasums after rebase

Update coverage thresholds

Add new endowment to hardening tests

Add mechanism to prevent endowment to be used multiple times per one request

Update coverage thresholds

Update after rebase

Update tests and logic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Long running Snaps for synchronous work
1 participant