Skip to content

Commit 5dd9d86

Browse files
authored
Merge branch 'OpenZeppelin:master' into feat/ERC-7540
2 parents 2784e8b + 6dc9242 commit 5dd9d86

26 files changed

+80
-84
lines changed

.changeset/green-drinks-report.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"openzeppelin-solidity": minor
3+
---
4+
5+
`Pausable`: Stop explicitly setting `paused` to `false` during construction.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ npm-debug.log
3737

3838
# docs artifacts
3939
docs/modules/api
40+
build/site
4041

4142
# only used to package @openzeppelin/contracts
4243
contracts/build/

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
### Breaking Changes
4+
5+
- Replace `GovernorCountingOverridable.VoteReceipt` struct parameter member names `hasOverriden` and `overridenWeight` for `hasOverridden` and `overriddenWeight` respectively.
6+
7+
#### Custom error changes
8+
9+
- Replace `GovernorAlreadyOverridenVote` with `GovernorAlreadyOverriddenVote`.
10+
311
## 5.2.0 (2025-01-08)
412

513
### Breaking Changes

contracts/governance/Governor.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ abstract contract Governor is Context, ERC165, EIP712, Nonces, IGovernor, IERC72
455455
* performed (for example adding a vault/timelock).
456456
*
457457
* NOTE: Calling this function directly will NOT check the current state of the proposal, set the executed flag to
458-
* true or emit the `ProposalExecuted` event. Executing a proposal should be done using {execute} or {_execute}.
458+
* true or emit the `ProposalExecuted` event. Executing a proposal should be done using {execute}.
459459
*/
460460
function _executeOperations(
461461
uint256 /* proposalId */,

contracts/governance/README.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ NOTE: Functions of the `Governor` contract do not include access control. If you
6868

6969
{{GovernorCountingFractional}}
7070

71-
{{GovernorCountingOverride}}
71+
{{GovernorCountingOverridable}}
7272

7373
{{GovernorVotes}}
7474

@@ -103,7 +103,7 @@ In a governance system, the {TimelockController} contract is in charge of introd
103103
[[timelock-terminology]]
104104
==== Terminology
105105

106-
* *Operation:* A transaction (or a set of transactions) that is the subject of the timelock. It has to be scheduled by a proposer and executed by an executor. The timelock enforces a minimum delay between the proposition and the execution (see xref:access-control.adoc#operation_lifecycle[operation lifecycle]). If the operation contains multiple transactions (batch mode), they are executed atomically. Operations are identified by the hash of their content.
106+
* *Operation:* A transaction (or a set of transactions) that is the subject of the timelock. It has to be scheduled by a proposer and executed by an executor. The timelock enforces a minimum delay between the proposition and the execution. If the operation contains multiple transactions (batch mode), they are executed atomically. Operations are identified by the hash of their content.
107107
* *Operation status:*
108108
** *Unset:* An operation that is not part of the timelock mechanism.
109109
** *Waiting:* An operation that has been scheduled, before the timer expires.

contracts/governance/extensions/GovernorCountingOverridable.sol

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ abstract contract GovernorCountingOverridable is GovernorVotes {
2727

2828
struct VoteReceipt {
2929
uint8 casted; // 0 if vote was not casted. Otherwise: support + 1
30-
bool hasOverriden;
31-
uint208 overridenWeight;
30+
bool hasOverridden;
31+
uint208 overriddenWeight;
3232
}
3333

3434
struct ProposalVote {
@@ -42,7 +42,7 @@ abstract contract GovernorCountingOverridable is GovernorVotes {
4242
/// @dev A delegated vote on `proposalId` was overridden by `weight`
4343
event OverrideVoteCast(address indexed voter, uint256 proposalId, uint8 support, uint256 weight, string reason);
4444

45-
error GovernorAlreadyOverridenVote(address account);
45+
error GovernorAlreadyOverriddenVote(address account);
4646

4747
mapping(uint256 proposalId => ProposalVote) private _proposalVotes;
4848

@@ -70,7 +70,7 @@ abstract contract GovernorCountingOverridable is GovernorVotes {
7070
* @dev Check if an `account` has overridden their delegate for a proposal.
7171
*/
7272
function hasVotedOverride(uint256 proposalId, address account) public view virtual returns (bool) {
73-
return _proposalVotes[proposalId].voteReceipt[account].hasOverriden;
73+
return _proposalVotes[proposalId].voteReceipt[account].hasOverridden;
7474
}
7575

7676
/**
@@ -122,7 +122,7 @@ abstract contract GovernorCountingOverridable is GovernorVotes {
122122
revert GovernorAlreadyCastVote(account);
123123
}
124124

125-
totalWeight -= proposalVote.voteReceipt[account].overridenWeight;
125+
totalWeight -= proposalVote.voteReceipt[account].overriddenWeight;
126126
proposalVote.votes[support] += totalWeight;
127127
proposalVote.voteReceipt[account].casted = support + 1;
128128

@@ -141,26 +141,26 @@ abstract contract GovernorCountingOverridable is GovernorVotes {
141141
revert GovernorInvalidVoteType();
142142
}
143143

144-
if (proposalVote.voteReceipt[account].hasOverriden) {
145-
revert GovernorAlreadyOverridenVote(account);
144+
if (proposalVote.voteReceipt[account].hasOverridden) {
145+
revert GovernorAlreadyOverriddenVote(account);
146146
}
147147

148148
uint256 snapshot = proposalSnapshot(proposalId);
149-
uint256 overridenWeight = VotesExtended(address(token())).getPastBalanceOf(account, snapshot);
149+
uint256 overriddenWeight = VotesExtended(address(token())).getPastBalanceOf(account, snapshot);
150150
address delegate = VotesExtended(address(token())).getPastDelegate(account, snapshot);
151151
uint8 delegateCasted = proposalVote.voteReceipt[delegate].casted;
152152

153-
proposalVote.voteReceipt[account].hasOverriden = true;
154-
proposalVote.votes[support] += overridenWeight;
153+
proposalVote.voteReceipt[account].hasOverridden = true;
154+
proposalVote.votes[support] += overriddenWeight;
155155
if (delegateCasted == 0) {
156-
proposalVote.voteReceipt[delegate].overridenWeight += SafeCast.toUint208(overridenWeight);
156+
proposalVote.voteReceipt[delegate].overriddenWeight += SafeCast.toUint208(overriddenWeight);
157157
} else {
158158
uint8 delegateSupport = delegateCasted - 1;
159-
proposalVote.votes[delegateSupport] -= overridenWeight;
160-
emit VoteReduced(delegate, proposalId, delegateSupport, overridenWeight);
159+
proposalVote.votes[delegateSupport] -= overriddenWeight;
160+
emit VoteReduced(delegate, proposalId, delegateSupport, overriddenWeight);
161161
}
162162

163-
return overridenWeight;
163+
return overriddenWeight;
164164
}
165165

166166
/// @dev Variant of {Governor-_castVote} that deals with vote overrides. Returns the overridden weight.
@@ -172,13 +172,13 @@ abstract contract GovernorCountingOverridable is GovernorVotes {
172172
) internal virtual returns (uint256) {
173173
_validateStateBitmap(proposalId, _encodeStateBitmap(ProposalState.Active));
174174

175-
uint256 overridenWeight = _countOverride(proposalId, account, support);
175+
uint256 overriddenWeight = _countOverride(proposalId, account, support);
176176

177-
emit OverrideVoteCast(account, proposalId, support, overridenWeight, reason);
177+
emit OverrideVoteCast(account, proposalId, support, overriddenWeight, reason);
178178

179179
_tallyUpdated(proposalId);
180180

181-
return overridenWeight;
181+
return overriddenWeight;
182182
}
183183

184184
/// @dev Public function for casting an override vote. Returns the overridden weight.

contracts/governance/extensions/GovernorStorage.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ abstract contract GovernorStorage is Governor {
5050
}
5151

5252
/**
53-
* @dev Version of {IGovernorTimelock-queue} with only `proposalId` as an argument.
53+
* @dev Version of {IGovernor-queue} with only `proposalId` as an argument.
5454
*/
5555
function queue(uint256 proposalId) public virtual {
5656
// here, using storage is more efficient than memory

contracts/governance/extensions/GovernorTimelockAccess.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ abstract contract GovernorTimelockAccess is Governor {
277277
}
278278

279279
/**
280-
* @dev See {IGovernor-_cancel}
280+
* @dev See {Governor-_cancel}
281281
*/
282282
function _cancel(
283283
address[] memory targets,

contracts/proxy/utils/UUPSUpgradeable.sol

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ abstract contract UUPSUpgradeable is IERC1822Proxiable {
9191
/**
9292
* @dev Reverts if the execution is not performed via delegatecall or the execution
9393
* context is not of a proxy with an ERC-1967 compliant implementation pointing to self.
94-
* See {_onlyProxy}.
9594
*/
9695
function _checkProxy() internal view virtual {
9796
if (

contracts/token/ERC1155/IERC1155.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ interface IERC1155 is IERC165 {
8181
* @dev Transfers a `value` amount of tokens of type `id` from `from` to `to`.
8282
*
8383
* WARNING: This function can potentially allow a reentrancy attack when transferring tokens
84-
* to an untrusted contract, when invoking {onERC1155Received} on the receiver.
84+
* to an untrusted contract, when invoking {IERC1155Receiver-onERC1155Received} on the receiver.
8585
* Ensure to follow the checks-effects-interactions pattern and consider employing
8686
* reentrancy guards when interacting with untrusted contracts.
8787
*
@@ -101,7 +101,7 @@ interface IERC1155 is IERC165 {
101101
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
102102
*
103103
* WARNING: This function can potentially allow a reentrancy attack when transferring tokens
104-
* to an untrusted contract, when invoking {onERC1155BatchReceived} on the receiver.
104+
* to an untrusted contract, when invoking {IERC1155Receiver-onERC1155BatchReceived} on the receiver.
105105
* Ensure to follow the checks-effects-interactions pattern and consider employing
106106
* reentrancy guards when interacting with untrusted contracts.
107107
*

0 commit comments

Comments
 (0)