@@ -84,7 +84,7 @@ struct CompressedRoundAccounting {
8484 * 1. Direct signal: Current signaler calls `signal()`
8585 * 2. Delegated signal: Anyone submits with signaler's signature via `signalWithSig()`
8686 * - Uses EIP-712 for signature verification
87- * - Includes nonce and round number to prevent replay attacks
87+ * - Includes slot and instance to prevent replay attacks
8888 *
8989 * @dev ABSTRACT FUNCTIONS:
9090 * Implementing contracts must provide:
@@ -107,8 +107,7 @@ abstract contract EmpireBase is EIP712, IEmpire {
107107 using CompressedTimeMath for CompressedSlot;
108108
109109 // EIP-712 type hash for the Signal struct
110- bytes32 public constant SIGNAL_TYPEHASH =
111- keccak256 ("Signal(address payload,uint256 nonce,uint256 round,address instance) " );
110+ bytes32 public constant SIGNAL_TYPEHASH = keccak256 ("Signal(address payload,uint256 slot,address instance) " );
112111
113112 // The number of signals needed for a payload to be considered submittable.
114113 uint256 public immutable QUORUM_SIZE;
@@ -121,8 +120,6 @@ abstract contract EmpireBase is EIP712, IEmpire {
121120
122121 // Mapping of instance to round number to round accounting.
123122 mapping (address instance = > mapping (uint256 roundNumber = > CompressedRoundAccounting)) internal rounds;
124- // Mapping of instance signaler to nonce. Used to prevent replay attacks.
125- mapping (address signaler = > uint256 nonce ) public nonces;
126123
127124 constructor (uint256 _quorumSize , uint256 _roundSize , uint256 _lifetimeInRounds , uint256 _executionDelayInRounds )
128125 EIP712 ("EmpireBase " , "1 " )
@@ -269,8 +266,8 @@ abstract contract EmpireBase is EIP712, IEmpire {
269266 return Slot.unwrap (_slot) / ROUND_SIZE;
270267 }
271268
272- function getSignalSignatureDigest (IPayload _payload , address _signaler , uint256 _round ) public view returns (bytes32 ) {
273- return _hashTypedDataV4 (keccak256 (abi.encode (SIGNAL_TYPEHASH, _payload, nonces[_signaler], _round , getInstance ())));
269+ function getSignalSignatureDigest (IPayload _payload , Slot _slot ) public view returns (bytes32 ) {
270+ return _hashTypedDataV4 (keccak256 (abi.encode (SIGNAL_TYPEHASH, _payload, _slot , getInstance ())));
274271 }
275272
276273 // Virtual functions
@@ -299,8 +296,7 @@ abstract contract EmpireBase is EIP712, IEmpire {
299296 if (_sig.isEmpty ()) {
300297 require (msg .sender == signaler, Errors.GovernanceProposer__OnlyProposerCanSignal (msg .sender , signaler));
301298 } else {
302- bytes32 digest = getSignalSignatureDigest (_payload, signaler, roundNumber);
303- nonces[signaler]++ ;
299+ bytes32 digest = getSignalSignatureDigest (_payload, currentSlot);
304300
305301 // _sig.verify will throw if invalid, it is more my sanity that I am doing this for.
306302 require (_sig.verify (signaler, digest), Errors.GovernanceProposer__OnlyProposerCanSignal (msg .sender , signaler));
0 commit comments