-
Notifications
You must be signed in to change notification settings - Fork 0
FLOW-10 - Validate betaRef parameter in createYieldVaultManager #146
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
base: main
Are you sure you want to change the base?
Conversation
Add pre-condition to createYieldVaultManager that invokes FlowYieldVaultsClosedBeta.validateBeta to verify the betaRef is valid, making the Beta gating behavior explicit and consistent with other Beta-gated methods. Addresses Quantstamp audit finding FLOW-10. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
Please can you a add a test for this change? ty |
| access(all) let capID: UInt64 | ||
| access(all) let isRevoked: Bool | ||
|
|
||
| init(_ capID: UInt64, _ isRevoked: Bool) { |
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.
Here and below: Use the argument label to document what the parameters mean, they make the call-sites easier to understand:
| init(_ capID: UInt64, _ isRevoked: Bool) { | |
| init(capID: UInt64, isRevoked: Bool) { |
| /// Issue a capability from the contract/deployer account and record its ID | ||
| access(contract) fun _issueBadgeCap(_ addr: Address): Capability<auth(Beta) &BetaBadge> { | ||
| let p = self._badgePath(addr) | ||
| let cap: Capability<auth(Beta) &BetaBadge> = |
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.
Type annotation is unnecessary and can be inferred
| let cap: Capability<auth(Beta) &BetaBadge> = | |
| let cap = |
| if info.isRevoked { | ||
| assert(info.isRevoked, message: "Beta access revoked") |
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.
This assert is a no-op, in this branch info.isRevoked is always true
|
|
||
| /// Per-user badge storage path (under the *contract/deployer* account) | ||
| access(contract) fun _badgePath(_ addr: Address): StoragePath { | ||
| return StoragePath(identifier: "FlowYieldVaultsBetaBadge_".concat(addr.toString()))! |
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.
Use string templates:
| return StoragePath(identifier: "FlowYieldVaultsBetaBadge_".concat(addr.toString()))! | |
| return StoragePath(identifier: "FlowYieldVaultsBetaBadge_\(addr.toString())")! |
|
|
||
| /// Ensure the admin-owned badge exists for the user | ||
| access(contract) fun _ensureBadge(_ addr: Address) { | ||
| let p = self._badgePath(addr) |
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.
Here and below: Use descriptive variable names:
| let p = self._badgePath(addr) | |
| let path = self._badgePath(addr) |
| access(all) view fun getOwner(): Address { | ||
| return self.assignedTo | ||
| } |
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 just make assignedTo access(all) and remove this unnecessary getter
Summary
createYieldVaultManagerthat callsFlowYieldVaultsClosedBeta.validateBetaQuantstamp Audit Finding
FLOW-10: Unused betaRef Parameter in YieldVaultManager Creation (Undetermined)
The
createYieldVaultManagerfunction accepts abetaRefparameter but did not use it in the function body. The recommendation was to invokeFlowYieldVaultsClosedBeta.validateBetainside the function for consistency with other Beta-gated methods.Test plan
createYieldVaultManagerrejects invalid betaRefCloses #141
🤖 Generated with Claude Code