Skip to content

Commit

Permalink
CS6.7 - Remove unreachable code (#227)
Browse files Browse the repository at this point in the history
From ChainSecurity audit: "The submissionToken will never be equal to
EXHAUSTED in this context, as this is the value provided by the user of
the wallet and submitted to the nonce manager, which asserts that it is
different from EXHAUSTED."

This appears to be true, so we can remove this check.
  • Loading branch information
kevincheng96 authored Oct 17, 2024
1 parent aeb8681 commit 3540d26
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
12 changes: 6 additions & 6 deletions .gas-snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ CallbacksTest:testNestedCallbackResetsCallbackSlot() (gas: 87858)
CallbacksTest:testPayableCallback() (gas: 76928)
CallbacksTest:testReentrancyGuardProtectsAgainstDoubleDipping() (gas: 54343)
CallbacksTest:testRevertsOnCallbackWhenNoActiveCallback() (gas: 72601)
CallbacksTest:testSimpleCallback() (gas: 284574)
CallbacksTest:testSimpleCallback() (gas: 284460)
CallbacksTest:testWithClearedCallback() (gas: 156369)
CallbacksTest:testWithoutAllowCallback() (gas: 156138)
CodeJarTest:testCodeJarCanBeWacky() (gas: 114646)
Expand Down Expand Up @@ -69,14 +69,14 @@ MulticallTest:testSupplyWETHWithdrawUSDCOnComet() (gas: 247586)
NoncerTest:testGetActiveNonceNested() (gas: 88525)
NoncerTest:testGetActiveNonceReplayable() (gas: 65730)
NoncerTest:testGetActiveNonceSingle() (gas: 44961)
NoncerTest:testGetActiveReplayCount() (gas: 85439)
NoncerTest:testGetActiveReplayCountNested() (gas: 89032)
NoncerTest:testGetActiveReplayCountSingle() (gas: 44824)
NoncerTest:testGetActiveReplayCountWithNonReplaySoftCancel() (gas: 69406)
NoncerTest:testGetActiveReplayCount() (gas: 85364)
NoncerTest:testGetActiveReplayCountNested() (gas: 88957)
NoncerTest:testGetActiveReplayCountSingle() (gas: 44799)
NoncerTest:testGetActiveReplayCountWithNonReplaySoftCancel() (gas: 69325)
NoncerTest:testGetActiveSubmissionTokenNested() (gas: 88031)
NoncerTest:testGetActiveSubmissionTokenReplayable() (gas: 65756)
NoncerTest:testGetActiveSubmissionTokenSingle() (gas: 47765)
NoncerTest:testNestedPlayPullingActiveReplayCount() (gas: 608396)
NoncerTest:testNestedPlayPullingActiveReplayCount() (gas: 608321)
NoncerTest:testPostNestReadsCorrectValue() (gas: 141247)
PaycallTest:testInitializeProperlyFromConstructor() (gas: 6368)
PaycallTest:testPaycallForPayWithUSDT() (gas: 116565)
Expand Down
4 changes: 0 additions & 4 deletions src/quark-core/src/QuarkScript.sol
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,6 @@ abstract contract QuarkScript {
bytes32 submissionToken = getActiveSubmissionToken();
uint256 n;

if (submissionToken == QuarkNonceManagerMetadata.EXHAUSTED) {
return 0;
}

for (n = 0; submissionToken != nonce; n++) {
submissionToken = keccak256(abi.encodePacked(submissionToken));
}
Expand Down

0 comments on commit 3540d26

Please sign in to comment.