Change the signature of ProcessPayload (#14610)

This commit is contained in:
Potuz
2024-11-03 11:37:52 -03:00
committed by GitHub
parent 4d98049054
commit 66d1bb54f6
7 changed files with 19 additions and 22 deletions

View File

@@ -56,10 +56,10 @@ func RunBlockHeaderTest(t *testing.T, config string, fork string, sszToBlock SSZ
bodyRoot, err := block.Block().Body().HashTreeRoot()
require.NoError(t, err)
pr := block.Block().ParentRoot()
beaconState, err := blocks.ProcessBlockHeaderNoVerify(context.Background(), preBeaconState, block.Block().Slot(), block.Block().ProposerIndex(), pr[:], bodyRoot[:])
_, err = blocks.ProcessBlockHeaderNoVerify(context.Background(), preBeaconState, block.Block().Slot(), block.Block().ProposerIndex(), pr[:], bodyRoot[:])
if postSSZExists {
require.NoError(t, err)
comparePostState(t, postSSZFilepath, sszToState, preBeaconState, beaconState)
comparePostState(t, postSSZFilepath, sszToState, preBeaconState)
} else {
// Note: This doesn't test anything worthwhile. It essentially tests
// that *any* error has occurred, not any specific error.

View File

@@ -54,10 +54,10 @@ func RunExecutionPayloadTest(t *testing.T, config string, fork string, sszToBloc
config := &ExecutionConfig{}
require.NoError(t, utils.UnmarshalYaml(file, config), "Failed to Unmarshal")
gotState, err := blocks.ProcessPayload(preBeaconState, body)
err = blocks.ProcessPayload(preBeaconState, body)
if postSSZExists {
require.NoError(t, err)
comparePostState(t, postSSZFilepath, sszToState, preBeaconState, gotState)
comparePostState(t, postSSZFilepath, sszToState, preBeaconState)
} else if config.Valid {
// Note: This doesn't test anything worthwhile. It essentially tests
// that *any* error has occurred, not any specific error.

View File

@@ -50,10 +50,10 @@ func RunBlockOperationTest(
}
helpers.ClearCache()
beaconState, err := operationFn(context.Background(), preState, wsb)
_, err = operationFn(context.Background(), preState, wsb)
if postSSZExists {
require.NoError(t, err)
comparePostState(t, postSSZFilepath, sszToState, preState, beaconState)
comparePostState(t, postSSZFilepath, sszToState, preState)
} else {
// Note: This doesn't test anything worthwhile. It essentially tests
// that *any* error has occurred, not any specific error.
@@ -65,7 +65,7 @@ func RunBlockOperationTest(
}
}
func comparePostState(t *testing.T, postSSZFilepath string, sszToState SSZToState, want state.BeaconState, got state.BeaconState) {
func comparePostState(t *testing.T, postSSZFilepath string, sszToState SSZToState, want state.BeaconState) {
postBeaconStateFile, err := os.ReadFile(postSSZFilepath) // #nosec G304
require.NoError(t, err)
postBeaconStateSSZ, err := snappy.Decode(nil /* dst */, postBeaconStateFile)