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

GetValidatorPerformance returns averageInclusionDistance of 0 in v2 #9545

Closed
alrevuelta opened this issue Sep 8, 2021 · 1 comment · Fixed by #9589
Closed

GetValidatorPerformance returns averageInclusionDistance of 0 in v2 #9545

alrevuelta opened this issue Sep 8, 2021 · 1 comment · Fixed by #9589
Assignees

Comments

@alrevuelta
Copy link

🐞 Bug Report

Description

After upgrading to v2.0.0-rc.1 in Prater, I get that the attestation inclusion distance is 0 for all validators, both in the summary posted by the validator and in the information fetched from the beacon chain using GetValidatorPerformance. Note that even if the attestation is not produced, a 0 is returned, whereas ^uint(0) was being returned before.

From the validator logs: Note averageInclusionDistance="0.00 slots"

time="2021-09-07 11:39:08" level=info msg="Vote summary since launch" attestationsInclusionPct="100%" averageInclusionDistance="0.00 slots" correctlyVotedHeadPct="86%" correctlyVotedSourcePct="99%" correctlyVotedTargetPct="100%" numberOfEpochs=902 pctChangeCombinedBalance="0.05755%" prefix=validator

I also tried querying the beacon node by myself with GetValidatorPerformance() and I get that InclusionDistances is always 0. I guess the issue might be somewhere here: https://github.com/prysmaticlabs/prysm/blob/develop/beacon-chain/rpc/prysm/v1alpha1/beacon/validators.go#L685-L699. The validatorSummary[n].inclusionDistances is empty for Altair.

Has this worked before in a previous version?

This was working on several previous versions, such as v1.4.3, where a valid attestation distance was being returned.

🔬 Minimal Reproduction

The issue can be reproduced having a beacon-chain running v2..0.0-rc.1 in Prater and calling GetValidatorPerformance.

package main

import (
	"fmt"
	"context"
	"google.golang.org/grpc"
	ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
	"github.com/ethereum/go-ethereum/common/hexutil"
)

func main() {
	dialContext, err := grpc.DialContext(context.Background(), "localhost:4000", grpc.WithInsecure())
	if err != nil {
		fmt.Println("error", err)
	}

	beaconClient := ethpb.NewBeaconChainClient(dialContext)

	pubKey := "0x8d7411ab4411ca27d9fd0a9cc05012bbe9be861e8e90ce2909adf5386a05bc484b004006f8dcd0d5207dc3dde0c73dbe"
	key, _ := hexutil.Decode(pubKey)
	pubKeys := make([][]byte, 1)
	pubKeys[0] = key

	req := &ethpb.ValidatorPerformanceRequest{
		PublicKeys: pubKeys,
	}

	valsPerformance, err := beaconClient.GetValidatorPerformance(context.Background(), req)
	if err != nil {
		fmt.Println("error", err)
	}

	fmt.Println("PublicKey:", pubKey)
	fmt.Println(valsPerformance)
}

See returned resp for different validators.
Inactive key (at the moment of writing)

PublicKey: 0x8d7411ab4411ca27d9fd0a9cc05012bbe9be861e8e90ce2909adf5386a05bc484b004006f8dcd0d5207dc3dde0c73dbe
current_effective_balances:32000000000 inclusion_slots:0 inclusion_distances:0 correctly_voted_source:false correctly_voted_target:false correctly_voted_head:false balances_before_epoch_transition:32334839458 balances_after_epoch_transition:32334824258 public_keys:"\x8dt\x11\xabD\x11\xca'\xd9\xfd\n\x9c\xc0P\x12\xbb龆\x1e\x8e\x90\xce)\t\xad\xf58j\x05\xbcHK\x00@\x06\xf8\xdc\xd0\xd5 }\xc3\xdd\xe0\xc7=\xbe"

Active key

PublicKey: 0x8000091c2ae64ee414a54c1cc1fc67dec663408bc636cb86756e0200e41a75c8f86603f104f02c856983d2783116be13
current_effective_balances:32000000000 inclusion_slots:0 inclusion_distances:0 correctly_voted_source:true correctly_voted_target:true correctly_voted_head:true balances_before_epoch_transition:32486753129 balances_after_epoch_transition:32486771083 public_keys:"\x80\x00\t\x1c*\xe6N\xe4\x14\xa5L\x1c\xc1\xfcg\xde\xc6c@\x8b\xc66ˆun\x02\x00\xe4\x1au\xc8\xf8f\x03\xf1\x04\xf0,\x85i\x83\xd2x1\x16\xbe\x13"

🔥 Error

Not an error per se but an unexpected output averageInclusionDistance="0.00 slots.

time="2021-09-07 11:39:08" level=info msg="Vote summary since launch" attestationsInclusionPct="100%" averageInclusionDistance="0.00 slots" correctlyVotedHeadPct="86%" correctlyVotedSourcePct="99%" correctlyVotedTargetPct="100%" numberOfEpochs=902 pctChangeCombinedBalance="0.05755%" prefix=validator

🌍 Your Environment

Operating System: Linux
What version of Prysm are you running? (Which release) v2.0.0-rc.1
Anything else relevant (validator index / public key)? NA

@prestonvanloon
Copy link
Member

I was talking with @terencechain about this and we landed on the fact that Altair no longer supports this information from the beacon state. I'll submit a PR to mark these fields as deprecated and stop showing them after the Altair hardfork.

From @terencechain

Here's the difference in accounting reform between phase0 and Altair

In phase 0
correctlyVotedTarget : voted target checkpoint correct
correctlyVotedSource: voted source checkpoint correct
correctlyVotedHead: voted head correct
inclusionDistance: how fast the attestation get included in the block

In phase1
correctlyVotedTarget : voted target checkpoint correct && att is included less than 32 slots
correctlyVotedSource: voted source checkpoint correct && att is included less than 6 slots
correctlyVotedHead: voted head correct && att is included in 1 slot

These correctlyVotedXXX info has some inclusion distance information in it, but it's no longer a number

This is also a good info to pass around: https://github.com/ethereum/annotated-spec/blob/master/altair/beacon-chain.md#aside-validator-duties-rewards-and-penalties

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

Successfully merging a pull request may close this issue.

2 participants