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

Account creation fee not deducted for newly created accounts in the Balance Sorted Accounts #1288

Closed trevorbernard closed 1 month ago

trevorbernard commented 2 months ago

When applying the staged ledger, we need to track newly created accounts to ensure the correct deduction of the account creation fee. It appears only accounts created via InternalCommands are correct.

Isaac-DeFrain commented 2 months ago

Do you have an example? I ask because we do take account creation fees into account for the balance-sorted calculations

robinbb commented 2 months ago

@Isaac-DeFrain My understanding, from Slack conversations with Trevor, is that this is systematically wrong - an off-by-1 error that appears everywhere.

trevorbernard commented 1 month ago

Do you have an example? I ask because we do take account creation fees into account for the balance-sorted calculations

From what I could gather we only track a subset of newly created accounts. Anything coming from the PCB's internal commands was accounted for (aka coinbase receiver accounts). But I didn't see evidence of newly created accounts originating from user commands being correctly handled.

This is one such example: B62qmLHpWmgZbam2DCdiShNC9jRuifCqHT9byo2kP7HkY3zkiTdVxps. All the ones I inspected were off by 1 Mina.

The indexer says the balance is: 274.0765962 but the mainnet state export for the hard fork says it's: 273.0765962. This is at height 359604.