zkvalidator/mina-vrf-rs

Cross-check winning blocks

kobigurk opened this issue · 1 comments

We can answer the question "has the BP produced all the blocks they could win?"

To do that, we need to add another post-processing step:

regen_schema.graphql

type Block {
...
  # Account that produced this block
  creatorAccount: Account!

  # Account that won the slot (Delegator/Staker)
  winnerAccount: Account!
...

Account is

# An account record according to the daemon
type Account {
  # The public identity of the account
  publicKey: PublicKey!

  # The token associated with this account
  token: TokenId!

  # The timing associated with this account
  timing: AccountTiming!

  # The amount of mina owned by the account
  balance: AnnotatedBalance!

  # A natural number that increases with each transaction (stringified uint32)
  nonce: String

  # Like the `nonce` field, except it includes the scheduled transactions (transactions not yet included in a block) (stringified uint32)
  inferredNonce: String

  # The account that you delegated on the staking ledger of the current block's epoch
  epochDelegateAccount: Account

  # Top hash of the receipt chain merkle-list
  receiptChainHash: String

  # The public key to which you are delegating - if you are not delegating to anybody, this would return your public key
  delegate: PublicKey @deprecated(reason: "use delegateAccount instead")

  # The account to which you are delegating - if you are not delegating to anybody, this would return your public key
  delegateAccount: Account

  # The list of accounts which are delegating to you (note that the info is recorded in the last epoch so it might not be up to date with the current account status)
  delegators: [Account!]

  # The list of accounts which are delegating to you in the last epoch (note that the info is recorded in the one before last epoch epoch so it might not be up to date with the current account status)
  lastEpochDelegators: [Account!]

  # The previous epoch lock hash of the chain which you are voting for
  votingFor: String

  # True if you are actively staking with this account on the current daemon - this may not yet have been updated if the staking key was changed recently
  stakingActive: Boolean!

  # Path of the private key file for this account
  privateKeyPath: String!

  # True if locked, false if unlocked, null if the account isn't tracked by the queried daemon
  locked: Boolean

  # True if this account owns its associated token
  isTokenOwner: Boolean

  # True if this account has been disabled by the owner of the associated token
  isDisabled: Boolean

  # The index of this account in the ledger, or null if this account does not yet have a known position in the best tip ledger
  index: Int
}

explorer_regen_schema.graphql

type Block {
...
  winnerAccount: BlockWinnerAccount

BlockWinnerAccount is

type BlockWinnerAccount {
  """"""
  balance: BlockWinnerAccountBalance

  """"""
  publicKey: String
}