If you wish to reconcile balances before the rosetta-cli reaches tip (which I am assuming is the case), you must support historical_balance_lookup. Unfortunately, there is no way to reconcile (compare computed balance with the balance returned via the /account/balance endpoint) at early blocks if we can’t fetch the balance at those blocks (we can only get the balance at the current block).
If you wait until the rosetta-cli syncs to tip (when historical_balance_lookup=false), it will automatically begin performing reconciliations when it determines it is possible. If you are curious how it does this, take a look at the reconciler package!
Great, thanks @patrick.ogrady
The flag --end doesn’t work as a “tip”, right ?
The blockchain I’m now using takes about 2s for each /block call, and it has more than 170k blocks, so it’s going to take a while to reach the reconciliations stage
No it does not . We are actively working on adding more sophisticated end conditions (like reaching tip, performing some number of reconciliations, etc.). We are tracking it with an issue in rosetta-cli (hoping to add support within the week).
Have you tried increasing the block_concurrency parameter in your config file? When doing my own testing, I usually ramp this up to 32 or even 64.
Hi @patrick.ogrady,
I would like to run check with reconciliation enable
Must I run rosetta-cli from genesis block 0 ?
Does start_index work with reconciliation_disable: false ?
This will work as long as your implementation supports historical balance lookup. When a new account is seen, we will attempt to fetch its balance at the parent block if we haven’t seen it yet and can only do that if we can access the balance at any previous block.
Just a warning that doing this will lead to a tad bit slower sync (because of the extra fetches) but shouldn’t be too bad!
In my test,
The chain had a reward operation at block 180 but start_index=190, so
computed_balance = initial_balance in bootstrap
while live_balance = initial _balance + miner reward at block 180
Could you remove the bootstrapping of balances (when starting from a non-genesis index)? Existing accounts (created during bootstrapping) will not have their balances “pre-fetched” (the feature I discussed earlier).
If I remove "bootstrap_balances": "bootstrap_balances.json"
looks like all accounts start with zero balance while some accounts have balance from genesis
Therefore, reconciliation failed at start_index
Command Failed: reconciliation failure: active reconciliation error for 0xa8D38FB29CDA4Ca011b430a680886fB4CA7F3043 at 183 (computed: 0TOMO, live: 55000000000000000000000000TOMO)
You’ll also need to delete the data directory you were using from the last time you synced (not sure if you did that). Reminder: this only works if historical balance lookup is enabled.
So I believe historical balance lookup works correctly
But reconciliation still failed start_index: 192
I put some logs in getBalance functions. When I run cli check, I didn’t see any call to get balance of the previous block like 191, 190, 189, 188
So I wonder if I miss anything in cli config ?