Skip to content
This repository has been archived by the owner on Mar 15, 2024. It is now read-only.

Commit

Permalink
Merge pull request #92 from iden3/feature/fix-checks
Browse files Browse the repository at this point in the history
Feature/fix checks
  • Loading branch information
invocamanman authored Feb 12, 2020
2 parents 4dfc7fe + 4e1fb65 commit e8abf9b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 7 deletions.
8 changes: 6 additions & 2 deletions rollup-operator/src/loop-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -556,11 +556,15 @@ class LoopManager{
async _checkStateRollup(){
const currentStateRoot = await this.rollupSynch.getCurrentStateRoot();
const currentOnchainHash = await this.rollupSynch.getMiningOnchainHash();

if (BigInt(currentStateRoot) === this.infoCurrentBatch.batchData.getNewStateRoot() &&
if (BigInt(currentStateRoot) === this.infoCurrentBatch.batchData.getOldStateRoot() &&
BigInt(currentOnchainHash) === this.infoCurrentBatch.batchData.getOnChainHash()) {
return true;
} else {
let info = `${chalk.yellowBright("OPERATOR STATE: ")}${chalk.white(strState[this.state])}`;
info += " | info ==> ";
info += `${chalk.white.bold("Current information of state root and/or onChain hash does not match with SC")}`;
this.logger.info(info);
return false;
}
}
Expand Down
3 changes: 2 additions & 1 deletion rollup-operator/src/server-proof.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ async function genProof() {
}
///// Server configuration
const app = express();
app.use(bodyParser.json());
app.use(bodyParser.json({ limit: "50mb" }));
app.use(bodyParser.urlencoded({ limit: "50mb", extended: true }));
app.use(cors());
app.use(morgan("dev"));

Expand Down
23 changes: 19 additions & 4 deletions rollup-operator/src/synch-pool-service/synch-pool-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,16 +148,31 @@ class SynchPool {
this.info += `last block synched: ${lastSynchBlock}`;
this.info += addedTokens;

this.logger.info(this.info);
this.logger.info(this.info);
}

_logError(message){
let info = `${chalk.cyan("POOL SYNCH")} | `;
info += "info ==> ";
info += chalk.white.bold(message);
this.logger.info(info);
}

async _updateTokensPrice() {
const listMarkets = await this.apiBitfinex.getTraddingPairs();
let listMarkets;
try {
listMarkets = await this.apiBitfinex.getTraddingPairs();
} catch (error) {
this._logError("api to get tokens price is not responding");
listMarkets = null;
}

for (const id in this.tokensList) {
const tokenSymbol = this.tokensList[id].tokenSymbol;
let infoToken;
let infoToken = undefined;
// get api information
infoToken = await this._getInfoToken(tokenSymbol, listMarkets);
if (listMarkets)
infoToken = await this._getInfoToken(tokenSymbol, listMarkets);
if (infoToken) {
this.tokensList[id].price = infoToken;
} else {
Expand Down

0 comments on commit e8abf9b

Please sign in to comment.