Skip to content

Commit

Permalink
TEMP
Browse files Browse the repository at this point in the history
  • Loading branch information
kronosapiens committed Mar 24, 2022
1 parent 5aeee5b commit 3881a51
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/reputation-miner/ReputationMiner.js
Original file line number Diff line number Diff line change
Expand Up @@ -1356,7 +1356,7 @@ class ReputationMiner {
filter.fromBlock = blockNumber;
const events = await this.realProvider.getLogs(filter);
let localHash = await this.reputationTree.getRootHash();
let applyLogs = false;
let applyLogs = true;

console.log(`Beginning sync from block ${blockNumber} with ${events.length} cycles`)

Expand Down Expand Up @@ -1512,7 +1512,7 @@ class ReputationMiner {
}
const currentStateHash = await this.reputationTree.getRootHash();
if (currentStateHash !== reputationRootHash) {
console.log("WARNING: The supplied state failed to be recreated successfully. Are you sure it was saved?");
console.log(`WARNING: The supplied state ${reputationRootHash} failed to be recreated successfully. Are you sure it was saved?`);
} else {
console.log(`Reputation state ${reputationRootHash} was loaded successfully.`);
}
Expand Down
4 changes: 4 additions & 0 deletions packages/reputation-miner/ReputationMinerClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,13 @@ class ReputationMinerClient {

// Get latest state from database if available, otherwise sync to current state on-chain
await this._miner.createDB();
this._adapter.log(`Attempting to load latest on-chain state ${latestConfirmedReputationHash}`);
await this._miner.loadState(latestConfirmedReputationHash);
if (this._miner.nReputations.eq(0)) {
this._adapter.log("Latest state not found - need to sync");
if (startingHash !== undefined) {
await this._miner.loadState(startingHash);
}
await this._miner.sync(startingBlock, true);
}

Expand Down
4 changes: 2 additions & 2 deletions packages/reputation-miner/bin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class RetryProvider extends ethers.providers.StaticJsonRpcProvider {

static attemptCheck(err, attemptNumber){
console.log("Retrying RPC request #", attemptNumber);
if (attemptNumber === 5){
if (attemptNumber === 1000){
return false;
}
return true;
Expand All @@ -59,7 +59,7 @@ class RetryProvider extends ethers.providers.StaticJsonRpcProvider {
// method is the method name (e.g. getBalance) and params is an
// object with normalized values passed in, depending on the method
perform(method, params) {
return backoff(() => super.perform(method, params), {retry: RetryProvider.attemptCheck, startingDelay: 1000});
return backoff(() => super.perform(method, params), {retry: RetryProvider.attemptCheck, startingDelay: 1000, numOfAttempts: 1000, timeMultiple: 1});
}
}

Expand Down

0 comments on commit 3881a51

Please sign in to comment.