-
Notifications
You must be signed in to change notification settings - Fork 7
refactor(pool): apply CEI ordering for transfers; ci: fork-safe tlin_check #883
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?
refactor(pool): apply CEI ordering for transfers; ci: fork-safe tlin_check #883
Conversation
Reorder internal state updates before cross-contract calls in: - safeTransfer: update balances before SafeGRC20Transfer - safeTransferFrom: update balances before SafeGRC20TransferFrom - collectProtocol: update balances before token transfers Applies checks-effects-interactions pattern for better security practices.
Use actions/checkout with PR head repo/ref and fetch-depth: 0 repository: ${{ github.event.pull_request.head.repo.full_name }} ref: ${{ github.event.pull_request.head.ref }} fetch-depth: 0 Fixes checkout failure when the branch doesn’t exist in the base repo (forked PRs) No behavior changes to the job; improves CI reliability for external contributors
I tagged refactor to not sound alarming but it's actually a security best practice for smart contract. https://www.nethermind.io/blog/best-practices-for-writing-secure-smart-contract-code |
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.
LGTM 👍 This pattern definitely seems better for managing effects. I'll consider applying this pattern to key functions going forward. thanks for the fix and suggestion.
After meeting, we will merge this PR if possible
|
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.
Don't merge it
Thanks for the review! I’m glad the CEI pattern is being considered — even if this PR doesn’t get merged, I’m happy it might help shape future improvements. |
refactor(pool): apply checks-effects-interactions (CEI)
pool/transfer.gno: update internal balances before external SafeGRC20Transfer/SafeGRC20TransferFrom
pool/pool.gno: update balances before external transfers in collectProtocol
Rationale: clearer invariants and consistent ordering; easier to reason about
Behavior: no functional change intended
ci(tlin): support forked PRs
.github/workflows/tlin_check.yml: checkout PR head repo/ref with fetch-depth: 0
Resolves checkout issues when branch isn’t on the base repo
Validation
Compiles and formats cleanly (gno fmt)
All CI checks passed for this PR