Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* use real blob verifier in forkchoice spectest * wip * Use real blob sidecar for test * Set file db correctly * correctly handle blob cases where valid=false * work-around spectest's weird Fork in genesis state * gaz * revert T-money's log level change * rm whitespace * unskip minimal test * Preston's feedback --------- Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com> Co-authored-by: terence tsao <terence@prysmaticlabs.com>
- Loading branch information
1 parent
9e73527
commit 07a0a95
Showing
14 changed files
with
275 additions
and
60 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
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
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,63 @@ | ||
package verification | ||
|
||
import ( | ||
"math" | ||
"testing" | ||
|
||
"github.com/prysmaticlabs/prysm/v5/testing/require" | ||
) | ||
|
||
func TestResultList(t *testing.T) { | ||
const ( | ||
a Requirement = iota | ||
b | ||
c | ||
d | ||
e | ||
f | ||
g | ||
h | ||
) | ||
// leave out h to test excluding non-existent item | ||
all := []Requirement{a, b, c, d, e, f, g} | ||
alsoAll := requirementList(all).excluding() | ||
require.DeepEqual(t, all, alsoAll) | ||
missingFirst := requirementList(all).excluding(a) | ||
require.Equal(t, len(all)-1, len(missingFirst)) | ||
require.DeepEqual(t, all[1:], missingFirst) | ||
missingLast := requirementList(all).excluding(g) | ||
require.Equal(t, len(all)-1, len(missingLast)) | ||
require.DeepEqual(t, all[0:len(all)-1], missingLast) | ||
missingEnds := requirementList(missingLast).excluding(a) | ||
require.Equal(t, len(missingLast)-1, len(missingEnds)) | ||
require.DeepEqual(t, all[1:len(all)-1], missingEnds) | ||
excludeNonexist := requirementList(missingEnds).excluding(h) | ||
require.Equal(t, len(missingEnds), len(excludeNonexist)) | ||
require.DeepEqual(t, missingEnds, excludeNonexist) | ||
} | ||
|
||
func TestExportedBlobSanityCheck(t *testing.T) { | ||
// make sure all requirement lists contain the bare minimum checks | ||
sanity := []Requirement{RequireValidProposerSignature, RequireSidecarKzgProofVerified, RequireBlobIndexInBounds, RequireSidecarInclusionProven} | ||
reqs := [][]Requirement{GossipSidecarRequirements, SpectestSidecarRequirements, InitsyncSidecarRequirements, BackfillSidecarRequirements} | ||
for i := range reqs { | ||
r := reqs[i] | ||
reqMap := make(map[Requirement]struct{}) | ||
for ii := range r { | ||
reqMap[r[ii]] = struct{}{} | ||
} | ||
for ii := range sanity { | ||
_, ok := reqMap[sanity[ii]] | ||
require.Equal(t, true, ok) | ||
} | ||
} | ||
require.DeepEqual(t, allSidecarRequirements, GossipSidecarRequirements) | ||
} | ||
|
||
func TestAllBlobRequirementsHaveStrings(t *testing.T) { | ||
var derp Requirement = math.MaxInt | ||
require.Equal(t, unknownRequirementName, derp.String()) | ||
for i := range allSidecarRequirements { | ||
require.NotEqual(t, unknownRequirementName, allSidecarRequirements[i].String()) | ||
} | ||
} |
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
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
Oops, something went wrong.