Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Firefly additional tests #290

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions test/blackboxAdminableProxy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import EVMRevert from './helpers/EVMRevert';

require('./helpers/setup');

const AdminableProxy = artifacts.require('AdminableProxy');
const Bridge = artifacts.require('Bridge');

contract('AdminableProxy', (accounts) => {

// Coverage imporvement tests for AdminableProxy
describe('AdminableProxyBlackboxTest', () => {
it('should not allow to call upgradeToAndCall without admin permission', async () => {
const bridge = await Bridge.new();
const parentBlockInterval = 0;
const arg1 = '0xe16ee973a3d642a9e834a2ec4c0305afff7f6eb2';
const arg2 = '0xd5b9aba833726bf3ba1809327df70051c7cfbbc47d790f2e88e52b3e2ac3fbbdbc9a49999ec85e05b330d14463bdc0721010ae8f7a0ea3788831adb1bc8c179a950e3c64e63b9899876203e0f200876811801169e4e5d69ce5480ed722f8213847b85efc3a354c5b989b33e4e1e8eed809';
let data = bridge.contract.methods.initialize(parentBlockInterval).encodeABI();
let proxy = await AdminableProxy.new(bridge.address, data, { from: accounts[2] });
await proxy.upgradeToAndCall(arg1, arg2).should.be.rejectedWith(EVMRevert);
});
});

});
49 changes: 49 additions & 0 deletions test/blackboxBridge.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import EVMRevert from './helpers/EVMRevert';

require('./helpers/setup');

const Bridge = artifacts.require('Bridge');

contract('Bridge', (accounts) => {

// Coverage imporvement tests for Bridge
describe('BridgeBlackboxTest', () => {
it('should not allow to call setOperator without admin permission', async () => {
const bridge = await Bridge.new();
const operator = '0xd1a81aa8c4288fbf84fe83947a06f38763f645ee';
await bridge.setOperator(operator).should.be.rejectedWith(EVMRevert);
});

it('should not allow to call ubmitPeriod without operator premission', async () => {
const bridge = await Bridge.new();
const arg1 = '0xcce0c5c0a51d75a5a6d7b4b049f75f358398ab4210fbd0571d190fd1e83171c2';
const arg2 = '0x00df40f4bb7be9a69fb997202d5ccc482bd43701783c461beb05f534579c3b6a';
await bridge.submitPeriod(arg1, arg2).should.be.rejectedWith(EVMRevert);
});

it('should allow to call initialize with blackbox generated value', async () => {
const bridge = await Bridge.new();
const parentBlockInterval = '0xe2a156e1314cd3dea54a14ef9b7c8eed0492651ae35e6fe9877cef277c58c622';
await bridge.initialize(parentBlockInterval).should.be.fulfilled;
});

it('should not allow to call setParentBlockInterval without admin permission', async () => {
const bridge = await Bridge.new();
const parentBlockInterval = '0xac5167fee3554b1785217edf9147585ea433c04c91dc554012638ec7c6008a8e';
await bridge.setParentBlockInterval(parentBlockInterval).should.be.rejectedWith(EVMRevert);
});

it('should not allow to call deletePeriod without operator premission', async () => {
const bridge = await Bridge.new();
const toDelete = '0x8d4f8497ace4736892521ed024932501de74bce4eace75d9b8fba3fd72284915';
await bridge.deletePeriod(toDelete).should.be.rejectedWith(EVMRevert);
});

it('should allow to visit public variables', async () => {
const bridge = await Bridge.new();
await bridge.lastParentBlock().should.be.fulfilled;
await bridge.genesisBlockNumber().should.be.fulfilled;
});
});

});
37 changes: 37 additions & 0 deletions test/blackboxBridgeProxy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import EVMRevert from './helpers/EVMRevert';

require('./helpers/setup');

const BridgeProxy = artifacts.require('BridgeProxy');

contract('Bridge', (accounts) => {

// Coverage imporvement tests for BridgeProxy
describe('BridgeProxyBlackboxTest', () => {
it('should allow to call admin and implementation', async () => {
const proxy = await BridgeProxy.deployed();
await proxy.admin().should.be.fulfilled;
await proxy.implementation().should.be.fulfilled;
});

it('should not allow to call changeAdmin without admin permission', async () => {
const proxy = await BridgeProxy.deployed();
const newAdmin = '0x30b126428898b36012396663bcc7da441d0f8156';
await proxy.changeAdmin(newAdmin).should.be.rejectedWith(EVMRevert);
});

it('should not allow to call upgradeTo without admin permission', async () => {
const proxy = await BridgeProxy.deployed();
const newImplementation = '0xdae4a245eef04d522c89314e8b292a1e4dfee977';
await proxy.upgradeTo(newImplementation).should.be.rejectedWith(EVMRevert);
});

it('should not allow to call upgradeToAndCall without admin permission', async () => {
const proxy = await BridgeProxy.deployed();
const newImplementation = '0xce8d663165edd5fb8e2cadfb0e9383b5fb0c9bed';
const data = '0x4f1ef286000000000000000000000000ce8d663165edd5fb8e2cadfb0e9383b5fb0c9bed000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000d446675f8ff0f33342f8cb7d193afd6616b7e6f9ba5eeafc67a164e6651a3e159b69b195656c1a1e1de6cd99c9ccb5e170e86d88f60bd8d10fe0619738f4e2edc26571e9f38a1f188d5a5f6a7df80f77386b3789e4dc800727fab01bd75ca49da9b0cb717b7ea9525b2a3760a99bc9d55d7ad9aa71509a7f7c3f08274554ccf402218c07cd051c8af67305b4af0f4edb2440b6bd4680f7ce9e377c7853464d99be3adc516a528a78e3584891e9802c2e38da78203344e6be911be5ab247b247baf56478492923ba606d62e21e4e741b264e5b4b47b000000000000000000000000';
await proxy.upgradeToAndCall(newImplementation, data).should.be.rejectedWith(EVMRevert);
});
});

});
37 changes: 37 additions & 0 deletions test/blackboxExitHandlerProxy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import EVMRevert from './helpers/EVMRevert';

require('./helpers/setup');

const ExitHandlerProxy = artifacts.require('ExitHandlerProxy');

contract('Bridge', (accounts) => {

// Coverage imporvement tests for ExitHandlerProxy
describe('ExitHandlerProxyBlackboxTest', () => {
it('should allow to call admin and implementation', async () => {
const proxy = await ExitHandlerProxy.deployed();
await proxy.admin().should.be.fulfilled;
await proxy.implementation().should.be.fulfilled;
});

it('should not allow to call changeAdmin without admin permission', async () => {
const proxy = await ExitHandlerProxy.deployed();
const newAdmin = '0x597529ad7b07b9ed91fe5221a3f019bb69795f96';
await proxy.changeAdmin(newAdmin).should.be.rejectedWith(EVMRevert);
});

it('should not allow to call upgradeTo without admin permission', async () => {
const proxy = await ExitHandlerProxy.deployed();
const newImplementation = '0xe2becf1e00a56d6644cab041804997ddfb6cb62b';
await proxy.upgradeTo(newImplementation).should.be.rejectedWith(EVMRevert);
});

it('should not allow to call upgradeToAndCall without admin permission', async () => {
const proxy = await ExitHandlerProxy.deployed();
const newImplementation = '0xc8798d1d03b6ddef7e32594c5900b8d22c8bd037';
const data = '0x4f1ef286000000000000000000000000c8798d1d03b6ddef7e32594c5900b8d22c8bd0370000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000009ceb4987796cfd9ec5293e334553d7ab1fc24effd9182b9e43ad9b6c1ecee755d57c3a6f1222432d0efa684dd6d2e8746a4d77dc7d1e592caf0dc82dc048ca6ba4b276fb215521c1114d8a5a9d8609fc6f8dcce49288be9741124005a9876185cca54396dfc4fa855c33cb2221eee9a7b070ffa9b8755b4637c3a312638d308ee088d2ac2cb86f912dde1cf2c97b338f7f62da12b0fb8f5cf3404c161e00000000';
await proxy.upgradeToAndCall(newImplementation, data).should.be.rejectedWith(EVMRevert);
});
});

});
79 changes: 79 additions & 0 deletions test/blackboxFastExitHandler.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import EVMRevert from './helpers/EVMRevert';

require('./helpers/setup');

const FastExitHandler = artifacts.require('FastExitHandler');

contract('FastExitHandler', (accounts) => {

// Coverage imporvement tests for FastExitHandler
describe('FastExitHandlerBlackboxTest', () => {
it('should allow to call public functions', async () => {
const handler = await FastExitHandler.deployed();
await handler.admin().should.be.fulfilled;
await handler.nstTokenCount().should.be.fulfilled;
await handler.exitStake().should.be.fulfilled;
});

it('should allow to call initialize', async () => {
const handler = await FastExitHandler.deployed();
const arg = '0x4548e7c72fc75e073ed802f31443924200dbf807';
await handler.initialize(arg).should.be.fulfilled;
});

it('should allow to call deposits', async () => {
const handler = await FastExitHandler.deployed();
const arg = '3662845420';
await handler.deposits(arg).should.be.fulfilled;
});

it('should allow to call tokens', async () => {
const handler = await FastExitHandler.deployed();
const arg = '5032';
await handler.tokens(arg).should.be.fulfilled;
});

it('should report revert on Wrong challenger when calling challengeYoungestInput', async () => {
const handler = await FastExitHandler.deployed();
const youngerInputProof = ['0x230fc118b0d54a456876d7b99ccc221b20ed5e48259be4cbc3c57a249b951be4'];
const exitingTxProof = ['0x8558a7039cf923fc1046d39a2b2c6c5925bdb0933555d2001d48de7481af452c'];
const outputIndex = '18';
const inputIndex = '15';
const challenger = '0x27f68d2c1fe5f580ed6d3307c990cd9c66407b74';
await handler.challengeYoungestInput(youngerInputProof, exitingTxProof, outputIndex, inputIndex, challenger).should.be.rejectedWith(EVMRevert);
});

it('should report revert on Wrong challenger when calling challengeExit', async () => {
const handler = await FastExitHandler.deployed();
const proof = ['0x9f2386fdaf56f0f36eb91397958f8731936c76f2d7f1416e88aea740cf744b41'];
const prevProof = ['0x1852f4272517315fc3b07b6a0c44bb98cc3bc2aa4777e48b6c2fae307e323177'];
const outputIndex = '190';
const inputIndex = '172';
const challenger = '0xe3a0cd7fba456e66261f084b225c7bba157a5289';
await handler.challengeExit(proof, prevProof, outputIndex, inputIndex, challenger).should.be.rejectedWith(EVMRevert);
});

it('should report revert on Wrong challenger when calling startExit', async () => {
const handler = await FastExitHandler.deployed();
const youngestInputProof = ['0x454e83db9d7f61ab5bd7a998140bc4f17aac71aff6f229105302d800c9e9c9f0'];
const proof = ['0xd4eb714ee190b1250b497a6a988c6a2feb6a084dfa72df8bdc7581356d5875c1'];
const outputIndex = '238';
const inputIndex = '86';
await handler.startExit(youngestInputProof, proof, outputIndex, inputIndex).should.be.rejectedWith(EVMRevert);
});

it('should not allow to call depositBySender', async () => {
const handler = await FastExitHandler.deployed();
const amountOrTokenId = '4480365206216364445374006444371875508405961465066149810314453285183562813654';
const color = '9924';
await handler.depositBySender(amountOrTokenId, color).should.be.rejectedWith(EVMRevert);
});

it('should not allow to call startDepositExit without owner permission', async () => {
const handler = await FastExitHandler.deployed();
const depositId = '99387598772445811392054892916031075469212601782978189782221669492240287432374';
await handler.startDepositExit(depositId).should.be.rejectedWith(EVMRevert);
});
});

});
30 changes: 30 additions & 0 deletions test/blackboxMigrations.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import EVMRevert from './helpers/EVMRevert';

require('./helpers/setup');

const Migrations = artifacts.require('Migrations');

contract('Migrations', (accounts) => {

// Coverage imporvement tests for Migrations
describe('MigrationsBlackboxTest', () => {
it('should allow to call public functions', async () => {
const migration = await Migrations.new();
await migration.owner().should.be.fulfilled;
await migration.lastCompletedMigration().should.be.fulfilled;
});

it('should allow to call setCompleted', async () => {
const migration = await Migrations.new();
const completed = '70963566859899165839558527649111661649699347273832314083995706144526855886607';
await migration.setCompleted(completed).should.be.fulfilled;
});

it('should not allow to call upgrade without owner permission', async () => {
const migration = await Migrations.new();
const arg = '0x49e539d2df581157b1b8b1264d0679fc3911bfce';
await migration.upgrade(arg).should.be.rejectedWith(EVMRevert);
});
});

});
32 changes: 32 additions & 0 deletions test/blackboxMinGov.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import EVMRevert from './helpers/EVMRevert';

require('./helpers/setup');

const MinGov = artifacts.require('MinGov');

contract('MinGov', (accounts) => {

// Coverage imporvement tests for MinGov
describe('MinGovBlackboxTest', () => {
it('should allow to call public functions', async () => {
const gov = await MinGov.new(0);
await gov.owner().should.be.fulfilled;
await gov.isOwner().should.be.fulfilled;
await gov.proposalTime().should.be.fulfilled;
await gov.renounceOwnership().should.be.fulfilled;
});

it('should allow to call proposals', async () => {
const gov = await MinGov.new(0);
const arg = '50093900738867472629321312238646250315650639137866923260776170871079882487917';
await gov.proposals(arg).should.be.fulfilled;
});

it('should allow to call transferOwnership', async () => {
const gov = await MinGov.new(0);
const arg = '0x57a4a0fa8b90b8c759873bce06068018fc7b2630';
await gov.transferOwnership(arg).should.be.fulfilled;
});
});

});
43 changes: 43 additions & 0 deletions test/blackboxNativeToken.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import EVMRevert from './helpers/EVMRevert';

require('./helpers/setup');

const NativeToken = artifacts.require('NativeToken');

contract('NativeToken', (accounts) => {

// Coverage imporvement tests for NativeToken
describe('NativeTokenBlackboxTest', () => {
it('should allow to call public functions', async () => {
const nativeToken = await NativeToken.new("Token", "TOK", 18);
await nativeToken.name().should.be.fulfilled;
await nativeToken.symbol().should.be.fulfilled;
await nativeToken.decimals().should.be.fulfilled;
await nativeToken.renounceMinter().should.be.fulfilled;
});

it('should allow to call increase/decreaseAllowance', async () => {
const nativeToken = await NativeToken.new("Token", "TOK", 18);
const arg1 = '0xd3029380fbd75b98c2628e1e7af70a816e9b66ad';
const arg2 = '93711521097009361375284895256869528583728073863956338933042532117529833830903';
await nativeToken.increaseAllowance(arg1, arg2).should.be.fulfilled;
await nativeToken.decreaseAllowance(arg1, arg2).should.be.fulfilled;
});

it('should allow to call allowance', async () => {
const nativeToken = await NativeToken.new("Token", "TOK", 18);
const arg1 = '0xa7a9bb0480178d1324e5d5b8411f0d53e4b18baa';
const arg2 = '0x70903adef31496c7927543197bee8370346adbab';
await nativeToken.allowance(arg1, arg2).should.be.fulfilled;
});

it('should report revert when calling burnFrom', async () => {
const nativeToken = await NativeToken.new("Token", "TOK", 18);
const arg1 = '0xdc3749d2d628d78afb30f345d07b5703476ddb76';
const arg2 = '64297420200039148773101778052343977788020645197704650418907426242172643152507';
await nativeToken.burnFrom(arg1, arg2).should.be.rejectedWith(EVMRevert);
});

});

});
37 changes: 37 additions & 0 deletions test/blackboxOperatorProxy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import EVMRevert from './helpers/EVMRevert';

require('./helpers/setup');

const OperatorProxy = artifacts.require('OperatorProxy');

contract('OperatorProxy', (accounts) => {

// Coverage imporvement tests for OperatorProxy
describe('OperatorProxyBlackboxTest', () => {
it('should allow to call public functions', async () => {
const operatorProxy = await OperatorProxy.deployed();
await operatorProxy.admin().should.be.fulfilled;
await operatorProxy.implementation().should.be.fulfilled;
});

it('should not allow to call upgradeToAndCall without admin permission', async () => {
const operatorProxy = await OperatorProxy.deployed();
const arg1 = '0x50e0f78823c5ceb0544a5126b58c9ff27b274274';
const arg2 = '0xe171a17271ff4ca75aa87c34d4d7b6a98d425dd80c0912c100ac71a11e8d1cf70876b5fa192d46f7a765d00b2fd344e8cad799c8a0fc693b44122fe8c7d899cf4997f5a457620a2adaab352fdf6cc0dbf200002e3ca465b37572b5e3ded122efaf1685fac84bc0b6f6db12243c6d2ec94758ca8a3f957c107f665988da1d3dc2f6905bf96168c5fe75d4d5e1d1c21440dec132ffe7cb40b3726d03ae7c67';
await operatorProxy.upgradeToAndCall(arg1, arg2).should.be.rejectedWith(EVMRevert);
});

it('should not allow to call applyProposal without admin permission', async () => {
const operatorProxy = await OperatorProxy.deployed();
const arg = '0xa1863ae79f1e50f9baa306156b58cf5356ab0d85952a0135d4e58227afa497a3964759c1bb35dc76544c8b50b3bcdd1b72fdb2eec4f0083a1e8fac6b9d240215';
await operatorProxy.applyProposal(arg).should.be.rejectedWith(EVMRevert);
});

it('should not allow to call upgradeTo without admin permission', async () => {
const operatorProxy = await OperatorProxy.deployed();
const arg = '0x0d8e38ce3b8028b245b2fdaf7133c9717101c55e';
await operatorProxy.upgradeTo(arg).should.be.rejectedWith(EVMRevert);
});
});

});
Loading