Skip to content

Commit

Permalink
Merge branch 'master' into timelock-public
Browse files Browse the repository at this point in the history
  • Loading branch information
Amxx committed Sep 16, 2020
2 parents cd0b97c + ace35fd commit bfb1396
Show file tree
Hide file tree
Showing 49 changed files with 23,951 additions and 29,085 deletions.
3 changes: 1 addition & 2 deletions contracts/token/ERC721/IERC721Receiver.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,5 @@ interface IERC721Receiver {
*
* The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
*/
function onERC721Received(address operator, address from, uint256 tokenId, bytes calldata data)
external returns (bytes4);
function onERC721Received(address operator, address from, uint256 tokenId, bytes calldata data) external returns (bytes4);
}
52,410 changes: 23,637 additions & 28,773 deletions package-lock.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
],
"scripts": {
"compile": "scripts/compile.sh",
"coverage": "scripts/coverage.sh",
"coverage": "scripts/coverage.js",
"docs": "oz-docs",
"docs:watch": "npm run docs watch contracts 'docs/*.hbs'",
"prepare-docs": "scripts/prepare-docs.sh",
Expand Down Expand Up @@ -50,7 +50,7 @@
"@openzeppelin/docs-utils": "^0.1.0",
"@openzeppelin/gsn-helpers": "^0.2.3",
"@openzeppelin/gsn-provider": "^0.1.10",
"@openzeppelin/test-environment": "^0.1.4",
"@openzeppelin/test-environment": "^0.1.5",
"@openzeppelin/test-helpers": "^0.5.6",
"chai": "^4.2.0",
"eslint": "^6.5.1",
Expand All @@ -61,14 +61,14 @@
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.1",
"ethereumjs-util": "^7.0.1",
"ganache-core-coverage": "https://github.com/OpenZeppelin/ganache-core-coverage/releases/download/2.5.3-coverage/ganache-core-coverage-2.5.3.tgz",
"ganache-cli": "^6.9.1",
"lodash.startcase": "^4.4.0",
"lodash.zip": "^4.2.0",
"micromatch": "^4.0.2",
"mocha": "^8.0.1",
"rimraf": "^3.0.2",
"solhint": "^3.2.0",
"solidity-coverage": "github:rotcivegaf/solidity-coverage#5875f5b7bc74d447f3312c9c0e9fc7814b482477",
"solidity-coverage": "^0.7.8",
"solidity-docgen": "^0.5.3"
},
"dependencies": {}
Expand Down
3 changes: 2 additions & 1 deletion renovate.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"rangeStrategy": "update-lockfile",
"rangeStrategy": "replace",
"extends": [
"config:base",
":maintainLockFilesWeekly",
"group:allNonMajor",
"schedule:weekly"
],
Expand Down
21 changes: 21 additions & 0 deletions scripts/coverage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env node

const { execSync } = require('child_process');
const { runCoverage } = require('@openzeppelin/test-environment');

async function main () {
await runCoverage(
['mocks'],
'npm run compile',
'./node_modules/.bin/mocha --exit --timeout 10000 --recursive'.split(' '),
);

if (process.env.CI) {
execSync('curl -s https://codecov.io/bash | bash -s -- -C "$CIRCLE_SHA1"', { stdio: 'inherit' });
}
}

main().catch(e => {
console.error(e);
process.exit(1);
});
25 changes: 0 additions & 25 deletions scripts/coverage.sh

This file was deleted.

2 changes: 1 addition & 1 deletion scripts/gen-nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const startCase = require('lodash.startcase');
const baseDir = process.argv[2];

const files = proc.execFileSync(
'find', [baseDir, '-type', 'f'], { encoding: 'utf8' }
'find', [baseDir, '-type', 'f'], { encoding: 'utf8' },
).split('\n').filter(s => s !== '');

console.log('.API');
Expand Down
2 changes: 1 addition & 1 deletion scripts/release/update-changelog-release-date.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if (changelog.indexOf(`## ${version} (unreleased)`) === -1) {

fs.writeFileSync('CHANGELOG.md', changelog.replace(
`## ${version} (unreleased)`,
`## ${version} (${new Date().toISOString().split('T')[0]})`)
`## ${version} (${new Date().toISOString().split('T')[0]})`),
);

cp.execSync('git add CHANGELOG.md', { stdio: 'inherit' });
6 changes: 3 additions & 3 deletions test/GSN/ERC721GSNRecipientMock.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ describe('ERC721GSNRecipient (integration)', function () {
await web3.eth.sign(
web3.utils.soliditySha3(
// eslint-disable-next-line max-len
data.relayerAddress, data.from, data.encodedFunctionCall, toBN(data.txFee), toBN(data.gasPrice), toBN(data.gas), toBN(data.nonce), data.relayHubAddress, this.token.address
), signer
)
data.relayerAddress, data.from, data.encodedFunctionCall, toBN(data.txFee), toBN(data.gasPrice), toBN(data.gas), toBN(data.nonce), data.relayHubAddress, this.token.address,
), signer,
),
);

await testMintToken(this.token, sender, tokenId, { useGSN: true, approveFunction });
Expand Down
4 changes: 2 additions & 2 deletions test/GSN/GSNRecipient.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ describe('GSNRecipient', function () {
it('cannot upgrade to the same RelayHub', async function () {
await expectRevert(
this.recipient.upgradeRelayHub(singletonRelayHub),
'GSNRecipient: new RelayHub is the current one'
'GSNRecipient: new RelayHub is the current one',
);
});

it('cannot upgrade to the zero address', async function () {
await expectRevert(
this.recipient.upgradeRelayHub(ZERO_ADDRESS), 'GSNRecipient: new RelayHub is the zero address'
this.recipient.upgradeRelayHub(ZERO_ADDRESS), 'GSNRecipient: new RelayHub is the zero address',
);
});

Expand Down
22 changes: 11 additions & 11 deletions test/GSN/GSNRecipientSignature.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ describe('GSNRecipientSignature', function () {
it('fails when constructor called with a zero address', async function () {
await expectRevert(
GSNRecipientSignatureMock.new(
ZERO_ADDRESS
ZERO_ADDRESS,
),
'GSNRecipientSignature: trusted signer is the zero address'
'GSNRecipientSignature: trusted signer is the zero address',
);
});
});
Expand All @@ -49,9 +49,9 @@ describe('GSNRecipientSignature', function () {
web3.utils.soliditySha3(
// the nonce is not signed
// eslint-disable-next-line max-len
data.relayerAddress, data.from, data.encodedFunctionCall, toBN(data.txFee), toBN(data.gasPrice), toBN(data.gas)
), signer
)
data.relayerAddress, data.from, data.encodedFunctionCall, toBN(data.txFee), toBN(data.gasPrice), toBN(data.gas),
), signer,
),
);

await gsn.expectError(this.recipient.mockFunction({ value: 0, useGSN: true, approveFunction }));
Expand All @@ -63,9 +63,9 @@ describe('GSNRecipientSignature', function () {
await web3.eth.sign(
web3.utils.soliditySha3(
// eslint-disable-next-line max-len
data.relayerAddress, data.from, data.encodedFunctionCall, toBN(data.txFee), toBN(data.gasPrice), toBN(data.gas), toBN(data.nonce), data.relayHubAddress, data.to
), signer
)
data.relayerAddress, data.from, data.encodedFunctionCall, toBN(data.txFee), toBN(data.gasPrice), toBN(data.gas), toBN(data.nonce), data.relayHubAddress, data.to,
), signer,
),
);

const { tx } = await this.recipient.mockFunction({ value: 0, useGSN: true, approveFunction });
Expand All @@ -79,9 +79,9 @@ describe('GSNRecipientSignature', function () {
await web3.eth.sign(
web3.utils.soliditySha3(
// eslint-disable-next-line max-len
data.relayerAddress, data.from, data.encodedFunctionCall, toBN(data.txFee), toBN(data.gasPrice), toBN(data.gas), toBN(data.nonce), data.relayHubAddress, data.to
), other
)
data.relayerAddress, data.from, data.encodedFunctionCall, toBN(data.txFee), toBN(data.gasPrice), toBN(data.gas), toBN(data.nonce), data.relayHubAddress, data.to,
), other,
),
);

await gsn.expectError(this.recipient.mockFunction({ value: 0, useGSN: true, approveFunction }));
Expand Down
10 changes: 5 additions & 5 deletions test/access/AccessControl.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ describe('AccessControl', function () {
it('non-admin cannot grant role to other accounts', async function () {
await expectRevert(
this.accessControl.grantRole(ROLE, authorized, { from: other }),
'AccessControl: sender must be an admin to grant'
'AccessControl: sender must be an admin to grant',
);
});

Expand Down Expand Up @@ -76,7 +76,7 @@ describe('AccessControl', function () {
it('non-admin cannot revoke role', async function () {
await expectRevert(
this.accessControl.revokeRole(ROLE, authorized, { from: other }),
'AccessControl: sender must be an admin to revoke'
'AccessControl: sender must be an admin to revoke',
);
});

Expand Down Expand Up @@ -110,7 +110,7 @@ describe('AccessControl', function () {
it('only the sender can renounce their roles', async function () {
await expectRevert(
this.accessControl.renounceRole(ROLE, authorized, { from: admin }),
'AccessControl: can only renounce roles for self'
'AccessControl: can only renounce roles for self',
);
});

Expand Down Expand Up @@ -170,14 +170,14 @@ describe('AccessControl', function () {
it('a role\'s previous admins no longer grant roles', async function () {
await expectRevert(
this.accessControl.grantRole(ROLE, authorized, { from: admin }),
'AccessControl: sender must be an admin to grant'
'AccessControl: sender must be an admin to grant',
);
});

it('a role\'s previous admins no longer revoke roles', async function () {
await expectRevert(
this.accessControl.revokeRole(ROLE, authorized, { from: admin }),
'AccessControl: sender must be an admin to revoke'
'AccessControl: sender must be an admin to revoke',
);
});
});
Expand Down
6 changes: 3 additions & 3 deletions test/access/Ownable.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ describe('Ownable', function () {
it('prevents non-owners from transferring', async function () {
await expectRevert(
this.ownable.transferOwnership(other, { from: other }),
'Ownable: caller is not the owner'
'Ownable: caller is not the owner',
);
});

it('guards ownership against stuck state', async function () {
await expectRevert(
this.ownable.transferOwnership(ZERO_ADDRESS, { from: owner }),
'Ownable: new owner is the zero address'
'Ownable: new owner is the zero address',
);
});
});
Expand All @@ -51,7 +51,7 @@ describe('Ownable', function () {
it('prevents non-owners from renouncement', async function () {
await expectRevert(
this.ownable.renounceOwnership({ from: other }),
'Ownable: caller is not the owner'
'Ownable: caller is not the owner',
);
});
});
Expand Down
4 changes: 2 additions & 2 deletions test/cryptography/ECDSA.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe('ECDSA', function () {
await expectRevert(
// eslint-disable-next-line max-len
this.ecdsa.recover(TEST_MESSAGE, '0x01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789'),
'ECDSA: invalid signature length'
'ECDSA: invalid signature length',
);
});
});
Expand Down Expand Up @@ -116,7 +116,7 @@ describe('ECDSA', function () {
// Recover the signer address from the generated message and signature.
expect(await this.ecdsa.recover(
toEthSignedMessageHash(TEST_MESSAGE),
signature
signature,
)).to.equal(other);
});
});
Expand Down
2 changes: 1 addition & 1 deletion test/helpers/sign.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const getSignFor = (contract, signer) => (redeemer, methodName, methodArgs = [])
if (methodArgs.length > 0) {
parts.push(
contract.contract.methods[methodName](...methodArgs.concat([DUMMY_SIGNATURE])).encodeABI()
.slice(0, -1 * PADDED_SIGNATURE_SIZE)
.slice(0, -1 * PADDED_SIGNATURE_SIZE),
);
} else {
const abi = contract.abi.find(abi => abi.name === methodName);
Expand Down
6 changes: 3 additions & 3 deletions test/introspection/ERC1820Implementer.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ describe('ERC1820Implementer', function () {
it('reverts when attempting to set as implementer in the registry', async function () {
await expectRevert(
this.registry.setInterfaceImplementer(
implementee, this.interfaceA, this.implementer.address, { from: implementee }
implementee, this.interfaceA, this.implementer.address, { from: implementee },
),
'Does not implement the interface'
'Does not implement the interface',
);
});
});
Expand All @@ -58,7 +58,7 @@ describe('ERC1820Implementer', function () {

it('can be set as an implementer for supported interfaces in the registry', async function () {
await this.registry.setInterfaceImplementer(
implementee, this.interfaceA, this.implementer.address, { from: implementee }
implementee, this.interfaceA, this.implementer.address, { from: implementee },
);

expect(await this.registry.getInterfaceImplementer(implementee, this.interfaceA))
Expand Down
14 changes: 7 additions & 7 deletions test/payment/PaymentSplitter.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,31 @@ describe('PaymentSplitter', function () {

it('rejects more payees than shares', async function () {
await expectRevert(PaymentSplitter.new([payee1, payee2, payee3], [20, 30]),
'PaymentSplitter: payees and shares length mismatch'
'PaymentSplitter: payees and shares length mismatch',
);
});

it('rejects more shares than payees', async function () {
await expectRevert(PaymentSplitter.new([payee1, payee2], [20, 30, 40]),
'PaymentSplitter: payees and shares length mismatch'
'PaymentSplitter: payees and shares length mismatch',
);
});

it('rejects null payees', async function () {
await expectRevert(PaymentSplitter.new([payee1, ZERO_ADDRESS], [20, 30]),
'PaymentSplitter: account is the zero address'
'PaymentSplitter: account is the zero address',
);
});

it('rejects zero-valued shares', async function () {
await expectRevert(PaymentSplitter.new([payee1, payee2], [20, 0]),
'PaymentSplitter: shares are 0'
'PaymentSplitter: shares are 0',
);
});

it('rejects repeated payees', async function () {
await expectRevert(PaymentSplitter.new([payee1, payee1], [20, 30]),
'PaymentSplitter: account already has shares'
'PaymentSplitter: account already has shares',
);
});

Expand Down Expand Up @@ -84,13 +84,13 @@ describe('PaymentSplitter', function () {
describe('release', async function () {
it('reverts if no funds to claim', async function () {
await expectRevert(this.contract.release(payee1),
'PaymentSplitter: account is not due payment'
'PaymentSplitter: account is not due payment',
);
});
it('reverts if non-payee want to claim', async function () {
await send.ether(payer1, this.contract.address, amount);
await expectRevert(this.contract.release(nonpayee1),
'PaymentSplitter: account has no shares'
'PaymentSplitter: account has no shares',
);
});
});
Expand Down
2 changes: 1 addition & 1 deletion test/payment/escrow/ConditionalEscrow.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ describe('ConditionalEscrow', function () {
await this.escrow.deposit(payee, { from: owner, value: amount });

await expectRevert(this.escrow.withdraw(payee, { from: owner }),
'ConditionalEscrow: payee is not allowed to withdraw'
'ConditionalEscrow: payee is not allowed to withdraw',
);
});
});
Expand Down
4 changes: 2 additions & 2 deletions test/payment/escrow/Escrow.behavior.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function shouldBehaveLikeEscrow (owner, [payee1, payee2]) {

it('only the owner can deposit', async function () {
await expectRevert(this.escrow.deposit(payee1, { from: payee2 }),
'Ownable: caller is not the owner'
'Ownable: caller is not the owner',
);
});

Expand Down Expand Up @@ -73,7 +73,7 @@ function shouldBehaveLikeEscrow (owner, [payee1, payee2]) {

it('only the owner can withdraw', async function () {
await expectRevert(this.escrow.withdraw(payee1, { from: payee1 }),
'Ownable: caller is not the owner'
'Ownable: caller is not the owner',
);
});

Expand Down
Loading

0 comments on commit bfb1396

Please sign in to comment.