Skip to content

Commit b3551ae

Browse files
updated tests and lint fixes
1 parent 4ce27c9 commit b3551ae

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

rolling-shutter/keyperimpl/gnosis/validatorsyncer_test.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,16 @@ import (
88
"net/http/httptest"
99
"testing"
1010

11+
blst "github.com/supranational/blst/bindings/go"
12+
"gotest.tools/assert"
13+
1114
"github.com/ethereum/go-ethereum/common"
1215
"github.com/ethereum/go-ethereum/core/types"
1316
validatorRegistryBindings "github.com/shutter-network/gnosh-contracts/gnoshcontracts/validatorregistry"
1417
"github.com/shutter-network/rolling-shutter/rolling-shutter/keyperimpl/gnosis/database"
1518
"github.com/shutter-network/rolling-shutter/rolling-shutter/medley/beaconapiclient"
1619
"github.com/shutter-network/rolling-shutter/rolling-shutter/medley/testsetup"
1720
"github.com/shutter-network/rolling-shutter/rolling-shutter/medley/validatorregistry"
18-
blst "github.com/supranational/blst/bindings/go"
19-
"gotest.tools/assert"
2021
)
2122

2223
func TestLegacyValidatorRegisterFilterEvent(t *testing.T) {
@@ -52,7 +53,7 @@ func TestLegacyValidatorRegisterFilterEvent(t *testing.T) {
5253
ChainID: msg.ChainID,
5354
}
5455

55-
events := []*validatorRegistryBindings.ValidatorregistryUpdated{&validatorRegistryBindings.ValidatorregistryUpdated{
56+
events := []*validatorRegistryBindings.ValidatorregistryUpdated{{
5657
Signature: sig.Compress(),
5758
Message: msg.Marshal(),
5859
Raw: types.Log{
@@ -106,7 +107,7 @@ func TestAggregateValidatorRegisterFilterEvent(t *testing.T) {
106107
ChainID: msg.ChainID,
107108
}
108109

109-
events := []*validatorRegistryBindings.ValidatorregistryUpdated{&validatorRegistryBindings.ValidatorregistryUpdated{
110+
events := []*validatorRegistryBindings.ValidatorregistryUpdated{{
110111
Signature: sig.Compress(),
111112
Message: msg.Marshal(),
112113
Raw: types.Log{
@@ -121,6 +122,7 @@ func TestAggregateValidatorRegisterFilterEvent(t *testing.T) {
121122
}
122123

123124
func mockBeaconClient(t *testing.T, pubKeyHex string) string {
125+
t.Helper()
124126
return httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
125127
x := beaconapiclient.GetValidatorByIndexResponse{
126128
Finalized: true,

rolling-shutter/medley/validatorregistry/validatorregistry.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,12 @@ func (m *AggregateRegistrationMessage) Unmarshal(b []byte) error {
6969
func (m *AggregateRegistrationMessage) ValidatorIndices() []int64 {
7070
if m.Version == LegacyValidatorRegistrationMessageVersion {
7171
return []int64{int64(m.ValidatorIndex)}
72-
} else {
73-
indices := make([]int64, 0)
74-
for i := 0; i < int(m.Count); i++ {
75-
indices = append(indices, int64(m.ValidatorIndex)+int64(i))
76-
}
77-
return indices
7872
}
73+
indices := make([]int64, 0)
74+
for i := 0; i < int(m.Count); i++ {
75+
indices = append(indices, int64(m.ValidatorIndex)+int64(i))
76+
}
77+
return indices
7978
}
8079

8180
type LegacyRegistrationMessage struct {

0 commit comments

Comments
 (0)