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

Fix gas on grant and publish #366

Merged
merged 1 commit into from
Feb 15, 2019
Merged
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 package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"prepare": "npm run build",
"test": "ava",
"lint": "eslint src test && documentation lint src test",
"extract-roles": "scripts/extract-roles"
"extract-roles": "node scripts/extract-roles"
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion src/acl/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ module.exports = ({ web3, network }) => {
const roleId = await getRoleId(repoAddr)

const call = acl.methods.grantPermission(grantee, repoAddr, roleId)
const estimatedGas = call.estimatedGas()
const estimatedGas = call.estimateGas()

return {
to: acl.options.address,
Expand Down
6 changes: 1 addition & 5 deletions src/commands/apm_cmds/grant.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const APM = require('@aragon/apm')
const ACL = require('../../acl')
const { ensureWeb3 } = require('../../helpers/web3-fallback')
const { getRecommendedGasLimit } = require('../../util')

exports.command = 'grant [grantees..]'
exports.describe =
Expand Down Expand Up @@ -61,10 +60,7 @@ exports.handler = async function({
.defaultGasPrice
transaction.from = from
transaction.gasPrice = network.gasPrice || DEFAULT_GAS_PRICE
transaction.gas = await getRecommendedGasLimit(
web3,
await transaction.estimateGas()
)
// the recommended gasLimit is already calculated by the ACL module

try {
const receipt = await web3.eth.sendTransaction(transaction)
Expand Down
6 changes: 1 addition & 5 deletions src/commands/apm_cmds/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ const deploy = require('../deploy')
const startIPFS = require('../ipfs')
const getRepoTask = require('../dao_cmds/utils/getRepoTask')
const listrOpts = require('../../helpers/listr-options')
const { getRecommendedGasLimit } = require('../../util')

const DEFAULT_GAS_PRICE = require('../../../package.json').aragon
.defaultGasPrice
Expand Down Expand Up @@ -578,10 +577,7 @@ exports.task = function({

transaction.from = from
transaction.gasPrice = network.gasPrice || DEFAULT_GAS_PRICE
transaction.gas = await getRecommendedGasLimit(
web3,
await transaction.estimateGas()
)
// apm.js already calculates the recommended gas

ctx.receipt = await web3.eth.sendTransaction(transaction)
} catch (e) {
Expand Down