mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-22 03:30:35 +00:00
Use the custom HTR in a few more places (#5743)
This commit is contained in:
parent
9ea3f58a5e
commit
eb27f35982
@ -297,7 +297,7 @@ func TestProcessBlockHeader_OK(t *testing.T) {
|
||||
}
|
||||
blockSig := priv.Sign(signingRoot[:])
|
||||
block.Signature = blockSig.Marshal()[:]
|
||||
bodyRoot, err := ssz.HashTreeRoot(block.Block.Body)
|
||||
bodyRoot, err := stateutil.BlockBodyRoot(block.Block.Body)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to hash block bytes got: %v", err)
|
||||
}
|
||||
|
@ -18,8 +18,10 @@ go_library(
|
||||
"//beacon-chain:__subpackages__",
|
||||
"//proto/testing:__subpackages__",
|
||||
"//shared/testutil:__subpackages__",
|
||||
"//slasher:__subpackages__",
|
||||
"//tools/blocktree:__pkg__",
|
||||
"//tools/pcli:__pkg__",
|
||||
"//validator/client:__pkg__",
|
||||
],
|
||||
deps = [
|
||||
"//proto/beacon/p2p/v1:go_default_library",
|
||||
|
@ -82,7 +82,6 @@ go_library(
|
||||
"@com_github_prometheus_client_golang//prometheus:go_default_library",
|
||||
"@com_github_prometheus_client_golang//prometheus/promauto:go_default_library",
|
||||
"@com_github_prysmaticlabs_ethereumapis//eth/v1alpha1:go_default_library",
|
||||
"@com_github_prysmaticlabs_go_ssz//:go_default_library",
|
||||
"@com_github_sirupsen_logrus//:go_default_library",
|
||||
"@io_opencensus_go//trace:go_default_library",
|
||||
"@org_golang_x_exp//rand:go_default_library",
|
||||
|
@ -7,7 +7,7 @@ import (
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"github.com/pkg/errors"
|
||||
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
||||
"github.com/prysmaticlabs/go-ssz"
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/state/stateutil"
|
||||
"github.com/prysmaticlabs/prysm/shared/bytesutil"
|
||||
)
|
||||
|
||||
@ -59,7 +59,7 @@ func (r *Service) proposerSlashingSubscriber(ctx context.Context, msg proto.Mess
|
||||
}
|
||||
// Do some nil checks to prevent easy DoS'ing of this handler.
|
||||
if ps.Header_1 != nil && ps.Header_1.Header != nil {
|
||||
root, err := ssz.HashTreeRoot(ps.Header_1.Header)
|
||||
root, err := stateutil.BlockHeaderRoot(ps.Header_1.Header)
|
||||
s, err := r.db.State(ctx, root)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -12,7 +12,6 @@ import (
|
||||
lru "github.com/hashicorp/golang-lru"
|
||||
pubsub "github.com/libp2p/go-libp2p-pubsub"
|
||||
pb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
||||
"github.com/prysmaticlabs/go-ssz"
|
||||
mockChain "github.com/prysmaticlabs/prysm/beacon-chain/blockchain/testing"
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/core/feed"
|
||||
statefeed "github.com/prysmaticlabs/prysm/beacon-chain/core/feed/state"
|
||||
@ -20,6 +19,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/operations/slashings"
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/p2p"
|
||||
p2ptest "github.com/prysmaticlabs/prysm/beacon-chain/p2p/testing"
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/state/stateutil"
|
||||
mockSync "github.com/prysmaticlabs/prysm/beacon-chain/sync/initial-sync/testing"
|
||||
"github.com/prysmaticlabs/prysm/shared/bls"
|
||||
"github.com/prysmaticlabs/prysm/shared/bytesutil"
|
||||
@ -173,7 +173,7 @@ func TestSubscribe_ReceivesProposerSlashing(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("Error generating proposer slashing")
|
||||
}
|
||||
root, err := ssz.HashTreeRoot(proposerSlashing.Header_1.Header)
|
||||
root, err := stateutil.BlockHeaderRoot(proposerSlashing.Header_1.Header)
|
||||
if err := r.db.SaveState(ctx, beaconState, root); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ go_library(
|
||||
importpath = "github.com/prysmaticlabs/prysm/slasher/detection",
|
||||
visibility = ["//slasher:__subpackages__"],
|
||||
deps = [
|
||||
"//beacon-chain/state/stateutil:go_default_library",
|
||||
"//shared/event:go_default_library",
|
||||
"//shared/hashutil:go_default_library",
|
||||
"//shared/sliceutil:go_default_library",
|
||||
@ -27,7 +28,6 @@ go_library(
|
||||
"@com_github_prometheus_client_golang//prometheus:go_default_library",
|
||||
"@com_github_prometheus_client_golang//prometheus/promauto:go_default_library",
|
||||
"@com_github_prysmaticlabs_ethereumapis//eth/v1alpha1:go_default_library",
|
||||
"@com_github_prysmaticlabs_go_ssz//:go_default_library",
|
||||
"@com_github_sirupsen_logrus//:go_default_library",
|
||||
"@io_opencensus_go//trace:go_default_library",
|
||||
],
|
||||
|
@ -11,7 +11,7 @@ import (
|
||||
|
||||
"github.com/pkg/errors"
|
||||
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
||||
"github.com/prysmaticlabs/go-ssz"
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/state/stateutil"
|
||||
"go.opencensus.io/trace"
|
||||
)
|
||||
|
||||
@ -83,7 +83,7 @@ func (ds *Service) detectIncomingAttestations(ctx context.Context, ch chan *ethp
|
||||
}
|
||||
|
||||
func signedBeaconBlockHeaderFromBlock(block *ethpb.SignedBeaconBlock) (*ethpb.SignedBeaconBlockHeader, error) {
|
||||
bodyRoot, err := ssz.HashTreeRoot(block.Block.Body)
|
||||
bodyRoot, err := stateutil.BlockBodyRoot(block.Block.Body)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "failed to get body root of block")
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ go_library(
|
||||
visibility = ["//validator:__subpackages__"],
|
||||
deps = [
|
||||
"//beacon-chain/core/helpers:go_default_library",
|
||||
"//beacon-chain/state/stateutil:go_default_library",
|
||||
"//proto/slashing:go_default_library",
|
||||
"//shared/bls:go_default_library",
|
||||
"//shared/bytesutil:go_default_library",
|
||||
|
@ -10,8 +10,8 @@ import (
|
||||
"github.com/prometheus/client_golang/prometheus/promauto"
|
||||
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
||||
"github.com/prysmaticlabs/go-bitfield"
|
||||
"github.com/prysmaticlabs/go-ssz"
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/core/helpers"
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/state/stateutil"
|
||||
"github.com/prysmaticlabs/prysm/shared/bls"
|
||||
"github.com/prysmaticlabs/prysm/shared/bytesutil"
|
||||
"github.com/prysmaticlabs/prysm/shared/featureconfig"
|
||||
@ -188,7 +188,7 @@ func (v *validator) signBlock(ctx context.Context, pubKey [48]byte, epoch uint64
|
||||
}
|
||||
var sig *bls.Signature
|
||||
if protectingKeymanager, supported := v.keyManager.(keymanager.ProtectingKeyManager); supported {
|
||||
bodyRoot, err := ssz.HashTreeRoot(b.Body)
|
||||
bodyRoot, err := stateutil.BlockBodyRoot(b.Body)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "could not get signing root")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user