Platform: Code4rena
Start Date: 04/01/2022
Pot Size: $25,000 USDC
Total HM: 3
Participants: 40
Period: 3 days
Judge: Ivo Georgiev
Total Solo HM: 1
Id: 75
League: ETH
Rank: 37/40
Findings: 1
Award: $7.61
🌟 Selected for report: 0
🚀 Solo Findings: 0
7.6096 USDC - $7.61
bitbopper
https://github.com/XDeFi-tech/xdefi-distribution/blob/3856a42df295183b40c6eee89307308f196612fe/contracts/XDEFIDistribution.sol#L51:L56
could be more gas efficient
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.6; contract LockProofOld { uint256 _locked = 0; modifier noReenter() { require(_locked == 0, "LOCKED"); _locked = uint256(1); _; _locked = uint256(0); } function test() public noReenter { } }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.6; contract LockProofNew { uint256 _locked = 1; modifier noReenter() { require(_locked == 1, "LOCKED"); _locked = uint256(2); _; _locked = uint256(1); } function test() public noReenter { } }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.6; import "ds-test/test.sol"; import "./LockProofOld.sol"; import "./LockProofNew.sol"; contract LockProofTest is DSTest { LockProofOld lockproofold; LockProofNew lockproofnew; function setUp() public { lockproofold = new LockProofOld(); lockproofnew = new LockProofNew(); } function test_old() public { lockproofold.test(); } function test_new() public { lockproofnew.test(); } }
dapp test Running 2 tests for src/LockProof.t.sol:LockProofTest [PASS] test_old() (gas: 21042) [PASS] test_new() (gas: 1136)
#0 - deluca-mike
2022-01-08T03:35:08Z
Agreed, we will change it. Extra points for using hevm
!
#1 - deluca-mike
2022-01-09T10:58:24Z
Duplicate #1