mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-11 00:18:06 -05:00
34 lines
1.0 KiB
Go
34 lines
1.0 KiB
Go
package operations
|
|
|
|
import (
|
|
"github.com/OffchainLabs/prysm/v7/beacon-chain/state"
|
|
state_native "github.com/OffchainLabs/prysm/v7/beacon-chain/state/state-native"
|
|
"github.com/OffchainLabs/prysm/v7/consensus-types/blocks"
|
|
"github.com/OffchainLabs/prysm/v7/consensus-types/interfaces"
|
|
ethpb "github.com/OffchainLabs/prysm/v7/proto/prysm/v1alpha1"
|
|
)
|
|
|
|
func sszToState(b []byte) (state.BeaconState, error) {
|
|
base := ðpb.BeaconStateDeneb{}
|
|
if err := base.UnmarshalSSZ(b); err != nil {
|
|
return nil, err
|
|
}
|
|
return state_native.InitializeFromProtoDeneb(base)
|
|
}
|
|
|
|
func sszToBlock(b []byte) (interfaces.SignedBeaconBlock, error) {
|
|
base := ðpb.BeaconBlockDeneb{}
|
|
if err := base.UnmarshalSSZ(b); err != nil {
|
|
return nil, err
|
|
}
|
|
return blocks.NewSignedBeaconBlock(ðpb.SignedBeaconBlockDeneb{Block: base})
|
|
}
|
|
|
|
func sszToBlockBody(b []byte) (interfaces.ReadOnlyBeaconBlockBody, error) {
|
|
base := ðpb.BeaconBlockBodyDeneb{}
|
|
if err := base.UnmarshalSSZ(b); err != nil {
|
|
return nil, err
|
|
}
|
|
return blocks.NewBeaconBlockBody(base)
|
|
}
|