Skip to content

Commit edc27fe

Browse files
committed
remove deprecated and duplicate storage
1 parent cd0407f commit edc27fe

File tree

3 files changed

+5
-30
lines changed

3 files changed

+5
-30
lines changed

contracts/governance/compatibility/GovernorCompatibilityBravo.sol

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ abstract contract GovernorCompatibilityBravo is IGovernorTimelock, IGovernorComp
2626
}
2727

2828
struct ProposalDetails {
29-
address proposer;
3029
address[] targets;
3130
uint256[] values;
3231
string[] signatures;
@@ -56,7 +55,7 @@ abstract contract GovernorCompatibilityBravo is IGovernorTimelock, IGovernorComp
5655
string memory description
5756
) public virtual override(IGovernor, Governor) returns (uint256) {
5857
// Stores the proposal details (if not already present) and executes the propose logic from the core.
59-
_storeProposal(_msgSender(), targets, values, new string[](calldatas.length), calldatas, description);
58+
_storeProposal(targets, values, new string[](calldatas.length), calldatas, description);
6059
return super.propose(targets, values, calldatas, description);
6160
}
6261

@@ -75,7 +74,7 @@ abstract contract GovernorCompatibilityBravo is IGovernorTimelock, IGovernorComp
7574
// after the full proposal is stored, so the store operation included in the fallback will be skipped. Here we
7675
// call `propose` and not `super.propose` to make sure if a child contract override `propose`, whatever code
7776
// is added there is also executed when calling this alternative interface.
78-
_storeProposal(_msgSender(), targets, values, signatures, calldatas, description);
77+
_storeProposal(targets, values, signatures, calldatas, description);
7978
return propose(targets, values, _encodeCalldata(signatures, calldatas), description);
8079
}
8180

@@ -132,7 +131,7 @@ abstract contract GovernorCompatibilityBravo is IGovernorTimelock, IGovernorComp
132131
bytes32 descriptionHash
133132
) public virtual override(IGovernor, Governor) returns (uint256) {
134133
uint256 proposalId = hashProposal(targets, values, calldatas, descriptionHash);
135-
address proposer = _proposalDetails[proposalId].proposer;
134+
address proposer = proposalProposer(proposalId);
136135

137136
require(
138137
_msgSender() == proposer || getVotes(proposer, clock() - 1) < proposalThreshold(),
@@ -182,7 +181,6 @@ abstract contract GovernorCompatibilityBravo is IGovernorTimelock, IGovernorComp
182181
* @dev Store proposal metadata (if not already present) for later lookup.
183182
*/
184183
function _storeProposal(
185-
address proposer,
186184
address[] memory targets,
187185
uint256[] memory values,
188186
string[] memory signatures,
@@ -194,7 +192,6 @@ abstract contract GovernorCompatibilityBravo is IGovernorTimelock, IGovernorComp
194192

195193
ProposalDetails storage details = _proposalDetails[proposalId];
196194
if (details.descriptionHash == bytes32(0)) {
197-
details.proposer = proposer;
198195
details.targets = targets;
199196
details.values = values;
200197
details.signatures = signatures;
@@ -228,12 +225,12 @@ abstract contract GovernorCompatibilityBravo is IGovernorTimelock, IGovernorComp
228225
)
229226
{
230227
id = proposalId;
228+
proposer = proposalProposer(proposalId);
231229
eta = proposalEta(proposalId);
232230
startBlock = proposalSnapshot(proposalId);
233231
endBlock = proposalDeadline(proposalId);
234232

235233
ProposalDetails storage details = _proposalDetails[proposalId];
236-
proposer = details.proposer;
237234
forVotes = details.forVotes;
238235
againstVotes = details.againstVotes;
239236
abstainVotes = details.abstainVotes;

contracts/governance/extensions/GovernorVotesQuorumFraction.sol

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ import "../../utils/math/SafeCast.sol";
1616
abstract contract GovernorVotesQuorumFraction is GovernorVotes {
1717
using Checkpoints for Checkpoints.Trace224;
1818

19-
uint256 private _quorumNumerator; // DEPRECATED in favor of _quorumNumeratorHistory
20-
2119
/// @custom:oz-retyped-from Checkpoints.History
2220
Checkpoints.Trace224 private _quorumNumeratorHistory;
2321

@@ -38,7 +36,7 @@ abstract contract GovernorVotesQuorumFraction is GovernorVotes {
3836
* @dev Returns the current quorum numerator. See {quorumDenominator}.
3937
*/
4038
function quorumNumerator() public view virtual returns (uint256) {
41-
return _quorumNumeratorHistory._checkpoints.length == 0 ? _quorumNumerator : _quorumNumeratorHistory.latest();
39+
return _quorumNumeratorHistory.latest();
4240
}
4341

4442
/**
@@ -47,9 +45,6 @@ abstract contract GovernorVotesQuorumFraction is GovernorVotes {
4745
function quorumNumerator(uint256 timepoint) public view virtual returns (uint256) {
4846
// If history is empty, fallback to old storage
4947
uint256 length = _quorumNumeratorHistory._checkpoints.length;
50-
if (length == 0) {
51-
return _quorumNumerator;
52-
}
5348

5449
// Optimistic search, check the latest checkpoint
5550
Checkpoints.Checkpoint224 memory latest = _quorumNumeratorHistory._checkpoints[length - 1];
@@ -105,15 +100,6 @@ abstract contract GovernorVotesQuorumFraction is GovernorVotes {
105100
);
106101

107102
uint256 oldQuorumNumerator = quorumNumerator();
108-
109-
// Make sure we keep track of the original numerator in contracts upgraded from a version without checkpoints.
110-
if (oldQuorumNumerator != 0 && _quorumNumeratorHistory._checkpoints.length == 0) {
111-
_quorumNumeratorHistory._checkpoints.push(
112-
Checkpoints.Checkpoint224({_key: 0, _value: SafeCast.toUint224(oldQuorumNumerator)})
113-
);
114-
}
115-
116-
// Set new quorum for future proposals
117103
_quorumNumeratorHistory.push(SafeCast.toUint32(clock()), SafeCast.toUint224(newQuorumNumerator));
118104

119105
emit QuorumNumeratorUpdated(oldQuorumNumerator, newQuorumNumerator);

contracts/token/ERC20/extensions/ERC20Permit.sol

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,6 @@ abstract contract ERC20Permit is ERC20, IERC20Permit, EIP712, Nonces {
2323
// solhint-disable-next-line var-name-mixedcase
2424
bytes32 private constant _PERMIT_TYPEHASH =
2525
keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
26-
/**
27-
* @dev In previous versions `_PERMIT_TYPEHASH` was declared as `immutable`.
28-
* However, to ensure consistency with the upgradeable transpiler, we will continue
29-
* to reserve a slot.
30-
* @custom:oz-renamed-from _PERMIT_TYPEHASH
31-
*/
32-
// solhint-disable-next-line var-name-mixedcase
33-
bytes32 private _PERMIT_TYPEHASH_DEPRECATED_SLOT;
3426

3527
/**
3628
* @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `"1"`.

0 commit comments

Comments
 (0)