weixin_39834488
weixin_39834488
2020-11-25 05:06

Token Account Balance test script

Problem

We don't currently have a way to verify that a live cluster has the correct total number of tokens in circulation.

Summary of Changes

Wrote script to aggregate some values from a cluster's RPC node responses. Returns token capitalization from the bank, as well as SOL/Lamport sum for all vote, stake, system, storage and config accounts.

Fixes #7323

该提问来源于开源项目:solana-labs/solana

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

7条回答

  • weixin_39834488 weixin_39834488 5月前

    this tool I put together doesn't necessarily need to go in in its current form, but I wanted to throw it up here to make it available to others. Just run it out of the box ./cluster_token_count.sh and it will dump some aggregate stats about the running SLP1 cluster

    点赞 评论 复制链接分享
  • weixin_39834488 weixin_39834488 5月前

    Can use the .csv output to verify that all the system and vote accounts from validators listed in genesis_accounts.rs are present in the deployed cluster, and can account for the sum of all stake account balances. Can't (to my knowledge) in this bulk account info form distinguish between a placeholder stake account and a real one, as we don't have an RPC API for getting the authorized staker from a given account pubkey. I could DOS the RPC node with solana show-stake-account [pubkey] though

    点赞 评论 复制链接分享
  • weixin_39932300 weixin_39932300 5月前

    seems like this would have been easier to write in Rust, bypassing the CLI

    点赞 评论 复制链接分享
  • weixin_39834488 weixin_39834488 5月前

    seems like this would have been easier to write in Rust, bypassing the CLI

    For my authorized stake issue, for sure Rust is faster. I'm playing around with that option now, but am slow on the Rust side, and thought it would be helpful to get an end to end query on a running cluster rather than unittesting some of this, no?

    点赞 评论 复制链接分享
  • weixin_39932300 weixin_39932300 5月前

    Not suggesting a unit-test. Suggesting an integration test that uses the RPC APIs via a Rust client instead of an integration test that uses the CLI via Bash.

    It was good to get this work done fast. It'd be nice to merge something that does this, but the Bash script is clunky and a maintenance burden. It can easily bitrot and go undetected. If you can migrate to doing all the exact same stuff via the Rust RPC API (not Rust calling the CLI!), we can merge it.

    点赞 评论 复制链接分享
  • weixin_39834488 weixin_39834488 5月前

    cc: -solana may or may not find this useful

    点赞 评论 复制链接分享
  • weixin_39834488 weixin_39834488 5月前

    Moved these tools over to my sandbox (https://github.com/danpaul000/token-counter) but this doesn't need to go in here in its present form.

    点赞 评论 复制链接分享

相关推荐