MinaProtocol / mina

Mina is a cryptocurrency protocol with a constant size blockchain, improving scaling while maintaining decentralization and security.
https://minaprotocol.com
Apache License 2.0
1.99k stars 529 forks source link

Surface insufficient txn fees/ unavailability of snark work #9227

Open deepthiskumar opened 3 years ago

deepthiskumar commented 3 years ago

The number of transactions included in a block depends on availability of snarks and whether or not they can purchased using transaction fees. block producers log this information as a summary and in the detail in the following two logs

  1. Number of proofs ready for purchase: $proof_count Number of user commands ready to be included: $txn_count Diff creation log: $diff_log

    diff_log: [
    0: {
     available_slots: 46      
     discarded_commands: {
      insufficient_space: 0       
      insufficient_work: 0       
     }
     discarded_completed_work: {
      extra_work: 0       
      insufficient_fees: 0       
     }
     end_resources: {
      coinbase_work_fees: [2]       
      commands: [2]       
      completed_work: [2]       
     }
     partition: [1]      
     required_work_count: 0      
     start_resources: {
      coinbase_work_fees: [2]       
      commands: [2]       
      completed_work: [2] 
    }
    }]
  2. Detailed diff creation log: $diff_log

Every node can compute this based on its mempool and so having a cli command/GraphQL that surfaces this information will help to better understand whether it is insufficient transaction fees or snark work unavailability that may be reducing the throughput.

aneesharaines commented 3 years ago

@deepthiskumar and @A-Manning to sync on a different possible solution

deepthiskumar commented 3 years ago

updated the issue description based on the discussion with @A-Manning

mrmr1993 commented 3 years ago

For usability, might it make more sense to expose the data in client status or in another client command (e.g. client recent-fees)? For example, I could imagine output like:

Transaction fees
================
min fee: X.X (prev block) | X.X (prev 3 blocks) | X.X (prev 5 blocks)
max fee: X.X (prev block) | X.X (prev 3 blocks) | X.X (prev 5 blocks)
max fee: X.X (prev block) | X.X (prev 3 blocks) | X.X (prev 5 blocks)
Snark work fees
===============
min fee: X.X (prev block) | X.X (prev 3 blocks) | X.X (prev 5 blocks)
max fee: X.X (prev block) | X.X (prev 3 blocks) | X.X (prev 5 blocks)
max fee: X.X (prev block) | X.X (prev 3 blocks) | X.X (prev 5 blocks)
Snark work
===========
available for next block: N
min fee: X.X
max fee: X.X
avg fee: X.X
works included: N (prev block) | N (prev 3 blocks) | N (prev 5 blocks)
Transactions
============
available for next block: N
min fee: X.X
max fee: X.X
avg fee: X.X
Transaction pool
=================
total available: N
min fee: X.X
max fee: X.X
avg fee: X.X

If this were generated from a GraphQL endpoint like we do with other commands, then this could easily be accessed programmatically from there too.