-
Notifications
You must be signed in to change notification settings - Fork 140
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
Change account linking pragma to run-time configuration of execution #2380
Change account linking pragma to run-time configuration of execution #2380
Conversation
Cadence Benchstat comparisonThis branch with compared with the base branch onflow:master commit 41f1c5b Collapsed results for better readability
|
Codecov Report
@@ Coverage Diff @@
## master #2380 +/- ##
=======================================
Coverage 78.50% 78.51%
=======================================
Files 316 316
Lines 68471 68492 +21
=======================================
+ Hits 53755 53774 +19
- Misses 12918 12920 +2
Partials 1798 1798
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
…t pragma, add tests
4042: Update to Cadence v0.31.5-account-linking-improved-pragma r=turbolent a=turbolent See onflow/cadence#2380 Co-authored-by: Bastian Müller <bastian@axiomzen.co>
4042: Update to Cadence v0.31.5-account-linking-improved-pragma r=turbolent a=turbolent See onflow/cadence#2380 Co-authored-by: Bastian Müller <bastian@axiomzen.co>
4042: Update to Cadence v0.31.5-account-linking-improved-pragma r=turbolent a=turbolent See onflow/cadence#2380 Co-authored-by: Bastian Müller <bastian@axiomzen.co>
4042: Update to Cadence v0.31.5-account-linking-improved-pragma r=turbolent a=turbolent See onflow/cadence#2380 Co-authored-by: Bastian Müller <bastian@axiomzen.co>
Description
Problem
#2353 introduced a pragma, which determines if the account linking function (
AuthAccount.linkAccount
) is available.This is a static check: If the pragma is declared in the same program, the function is available, if the pragma is not declared, the function is not available.
This works well to allow wallets to detect transactions which attempt to use the account linking function, and potentially reject them. However, if the function is used in a contract, the current implementation requires the contract to declare the pragma, and a transaction which calls into the transaction does not need to declare the pragma. This prevents wallets from easily detecting a potential use of the account linking function.
Solution
Change the behaviour of the account linking pragma
#allowAccountLinking
from just a static check, to both a static check (as before, ensure the pragma is declared in the header of a program), and a dynamic check when the account linking function is called. The dynamic check requires that the pragma was declared.Changes
AuthAccount.linkAccount
function, from being only defined when the pragma is defined in the same program, to being always available, independent of the pragmamaster
branchFiles changed
in the Github PR explorer