Skip to content

Commit

Permalink
Potuz's feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
terencechain committed May 13, 2024
1 parent b028d0c commit c4a9469
Show file tree
Hide file tree
Showing 12 changed files with 90 additions and 90 deletions.
4 changes: 2 additions & 2 deletions beacon-chain/db/iface/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ type ReadOnlyDatabase interface {
DepositContractAddress(ctx context.Context) ([]byte, error)
// ExecutionChainData operations.
ExecutionChainData(ctx context.Context) (*ethpb.ETH1ChainData, error)
SignedExecutionPayloadEnvelopeBlind(ctx context.Context, blockRoot []byte) (*ethpb.SignedExecutionPayloadEnvelopeBlind, error)
SignedBlindPayloadEnvelope(ctx context.Context, blockRoot []byte) (*ethpb.SignedBlindPayloadEnvelope, error)
// Fee recipients operations.
FeeRecipientByValidatorID(ctx context.Context, id primitives.ValidatorIndex) (common.Address, error)
RegistrationByValidatorID(ctx context.Context, id primitives.ValidatorIndex) (*ethpb.ValidatorRegistrationV1, error)
Expand Down Expand Up @@ -88,7 +88,7 @@ type NoHeadAccessDatabase interface {
SaveDepositContractAddress(ctx context.Context, addr common.Address) error
// SaveExecutionChainData operations.
SaveExecutionChainData(ctx context.Context, data *ethpb.ETH1ChainData) error
SaveSignedExecutionPayloadEnvelopeBlind(ctx context.Context, envelope *ethpb.SignedExecutionPayloadEnvelopeBlind) error
SavePayloadEnvelope(ctx context.Context, envelope *ethpb.SignedBlindPayloadEnvelope) error
// Run any required database migrations.
RunMigrations(ctx context.Context) error
// Fee recipients operations.
Expand Down
14 changes: 7 additions & 7 deletions beacon-chain/db/kv/blind_payload_envelope.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
"go.opencensus.io/trace"
)

// SaveSignedExecutionPayloadEnvelopeBlind saves a signed execution payload envelope blind in the database.
func (s *Store) SaveSignedExecutionPayloadEnvelopeBlind(ctx context.Context, env *ethpb.SignedExecutionPayloadEnvelopeBlind) error {
ctx, span := trace.StartSpan(ctx, "BeaconDB.SaveSignedExecutionPayloadEnvelopeBlind")
// SavePayloadEnvelope saves a signed execution payload envelope blind in the database.
func (s *Store) SavePayloadEnvelope(ctx context.Context, env *ethpb.SignedBlindPayloadEnvelope) error {
ctx, span := trace.StartSpan(ctx, "BeaconDB.SavePayloadEnvelope")
defer span.End()

enc, err := encode(ctx, env)
Expand All @@ -27,12 +27,12 @@ func (s *Store) SaveSignedExecutionPayloadEnvelopeBlind(ctx context.Context, env
return err
}

// SignedExecutionPayloadEnvelopeBlind retrieves a signed execution payload envelope blind from the database.
func (s *Store) SignedExecutionPayloadEnvelopeBlind(ctx context.Context, blockRoot []byte) (*ethpb.SignedExecutionPayloadEnvelopeBlind, error) {
ctx, span := trace.StartSpan(ctx, "BeaconDB.SignedExecutionPayloadEnvelopeBlind")
// SignedBlindPayloadEnvelope retrieves a signed execution payload envelope blind from the database.
func (s *Store) SignedBlindPayloadEnvelope(ctx context.Context, blockRoot []byte) (*ethpb.SignedBlindPayloadEnvelope, error) {
ctx, span := trace.StartSpan(ctx, "BeaconDB.SignedBlindPayloadEnvelope")
defer span.End()

env := &ethpb.SignedExecutionPayloadEnvelopeBlind{}
env := &ethpb.SignedBlindPayloadEnvelope{}
err := s.db.View(func(tx *bolt.Tx) error {
bkt := tx.Bucket(executionPayloadEnvelopeBucket)
enc := bkt.Get(blockRoot)
Expand Down
10 changes: 5 additions & 5 deletions beacon-chain/db/kv/blind_payload_envelope_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ import (
"github.com/prysmaticlabs/prysm/v5/testing/util/random"
)

func TestStore_SignedExecutionPayloadEnvelopeBlind(t *testing.T) {
func TestStore_SignedBlindPayloadEnvelope(t *testing.T) {
db := setupDB(t)
ctx := context.Background()
_, err := db.SignedExecutionPayloadEnvelopeBlind(ctx, []byte("test"))
_, err := db.SignedBlindPayloadEnvelope(ctx, []byte("test"))
require.ErrorIs(t, err, ErrNotFound)

env := random.SignedExecutionPayloadEnvelopeBlind(t)
err = db.SaveSignedExecutionPayloadEnvelopeBlind(ctx, env)
env := random.SignedBlindPayloadEnvelope(t)
err = db.SavePayloadEnvelope(ctx, env)
require.NoError(t, err)
got, err := db.SignedExecutionPayloadEnvelopeBlind(ctx, env.Message.BeaconBlockRoot)
got, err := db.SignedBlindPayloadEnvelope(ctx, env.Message.BeaconBlockRoot)
require.NoError(t, err)
require.DeepEqual(t, got, env)
}
2 changes: 1 addition & 1 deletion beacon-chain/db/kv/blocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ func prepareBlockBatch(blks []blocks.ROBlock, shouldBlind bool) ([]blockBatchEnt
if !errors.Is(err, blocks.ErrUnsupportedVersion) {
return nil, errors.Wrapf(err, "could not convert block to blinded format for root %#x", batch[i].root)
}
// Pre-bellatrix and ePBS blocks give ErrUnsupportedVersion; use the full block already in the batch entry.
// Pre-deneb blocks give ErrUnsupportedVersion; use the full block already in the batch entry.
} else {
batch[i].block = blinded
}
Expand Down
2 changes: 1 addition & 1 deletion beacon-chain/db/kv/encoding.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func isSSZStorageFormat(obj interface{}) bool {
return true
case *ethpb.VoluntaryExit:
return true
case *ethpb.SignedExecutionPayloadEnvelopeBlind:
case *ethpb.SignedBlindPayloadEnvelope:
return true
case *ethpb.ValidatorRegistrationV1:
return true
Expand Down
2 changes: 1 addition & 1 deletion proto/eth/v1/generated.ssz.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion proto/eth/v2/generated.ssz.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions proto/prysm/v1alpha1/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ ssz_gen_marshal(
"PayloadAttestationData",
"PayloadAttestation",
"PayloadAttestationMessage",
"SignedExecutionPayloadEnvelopeBlind",
"ExecutionPayloadEnvelopeBlind",
"SignedBlindPayloadEnvelope",
"BlindPayloadEnvelope",
],
)

Expand Down
66 changes: 33 additions & 33 deletions proto/prysm/v1alpha1/blind_payload_envelope.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions proto/prysm/v1alpha1/blind_payload_envelope.proto
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ option java_outer_classname = "BlindPayloadEnvelopeProto";
option java_package = "org.ethereum.eth.v1alpha1";
option php_namespace = "Ethereum\\Eth\\v1alpha1";

message SignedExecutionPayloadEnvelopeBlind {
ExecutionPayloadEnvelopeBlind message = 1;
message SignedBlindPayloadEnvelope {
BlindPayloadEnvelope message = 1;
bytes signature = 2 [(ethereum.eth.ext.ssz_size) = "96"];
}

message ExecutionPayloadEnvelopeBlind {
message BlindPayloadEnvelope {
bytes payload_root = 1 [(ethereum.eth.ext.ssz_size) = "32"];
uint64 builder_index = 2 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.ValidatorIndex"];
bytes beacon_block_root = 3 [(ethereum.eth.ext.ssz_size) = "32"];
Expand Down
Loading

0 comments on commit c4a9469

Please sign in to comment.