Skip to content

Commit

Permalink
Add comments about extra gas
Browse files Browse the repository at this point in the history
  • Loading branch information
area committed Nov 23, 2022
1 parent 9c3e77c commit 0745107
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/reputation-miner/ReputationMiner.js
Original file line number Diff line number Diff line change
Expand Up @@ -756,6 +756,7 @@ class ReputationMiner {
let gasEstimate;
try {
gasEstimate = await repCycle.estimateGas.submitRootHash(hash, nLeaves, jrh, entryIndex);
// Add some extra gas just in case the details change and a little more is needed
gasEstimate = gasEstimate.mul(11).div(10);
} catch (err) {
gasEstimate = ethers.BigNumber.from(1000000);
Expand Down Expand Up @@ -1005,6 +1006,7 @@ class ReputationMiner {
let gasEstimate;
try {
gasEstimate = await repCycle.estimateGas.confirmJustificationRootHash(round, index, siblings1, siblings2);
// Add some extra gas just in case the details change and a little more is needed
gasEstimate = gasEstimate.mul(11).div(10)
} catch (err) {
gasEstimate = ethers.BigNumber.from(6000000);
Expand Down Expand Up @@ -1093,6 +1095,7 @@ class ReputationMiner {
intermediateReputationHash,
siblings
);
// Add some extra gas just in case the details change and a little more is needed
gasEstimate = gasEstimate.mul(11).div(10);
} catch (err) {
gasEstimate = ethers.BigNumber.from(1000000);
Expand Down Expand Up @@ -1128,6 +1131,7 @@ class ReputationMiner {

try {
gasEstimate = await repCycle.estimateGas.confirmBinarySearchResult(round, index, intermediateReputationHash, siblings);
// Add some extra gas just in case the details change and a little more is needed
gasEstimate = gasEstimate.mul(11).div(10);
} catch (err){
gasEstimate = ethers.BigNumber.from(1000000);
Expand Down Expand Up @@ -1232,6 +1236,7 @@ class ReputationMiner {
let gasEstimate;
try {
gasEstimate = await repCycle.estimateGas.respondToChallenge(...functionArgs);
// Add some extra gas just in case the details change and a little more is needed
gasEstimate = gasEstimate.mul(11).div(10);
} catch (err){
gasEstimate = ethers.BigNumber.from(4000000);
Expand All @@ -1253,6 +1258,7 @@ class ReputationMiner {
let gasEstimate;
try {
gasEstimate = await repCycle.estimateGas.confirmNewHash(round);
// Add some extra gas just in case the details change and a little more is needed
gasEstimate = gasEstimate.mul(11).div(10);
} catch (err){
gasEstimate = ethers.BigNumber.from(4000000);
Expand Down

0 comments on commit 0745107

Please sign in to comment.