Skip to content

Commit

Permalink
linterr
Browse files Browse the repository at this point in the history
Signed-off-by: nidhi-singh02 <trippin@berachain.com>
  • Loading branch information
nidhi-singh02 committed Sep 20, 2024
1 parent 28d38c2 commit 322a794
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
7 changes: 4 additions & 3 deletions mod/node-api/handlers/beacon/header.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ func (h *Handler[
func (h *Handler[
BeaconBlockHeaderT, ContextT, _, _,
]) determineSlot(req *beacontypes.GetBlockHeadersRequest) (math.Slot, error) {
var slot math.Slot
var parentRoot common.Root
switch {
case req.Slot != "" && req.ParentRoot != "":
Expand All @@ -86,7 +85,9 @@ func (h *Handler[
return 0, errVerify
}
if verifiedSlot != slot {
return 0, errors.New("provided slot does not match the slot for the given parent root")
return 0, errors.New(
"provided slot does not match the slot for the given parent root",
)
}
return slot, nil

Expand All @@ -106,7 +107,7 @@ func (h *Handler[
if err != nil {
return 0, errors.Wrapf(err, "invalid parent root: %v", req.ParentRoot)
}
slot, err = h.backend.GetSlotByParentRoot(parentRoot)
slot, err := h.backend.GetSlotByParentRoot(parentRoot)
if err != nil {
return 0, err
}
Expand Down
2 changes: 1 addition & 1 deletion mod/storage/pkg/block/mocks/beacon_block.mock.go

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

4 changes: 4 additions & 0 deletions mod/storage/pkg/block/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ func (m MockBeaconBlock) GetStateRoot() common.Root {
return [32]byte{byte(m.slot)}
}

func (m MockBeaconBlock) GetParentBlockRoot() common.Root {
return [32]byte{byte(m.slot - 1)}
}

func TestBlockStore(t *testing.T) {
blockStore := block.NewStore[*MockBeaconBlock](noop.NewLogger[any](), 5)

Expand Down

0 comments on commit 322a794

Please sign in to comment.