Skip to content

Commit

Permalink
make format
Browse files Browse the repository at this point in the history
  • Loading branch information
charleenfei committed Aug 9, 2022
1 parent 59e89df commit d1f068a
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 37 deletions.
6 changes: 3 additions & 3 deletions modules/core/02-client/legacy/v100/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ func migrateSolomachine(clientState *ClientState) *smtypes.ClientState {
}

return &smtypes.ClientState{
Sequence: clientState.Sequence,
IsFrozen: isFrozen,
ConsensusState: consensusState,
Sequence: clientState.Sequence,
IsFrozen: isFrozen,
ConsensusState: consensusState,
}
}

Expand Down
1 change: 0 additions & 1 deletion modules/core/02-client/types/proposal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ func (suite *TypesTestSuite) TestUpgradeProposalValidateBasic() {
"fails validate abstract - empty title", func() {
proposal, err = types.NewUpgradeProposal("", ibctesting.Description, plan, cs.ZeroCustomFields())
suite.Require().NoError(err)

}, false,
},
{
Expand Down
2 changes: 0 additions & 2 deletions modules/light-clients/06-solomachine/client_state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ func (suite *SoloMachineTestSuite) TestClientStateValidateBasic() {
tc := tc

suite.Run(tc.name, func() {

err := tc.clientState.Validate()

if tc.expPass {
Expand Down Expand Up @@ -193,7 +192,6 @@ func (suite *SoloMachineTestSuite) TestVerifyMembership() {

proof, err = suite.chainA.Codec.Marshal(signatureDoc)
suite.Require().NoError(err)

},
true,
},
Expand Down
1 change: 0 additions & 1 deletion modules/light-clients/06-solomachine/misbehaviour_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ func (suite *SoloMachineTestSuite) TestMisbehaviourValidateBasic() {
tc := tc

suite.Run(tc.name, func() {

misbehaviour := sm.CreateMisbehaviour()
tc.malleateMisbehaviour(misbehaviour)

Expand Down
9 changes: 1 addition & 8 deletions modules/light-clients/06-solomachine/update_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ func (suite *SoloMachineTestSuite) TestVerifyClientMessageHeader() {
{
"signature uses wrong sequence",
func() {

sm.Sequence++
clientMsg = sm.CreateHeader(sm.Diversifier)
},
Expand Down Expand Up @@ -125,7 +124,6 @@ func (suite *SoloMachineTestSuite) TestVerifyClientMessageHeader() {

clientState = cs
clientMsg = h

},
false,
},
Expand Down Expand Up @@ -341,7 +339,6 @@ func (suite *SoloMachineTestSuite) TestVerifyClientMessageMisbehaviour() {
{
"signatures sign over different sequence",
func() {

// store in temp before assigning to interface type
m := sm.CreateMisbehaviour()

Expand Down Expand Up @@ -470,16 +467,13 @@ func (suite *SoloMachineTestSuite) TestUpdateState() {
clientState.UpdateState(suite.chainA.GetContext(), suite.chainA.Codec, suite.store, clientMsg)
})
}

})
}
}
}

func (suite *SoloMachineTestSuite) TestCheckForMisbehaviour() {
var (
clientMsg exported.ClientMessage
)
var clientMsg exported.ClientMessage

// test singlesig and multisig public keys
for _, sm := range []*ibctesting.Solomachine{suite.solomachine, suite.solomachineMulti} {
Expand Down Expand Up @@ -519,7 +513,6 @@ func (suite *SoloMachineTestSuite) TestCheckForMisbehaviour() {
} else {
suite.Require().False(foundMisbehaviour)
}

})
}
}
Expand Down
5 changes: 1 addition & 4 deletions modules/light-clients/07-tendermint/client_state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ const (
fiftyOneCharChainID = "123456789012345678901234567890123456789012345678901"
)

var (
invalidProof = []byte("invalid proof")
)
var invalidProof = []byte("invalid proof")

func (suite *TendermintTestSuite) TestStatus() {
var (
Expand Down Expand Up @@ -162,7 +160,6 @@ func (suite *TendermintTestSuite) TestValidate() {
}

func (suite *TendermintTestSuite) TestInitialize() {

testCases := []struct {
name string
consensusState exported.ConsensusState
Expand Down
30 changes: 20 additions & 10 deletions modules/light-clients/07-tendermint/consensus_state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,35 +14,44 @@ func (suite *TendermintTestSuite) TestConsensusStateValidateBasic() {
consensusState *ibctm.ConsensusState
expectPass bool
}{
{"success",
{
"success",
&ibctm.ConsensusState{
Timestamp: suite.now,
Root: commitmenttypes.NewMerkleRoot([]byte("app_hash")),
NextValidatorsHash: suite.valsHash,
},
true},
{"success with sentinel",
true,
},
{
"success with sentinel",
&ibctm.ConsensusState{
Timestamp: suite.now,
Root: commitmenttypes.NewMerkleRoot([]byte(ibctm.SentinelRoot)),
NextValidatorsHash: suite.valsHash,
},
true},
{"root is nil",
true,
},
{
"root is nil",
&ibctm.ConsensusState{
Timestamp: suite.now,
Root: commitmenttypes.MerkleRoot{},
NextValidatorsHash: suite.valsHash,
},
false},
{"root is empty",
false,
},
{
"root is empty",
&ibctm.ConsensusState{
Timestamp: suite.now,
Root: commitmenttypes.MerkleRoot{},
NextValidatorsHash: suite.valsHash,
},
false},
{"nextvalshash is invalid",
false,
},
{
"nextvalshash is invalid",
&ibctm.ConsensusState{
Timestamp: suite.now,
Root: commitmenttypes.NewMerkleRoot([]byte("app_hash")),
Expand All @@ -51,7 +60,8 @@ func (suite *TendermintTestSuite) TestConsensusStateValidateBasic() {
false,
},

{"timestamp is zero",
{
"timestamp is zero",
&ibctm.ConsensusState{
Timestamp: time.Time{},
Root: commitmenttypes.NewMerkleRoot([]byte("app_hash")),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,10 @@ func (suite *TendermintTestSuite) TestVerifyMisbehaviour() {
Header1: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, suite.chainB.CurrentHeader.Height, trustedHeight1, suite.chainB.CurrentHeader.Time.Add(time.Minute), suite.chainB.Vals, suite.chainB.NextVals, trustedVals1, suite.chainB.Signers),
Header2: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, suite.chainB.CurrentHeader.Height, trustedHeight2, suite.chainB.CurrentHeader.Time, suite.chainB.Vals, suite.chainB.NextVals, trustedVals2, suite.chainB.Signers),
}

},
true,
},
{

"valid misbehaviour at a previous revision", func() {
trustedHeight := path.EndpointA.GetClientState().GetLatestHeight().(clienttypes.Height)

Expand Down Expand Up @@ -254,7 +252,6 @@ func (suite *TendermintTestSuite) TestVerifyMisbehaviour() {
Header1: suite.chainB.CreateTMClientHeader("evmos", int64(height.RevisionHeight), trustedHeight, suite.chainB.CurrentHeader.Time.Add(time.Minute), suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers),
Header2: suite.chainB.CreateTMClientHeader("evmos", int64(height.RevisionHeight), trustedHeight, suite.chainB.CurrentHeader.Time, suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers),
}

}, false,
},
{
Expand Down Expand Up @@ -500,7 +497,6 @@ func (suite *TendermintTestSuite) TestVerifyMisbehaviourNonRevisionChainID() {
Header1: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, suite.chainB.CurrentHeader.Height, trustedHeight1, suite.chainB.CurrentHeader.Time.Add(time.Minute), suite.chainB.Vals, suite.chainB.NextVals, trustedVals1, suite.chainB.Signers),
Header2: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, suite.chainB.CurrentHeader.Height, trustedHeight2, suite.chainB.CurrentHeader.Time, suite.chainB.Vals, suite.chainB.NextVals, trustedVals2, suite.chainB.Signers),
}

},
true,
},
Expand Down Expand Up @@ -575,7 +571,6 @@ func (suite *TendermintTestSuite) TestVerifyMisbehaviourNonRevisionChainID() {
Header1: suite.chainB.CreateTMClientHeader("evmos", int64(height.RevisionHeight), trustedHeight, suite.chainB.CurrentHeader.Time.Add(time.Minute), suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers),
Header2: suite.chainB.CreateTMClientHeader("evmos", int64(height.RevisionHeight), trustedHeight, suite.chainB.CurrentHeader.Time, suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers),
}

}, false,
},
{
Expand Down
4 changes: 1 addition & 3 deletions modules/light-clients/07-tendermint/update_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -699,9 +699,7 @@ func (suite *TendermintTestSuite) TestCheckForMisbehaviour() {
}

func (suite *TendermintTestSuite) TestUpdateStateOnMisbehaviour() {
var (
path *ibctesting.Path
)
var path *ibctesting.Path

testCases := []struct {
name string
Expand Down

0 comments on commit d1f068a

Please sign in to comment.