Allow Initializable versions greater than 256 (#4460)
Co-authored-by: Francisco <fg@frang.io>
This commit is contained in:
7
test/helpers/constants.js
Normal file
7
test/helpers/constants.js
Normal file
@ -0,0 +1,7 @@
|
||||
const MAX_UINT48 = web3.utils.toBN(1).shln(48).subn(1).toString();
|
||||
const MAX_UINT64 = web3.utils.toBN(1).shln(64).subn(1).toString();
|
||||
|
||||
module.exports = {
|
||||
MAX_UINT48,
|
||||
MAX_UINT64,
|
||||
};
|
||||
@ -1,6 +1,7 @@
|
||||
const ethSigUtil = require('eth-sig-util');
|
||||
const Wallet = require('ethereumjs-wallet').default;
|
||||
const { getDomain, domainType } = require('../helpers/eip712');
|
||||
const { MAX_UINT48 } = require('../helpers/constants');
|
||||
|
||||
const { expectEvent } = require('@openzeppelin/test-helpers');
|
||||
const { expect } = require('chai');
|
||||
@ -14,8 +15,6 @@ const { shouldBehaveLikeRegularContext } = require('../utils/Context.behavior');
|
||||
contract('ERC2771Context', function (accounts) {
|
||||
const [, trustedForwarder] = accounts;
|
||||
|
||||
const MAX_UINT48 = web3.utils.toBN(1).shln(48).subn(1).toString();
|
||||
|
||||
beforeEach(async function () {
|
||||
this.forwarder = await ERC2771Forwarder.new('ERC2771Forwarder');
|
||||
this.recipient = await ERC2771ContextMock.new(this.forwarder.address);
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
const { expectEvent } = require('@openzeppelin/test-helpers');
|
||||
const { expect } = require('chai');
|
||||
const { expectRevertCustomError } = require('../../helpers/customError');
|
||||
const { MAX_UINT64 } = require('../../helpers/constants');
|
||||
|
||||
const InitializableMock = artifacts.require('InitializableMock');
|
||||
const ConstructorInitializableMock = artifacts.require('ConstructorInitializableMock');
|
||||
@ -213,7 +214,7 @@ contract('Initializable', function () {
|
||||
it('old and new patterns in good sequence', async function () {
|
||||
const ok = await DisableOk.new();
|
||||
await expectEvent.inConstruction(ok, 'Initialized', { version: '1' });
|
||||
await expectEvent.inConstruction(ok, 'Initialized', { version: '255' });
|
||||
await expectEvent.inConstruction(ok, 'Initialized', { version: MAX_UINT64 });
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user