Skip to content

Commit

Permalink
Merge branch 'develop' into duties-cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
james-prysm authored Jan 22, 2024
2 parents 14d569e + 5a2453a commit 306d316
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 14 deletions.
4 changes: 2 additions & 2 deletions beacon-chain/rpc/eth/validator/handlers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1198,14 +1198,14 @@ func TestGetAttestationData(t *testing.T) {
func TestProduceSyncCommitteeContribution(t *testing.T) {
root := bytesutil.PadTo([]byte("0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2"), 32)
sig := bls.NewAggregateSignature().Marshal()
messsage := &ethpbalpha.SyncCommitteeMessage{
message := &ethpbalpha.SyncCommitteeMessage{
Slot: 1,
BlockRoot: root,
ValidatorIndex: 0,
Signature: sig,
}
syncCommitteePool := synccommittee.NewStore()
require.NoError(t, syncCommitteePool.SaveSyncCommitteeMessage(messsage))
require.NoError(t, syncCommitteePool.SaveSyncCommitteeMessage(message))
server := Server{
CoreService: &core.Service{
HeadFetcher: &mockChain.ChainService{
Expand Down
2 changes: 1 addition & 1 deletion beacon-chain/verification/blob.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ func (bv *ROBlobVerifier) SidecarParentSlotLower() (err error) {
// -- i.e. get_checkpoint_block(store, block_header.parent_root, store.finalized_checkpoint.epoch) == store.finalized_checkpoint.root.
func (bv *ROBlobVerifier) SidecarDescendsFromFinalized() (err error) {
defer bv.recordResult(RequireSidecarDescendsFromFinalized, &err)
if !bv.fc.IsCanonical(bv.blob.ParentRoot()) {
if !bv.fc.HasNode(bv.blob.ParentRoot()) {
return ErrSidecarNotFinalizedDescendent
}
return nil
Expand Down
6 changes: 3 additions & 3 deletions beacon-chain/verification/blob_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ func TestSidecarDescendsFromFinalized(t *testing.T) {
_, blobs := util.GenerateTestDenebBlockWithSidecar(t, [32]byte{}, 1, 1)
b := blobs[0]
t.Run("not canonical", func(t *testing.T) {
ini := Initializer{shared: &sharedResources{fc: &mockForkchoicer{IsCanonicalCB: func(r [32]byte) bool {
ini := Initializer{shared: &sharedResources{fc: &mockForkchoicer{HasNodeCB: func(r [32]byte) bool {
if b.ParentRoot() != r {
t.Error("forkchoice.Slot called with unexpected parent root")
}
Expand All @@ -369,8 +369,8 @@ func TestSidecarDescendsFromFinalized(t *testing.T) {
require.Equal(t, true, v.results.executed(RequireSidecarDescendsFromFinalized))
require.NotNil(t, v.results.result(RequireSidecarDescendsFromFinalized))
})
t.Run("not canonical", func(t *testing.T) {
ini := Initializer{shared: &sharedResources{fc: &mockForkchoicer{IsCanonicalCB: func(r [32]byte) bool {
t.Run("canonical", func(t *testing.T) {
ini := Initializer{shared: &sharedResources{fc: &mockForkchoicer{HasNodeCB: func(r [32]byte) bool {
if b.ParentRoot() != r {
t.Error("forkchoice.Slot called with unexpected parent root")
}
Expand Down
4 changes: 1 addition & 3 deletions config/params/testnet_sepolia_config.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package params

import (
"math"

eth1Params "github.com/ethereum/go-ethereum/params"
)

Expand Down Expand Up @@ -37,7 +35,7 @@ func SepoliaConfig() *BeaconChainConfig {
cfg.BellatrixForkVersion = []byte{0x90, 0x00, 0x00, 0x71}
cfg.CapellaForkEpoch = 56832
cfg.CapellaForkVersion = []byte{0x90, 0x00, 0x00, 0x72}
cfg.DenebForkEpoch = math.MaxUint64
cfg.DenebForkEpoch = 132608
cfg.DenebForkVersion = []byte{0x90, 0x00, 0x00, 0x73}
cfg.TerminalTotalDifficulty = "17000000000000000"
cfg.DepositContractAddress = "0x7f02C3E3c98b133055B8B348B2Ac625669Ed295D"
Expand Down
2 changes: 1 addition & 1 deletion consensus-types/blocks/roblob.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func (b *ROBlob) ProposerIndex() primitives.ValidatorIndex {
return b.SignedBlockHeader.Header.ProposerIndex
}

// BlockRootSlice returns the block root as a byte slice. This is often more conveninent/concise
// BlockRootSlice returns the block root as a byte slice. This is often more convenient/concise
// than setting a tmp var to BlockRoot(), just so that it can be sliced.
func (b *ROBlob) BlockRootSlice() []byte {
return b.root[:]
Expand Down
2 changes: 0 additions & 2 deletions testing/endtoend/components/lighthouse_beacon.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ func (node *LighthouseBeaconNode) Start(ctx context.Context) error {
fmt.Sprintf("--port=%d", e2e.TestParams.Ports.LighthouseBeaconNodeP2PPort+index*2), // multiply by 2 because LH adds 1 for quic4 port
fmt.Sprintf("--http-port=%d", e2e.TestParams.Ports.LighthouseBeaconNodeHTTPPort+index),
fmt.Sprintf("--target-peers=%d", 10),
fmt.Sprintf("--eth1-endpoints=http://127.0.0.1:%d", e2e.TestParams.Ports.Eth1RPCPort+prysmNodeCount+index),
fmt.Sprintf("--execution-endpoint=http://127.0.0.1:%d", e2e.TestParams.Ports.Eth1ProxyPort+prysmNodeCount+index),
fmt.Sprintf("--jwt-secrets=%s", jwtPath),
fmt.Sprintf("--boot-nodes=%s", node.enr),
Expand All @@ -193,7 +192,6 @@ func (node *LighthouseBeaconNode) Start(ctx context.Context) error {
"--http-allow-sync-stalled",
"--enable-private-discovery",
"--debug-level=debug",
"--merge",
"--suggested-fee-recipient=0x878705ba3f8bc32fcf7f4caa1a35e72af65cf766",
}
if node.config.UseFixedPeerIDs {
Expand Down
2 changes: 1 addition & 1 deletion testing/util/wait_timeout.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func NewWaiter() *Waiter {
}

// Done is used with RequireDoneAfter and RequireDoneBefore to make assertions
// that certain test code is reached before a timeout or context cancelation.
// that certain test code is reached before a timeout or context cancellation.
func (w *Waiter) Done() {
close(w.c)
}
Expand Down
31 changes: 30 additions & 1 deletion tools/pcli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ func main() {
blkRoot,
preStateRoot,
)
postState, err := transition.ExecuteStateTransition(context.Background(), stateObj, block)
postState, err := debugStateTransition(context.Background(), stateObj, block)
if err != nil {
log.Fatal(err)
}
Expand Down Expand Up @@ -355,3 +355,32 @@ func benchmarkHash(sszPath string, sszType string) {
log.Fatal("Invalid type")
}
}

func debugStateTransition(
ctx context.Context,
st state.BeaconState,
signed interfaces.ReadOnlySignedBeaconBlock,
) (state.BeaconState, error) {
var err error

parentRoot := signed.Block().ParentRoot()
st, err = transition.ProcessSlotsUsingNextSlotCache(ctx, st, parentRoot[:], signed.Block().Slot())
if err != nil {
return st, errors.Wrap(err, "could not process slots")
}

// Execute per block transition.
set, st, err := transition.ProcessBlockNoVerifyAnySig(ctx, st, signed)
if err != nil {
return st, errors.Wrap(err, "could not process block")
}
var valid bool
valid, err = set.VerifyVerbosely()
if err != nil {
return st, errors.Wrap(err, "could not batch verify signature")
}
if !valid {
return st, errors.New("signature in block failed to verify")
}
return st, nil
}

0 comments on commit 306d316

Please sign in to comment.