Skip to content

Commit

Permalink
Fix operational gas estimation
Browse files Browse the repository at this point in the history
  • Loading branch information
Uxio0 committed May 8, 2019
1 parent cdca94f commit 54a9115
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,10 @@ deploy:
on:
tags: true
branch: master
- provider: script
script: bash scripts/deploy_docker.sh $TRAVIS_TAG
on:
tags: true
branch: hotfix
after_success:
- coveralls
11 changes: 9 additions & 2 deletions safe_relay_service/relay/services/transaction_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,15 @@ def estimate_tx(self, safe_address: str, to: str, value: int, data: str, operati
safe_tx_gas = self.safe_service.estimate_tx_gas(safe_address, to, value, data, operation)
safe_data_tx_gas = self.safe_service.estimate_tx_data_gas(safe_address, to, value, data, operation, gas_token,
safe_tx_gas)
safe_operational_tx_gas = self.safe_service.estimate_tx_operational_gas(safe_address,
len(data) if data else 0)
# For Safe contracts v1.0.0 operational gas is not used (`base_gas` has all the related costs already)
safe_version = self.safe_service.retrieve_version(safe_address)
if safe_version == '1.0.0':
safe_operational_tx_gas = 0
else:
safe_operational_tx_gas = self.safe_service.estimate_tx_operational_gas(safe_address,
len(data) if data else 0)
safe_data_tx_gas -= safe_operational_tx_gas

# Can throw RelayServiceException
gas_price = self._estimate_tx_gas_price(gas_token)
return TransactionEstimation(safe_tx_gas, safe_data_tx_gas, safe_operational_tx_gas, gas_price,
Expand Down

0 comments on commit 54a9115

Please sign in to comment.