Skip to content

Commit c8e1438

Browse files
Add clearer messaging around the risks of overwriting _getNonce (#70)
* Add clearer messaging around the risks of overwriting _getNonce * Update MultisigBase.sol Improve clarity of comment
1 parent 32022cd commit c8e1438

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

script/universal/MultisigBase.sol

+6
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ abstract contract MultisigBase is Simulator {
2121

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

0 commit comments

Comments
 (0)