Fix issues caused by abi.decode reverting (#3552)
Co-authored-by: Francisco Giordano <frangio.1@gmail.com>
(cherry picked from commit 628a6e2866)
This commit is contained in:
committed by
Francisco Giordano
parent
8c49ad74ea
commit
212de08e7f
@ -4,6 +4,7 @@ const { expect } = require('chai');
|
||||
|
||||
const ERC165CheckerMock = artifacts.require('ERC165CheckerMock');
|
||||
const ERC165MissingData = artifacts.require('ERC165MissingData');
|
||||
const ERC165MaliciousData = artifacts.require('ERC165MaliciousData');
|
||||
const ERC165NotSupported = artifacts.require('ERC165NotSupported');
|
||||
const ERC165InterfacesSupported = artifacts.require('ERC165InterfacesSupported');
|
||||
|
||||
@ -46,6 +47,38 @@ contract('ERC165Checker', function (accounts) {
|
||||
});
|
||||
});
|
||||
|
||||
context('ERC165 malicious return data', function () {
|
||||
beforeEach(async function () {
|
||||
this.target = await ERC165MaliciousData.new();
|
||||
});
|
||||
|
||||
it('does not support ERC165', async function () {
|
||||
const supported = await this.mock.supportsERC165(this.target.address);
|
||||
expect(supported).to.equal(false);
|
||||
});
|
||||
|
||||
it('does not support mock interface via supportsInterface', async function () {
|
||||
const supported = await this.mock.supportsInterface(this.target.address, DUMMY_ID);
|
||||
expect(supported).to.equal(false);
|
||||
});
|
||||
|
||||
it('does not support mock interface via supportsAllInterfaces', async function () {
|
||||
const supported = await this.mock.supportsAllInterfaces(this.target.address, [DUMMY_ID]);
|
||||
expect(supported).to.equal(false);
|
||||
});
|
||||
|
||||
it('does not support mock interface via getSupportedInterfaces', async function () {
|
||||
const supported = await this.mock.getSupportedInterfaces(this.target.address, [DUMMY_ID]);
|
||||
expect(supported.length).to.equal(1);
|
||||
expect(supported[0]).to.equal(false);
|
||||
});
|
||||
|
||||
it('does not support mock interface via supportsERC165InterfaceUnchecked', async function () {
|
||||
const supported = await this.mock.supportsERC165InterfaceUnchecked(this.target.address, DUMMY_ID);
|
||||
expect(supported).to.equal(true);
|
||||
});
|
||||
});
|
||||
|
||||
context('ERC165 not supported', function () {
|
||||
beforeEach(async function () {
|
||||
this.target = await ERC165NotSupported.new();
|
||||
|
||||
Reference in New Issue
Block a user