Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('Revert when making a call to library with incorrect address in system', async function() {
data = await init()
platform = data.platform
system = Contract(MatryxSystem.address, IMatryxSystem)
const versions = await system.getAllVersions()
const v = await system.getVersion()
console.log(`all versions: ${versions} (system ${system.address}) `)
await system.setContract(1, stb("LibCommit"), MatryxSystem.address)
const tx = commit.getInitialCommits()
await shouldFail.reverting(tx)
})
it("[4.2] Reveal - Error (unset)", async () => {
await shouldFail.reverting(IexecHubInstance.reveal(
tasks[2],
odbtools.hashResult(tasks[2], "true").digest,
{ from: worker1, gas: constants.AMOUNT_GAS_PROVIDED }
));
});
it('reverts when sending more than the balance', async function () {
const balance = await this.token.balanceOf(holder);
await shouldFail.reverting(this.token.send(recipient, balance.addn(1), data, { from: holder }));
});
it("Unauthorized execute", async () => {
assert.equal(await web3.eth.getBalance(Ident.address), web3.utils.toWei("0.50", "ether"));
await shouldFail.reverting(Ident.execute(
0,
user2,
web3.utils.toWei("0.50", "ether"),
"0x",
{ from: user2 }
));
assert.equal(await web3.eth.getBalance(Ident.address), web3.utils.toWei("0.50", "ether"));
});
it("[1.2] Initialization - Error (low id)", async () => {
await shouldFail.reverting(IexecHubInstance.initialize(deals[1], 0, { from: scheduler, gas: constants.AMOUNT_GAS_PROVIDED }));
});
it('Unable to create a tournament with 0 bounty', async function() {
let rData = {
start: 0,
duration: 30,
review: 20,
bounty: 0
}
let tData = {
content: 'content',
bounty: 0,
entryFee: web3.toWei(2)
}
let tx = platform.createTournament(tData, rData)
await shouldFail.reverting(tx)
})
it("Unable to create the same version twice", async function() {
await system.createVersion(25)
const tx = system.createVersion(25)
await shouldFail.reverting(tx)
})
it('Revert when setting library that has no code', async function() {
data = await init()
platform = data.platform
system = data.system
const tx = system.setContract(1, stb("LibPlatform"), accounts[0])
await shouldFail.reverting(tx)
})
it('Unable to use the same commit hash for 2 submissions in the same round', async () => {
let submissionHash = await createSubmission(t, '0x00', toWei(10), 1)
let { commitHash } = await platform.getSubmission(submissionHash)
t.accountNumber = 1
let tx = t.createSubmission('content', commitHash)
await shouldFail.reverting(tx)
})
})
it('Cannot add user to a group twice', async () => {
let commitHash = await createCommit('0x00', false, genId(16), toWei(1), 0)
await commit.addGroupMember(commitHash, accounts[1])
let tx = commit.addGroupMember(commitHash, accounts[1])
await shouldFail.reverting(tx)
})