mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 15:37:56 -05:00
Add Gloas beacon state package (#15611)
* Add Gloas protobuf definitions with spec tests Add Gloas state fields to beacon state implementation * Remove shared field for pending payment * Radek's feedback * Potuz feedback * use slice concat * Fix comment * Fix concat * Fix comment * Fix correct index
This commit is contained in:
@@ -7,8 +7,10 @@ go_library(
|
||||
importpath = "github.com/OffchainLabs/prysm/v7/testing/spectest/shared/gloas/ssz_static",
|
||||
visibility = ["//testing/spectest:__subpackages__"],
|
||||
deps = [
|
||||
"//beacon-chain/state/state-native:go_default_library",
|
||||
"//proto/engine/v1:go_default_library",
|
||||
"//proto/prysm/v1alpha1:go_default_library",
|
||||
"//testing/require:go_default_library",
|
||||
"//testing/spectest/shared/common/ssz_static:go_default_library",
|
||||
"@com_github_prysmaticlabs_fastssz//:go_default_library",
|
||||
],
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
package ssz_static
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"testing"
|
||||
|
||||
state_native "github.com/OffchainLabs/prysm/v7/beacon-chain/state/state-native"
|
||||
enginev1 "github.com/OffchainLabs/prysm/v7/proto/engine/v1"
|
||||
ethpb "github.com/OffchainLabs/prysm/v7/proto/prysm/v1alpha1"
|
||||
"github.com/OffchainLabs/prysm/v7/testing/require"
|
||||
common "github.com/OffchainLabs/prysm/v7/testing/spectest/shared/common/ssz_static"
|
||||
fssz "github.com/prysmaticlabs/fastssz"
|
||||
)
|
||||
@@ -16,8 +19,18 @@ func RunSSZStaticTests(t *testing.T, config string) {
|
||||
}
|
||||
|
||||
func customHtr(t *testing.T, htrs []common.HTR, object any) []common.HTR {
|
||||
// TODO: Add custom HTR for BeaconStateGloas when state-native support is implemented
|
||||
// For now, only use the default fastssz HTR methods
|
||||
_, ok := object.(*ethpb.BeaconStateGloas)
|
||||
if !ok {
|
||||
return htrs
|
||||
}
|
||||
|
||||
htrs = append(htrs, func(s any) ([32]byte, error) {
|
||||
beaconState, err := state_native.InitializeFromProtoGloas(s.(*ethpb.BeaconStateGloas))
|
||||
require.NoError(t, err)
|
||||
|
||||
return beaconState.HashTreeRoot(context.Background())
|
||||
})
|
||||
|
||||
return htrs
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user