Skip to content

Commit 58fa0f8

Browse files
Transpile 7415e3c
1 parent f6c4c9c commit 58fa0f8

15 files changed

+92
-41
lines changed

.gitmodules

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
[submodule "lib/forge-std"]
2+
branch = v1
23
path = lib/forge-std
34
url = https://github.com/foundry-rs/forge-std

CHANGELOG.md

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

3+
## 4.8.3 (2023-04-13)
4+
5+
- `GovernorCompatibilityBravo`: Fix encoding of proposal data when signatures are missing.
6+
- `TransparentUpgradeableProxy`: Fix transparency in case of selector clash with non-decodable calldata or payable mutability. ([#4154](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4154))
7+
38
## 4.8.2 (2023-03-02)
49

510
- `ERC721Consecutive`: Fixed a bug when `_mintConsecutive` is used for batches of size 1 that could lead to balance overflow. Refer to the breaking changes section in the changelog for a note on the behavior of `ERC721._beforeTokenTransfer`.

contracts/governance/compatibility/GovernorCompatibilityBravoUpgradeable.sol

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: MIT
2-
// OpenZeppelin Contracts (last updated v4.8.0) (governance/compatibility/GovernorCompatibilityBravo.sol)
2+
// OpenZeppelin Contracts (last updated v4.8.3) (governance/compatibility/GovernorCompatibilityBravo.sol)
33

44
pragma solidity ^0.8.0;
55

@@ -75,6 +75,11 @@ abstract contract GovernorCompatibilityBravoUpgradeable is Initializable, IGover
7575
bytes[] memory calldatas,
7676
string memory description
7777
) public virtual override returns (uint256) {
78+
require(signatures.length == calldatas.length, "GovernorBravo: invalid signatures length");
79+
// Stores the full proposal and fallback to the public (possibly overridden) propose. The fallback is done
80+
// after the full proposal is stored, so the store operation included in the fallback will be skipped. Here we
81+
// call `propose` and not `super.propose` to make sure if a child contract override `propose`, whatever code
82+
// is added their is also executed when calling this alternative interface.
7883
_storeProposal(_msgSender(), targets, values, signatures, calldatas, description);
7984
return propose(targets, values, _encodeCalldata(signatures, calldatas), description);
8085
}
@@ -130,8 +135,7 @@ abstract contract GovernorCompatibilityBravoUpgradeable is Initializable, IGover
130135
returns (bytes[] memory)
131136
{
132137
bytes[] memory fullcalldatas = new bytes[](calldatas.length);
133-
134-
for (uint256 i = 0; i < signatures.length; ++i) {
138+
for (uint256 i = 0; i < fullcalldatas.length; ++i) {
135139
fullcalldatas[i] = bytes(signatures[i]).length == 0
136140
? calldatas[i]
137141
: abi.encodePacked(bytes4(keccak256(bytes(signatures[i]))), calldatas[i]);
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// SPDX-License-Identifier: MIT
2+
// OpenZeppelin Contracts (last updated v4.8.3) (interfaces/IERC1967.sol)
3+
4+
pragma solidity ^0.8.0;
5+
6+
/**
7+
* @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC.
8+
*
9+
* _Available since v4.9._
10+
*/
11+
interface IERC1967Upgradeable {
12+
/**
13+
* @dev Emitted when the implementation is upgraded.
14+
*/
15+
event Upgraded(address indexed implementation);
16+
17+
/**
18+
* @dev Emitted when the admin account has changed.
19+
*/
20+
event AdminChanged(address previousAdmin, address newAdmin);
21+
22+
/**
23+
* @dev Emitted when the beacon is changed.
24+
*/
25+
event BeaconUpgraded(address indexed beacon);
26+
}

contracts/mocks/ClashingImplementationUpgradeable.sol

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,16 @@ pragma solidity ^0.8.0;
44
import "../proxy/utils/Initializable.sol";
55

66
/**
7-
* @dev Implementation contract with an admin() function made to clash with
8-
* @dev TransparentUpgradeableProxy's to test correct functioning of the
9-
* @dev Transparent Proxy feature.
7+
* @dev Implementation contract with a payable admin() function made to clash with TransparentUpgradeableProxy's to
8+
* test correct functioning of the Transparent Proxy feature.
109
*/
1110
contract ClashingImplementationUpgradeable is Initializable {
1211
function __ClashingImplementation_init() internal onlyInitializing {
1312
}
1413

1514
function __ClashingImplementation_init_unchained() internal onlyInitializing {
1615
}
17-
function admin() external pure returns (address) {
16+
function admin() external payable returns (address) {
1817
return 0x0000000000000000000000000000000011111142;
1918
}
2019

contracts/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@openzeppelin/contracts-upgradeable",
33
"description": "Secure Smart Contract library for Solidity",
4-
"version": "4.8.2",
4+
"version": "4.8.3",
55
"files": [
66
"**/*.sol",
77
"/build/contracts/*.json",

contracts/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
// SPDX-License-Identifier: MIT
2-
// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)
2+
// OpenZeppelin Contracts (last updated v4.8.3) (proxy/ERC1967/ERC1967Upgrade.sol)
33

44
pragma solidity ^0.8.2;
55

66
import "../beacon/IBeaconUpgradeable.sol";
7+
import "../../interfaces/IERC1967Upgradeable.sol";
78
import "../../interfaces/draft-IERC1822Upgradeable.sol";
89
import "../../utils/AddressUpgradeable.sol";
910
import "../../utils/StorageSlotUpgradeable.sol";
@@ -17,7 +18,7 @@ import "../utils/Initializable.sol";
1718
*
1819
* @custom:oz-upgrades-unsafe-allow delegatecall
1920
*/
20-
abstract contract ERC1967UpgradeUpgradeable is Initializable {
21+
abstract contract ERC1967UpgradeUpgradeable is Initializable, IERC1967Upgradeable {
2122
function __ERC1967Upgrade_init() internal onlyInitializing {
2223
}
2324

@@ -33,11 +34,6 @@ abstract contract ERC1967UpgradeUpgradeable is Initializable {
3334
*/
3435
bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
3536

36-
/**
37-
* @dev Emitted when the implementation is upgraded.
38-
*/
39-
event Upgraded(address indexed implementation);
40-
4137
/**
4238
* @dev Returns the current implementation address.
4339
*/
@@ -111,11 +107,6 @@ abstract contract ERC1967UpgradeUpgradeable is Initializable {
111107
*/
112108
bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
113109

114-
/**
115-
* @dev Emitted when the admin account has changed.
116-
*/
117-
event AdminChanged(address previousAdmin, address newAdmin);
118-
119110
/**
120111
* @dev Returns the current admin.
121112
*/
@@ -147,11 +138,6 @@ abstract contract ERC1967UpgradeUpgradeable is Initializable {
147138
*/
148139
bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;
149140

150-
/**
151-
* @dev Emitted when the beacon is upgraded.
152-
*/
153-
event BeaconUpgraded(address indexed beacon);
154-
155141
/**
156142
* @dev Returns the current beacon.
157143
*/

contracts/proxy/README.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ The current implementation of this security mechanism uses https://eips.ethereum
5656

5757
== ERC1967
5858

59+
{{IERC1967}}
60+
5961
{{ERC1967Proxy}}
6062

6163
{{ERC1967Upgrade}}

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)