Granola-Team / mina-indexer

The Mina Indexer is a re-imagined version of the software collectively called the "Mina archive node."
Apache License 2.0
18 stars 10 forks source link

Problem: There is a bug in the genesis ledger to ledger conversion code for balances #239

Closed trevorbernard closed 11 months ago

trevorbernard commented 11 months ago

Consider the following entry in the genesis ledger:

{
    "pk": "B62qqDJCQsfDoHJvJCh1hgTpiVbmgBg8SbNKLMXsjuVsX5pxCELDyFk",
    "balance": "148837.2",
    "delegate": "B62qp8Vq6n4VHq1LUm9Wd5QKjpKb7umoZ2oU9gpJYuHNUc7t2HGhGUA",
    "timing": {
        "initial_minimum_balance": "148837.2",
        "cliff_time": "86400",
        "cliff_amount": "148837.2",
        "vesting_period": "1",
        "vesting_increment": "0"
}

Start an indexer with no blocks

target/release/mina-indexer server cli --initial-ledger ~/mainnet.json -s ~/.mina-indexer/blocks/empty

Query the account balance for the above public key

target/release/mina-indexer client account -p B62qqDJCQsfDoHJvJCh1hgTpiVbmgBg8SbNKLMXsjuVsX5pxCELDyFk
{
  pk:       B62qqDJCQsfDoHJvJCh1hgTpiVbmgBg8SbNKLMXsjuVsX5pxCELDyFk
  balance:  0
  nonce:    0
  delegate: B62qp8Vq6n4VHq1LUm9Wd5QKjpKb7umoZ2oU9gpJYuHNUc7t2HGhGUA
}

The balance should be 148837.2

jenr24G commented 11 months ago

got a fix ready!

trevorbernard commented 11 months ago

Resolved with the following PR: https://github.com/Granola-Team/mina-indexer/pull/240