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

contracts: Fix strange revert issue #144

Closed
wants to merge 2 commits into from
Closed
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
2 changes: 1 addition & 1 deletion packages/contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"xmlhttprequest": "^1.8.0"
},
"devDependencies": {
"@nomiclabs/buidler": "^1.4.4",
"@nomiclabs/buidler": "1.4.4",
"@nomiclabs/buidler-ethers": "^1.3.4",
"@nomiclabs/buidler-truffle5": "^1.3.4",
"@nomiclabs/buidler-web3": "^1.3.4",
Expand Down
36 changes: 18 additions & 18 deletions packages/contracts/test/AccessControlTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ contract('Access Control: Liquity functions with the caller restricted to Liquit

} catch (err) {
assert.include(err.message, "revert")
// assert.include(err.message, "Caller is not the BorrowerOperations contract")
assert.include(err.message, "Caller is not the BorrowerOperations contract")
}
})

Expand All @@ -75,7 +75,7 @@ contract('Access Control: Liquity functions with the caller restricted to Liquit

} catch (err) {
assert.include(err.message, "revert" )
// assert.include(err.message, "Caller is not the BorrowerOperations contract")
assert.include(err.message, "Caller is not the BorrowerOperations contract")
}
})

Expand All @@ -87,7 +87,7 @@ contract('Access Control: Liquity functions with the caller restricted to Liquit

} catch (err) {
assert.include(err.message, "revert")
// assert.include(err.message, "Caller is not the BorrowerOperations contract")
assert.include(err.message, "Caller is not the BorrowerOperations contract")
}
})

Expand All @@ -99,7 +99,7 @@ contract('Access Control: Liquity functions with the caller restricted to Liquit

} catch (err) {
assert.include(err.message, "revert")
// assert.include(err.message, "Caller is not the BorrowerOperations contract")
assert.include(err.message, "Caller is not the BorrowerOperations contract")
}
})

Expand All @@ -111,7 +111,7 @@ contract('Access Control: Liquity functions with the caller restricted to Liquit

} catch (err) {
assert.include(err.message, "revert")
// assert.include(err.message, "Caller is not the BorrowerOperations contract")
assert.include(err.message, "Caller is not the BorrowerOperations contract")
}
})

Expand All @@ -123,8 +123,8 @@ contract('Access Control: Liquity functions with the caller restricted to Liquit
const txAlice = await troveManager.addTroveOwnerToArray(bob, { from: alice })

} catch (err) {
assert.include(err.message, "revert")
// assert.include(err.message, "Caller is not the BorrowerOperations contract")
assert.include(err.message, "revert")
assert.include(err.message, "Caller is not the BorrowerOperations contract")
}
})

Expand All @@ -136,8 +136,8 @@ contract('Access Control: Liquity functions with the caller restricted to Liquit
const txAlice = await troveManager.setTroveStatus(bob, 1, { from: alice })

} catch (err) {
assert.include(err.message, "revert")
// assert.include(err.message, "Caller is not the BorrowerOperations contract")
assert.include(err.message, "revert")
assert.include(err.message, "Caller is not the BorrowerOperations contract")
}
})

Expand All @@ -148,8 +148,8 @@ contract('Access Control: Liquity functions with the caller restricted to Liquit
const txAlice = await troveManager.increaseTroveColl(bob, 100, { from: alice })

} catch (err) {
assert.include(err.message, "revert")
// assert.include(err.message, "Caller is not the BorrowerOperations contract")
assert.include(err.message, "revert")
assert.include(err.message, "Caller is not the BorrowerOperations contract")
}
})

Expand All @@ -160,8 +160,8 @@ contract('Access Control: Liquity functions with the caller restricted to Liquit
const txAlice = await troveManager.decreaseTroveColl(bob, 100, { from: alice })

} catch (err) {
assert.include(err.message, "revert")
// assert.include(err.message, "Caller is not the BorrowerOperations contract")
assert.include(err.message, "revert")
assert.include(err.message, "Caller is not the BorrowerOperations contract")
}
})

Expand All @@ -172,8 +172,8 @@ contract('Access Control: Liquity functions with the caller restricted to Liquit
const txAlice = await troveManager.increaseTroveDebt(bob, 100, { from: alice })

} catch (err) {
assert.include(err.message, "revert")
// assert.include(err.message, "Caller is not the BorrowerOperations contract")
assert.include(err.message, "revert")
assert.include(err.message, "Caller is not the BorrowerOperations contract")
}
})

Expand All @@ -184,8 +184,8 @@ contract('Access Control: Liquity functions with the caller restricted to Liquit
const txAlice = await troveManager.decreaseTroveDebt(bob, 100, { from: alice })

} catch (err) {
assert.include(err.message, "revert")
// assert.include(err.message, "Caller is not the BorrowerOperations contract")
assert.include(err.message, "revert")
assert.include(err.message, "Caller is not the BorrowerOperations contract")
}
})
})
Expand Down Expand Up @@ -361,7 +361,7 @@ contract('Access Control: Liquity functions with the caller restricted to Liquit

} catch (err) {
assert.include(err.message, "revert")
// assert.include(err.message, "Caller is neither TroveManager nor StabilityPool")
assert.include(err.message, "Caller is neither TroveManager nor StabilityPool")
}
})
})
Expand Down
8 changes: 4 additions & 4 deletions packages/contracts/test/CollSurplusPool.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const mv = testHelpers.MoneyValues
const timeValues = testHelpers.TimeValues


contract('CollSUrplusPool', async accounts => {
contract('CollSurplusPool', async accounts => {
const [
owner,
A, B, C, D, E] = accounts;
Expand Down Expand Up @@ -50,11 +50,11 @@ contract('CollSUrplusPool', async accounts => {
})

it("CollSurplusPool: claimColl(): Reverts if caller is not Borrower Operations", async () => {
await th.assertRevert(collSurplusPool.claimColl(A, { from: A }), 'CollSurplus: Caller is not Borrower Operations')
await th.assertRevert(collSurplusPool.claimColl(A, { from: A }), 'CollSurplusPool: Caller is not Borrower Operations')
})

it("CollSurplusPool: claimColl(): Reverts if nothing to claim", async () => {
await th.assertRevert(borrowerOperations.claimRedeemedCollateral(A), 'CollSurplus: No collateral available to claim')
await th.assertRevert(borrowerOperations.claimRedeemedCollateral(A), 'CollSurplusPool: No collateral available to claim')
})

it("CollSurplusPool: claimColl(): Reverts if owner cannot receive ETH surplus", async () => {
Expand All @@ -72,7 +72,7 @@ contract('CollSUrplusPool', async accounts => {
const ETH_2 = await collSurplusPool.getETH()
assert.equal(ETH_2, dec(5, 17))

await th.assertRevert(borrowerOperations.claimRedeemedCollateral(B), 'CollSurplus: sending ETH failed')
await th.assertRevert(borrowerOperations.claimRedeemedCollateral(nonPayable.address), 'CollSurplusPool: sending ETH failed')
})

it('CollSurplusPool: reverts trying to send ETH to it', async () => {
Expand Down
3 changes: 0 additions & 3 deletions packages/contracts/utils/testHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -968,12 +968,9 @@ class TestHelper {
const tx = await txPromise
} catch (err) {
assert.include(err.message, "revert")
// TODO !!!
/*
if (message) {
assert.include(err.message, message)
}
*/
}
}

Expand Down
18 changes: 9 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2617,10 +2617,10 @@
dependencies:
"@types/bignumber.js" "^5.0.0"

"@nomiclabs/buidler@^1.3.6":
version "1.4.8"
resolved "https://registry.yarnpkg.com/@nomiclabs/buidler/-/buidler-1.4.8.tgz#36ebbd0fb54eb2052b1336bf90ee47825393e5dc"
integrity sha512-OUnNWx+WXOJzueJCfyuEXu3qNMq1j9eGDDpgflpRwjPeiQQnvVzfbwrPjs0PlxOC3Xtmaxabtgek5wGxS1C7Ew==
"@nomiclabs/buidler@1.4.4":
version "1.4.4"
resolved "https://registry.yarnpkg.com/@nomiclabs/buidler/-/buidler-1.4.4.tgz#a46ff9383111330c10d9fe96ccc626d742093022"
integrity sha512-XciYZnaVOwXupwqTS5AqR/G0pWG2BBw61Na8m8Dm63n2KH0A+077n7xUw3PHpmMP32vw1Ua/U29o2phHNXrIAQ==
dependencies:
"@nomiclabs/ethereumjs-vm" "^4.1.1"
"@sentry/node" "^5.18.1"
Expand All @@ -2636,7 +2636,6 @@
deepmerge "^2.1.0"
download "^7.1.0"
enquirer "^2.3.0"
env-paths "^2.2.0"
eth-sig-util "^2.5.2"
ethereum-cryptography "^0.1.2"
ethereumjs-abi "^0.6.8"
Expand Down Expand Up @@ -2666,10 +2665,10 @@
uuid "^3.3.2"
ws "^7.2.1"

"@nomiclabs/buidler@^1.4.4":
version "1.4.5"
resolved "https://registry.yarnpkg.com/@nomiclabs/buidler/-/buidler-1.4.5.tgz#9e332918bf0c19416494e3c4580fd3ca350ed70b"
integrity sha512-jaaVvG7OsrObhEBnLtQ/8L3J92+Jgioaw2+296dDO4Uc+MO/kprORbnpbE/WKvPL1geKQ4uj6VdCpM7qNCwL3g==
"@nomiclabs/buidler@^1.3.6":
version "1.4.8"
resolved "https://registry.yarnpkg.com/@nomiclabs/buidler/-/buidler-1.4.8.tgz#36ebbd0fb54eb2052b1336bf90ee47825393e5dc"
integrity sha512-OUnNWx+WXOJzueJCfyuEXu3qNMq1j9eGDDpgflpRwjPeiQQnvVzfbwrPjs0PlxOC3Xtmaxabtgek5wGxS1C7Ew==
dependencies:
"@nomiclabs/ethereumjs-vm" "^4.1.1"
"@sentry/node" "^5.18.1"
Expand All @@ -2685,6 +2684,7 @@
deepmerge "^2.1.0"
download "^7.1.0"
enquirer "^2.3.0"
env-paths "^2.2.0"
eth-sig-util "^2.5.2"
ethereum-cryptography "^0.1.2"
ethereumjs-abi "^0.6.8"
Expand Down