-
Notifications
You must be signed in to change notification settings - Fork 33
feat(frontend): integrate pow into loader and guard logic #5890
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
Draft
DecentAgeCoder
wants to merge
108
commits into
main
Choose a base branch
from
feat/frontend/pow/protect-allow-signing-7
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
108 commits
Select commit
Hold shift + click to select a range
17b07aa
feat: integrate pow into loader and guard logic (scope 7)
DecentAgeCoder 362ae5c
🤖 Apply formatting changes
github-actions[bot] 5e97ad9
Merge remote-tracking branch 'origin/main' into feat/frontend/pow/pro…
DecentAgeCoder 042e19c
Replaced `POW_ENABLED` with `POW_FEATURE_ENABLED` for clarity and con…
DecentAgeCoder f029811
Merge remote-tracking branch 'origin/main' into feat/frontend/pow/pro…
DecentAgeCoder 80a3ff7
Merge branch 'main' into feat/frontend/pow/protect-allow-signing-7
AntonioVentilii af63801
Merge branch 'main' into feat/frontend/pow/protect-allow-signing-7
DecentAgeCoder ea2f451
Merge remote-tracking branch 'refs/remotes/origin/main' into feat/fro…
DecentAgeCoder 322700c
Merge branch 'refs/heads/main' into feat/frontend/pow/protect-allow-s…
DecentAgeCoder 79a1d16
Renamed POW_ENABLED to POW_FEATURE_ENABLED
DecentAgeCoder b5e5713
Using the re-factored parseBoolEnvVar(..) function
DecentAgeCoder 014881b
Merge remote-tracking branch 'origin/main' into feat/frontend/pow/pro…
DecentAgeCoder 366aaa8
Merge branch 'refs/heads/main' into feat/frontend/pow/protect-allow-s…
DecentAgeCoder 0c9e0ab
Merge remote-tracking branch 'origin/main' into feat/frontend/pow/pro…
DecentAgeCoder 2487440
Integrated `hasRequiredCycles` function to ensure users meet the mini…
DecentAgeCoder ae12b8a
Merge remote-tracking branch 'origin/main' into feat/frontend/pow/pro…
DecentAgeCoder 38ac281
Merge remote-tracking branch 'origin/main' into feat/frontend/pow/pro…
DecentAgeCoder 3a17a06
Merged conflicts
DecentAgeCoder 193d70a
Merged conflicts
DecentAgeCoder b8f5fdb
Merged changes
DecentAgeCoder e8cc92a
Working version
DecentAgeCoder 379896e
Integrated storing post messages
DecentAgeCoder 016268a
Merge remote-tracking branch 'origin/main' into feat/frontend/pow/pro…
DecentAgeCoder b141790
Integrated storing post messages
DecentAgeCoder 053c4f3
Merge remote-tracking branch 'origin/main' into feat/frontend/pow/pro…
DecentAgeCoder 5f1a6c6
🤖 Updated i18n files
github-actions[bot] aead0b6
Merge branch 'main' into feat/frontend/pow/protect-allow-signing-7
DecentAgeCoder 1eb81bf
🤖 Apply formatting changes
github-actions[bot] 69672b7
Merge branch 'main' into feat/frontend/pow/protect-allow-signing-7
DecentAgeCoder 614abfc
Merge branch 'main' into feat/frontend/pow/protect-allow-signing-7
DecentAgeCoder 1967a64
Updated
DecentAgeCoder 9582595
Merge remote-tracking branch 'origin/feat/frontend/pow/protect-allow-…
DecentAgeCoder 269e29f
Merge remote-tracking branch 'origin/main' into feat/frontend/pow/pro…
DecentAgeCoder f1fd625
Remove uncommented code
DecentAgeCoder 846ab2d
Improved error handling
DecentAgeCoder 552da7c
Merge branch 'refs/heads/main' into feat/frontend/pow/protect-allow-s…
DecentAgeCoder bff80c3
Merge remote-tracking branch 'origin/main' into feat/frontend/pow/pro…
DecentAgeCoder 7835081
Updated
DecentAgeCoder b674013
Integrated the cycles canister into the build scripts
DecentAgeCoder 7670708
Merge remote-tracking branch 'origin/main' into feat/frontend/pow/pro…
DecentAgeCoder c8ddea6
Merged PR's
DecentAgeCoder 9ad8c66
🤖 Apply formatting changes
github-actions[bot] 26236bf
Fixed linter issue: Use an `interface` instead of a `type`
DecentAgeCoder 42ce7f9
Merge remote-tracking branch 'origin/feat/frontend/pow/protect-allow-…
DecentAgeCoder 872ef2c
Merge remote-tracking branch 'origin/main' into feat/frontend/cycles-…
DecentAgeCoder 865ca68
Fixed incorrect jq mapping for WASM_FILE
DecentAgeCoder d1a85c3
initial implementation of the cycles ledger api
DecentAgeCoder 5d5798d
Added deployment of cycles_ledger to main deployment
DecentAgeCoder 0e2245c
Updated the dfx canister definition for cycles_ledger
DecentAgeCoder 9b7b0ba
Initial implementation for mapping the cycles ledger errors
DecentAgeCoder 351639d
Initial implementation of the cycles ledger canister
DecentAgeCoder c717633
Updated cycles ledger build
DecentAgeCoder b013885
Updated
DecentAgeCoder 62698e2
Merge remote-tracking branch 'origin/main' into feat/frontend/cycles-…
DecentAgeCoder 54c0d9e
Merge remote-tracking branch 'origin/main' into feat/frontend/cycles-…
DecentAgeCoder 87599c0
Merge remote-tracking branch 'refs/remotes/origin/main' into feat/fro…
DecentAgeCoder c122f0f
Updated scripts
DecentAgeCoder d4bda2b
Merge branch 'refs/heads/main' into feat/frontend/cycles-ledger/integ…
DecentAgeCoder 3e3eda5
Updated scripts
DecentAgeCoder 5fb187c
Merge branch 'refs/heads/main' into feat/frontend/cycles-ledger/integ…
DecentAgeCoder e51836c
Fixed cycles ledger deployment
DecentAgeCoder 7a3ab64
Merge branch 'refs/heads/main' into feat/frontend/pow/protect-allow-s…
DecentAgeCoder 81523ba
🤖 Updated i18n files
github-actions[bot] 7a93fca
🤖 Apply formatting changes
github-actions[bot] 70ca063
Merge branch 'refs/heads/main' into feat/frontend/cycles-ledger/integ…
DecentAgeCoder 9995872
Merge branch 'refs/heads/main' into feat/frontend/pow/protect-allow-s…
DecentAgeCoder 9549924
Generated candid files for cycles_ledger
DecentAgeCoder e68d50d
Fixed call
DecentAgeCoder 28723ae
Cleanup
DecentAgeCoder 91f8a5f
Improved and enhanced API and canister interface for cycles ledger en…
DecentAgeCoder 1ac22c6
Merge branch 'refs/heads/main' into feat/frontend/cycles-ledger/integ…
DecentAgeCoder 6922cf3
🤖 Apply formatting changes
github-actions[bot] 952901f
Merge branch 'main' into feat/frontend/cycles-ledger/integrate-cycles…
DecentAgeCoder 6400fe5
Changed order of cycles_ledger's config properties
DecentAgeCoder 5c179b9
Added a second mock principal that can be used in tests that require …
DecentAgeCoder f285da2
Added allowance utility function to access the icrc_2_allowance endpoint
DecentAgeCoder 3c30935
Implemented a convient function to get a sub-account for a principal
DecentAgeCoder d2c4e38
Created vario9us tests to test the behavior of the allowance API
DecentAgeCoder 61f3ef7
Added hard-coded env sourced variables for the cycles ledger canister id
DecentAgeCoder 47a0a19
Merge remote-tracking branch 'origin/main' into feat/frontend/cycles-…
DecentAgeCoder f2ad8d7
Removed cycles ledger integration since we are using the ledger-icrc …
DecentAgeCoder 20b9aaa
🤖 Apply formatting changes
github-actions[bot] 3f8afa0
Removed cycles ledger api since we want to relay on a the icrc-ledger…
DecentAgeCoder 2e5cb6f
Merge remote-tracking branch 'origin/feat/frontend/cycles-ledger/inte…
DecentAgeCoder 8445de8
Add doc to the allowance API function
DecentAgeCoder d9adbee
Reformated
DecentAgeCoder 029bbfc
This error mapping is not required anymore
DecentAgeCoder 39fd5c5
Removed the candid files since we relay on the icrc-ledger API
DecentAgeCoder 55a768d
Deregistered cycles_ledger since we relay on the icrc-ledger API
DecentAgeCoder 7c70759
Removed the dependency to the cycles ledger canidid files
DecentAgeCoder b25e1f3
🤖 Apply formatting changes
github-actions[bot] 9a6656b
Merge branch 'main' into feat/frontend/cycles-ledger/integrate-cycles…
DecentAgeCoder 2275a90
Merge branch 'main' into feat/frontend/cycles-ledger/integrate-cycles…
DecentAgeCoder 767a6cb
Merge remote-tracking branch 'origin/main' into feat/frontend/pow/pro…
DecentAgeCoder 2302fab
Removed legacy allowance integration
DecentAgeCoder f57a02b
Merge remote-tracking branch 'origin/main' into feat/frontend/cycles-…
DecentAgeCoder 5624d9b
Merge branch 'feat/frontend/cycles-ledger/integrate-cycles-ledger-can…
DecentAgeCoder 815e4c7
Updated
DecentAgeCoder 2509520
Merge remote-tracking branch 'origin/main' into feat/frontend/pow/pro…
DecentAgeCoder c889f52
Reverted merged cycles ledger canister integration
DecentAgeCoder cf1500b
Merge branch 'refs/heads/main' into feat/frontend/pow/protect-allow-s…
DecentAgeCoder ccedec9
we do not need to start the PoW if the user has enough cycles
DecentAgeCoder a9e4464
🤖 Apply formatting changes
github-actions[bot] 46aee82
Fixed getIcrcSubaccount() sub account conversion
DecentAgeCoder 0c35c45
Set correct constant for ledgerCanisterId
DecentAgeCoder 3533338
POW_ENABLED must be disabled since trhe frontend settings in github m…
DecentAgeCoder d5df840
Merge remote-tracking branch 'origin/main' into feat/frontend/pow/pro…
DecentAgeCoder ab99449
🤖 Updated i18n files
github-actions[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { | ||
powProtectoreNextAllowanceStore, | ||
powProtectoreProgressStore, | ||
type PowProtectorNextAllowanceData, | ||
type PowProtectorProgressData | ||
} from '$lib/stores/pow-protection.store'; | ||
import type { | ||
PostMessageDataResponsePowProtectorNextAllowance, | ||
PostMessageDataResponsePowProtectorProgress | ||
} from '$lib/types/post-message'; | ||
|
||
export interface PowProtectorWorkerInitResult { | ||
start: () => void; | ||
stop: () => void; | ||
trigger: () => void; | ||
} | ||
|
||
export type PowProtectorWorker = () => Promise<PowProtectorWorkerInitResult>; | ||
|
||
export const syncPowProgress = ({ | ||
data | ||
}: { | ||
data: PostMessageDataResponsePowProtectorProgress; | ||
}) => { | ||
const mappedData: PowProtectorProgressData = { | ||
progress: data.progress | ||
}; | ||
powProtectoreProgressStore.setPowProtectorProgressData(mappedData); | ||
}; | ||
|
||
export const syncPowNextAllowance = ({ | ||
data | ||
}: { | ||
data: PostMessageDataResponsePowProtectorNextAllowance; | ||
}) => { | ||
const mappedData: PowProtectorNextAllowanceData = { | ||
nextAllowanceMs: data.nextAllowanceMs | ||
}; | ||
powProtectoreNextAllowanceStore.setPowProtectorNextAllowanceData(mappedData); | ||
}; |
48 changes: 43 additions & 5 deletions
48
src/frontend/src/icp/services/worker.pow-protection.services.ts
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
This file was deleted.
Oops, something went wrong.
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe now can be renamed?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes the pow environment naming has been fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i mean, if you are going to remove the signer allowance, you can rename this function no?
My understanding is that once the feature is complete, the feature flag is gone, so that part inside the IF condition disappear. Or not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recommend to leave the Feature flag, so that we can disable it quickly if there are issues with the PoW in production (e.g. to much CPU overhead, or not enough Cycles per time period are allowance (fine-tuning of settings)).