Skip to content

Commit

Permalink
Add clearer messaging around the risks of overwriting _getNonce (#70)
Browse files Browse the repository at this point in the history
* Add clearer messaging around the risks of overwriting _getNonce

* Update MultisigBase.sol

Improve clarity of comment
  • Loading branch information
stevieraykatz authored Apr 9, 2024
1 parent 32022cd commit c8e1438
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions script/universal/MultisigBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ abstract contract MultisigBase is Simulator {

// Virtual method which can be overwritten
// Default logic here is vestigial for backwards compatibility
// IMPORTANT: this method is used in the sign, simulate, AND execution contexts
// If you override it, ensure that the behavior is correct for all contexts
// As an example, if you are pre-signing a message that needs safe.nonce+1 (before safe.nonce is executed),
// you should explicitly set the nonce value with an env var.
// Overwriting this method with safe.nonce + 1 will cause issues upon execution because the transaction
// hash will differ from the one signed.
function _getNonce(IGnosisSafe safe) internal view virtual returns (uint256 nonce) {
nonce = safe.nonce();
console.log("Safe current nonce:", nonce);
Expand Down

0 comments on commit c8e1438

Please sign in to comment.