-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for edge case where cached script address differs from the Q…
…uark Operation script (#183) Weird edge-case that seems benign and scripts really have to go out of their way to achieve this. The right way to fix this is to cache the `scriptAddress` before calling `executeScriptWithNonceLock`, but that adds a ~15k gas overhead. Consider our implementation a conscious optimization at this point.
- Loading branch information
1 parent
8d25fdf
commit b2ab0d6
Showing
2 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// SPDX-License-Identifier: BSD-3-Clause | ||
pragma solidity 0.8.23; | ||
|
||
import "quark-core/src/QuarkScript.sol"; | ||
import "quark-core/src/QuarkWallet.sol"; | ||
|
||
contract CallOtherScript is QuarkScript { | ||
function call(uint96 nonce, address scriptAddress, bytes calldata scriptCalldata) public { | ||
// Anti-pattern to clear replay first, but this is necessary to hit our edge case | ||
allowReplay(); | ||
QuarkWallet(payable(address(this))).stateManager().setActiveNonceAndCallback( | ||
nonce, scriptAddress, scriptCalldata | ||
); | ||
QuarkWallet(payable(address(this))).stateManager().setNonce(nonce); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters