Skip to content

Commit

Permalink
chore: forge fmt hates readability
Browse files Browse the repository at this point in the history
  • Loading branch information
fluffywaffles committed Nov 3, 2023
1 parent 25c32ad commit c997fef
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
14 changes: 8 additions & 6 deletions src/QuarkStateManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
pragma solidity ^0.8.21;

interface IExecutor {
function executeScriptWithNonceLock(address scriptAddress, bytes calldata scriptCalldata) external returns (bytes memory);
function executeScriptWithNonceLock(address scriptAddress, bytes calldata scriptCalldata)
external
returns (bytes memory);
}

contract QuarkStateManager {
Expand Down Expand Up @@ -125,7 +127,10 @@ contract QuarkStateManager {
* @param nonce Nonce to activate for the transaction
* @dev The script is expected to clearNonce() if it wishes to be replayable
*/
function setActiveNonceAndCallback(uint96 nonce, address scriptAddress, bytes calldata scriptCalldata) external returns (bytes memory) {
function setActiveNonceAndCallback(uint96 nonce, address scriptAddress, bytes calldata scriptCalldata)
external
returns (bytes memory)
{
if (nonce == 0) {
revert InvalidNonce();
}
Expand All @@ -148,10 +153,7 @@ contract QuarkStateManager {

// set the nonce-script pair active and yield to the wallet callback
NonceScript storage previousNonceScript = activeNonceScript[msg.sender];
activeNonceScript[msg.sender] = NonceScript({
nonce: nonce,
scriptAddress: scriptAddress
});
activeNonceScript[msg.sender] = NonceScript({nonce: nonce, scriptAddress: scriptAddress});

bytes memory result = IExecutor(msg.sender).executeScriptWithNonceLock(scriptAddress, scriptCalldata);

Expand Down
10 changes: 2 additions & 8 deletions test/Nonce.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,10 @@ import {QuarkStateManager} from "../src/QuarkStateManager.sol";
contract QuarkStateManagerHarness is QuarkStateManager {
function setNonceExternal(uint96 nonce) external {
// NOTE: intentionally violates invariant in the name of... testing
activeNonceScript[msg.sender] = NonceScript({
nonce: nonce,
scriptAddress: address(0)
});
activeNonceScript[msg.sender] = NonceScript({nonce: nonce, scriptAddress: address(0)});
(uint256 bucket, uint256 setMask) = getBucket(nonce);
nonces[msg.sender][bucket] |= setMask;
activeNonceScript[msg.sender] = NonceScript({
nonce: 0,
scriptAddress: address(0)
});
activeNonceScript[msg.sender] = NonceScript({nonce: 0, scriptAddress: address(0)});
}
}

Expand Down

0 comments on commit c997fef

Please sign in to comment.