Skip to content

Commit 2782b73

Browse files
committed
Merge branch 'master' into remove/presets
2 parents b5b9567 + 17bc2da commit 2782b73

File tree

117 files changed

+13060
-13261
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

117 files changed

+13060
-13261
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ indent_size = 4
1717
[*.js]
1818
indent_size = 2
1919

20-
[*.adoc]
20+
[*.{adoc,md}]
2121
max_line_length = 0

.eslintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,6 @@
5757
"promise/avoid-new": "off",
5858
},
5959
"parserOptions": {
60-
"ecmaVersion": 2018
60+
"ecmaVersion": 2020
6161
}
6262
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Compare gas costs
2+
inputs:
3+
token:
4+
description: github token
5+
required: true
6+
report:
7+
description: report to read from
8+
required: false
9+
default: gasReporterOutput.json
10+
out_report:
11+
description: report to read
12+
required: false
13+
default: ${{ github.ref_name }}.gasreport.json
14+
ref_report:
15+
description: report to read from
16+
required: false
17+
default: ${{ github.base_ref }}.gasreport.json
18+
19+
runs:
20+
using: composite
21+
steps:
22+
- name: Download reference report
23+
if: github.event_name == 'pull_request'
24+
run: |
25+
RUN_ID=`gh run list --repo ${{ github.repository }} --branch ${{ github.base_ref }} --workflow ${{ github.workflow }} --limit 100 --json 'conclusion,databaseId,event' --jq 'map(select(.conclusion=="success" and .event!="pull_request"))[0].databaseId'`
26+
gh run download ${RUN_ID} --repo ${{ github.repository }} -n gasreport
27+
env:
28+
GITHUB_TOKEN: ${{ inputs.token }}
29+
shell: bash
30+
continue-on-error: true
31+
id: reference
32+
- name: Compare reports
33+
if: steps.reference.outcome == 'success' && github.event_name == 'pull_request'
34+
run: |
35+
node scripts/checks/compareGasReports.js ${{ inputs.report }} ${{ inputs.ref_report }} >> $GITHUB_STEP_SUMMARY
36+
env:
37+
STYLE: markdown
38+
shell: bash
39+
- name: Rename report for upload
40+
if: github.event_name != 'pull_request'
41+
run: |
42+
mv ${{ inputs.report }} ${{ inputs.out_report }}
43+
shell: bash
44+
- name: Save report
45+
if: github.event_name != 'pull_request'
46+
uses: actions/upload-artifact@v3
47+
with:
48+
name: gasreport
49+
path: ${{ inputs.out_report }}

.github/workflows/checks.yml

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,21 @@ concurrency:
1313
cancel-in-progress: true
1414

1515
jobs:
16+
changelog:
17+
if: github.event_name == 'pull_request' && github.repository != 'OpenZeppelin/openzeppelin-contracts-upgradeable'
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v3
21+
- name: Check diff
22+
run: |
23+
git fetch origin ${{ github.base_ref }} --depth=1
24+
if git diff --exit-code origin/${{ github.base_ref }} -- CHANGELOG.md ; then
25+
echo 'Missing changelog entry'
26+
exit 1
27+
fi
28+
1629
lint:
30+
if: github.repository != 'OpenZeppelin/openzeppelin-contracts-upgradeable'
1731
runs-on: ubuntu-latest
1832
steps:
1933
- uses: actions/checkout@v3
@@ -23,18 +37,27 @@ jobs:
2337

2438
tests:
2539
runs-on: ubuntu-latest
40+
env:
41+
FORCE_COLOR: 1
42+
GAS: true
2643
steps:
2744
- uses: actions/checkout@v3
2845
- name: Set up environment
2946
uses: ./.github/actions/setup
30-
- run: npm run test
31-
env:
32-
FORCE_COLOR: 1
33-
ENABLE_GAS_REPORT: true
34-
- run: npm run test:inheritance
35-
- run: npm run test:generation
47+
- name: Run tests and generate gas report
48+
run: npm run test
49+
- name: Check linearisation of the inheritance graph
50+
run: npm run test:inheritance
51+
- name: Check proceduraly generated contracts are up-to-date
52+
if: github.repository != 'OpenZeppelin/openzeppelin-contracts-upgradeable'
53+
run: npm run test:generation
54+
- name: Compare gas costs
55+
uses: ./.github/actions/gas-compare
56+
with:
57+
token: ${{ github.token }}
3658

3759
coverage:
60+
if: github.repository != 'OpenZeppelin/openzeppelin-contracts-upgradeable'
3861
runs-on: ubuntu-latest
3962
steps:
4063
- uses: actions/checkout@v3
@@ -46,6 +69,7 @@ jobs:
4669
- uses: codecov/codecov-action@v3
4770

4871
slither:
72+
if: github.repository != 'OpenZeppelin/openzeppelin-contracts-upgradeable'
4973
runs-on: ubuntu-latest
5074
steps:
5175
- uses: actions/checkout@v3

CHANGELOG.md

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,57 @@
66

77
## Unreleased
88

9+
* `Initializable`: add internal functions `_getInitializedVersion` and `_isInitializing` ([#3598](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3598))
10+
* `ERC165Checker`: add `supportsERC165InterfaceUnchecked` for consulting individual interfaces without the full ERC165 protocol. ([#3339](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3339))
11+
* `Address`: optimize `functionCall` by calling `functionCallWithValue` directly. ([#3468](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3468))
12+
* `Address`: optimize `functionCall` functions by checking contract size only if there is no returned data. ([#3469](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3469))
13+
* `GovernorCompatibilityBravo`: remove unused `using` statements ([#3506](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3506))
14+
* `ERC20`: optimize `_transfer`, `_mint` and `_burn` by using `unchecked` arithmetic when possible. ([#3513](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3513))
15+
* `ERC20FlashMint`: add an internal `_flashFee` function for overriding. ([#3551](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3551))
16+
* `ERC721`: optimize transfers by making approval clearing implicit instead of emitting an event. ([#3481](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3481))
17+
* `ERC721`: optimize burn by making approval clearing implicit instead of emitting an event. ([#3538](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3538))
18+
* `ReentrancyGuard`: Reduce code size impact of the modifier by using internal functions. ([#3515](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3515))
19+
* `SafeCast`: optimize downcasting of signed integers. ([#3565](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3565))
20+
* `VestingWallet`: remove unused library `Math.sol`. ([#3605](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3605))
21+
* `ECDSA`: Remove redundant check on the `v` value. ([#3591](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3591))
22+
* `VestingWallet`: add `releasable` getters. ([#3580](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3580))
23+
24+
### Deprecations
25+
26+
* `EIP712`: Added the file `EIP712.sol` and deprecated `draft-EIP712.sol` since the EIP is no longer a Draft. Developers are encouraged to update their imports. ([#3621](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3621))
27+
28+
```diff
29+
-import "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol";
30+
+import "@openzeppelin/contracts/utils/cryptography/EIP712.sol";
31+
```
32+
33+
### Compatibility Note
34+
35+
ERC-721 integrators that interpret contract state from events should make sure that they implement the clearing of approval that is implicit in every transfer according to the EIP. Previous versions of OpenZeppelin Contracts emitted an explicit `Approval` event even though it was not required by the specification, and this is no longer the case.
36+
37+
## 4.7.3
38+
39+
### Breaking changes
40+
41+
* `ECDSA`: `recover(bytes32,bytes)` and `tryRecover(bytes32,bytes)` no longer accept compact signatures to prevent malleability. Compact signature support remains available using `recover(bytes32,bytes32,bytes32)` and `tryRecover(bytes32,bytes32,bytes32)`.
42+
43+
## 4.7.2
44+
45+
* `LibArbitrumL2`, `CrossChainEnabledArbitrumL2`: Fixed detection of cross-chain calls for EOAs. Previously, calls from EOAs would be classified as cross-chain calls. ([#3578](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3578))
46+
* `GovernorVotesQuorumFraction`: Fixed quorum updates so they do not affect past proposals that failed due to lack of quorum. ([#3561](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3561))
47+
* `ERC165Checker`: Added protection against large returndata. ([#3587](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3587))
48+
49+
## 4.7.1
50+
51+
* `SignatureChecker`: Fix an issue that causes `isValidSignatureNow` to revert when the target contract returns ill-encoded data. ([#3552](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3552))
52+
* `ERC165Checker`: Fix an issue that causes `supportsInterface` to revert when the target contract returns ill-encoded data. ([#3552](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3552))
53+
54+
## 4.7.0 (2022-06-29)
55+
956
* `TimelockController`: Migrate `_call` to `_execute` and allow inheritance and overriding similar to `Governor`. ([#3317](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3317))
1057
* `CrossChainEnabledPolygonChild`: replace the `require` statement with the custom error `NotCrossChainCall`. ([#3380](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3380))
1158
* `ERC20FlashMint`: Add customizable flash fee receiver. ([#3327](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3327))
12-
* `ERC20TokenizedVault`: add an extension of `ERC20` that implements the ERC4626 Tokenized Vault Standard. ([#3171](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3171))
59+
* `ERC4626`: add an extension of `ERC20` that implements the ERC4626 Tokenized Vault Standard. ([#3171](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3171))
1360
* `SafeERC20`: add `safePermit` as mitigation against phantom permit functions. ([#3280](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3280))
1461
* `Math`: add a `mulDiv` function that can round the result either up or down. ([#3171](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3171))
1562
* `Math`: Add a `sqrt` function to compute square roots of integers, rounding either up or down. ([#3242](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3242))

README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
[![Docs](https://img.shields.io/badge/docs-%F0%9F%93%84-blue)](https://docs.openzeppelin.com/contracts)
44
[![NPM Package](https://img.shields.io/npm/v/@openzeppelin/contracts.svg)](https://www.npmjs.org/package/@openzeppelin/contracts)
55
[![Coverage Status](https://codecov.io/gh/OpenZeppelin/openzeppelin-contracts/graph/badge.svg)](https://codecov.io/gh/OpenZeppelin/openzeppelin-contracts)
6+
[![gitpoap badge](https://public-api.gitpoap.io/v1/repo/OpenZeppelin/openzeppelin-contracts/badge)](https://www.gitpoap.io/gh/OpenZeppelin/openzeppelin-contracts)
67

78
**A library for secure smart contract development.** Build on a solid foundation of community-vetted code.
89

@@ -22,9 +23,9 @@
2223
$ npm install @openzeppelin/contracts
2324
```
2425

25-
OpenZeppelin Contracts features a [stable API](https://docs.openzeppelin.com/contracts/releases-stability#api-stability), which means your contracts won't break unexpectedly when upgrading to a newer minor version.
26+
OpenZeppelin Contracts features a [stable API](https://docs.openzeppelin.com/contracts/releases-stability#api-stability), which means that your contracts won't break unexpectedly when upgrading to a newer minor version.
2627

27-
An alternative to npm is to use the GitHub repository `openzeppelin/openzeppelin-contracts` to retrieve the contracts. When doing this, make sure to specify the tag for a release such as `v4.5.0`, instead of using the `master` branch.
28+
An alternative to npm is to use the GitHub repository (`openzeppelin/openzeppelin-contracts`) to retrieve the contracts. When doing this, make sure to specify the tag for a release such as `v4.5.0`, instead of using the `master` branch.
2829

2930
### Usage
3031

@@ -43,20 +44,20 @@ contract MyCollectible is ERC721 {
4344

4445
_If you're new to smart contract development, head to [Developing Smart Contracts](https://docs.openzeppelin.com/learn/developing-smart-contracts) to learn about creating a new project and compiling your contracts._
4546

46-
To keep your system secure, you should **always** use the installed code as-is, and neither copy-paste it from online sources, nor modify it yourself. The library is designed so that only the contracts and functions you use are deployed, so you don't need to worry about it needlessly increasing gas costs.
47+
To keep your system secure, you should **always** use the installed code as-is, and neither copy-paste it from online sources nor modify it yourself. The library is designed so that only the contracts and functions you use are deployed, so you don't need to worry about it needlessly increasing gas costs.
4748

4849
## Learn More
4950

50-
The guides in the [docs site](https://docs.openzeppelin.com/contracts) will teach about different concepts, and how to use the related contracts that OpenZeppelin Contracts provides:
51+
The guides in the [documentation site](https://docs.openzeppelin.com/contracts) will teach about different concepts, and how to use the related contracts that OpenZeppelin Contracts provides:
5152

5253
* [Access Control](https://docs.openzeppelin.com/contracts/access-control): decide who can perform each of the actions on your system.
5354
* [Tokens](https://docs.openzeppelin.com/contracts/tokens): create tradeable assets or collectives, and distribute them via [Crowdsales](https://docs.openzeppelin.com/contracts/crowdsales).
5455
* [Gas Station Network](https://docs.openzeppelin.com/contracts/gsn): let your users interact with your contracts without having to pay for gas themselves.
55-
* [Utilities](https://docs.openzeppelin.com/contracts/utilities): generic useful tools, including non-overflowing math, signature verification, and trustless paying systems.
56+
* [Utilities](https://docs.openzeppelin.com/contracts/utilities): generic useful tools including non-overflowing math, signature verification, and trustless paying systems.
5657

5758
The [full API](https://docs.openzeppelin.com/contracts/api/token/ERC20) is also thoroughly documented, and serves as a great reference when developing your smart contract application. You can also ask for help or follow Contracts's development in the [community forum](https://forum.openzeppelin.com).
5859

59-
Finally, you may want to take a look at the [guides on our blog](https://blog.openzeppelin.com/guides), which cover several common use cases and good practices.. The following articles provide great background reading, though please note, some of the referenced tools have changed as the tooling in the ecosystem continues to rapidly evolve.
60+
Finally, you may want to take a look at the [guides on our blog](https://blog.openzeppelin.com/guides), which cover several common use cases and good practices. The following articles provide great background reading, though please note that some of the referenced tools have changed, as the tooling in the ecosystem continues to rapidly evolve.
6061

6162
* [The Hitchhiker’s Guide to Smart Contracts in Ethereum](https://blog.openzeppelin.com/the-hitchhikers-guide-to-smart-contracts-in-ethereum-848f08001f05) will help you get an overview of the various tools available for smart contract development, and help you set up your environment.
6263
* [A Gentle Introduction to Ethereum Programming, Part 1](https://blog.openzeppelin.com/a-gentle-introduction-to-ethereum-programming-part-1-783cc7796094) provides very useful information on an introductory level, including many basic concepts from the Ethereum platform.

contracts/access/AccessControl.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: MIT
2-
// OpenZeppelin Contracts (last updated v4.6.0) (access/AccessControl.sol)
2+
// OpenZeppelin Contracts (last updated v4.7.0) (access/AccessControl.sol)
33

44
pragma solidity ^0.8.0;
55

@@ -110,7 +110,7 @@ abstract contract AccessControl is Context, IAccessControl, ERC165 {
110110
string(
111111
abi.encodePacked(
112112
"AccessControl: account ",
113-
Strings.toHexString(uint160(account), 20),
113+
Strings.toHexString(account),
114114
" is missing role ",
115115
Strings.toHexString(uint256(role), 32)
116116
)

contracts/access/Ownable.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: MIT
2-
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
2+
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)
33

44
pragma solidity ^0.8.0;
55

contracts/crosschain/amb/CrossChainEnabledAMB.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: MIT
2-
// OpenZeppelin Contracts (last updated v4.6.0) (crosschain/amb/CrossChainEnabledAMB.sol)
2+
// OpenZeppelin Contracts (last updated v4.7.0) (crosschain/amb/CrossChainEnabledAMB.sol)
33

44
pragma solidity ^0.8.4;
55

contracts/crosschain/amb/LibAMB.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: MIT
2-
// OpenZeppelin Contracts (last updated v4.6.0) (crosschain/amb/LibAMB.sol)
2+
// OpenZeppelin Contracts (last updated v4.7.0) (crosschain/amb/LibAMB.sol)
33

44
pragma solidity ^0.8.4;
55

0 commit comments

Comments
 (0)