-
Notifications
You must be signed in to change notification settings - Fork 198
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
Compute the stake by quorums #37
Conversation
@@ -17,19 +17,21 @@ const ( | |||
) | |||
|
|||
func (s *server) getMetric(ctx context.Context, startTime int64, endTime int64, limit int) (*Metric, error) { | |||
operators, err := s.subgraphClient.QueryOperatorsWithLimit(ctx, limit) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not only inefficient, but also incorrect: if we have more than 10 operators (the default limit), we will not get the total stake.
blockNumber, err := s.transactor.GetCurrentBlockNumber(ctx) | ||
if err != nil { | ||
return nil, fmt.Errorf("failed to get current block number: %w", err) | ||
} | ||
totalStake, err := s.calculateTotalStake(operators, blockNumber) | ||
operatorState, err := s.chainState.GetOperatorState(ctx, uint(blockNumber), []core.QuorumID{core.QuorumID(0)}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gpsanant we are counting on this to get the stakes onchain, let me know if it's not reliable, we'd otherwise merge this PR
…eters [INT-114] chore: add missing help parameters
Why are these changes needed?
This is a simpler and more efficient way to compute stake:
It issues just one RPC to just eth node.
Checks