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

[Hacken 2022-11-25 High #3] Data Consistency #32

Closed
zhongfu opened this issue Dec 1, 2022 · 1 comment · Fixed by #51 or #61
Closed

[Hacken 2022-11-25 High #3] Data Consistency #32

zhongfu opened this issue Dec 1, 2022 · 1 comment · Fixed by #51 or #61
Labels
sev:p1 High type:enhancement Good-to-have features or fixes

Comments

@zhongfu
Copy link
Contributor

zhongfu commented Dec 1, 2022

The approvals performed in the Funnel contract are not connected with the approvals done in the _baseToken tokens.

The EIP-5827 should check if it has enough allowance in _baseToken in functions allowance(), transferFrom(), and transfer().

In situations where the allowance in _baseToken is less than the allowance calculated by Funnel, there will be data inconsistency and denial of service in transfer functions.

Path

./src/Funnel.sol : allowance(), transferFrom(), transfer()

Recommendation

Consider checking allowance from _baseToken and compare it with _ramainingAllowance. React to the result in a friendly user manner.

Status

New

@zhongfu zhongfu added type:enhancement Good-to-have features or fixes sev:p1 High labels Dec 1, 2022
@zhongfu zhongfu changed the title [Hacken 2022-11-25 High #2] Data Consistency [Hacken 2022-11-25 High #3] Data Consistency Dec 1, 2022
@zhongfu zhongfu added this to the Hacken Audit 2022-11-25 milestone Dec 1, 2022
zlace0x added a commit that referenced this issue Dec 5, 2022
@zlace0x zlace0x mentioned this issue Dec 5, 2022
@zlace0x zlace0x linked a pull request Dec 5, 2022 that will close this issue
@zhongfu
Copy link
Contributor Author

zhongfu commented Dec 8, 2022

should be fixed for allowance() in #51 (and by extension, transferFrom() as well)

as for transfer(), base token should revert in case of insufficient allowance -- and user should be able to see that, I guess

zlace0x added a commit that referenced this issue Dec 12, 2022
* fix: addresses #32, allowance() amount should reflect transferable amounts for transferFrom() and transfer()

* fix: comment contradition #43

* wip: added overflow test cases according to #30, identified area of overflow

* fix: potential fix for #30

* refactor: adhere to checks-effects-interaction pattern #35

* fix: make allowance() external #45

* fix: dropped virtual from permit, permitRenewable #44

* refactor: added require reason

* chore: added gas reports

* fix: solidity compiler for deploy script

* Chore/natspec (#53)

* style: grouped functions

* forge install: openzeppelin-contracts

* chore: updates to lib

* chore: natspec comments for contracts

* chore: closes #39 and #40

* chore: removed unused solmate

* refactor: moved saturatingAdd to mathUtil

* chore: cleanup

* Apply suggestions from code review

Co-authored-by: zlace0x <81418809+zlace0x@users.noreply.github.com>

* fix: resolve some comments

* doc: generated docs under doc/

* chore: cleanups on comments

* style: use custom errors instead (#56)

* style: use custom errors instead

* fix: structured files for custom errors

* style: change INITIAL values to upper-case

* Update src/Funnel.sol

Co-authored-by: zlace0x <81418809+zlace0x@users.noreply.github.com>

Co-authored-by: Edison <6057323+edison0x@users.noreply.github.com>
Co-authored-by: zlace0x <81418809+zlace0x@users.noreply.github.com>

* chore: fix comments slashes

* fix: apply linter version changes

Co-authored-by: Edison <6057323+edison0x@users.noreply.github.com>
Co-authored-by: zlace0x <zlace0x@gmail.com>
Co-authored-by: zlace0x <81418809+zlace0x@users.noreply.github.com>

Co-authored-by: Edison <6057323+edison0xyz@users.noreply.github.com>
Co-authored-by: Edison <6057323+edison0x@users.noreply.github.com>
zlace0x added a commit that referenced this issue Dec 12, 2022
* fix: resolves #48 resolves 45 resolves #44 resolves #41 resolves #38

* fix: closes #34

* fix: zero address validation and make functions external. Closes #42 closes #45

* fixed pragma. closes #36

* fix as 0.8.17

* fix: remove solmate

* refactor: PR comments
- reorder imports, fix qoutes
- removed virtual for _checkOn* functions
- added virtual to supportsInterface
- fix compiler version to 0.8.17

* fix: addresses #32, allowance() amount should reflect transferable amounts for transferFrom() and transfer()

* fix: comment contradition #43

* wip: added overflow test cases according to #30, identified area of overflow

* fix: potential fix for #30

* refactor: adhere to checks-effects-interaction pattern #35

* fix: make allowance() external #45

* fix: dropped virtual from permit, permitRenewable #44

* refactor: added require reason

* chore: added gas reports

* fix: solidity compiler for deploy script

* Chore/natspec (#53)

* style: grouped functions

* forge install: openzeppelin-contracts

* chore: updates to lib

* chore: natspec comments for contracts

* chore: closes #39 and #40

* chore: removed unused solmate

* refactor: moved saturatingAdd to mathUtil

* chore: cleanup

* Apply suggestions from code review

Co-authored-by: zlace0x <81418809+zlace0x@users.noreply.github.com>

* fix: resolve some comments

* doc: generated docs under doc/

* chore: cleanups on comments

* style: use custom errors instead (#56)

* style: use custom errors instead

* fix: structured files for custom errors

* style: change INITIAL values to upper-case

* Update src/Funnel.sol

Co-authored-by: zlace0x <81418809+zlace0x@users.noreply.github.com>

Co-authored-by: Edison <6057323+edison0x@users.noreply.github.com>
Co-authored-by: zlace0x <81418809+zlace0x@users.noreply.github.com>

* chore: fix comments slashes

* fix: apply linter version changes

Co-authored-by: Edison <6057323+edison0x@users.noreply.github.com>
Co-authored-by: zlace0x <zlace0x@gmail.com>
Co-authored-by: zlace0x <81418809+zlace0x@users.noreply.github.com>

Co-authored-by: Edison <6057323+edison0x@users.noreply.github.com>
Co-authored-by: Edison <6057323+edison0xyz@users.noreply.github.com>
@zlace0x zlace0x linked a pull request Dec 13, 2022 that will close this issue
@zlace0x zlace0x closed this as completed Dec 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sev:p1 High type:enhancement Good-to-have features or fixes
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants