Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose wallet balance via /metrics to authority-claimer #495

Open
endersonmaia opened this issue Jun 28, 2024 · 1 comment
Open

Expose wallet balance via /metrics to authority-claimer #495

endersonmaia opened this issue Jun 28, 2024 · 1 comment
Labels
#feat:claimer Feature: claimer triage To be triaged
Milestone

Comments

@endersonmaia
Copy link
Contributor

📚 Context

The cartesi-rollups-authority-claimer should expose the balance for the Authority Owner wallet as a metric in the /metrics endpoint.

As a rollups-node operator, it's important to keep track of the balance so that the validator node can keep making claims without problems.

For Sunodo, we must keep track of at least 8 different wallet balances, for all the chains we support.

✔️ Solution

Provide the balance of the Authority Onwer wallet as a metrics in trghe /metrics endpoint.

For ex,:

# HELP cartesi_rollups_authority_claimer_wallet_balance Show the current balance of the wallet
# TYPE cartesi_rollups_authority_claimer_wallet_balance gauge
cartesi_rollups_authority_claimer_wallet_balance{chain_id="11155420",authority_onwer="cartesi_rollups_authority_claimer_wallet_balance"} 123
# EOF

I don't know what should be the value since each chain has its own token. maybe we'd need a configuration to define the token or the precision for the value.

@endersonmaia
Copy link
Contributor Author

This is a sample output of my own exporter that I'm using for sunodo.

# HELP sunodo_wallet_balance The balance for a given address as float64 from BigInt with loss of precision.
# TYPE sunodo_wallet_balance gauge
sunodo_wallet_balance{address="0xd330c12e8dbd00570616d9406614106e2b3a1cf5",chain_id="1",chain_name="mainnet"} 0
sunodo_wallet_balance{address="0xd330c12e8dbd00570616d9406614106e2b3a1cf5",chain_id="10",chain_name="optimism-mainnet"} 0
sunodo_wallet_balance{address="0xd330c12e8dbd00570616d9406614106e2b3a1cf5",chain_id="11155111",chain_name="sepolia"} 4.900563043998054e+16
sunodo_wallet_balance{address="0xd330c12e8dbd00570616d9406614106e2b3a1cf5",chain_id="11155420",chain_name="optimism-sepolia"} 1.0275045421842128e+17
sunodo_wallet_balance{address="0xd330c12e8dbd00570616d9406614106e2b3a1cf5",chain_id="42161",chain_name="arbitrum-mainnet"} 0
sunodo_wallet_balance{address="0xd330c12e8dbd00570616d9406614106e2b3a1cf5",chain_id="421614",chain_name="arbitrum-sepolia"} 4.99053544e+16
sunodo_wallet_balance{address="0xd330c12e8dbd00570616d9406614106e2b3a1cf5",chain_id="8453",chain_name="base-mainnet"} 0
sunodo_wallet_balance{address="0xd330c12e8dbd00570616d9406614106e2b3a1cf5",chain_id="84532",chain_name="base-sepolia"} 3.9783845731226925e+17

My version will hit the blockchain provider RPC every time a scrape is made to the /metrics endpoint.

Ideally, having this integrated into the rollups-node-authority-claimer, the metrics should be updated every time a transaction (claim) is made that can change the wallet balance.

@marcelstanley marcelstanley added this to the TBD milestone Jul 26, 2024
@marcelstanley marcelstanley added triage To be triaged #feat:claimer Feature: claimer labels Jul 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
#feat:claimer Feature: claimer triage To be triaged
Projects
None yet
Development

No branches or pull requests

2 participants