-
Notifications
You must be signed in to change notification settings - Fork 985
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update participation metrics (#7582)
* Update participation metrics * Add unhappy tests
- Loading branch information
1 parent
0b53a89
commit a5ce6db
Showing
6 changed files
with
77 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package blockchain | ||
|
||
import ( | ||
"context" | ||
"testing" | ||
|
||
pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1" | ||
"github.com/prysmaticlabs/prysm/shared/testutil" | ||
"github.com/prysmaticlabs/prysm/shared/testutil/require" | ||
) | ||
|
||
func TestReportEpochMetrics_BadHeadState(t *testing.T) { | ||
s := testutil.NewBeaconState() | ||
h := testutil.NewBeaconState() | ||
require.NoError(t, h.SetValidators(nil)) | ||
err := reportEpochMetrics(context.Background(), s, h) | ||
require.ErrorContains(t, "failed to initialize precompute: nil validators in state", err) | ||
} | ||
|
||
func TestReportEpochMetrics_BadAttestation(t *testing.T) { | ||
s := testutil.NewBeaconState() | ||
h := testutil.NewBeaconState() | ||
require.NoError(t, h.SetCurrentEpochAttestations([]*pb.PendingAttestation{{InclusionDelay: 0}})) | ||
err := reportEpochMetrics(context.Background(), s, h) | ||
require.ErrorContains(t, "attestation with inclusion delay of 0", err) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters