Compare commits

...

4 Commits
3.1.0 ... 3.2.0

Author SHA1 Message Date
Alexander Kolotov
d36dcadd34 Merge the develop branch to the master branch, preparation to v3.2.0
This merge contains the following set of changes:
  * [Oracle, Fix] Use more accurate gas estimates for very high message gas limits (#611)
  * [Common, Other] Final version of AMB and OB contracts security audit report by ChainSecurity (#608)
2021-10-07 21:45:51 +03:00
Kirill Fedoseev
d543dbb339 Use more accurate gas estimates for very high message gas limits (#611) 2021-10-07 20:44:14 +03:00
Kirill Fedoseev
bd21cc163e Merge pull request #608 from poanetwork/reports/chainsecurity-amb-6.0.0-ob-1.1.0-contracts
AMB and OB contracts security audit report by ChainSecurity
2021-09-28 21:12:37 +03:00
Alexander Kolotov
4a0fc936a1 Final version of AMB and OB contracts security audit report by ChainSecurity 2021-09-28 20:39:04 +03:00
4 changed files with 4 additions and 3 deletions

View File

@@ -15,7 +15,7 @@ async function estimateGas({ web3, homeBridge, validatorContract, message, addre
const gasEstimate = await homeBridge.methods.executeAffirmation(message).estimateGas({
from: address
})
const msgGasLimit = parseAMBHeader(message).gasLimit
const msgGasLimit = Math.ceil((parseAMBHeader(message).gasLimit * 64) / 63)
// message length in bytes
const len = strip0x(message).length / 2 - MIN_AMB_HEADER_LENGTH

View File

@@ -24,7 +24,8 @@ async function estimateGas({
// message length in bytes
const len = strip0x(result).length / 2
const callbackGasLimit = parseInt(await homeBridge.methods.maxGasPerTx().call(), 10)
let callbackGasLimit = parseInt(await homeBridge.methods.maxGasPerTx().call(), 10)
callbackGasLimit = Math.ceil((callbackGasLimit * 64) / 63)
return gasEstimate + callbackGasLimit + estimateExtraGas(len)
} catch (e) {

View File

@@ -1,6 +1,6 @@
module.exports = {
EXTRA_GAS_PERCENTAGE: 4,
EXTRA_GAS_ABSOLUTE: 200000,
EXTRA_GAS_ABSOLUTE: 250000,
AMB_AFFIRMATION_REQUEST_EXTRA_GAS_ESTIMATOR: len => Math.floor(0.0035 * len ** 2 + 40 * len),
MIN_AMB_HEADER_LENGTH: 32 + 20 + 20 + 4 + 2 + 1 + 2,
MAX_GAS_LIMIT: 10000000,