Skip to content

Commit d36dcad

Browse files
authored
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)
2 parents 78564af + d543dbb commit d36dcad

File tree

4 files changed

+4
-3
lines changed

4 files changed

+4
-3
lines changed

oracle/src/events/processAMBAffirmationRequests/estimateGas.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ async function estimateGas({ web3, homeBridge, validatorContract, message, addre
1515
const gasEstimate = await homeBridge.methods.executeAffirmation(message).estimateGas({
1616
from: address
1717
})
18-
const msgGasLimit = parseAMBHeader(message).gasLimit
18+
const msgGasLimit = Math.ceil((parseAMBHeader(message).gasLimit * 64) / 63)
1919
// message length in bytes
2020
const len = strip0x(message).length / 2 - MIN_AMB_HEADER_LENGTH
2121

oracle/src/events/processAMBInformationRequests/estimateGas.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ async function estimateGas({
2424
// message length in bytes
2525
const len = strip0x(result).length / 2
2626

27-
const callbackGasLimit = parseInt(await homeBridge.methods.maxGasPerTx().call(), 10)
27+
let callbackGasLimit = parseInt(await homeBridge.methods.maxGasPerTx().call(), 10)
28+
callbackGasLimit = Math.ceil((callbackGasLimit * 64) / 63)
2829

2930
return gasEstimate + callbackGasLimit + estimateExtraGas(len)
3031
} catch (e) {

oracle/src/utils/constants.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module.exports = {
22
EXTRA_GAS_PERCENTAGE: 4,
3-
EXTRA_GAS_ABSOLUTE: 200000,
3+
EXTRA_GAS_ABSOLUTE: 250000,
44
AMB_AFFIRMATION_REQUEST_EXTRA_GAS_ESTIMATOR: len => Math.floor(0.0035 * len ** 2 + 40 * len),
55
MIN_AMB_HEADER_LENGTH: 32 + 20 + 20 + 4 + 2 + 1 + 2,
66
MAX_GAS_LIMIT: 10000000,

0 commit comments

Comments
 (0)