diff --git a/src/quark-core/src/QuarkStateManager.sol b/src/quark-core/src/QuarkStateManager.sol index 9053a30b..2fe1ca91 100644 --- a/src/quark-core/src/QuarkStateManager.sol +++ b/src/quark-core/src/QuarkStateManager.sol @@ -90,7 +90,6 @@ contract QuarkStateManager { if (scriptAddress == address(0)) { revert NoActiveNonce(); } - // the last 20 bytes is the address return scriptAddress; } @@ -133,6 +132,7 @@ contract QuarkStateManager { * @param nonce Nonce to activate for the transaction * @param scriptAddress Address of script to invoke with nonce lock * @param scriptCalldata Calldata for script call to invoke with nonce lock + * @return Return value from the executed operation * @dev The script is expected to clearNonce() if it wishes to be replayable */ function setActiveNonceAndCallback(uint96 nonce, address scriptAddress, bytes calldata scriptCalldata) @@ -147,15 +147,15 @@ contract QuarkStateManager { revert NonceAlreadySet(); } - // spend the nonce; only if the callee chooses to clear it will it get un-set and become replayable - setNonceInternal(bucket, setMask); - address cachedScriptAddress = nonceScriptAddress[msg.sender][nonce]; // if the nonce has been used before, check if the script address matches, and revert if not if ((cachedScriptAddress != address(0)) && (cachedScriptAddress != scriptAddress)) { revert NonceScriptMismatch(); } + // spend the nonce; only if the callee chooses to clear it will it get un-set and become replayable + setNonceInternal(bucket, setMask); + // set the nonce-script pair active and yield to the wallet callback NonceScript memory previousNonceScript = activeNonceScript[msg.sender]; activeNonceScript[msg.sender] = NonceScript({nonce: nonce, scriptAddress: scriptAddress}); diff --git a/src/quark-core/src/QuarkWallet.sol b/src/quark-core/src/QuarkWallet.sol index e8395ee7..09637624 100644 --- a/src/quark-core/src/QuarkWallet.sol +++ b/src/quark-core/src/QuarkWallet.sol @@ -118,7 +118,7 @@ contract QuarkWallet is IERC1271 { * @param v EIP-712 signature v value * @param r EIP-712 signature r value * @param s EIP-712 signature s value - * @return return value from the executed operation + * @return Return value from the executed operation */ function executeQuarkOperation(QuarkOperation calldata op, uint8 v, bytes32 r, bytes32 s) external @@ -214,7 +214,7 @@ contract QuarkWallet is IERC1271 { * smart contract * @param hash Hash of the signed data * @param signature Signature byte array associated with data - * @return bytes4 Returns the ERC-1271 "magic value" that indicates that the signature is valid + * @return The ERC-1271 "magic value" that indicates the signature is valid */ function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4) { /*