Skip to content

Commit 08c8eff

Browse files
committed
Merge branch 'master' into feat/eip1363-v5.x
2 parents af285c6 + 72c642e commit 08c8eff

Some content is hidden

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

54 files changed

+469
-858
lines changed

.changeset/brown-cooks-dress.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'openzeppelin-solidity': patch
3+
---
4+
5+
`Checkpoints`: Optimized checkpoint access by removing redundant memory usage.

.changeset/twenty-feet-grin.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+
`Base64`: Add `encodeURL` following section 5 of RFC4648 for URL encoding

.changeset/violet-moons-tell.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+
`AccessControlEnumerable`: Add a `getRoleMembers` method to return all accounts that have `role`.

.github/actions/setup/action.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ name: Setup
33
runs:
44
using: composite
55
steps:
6-
- uses: actions/setup-node@v3
6+
- uses: actions/setup-node@v4
77
with:
8-
node-version: 16.x
9-
- uses: actions/cache@v3
8+
node-version: 20.x
9+
- uses: actions/cache@v4
1010
id: cache
1111
with:
1212
path: '**/node_modules'

.github/workflows/checks.yml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ jobs:
2929
runs-on: ubuntu-latest
3030
env:
3131
FORCE_COLOR: 1
32+
# Needed for "eth-gas-reporter" to produce a "gasReporterOutput.json" as documented in
33+
# https://github.com/cgewecke/eth-gas-reporter/blob/v0.2.27/docs/gasReporterOutput.md
34+
CI: true
3235
GAS: true
3336
steps:
3437
- uses: actions/checkout@v4
@@ -42,7 +45,6 @@ jobs:
4245
run: npm run test:generation
4346
- name: Compare gas costs
4447
uses: ./.github/actions/gas-compare
45-
if: github.base_ref == 'master'
4648
with:
4749
token: ${{ github.token }}
4850

@@ -68,7 +70,6 @@ jobs:
6870
run: npm run test:inheritance
6971
- name: Check storage layout
7072
uses: ./.github/actions/storage-layout
71-
if: github.base_ref == 'master'
7273
continue-on-error: ${{ contains(github.event.pull_request.labels.*.name, 'breaking change') }}
7374
with:
7475
token: ${{ github.token }}
@@ -82,7 +83,8 @@ jobs:
8283
- name: Set up environment
8384
uses: ./.github/actions/setup
8485
- name: Run tests
85-
run: forge test -vv
86+
# Base64Test requires `--ffi`. See test/utils/Base64.t.sol
87+
run: forge test -vv --no-match-contract Base64Test
8688

8789
coverage:
8890
runs-on: ubuntu-latest
@@ -96,6 +98,17 @@ jobs:
9698
with:
9799
token: ${{ secrets.CODECOV_TOKEN }}
98100

101+
harnesses:
102+
runs-on: ubuntu-latest
103+
steps:
104+
- uses: actions/checkout@v4
105+
- name: Set up environment
106+
uses: ./.github/actions/setup
107+
- name: Compile harnesses
108+
run: |
109+
make -C certora apply
110+
npm run compile:harnesses
111+
99112
slither:
100113
runs-on: ubuntu-latest
101114
steps:

.github/workflows/release-cycle.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ jobs:
143143
env:
144144
PRERELEASE: ${{ needs.state.outputs.is_prerelease }}
145145
- name: Upload tarball artifact
146-
uses: actions/upload-artifact@v3
146+
uses: actions/upload-artifact@v4
147147
with:
148148
name: ${{ github.ref_name }}
149149
path: ${{ steps.pack.outputs.tarball }}
@@ -170,9 +170,7 @@ jobs:
170170
- uses: actions/checkout@v4
171171
- name: Download tarball artifact
172172
id: artifact
173-
# Replace with actions/upload-artifact@v3 when
174-
# https://github.com/actions/download-artifact/pull/194 gets released
175-
uses: actions/download-artifact@e9ef242655d12993efdcda9058dee2db83a2cb9b
173+
uses: actions/download-artifact@v4
176174
with:
177175
name: ${{ github.ref_name }}
178176
- name: Check integrity

certora/harnesses/EnumerableMapHarness.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ contract EnumerableMapHarness {
4949
return _map.get(key);
5050
}
5151

52-
function _indexOf(bytes32 key) public view returns (uint256) {
53-
return _map._keys._inner._indexes[key];
52+
function _positionOf(bytes32 key) public view returns (uint256) {
53+
return _map._keys._inner._positions[key];
5454
}
5555
}

certora/harnesses/EnumerableSetHarness.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ contract EnumerableSetHarness {
2929
return _set.at(index);
3030
}
3131

32-
function _indexOf(bytes32 value) public view returns (uint256) {
33-
return _set._inner._indexes[value];
32+
function _positionOf(bytes32 value) public view returns (uint256) {
33+
return _set._inner._positions[value];
3434
}
3535
}

certora/specs/EnumerableMap.spec

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ methods {
1313
function get(bytes32) external returns (bytes32) envfree;
1414

1515
// FV
16-
function _indexOf(bytes32) external returns (uint256) envfree;
16+
function _positionOf(bytes32) external returns (uint256) envfree;
1717
}
1818

1919
/*
@@ -69,13 +69,13 @@ invariant atUniqueness(uint256 index1, uint256 index2)
6969
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
7070
Invariant: index <> value relationship is consistent
7171
│ │
72-
Note that the two consistencyXxx invariants, put together, prove that at_ and _indexOf are inverse of one another.
73-
This proves that we have a bijection between indices (the enumerability part) and keys (the entries that are set
74-
and removed from the EnumerableMap).
72+
Note that the two consistencyXxx invariants, put together, prove that at_ and _positionOf are inverse of one
73+
another. This proves that we have a bijection between indices (the enumerability part) and keys (the entries that
74+
are set and removed from the EnumerableMap). │
7575
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
7676
*/
7777
invariant consistencyIndex(uint256 index)
78-
index < length() => to_mathint(_indexOf(key_at(index))) == index + 1
78+
index < length() => to_mathint(_positionOf(key_at(index))) == index + 1
7979
{
8080
preserved remove(bytes32 key) {
8181
requireInvariant consistencyIndex(require_uint256(length() - 1));
@@ -84,16 +84,16 @@ invariant consistencyIndex(uint256 index)
8484

8585
invariant consistencyKey(bytes32 key)
8686
contains(key) => (
87-
_indexOf(key) > 0 &&
88-
_indexOf(key) <= length() &&
89-
key_at(require_uint256(_indexOf(key) - 1)) == key
87+
_positionOf(key) > 0 &&
88+
_positionOf(key) <= length() &&
89+
key_at(require_uint256(_positionOf(key) - 1)) == key
9090
)
9191
{
9292
preserved remove(bytes32 otherKey) {
9393
requireInvariant consistencyKey(otherKey);
9494
requireInvariant atUniqueness(
95-
require_uint256(_indexOf(key) - 1),
96-
require_uint256(_indexOf(otherKey) - 1)
95+
require_uint256(_positionOf(key) - 1),
96+
require_uint256(_positionOf(otherKey) - 1)
9797
);
9898
}
9999
}

certora/specs/EnumerableSet.spec

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ methods {
99
function at_(uint256) external returns (bytes32) envfree;
1010

1111
// FV
12-
function _indexOf(bytes32) external returns (uint256) envfree;
12+
function _positionOf(bytes32) external returns (uint256) envfree;
1313
}
1414

1515
/*
@@ -52,13 +52,13 @@ invariant atUniqueness(uint256 index1, uint256 index2)
5252
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
5353
Invariant: index <> key relationship is consistent
5454
│ │
55-
Note that the two consistencyXxx invariants, put together, prove that at_ and _indexOf are inverse of one another.
56-
This proves that we have a bijection between indices (the enumerability part) and keys (the entries that are added
57-
and removed from the EnumerableSet).
55+
Note that the two consistencyXxx invariants, put together, prove that at_ and _positionOf are inverse of one
56+
another. This proves that we have a bijection between indices (the enumerability part) and keys (the entries that
57+
are added and removed from the EnumerableSet). │
5858
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
5959
*/
6060
invariant consistencyIndex(uint256 index)
61-
index < length() => _indexOf(at_(index)) == require_uint256(index + 1)
61+
index < length() => _positionOf(at_(index)) == require_uint256(index + 1)
6262
{
6363
preserved remove(bytes32 key) {
6464
requireInvariant consistencyIndex(require_uint256(length() - 1));
@@ -67,16 +67,16 @@ invariant consistencyIndex(uint256 index)
6767

6868
invariant consistencyKey(bytes32 key)
6969
contains(key) => (
70-
_indexOf(key) > 0 &&
71-
_indexOf(key) <= length() &&
72-
at_(require_uint256(_indexOf(key) - 1)) == key
70+
_positionOf(key) > 0 &&
71+
_positionOf(key) <= length() &&
72+
at_(require_uint256(_positionOf(key) - 1)) == key
7373
)
7474
{
7575
preserved remove(bytes32 otherKey) {
7676
requireInvariant consistencyKey(otherKey);
7777
requireInvariant atUniqueness(
78-
require_uint256(_indexOf(key) - 1),
79-
require_uint256(_indexOf(otherKey) - 1)
78+
require_uint256(_positionOf(key) - 1),
79+
require_uint256(_positionOf(otherKey) - 1)
8080
);
8181
}
8282
}

0 commit comments

Comments
 (0)