Platform: Code4rena
Start Date: 23/11/2022
Pot Size: $24,500 CANTO
Total HM: 5
Participants: 37
Period: 5 days
Judge: berndartmueller
Total Solo HM: 2
Id: 185
League: ETH
Rank: 22/37
Findings: 1
Award: $13.69
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: Tricko
Also found by: 0xhacksmithh, AkshaySrivastav, Awesome, Beepidibop, Deivitto, DijkstraDev, Dinesh11G, Englave, JC, Rahoz, RaymondFam, ReyAdmirado, SaeedAlipoor01988, Sathish9098, abiih, aphak5010, chaduke, chrisdior4, exolorkistis, gzeon, martin, nicobevi, oyc_109, peritoflores, rotcivegaf
84.7394 CANTO - $13.69
If a function modifier such as onlyOwner is used, the function will revert if a normal user tries to pay the function. Marking the function as payable will lower the gas cost for legitimate callers because the compiler will not include checks for whether a payment was provided. The extra opcodes avoided are CALLVALUE(2),DUP1(3),ISZERO(3),PUSH2(3),JUMPI(10),PUSH1(3),DUP1(3),REVERT(0),JUMPDEST(1),POP(2), which costs an average of about 21 gas per call to the function, in addition to the extra deployment cost
Turnstile.sol::86 => function register(address _recipient) public onlyUnregistered returns (uint256 tokenId) { Turnstile.sol::107 => function assign(uint256 _tokenId) public onlyUnregistered returns (uint256) {
The code should be refactored such that they no longer exist, or the block should do something useful, such as emitting an event or reverting.
Turnstile.sol::57 => constructor() ERC721("Turnstile", "Turnstile") {}
use <x> = <x> + <y> or <x> = <x> - <y> instead to save gas
Turnstile.sol::151 => balances[_tokenId] += msg.value;
Contracts are allowed to override their parents' functions and change the visibility from external to public and can save gas by doing so.
Turnstile.sol::107 => function assign(uint256 _tokenId) public onlyUnregistered returns (uint256) { Turnstile.sol::148 => function distributeFees(uint256 _tokenId) public onlyOwner payable {
#0 - c4-judge
2022-11-29T19:41:26Z
berndartmueller marked the issue as grade-b