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

Print Validator Balance Information #2537

Open
1 of 7 tasks
meaghanfitzgerald opened this issue Jan 8, 2025 · 10 comments
Open
1 of 7 tasks

Print Validator Balance Information #2537

meaghanfitzgerald opened this issue Jan 8, 2025 · 10 comments
Assignees

Comments

@meaghanfitzgerald
Copy link
Collaborator

meaghanfitzgerald commented Jan 8, 2025

Goal

Help clarify how to maintain a validator's balance whenever a new validator is created by printing helpful information.

Assumptions and Scope

Network creators and independent validators may not implicitly understand that a validator's Balance needs to be watched and maintained >0 in order to avoid an interruption in validation of their L1.

Requirements

The requirements for this issue are listed in the order they should be completed. Each list item should have its own PR to simplify code review:

  • sdk function that takes a given validationID and returns the current balance.

  • sdk function that takes a balance, multiplies it by the current fee rate to return the "remaining validation time" denominated in seconds.

  • avalanche validator list to include a new column that includes time remaining denominated in days by utilizing the sdk function above.

  • avalanche validator getBalance to include a new column that includes time remaining denominated in days by utilizing the sdk function above.

  • during avalanche validator increaseBalance, print the output of avalanche validator getBalance which includes the estimated time remaining (after the fourth item in this list is completed). Also print the price to validate for 1 day at the current fee rate.

    At the current fee rate, _x_ AVAX is spent per day per L1 validator. 
    How much AVAX would you like to increase your validator's balance by?
  • on the successful execution of avalanche blockchain deploy <exampleL1>, before termination, print the user the output of avalanche validator list <exampleL1> so they can view the current balance and time remaining per validator for their new network. Follow this list with a printed message that says:

    To avoid an interruption of service, an L1 validator must keep it's balance above 0 AVAX.
    To increase a validator's remaining validation time, you may add more AVAX to the 
    validator balance with `avalanche validator increaseBalance`.
  • on the successful execution of avalanche blockchain addValidator <exampleL1>, before termination, print the user the output of avalanche validator getBalance so they can view the current balance and time remaining for their new validator. Follow this list with a printed message that says:

    To avoid an interruption of service, an L1 validator must keep it's balance above 0 AVAX.
    To increase a validator's remaining validation time, you may add more AVAX to the 
    validator balance with `avalanche validator increaseBalance`.

Open Questions

@felipemadero
Copy link
Collaborator

Also add to avalanche validator increaseBalance a msg that orientates the user on the relationship between time and balance, when asked for the balance. Something on the line of:

At current rates, an amount of ... AVAX is spend each validation day.
How many AVAX ... ?

@meaghanfitzgerald
Copy link
Collaborator Author

meaghanfitzgerald commented Jan 8, 2025

I think it would be best instead to just add:

  • during avalanche validator increaseBalance, print the output of avalanche validator getBalance which includes the estimated time remaining (after the fourth item in this list is completed).

What do you think? @felipemadero

@felipemadero
Copy link
Collaborator

felipemadero commented Jan 8, 2025

I believe that depends on the remaining balance being not zero @meaghanfitzgerald

@meaghanfitzgerald
Copy link
Collaborator Author

if the balance is 0, wont it return 0?

@felipemadero
Copy link
Collaborator

yes, so the user losses the hint because he will see 0 remaining time.

@meaghanfitzgerald
Copy link
Collaborator Author

@felipemadero I added that to the list as the 5th item

@meaghanfitzgerald meaghanfitzgerald moved this from Backlog 🗄️ to Researching 📚 in Platform Engineering Group Jan 13, 2025
@arturrez
Copy link
Contributor

arturrez commented Jan 13, 2025

@meaghanfitzgerald there is no way to access price per second for L1 validator as per @StephenButtolph.
it's currently calculated in https://github.com/ava-labs/avalanchego/blob/master/vms/platformvm/txs/executor/state_changes.go#L303-L322

we need to wait until this cost is exposed via GetFeeState API call
cc @felipemadero

@meaghanfitzgerald
Copy link
Collaborator Author

the price returned by platform.getFeeState is not what we are looking for here?

@arturrez
Copy link
Contributor

arturrez commented Jan 13, 2025

it's PChain gas price not L1
ref ava-labs/avalanchego#3647

@arturrez
Copy link
Contributor

first item is done via https://github.com/ava-labs/avalanche-cli/blob/main/sdk/validator/validator.go#L46

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress 🏗
Development

No branches or pull requests

3 participants