Skip to content

Commit

Permalink
test(systemtest): fix cometbft client (#22835)
Browse files Browse the repository at this point in the history
  • Loading branch information
julienrbrt authored Dec 11, 2024
1 parent a38a6a2 commit f266328
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 20 deletions.
24 changes: 6 additions & 18 deletions store/v2/root/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import (
"sync"
"time"

"golang.org/x/sync/errgroup"

corelog "cosmossdk.io/core/log"
corestore "cosmossdk.io/core/store"
"cosmossdk.io/store/v2"
Expand Down Expand Up @@ -305,24 +303,14 @@ func (s *Store) Commit(cs *corestore.Changeset) ([]byte, error) {
// background pruning process (iavl v1 for example) which must be paused during the commit
s.pruningManager.PausePruning()

eg := new(errgroup.Group)

// commit SC async
var cInfo *proof.CommitInfo
eg.Go(func() error {
if err := s.stateCommitment.WriteChangeset(cs); err != nil {
return fmt.Errorf("failed to write batch to SC store: %w", err)
}
var scErr error
cInfo, scErr = s.stateCommitment.Commit(cs.Version)
if scErr != nil {
return fmt.Errorf("failed to commit SC store: %w", scErr)
}
return nil
})
if err := s.stateCommitment.WriteChangeset(cs); err != nil {
return nil, fmt.Errorf("failed to write batch to SC store: %w", err)
}

if err := eg.Wait(); err != nil {
return nil, err
cInfo, err := s.stateCommitment.Commit(cs.Version)
if err != nil {
return nil, fmt.Errorf("failed to commit SC store: %w", err)
}

if cInfo.Version != cs.Version {
Expand Down
11 changes: 9 additions & 2 deletions tests/systemtests/cometbft_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,12 @@ func TestQueryStatus(t *testing.T) {
cli := systest.NewCLIWrapper(t, systest.Sut, systest.Verbose)
systest.Sut.StartChain(t)

resp := cli.CustomQuery("status")
var resp string
if systest.IsV2() {
resp = cli.CustomQuery("comet", "status")
} else {
resp = cli.CustomQuery("status")
}

// make sure the output has the validator moniker.
assert.Contains(t, resp, "\"moniker\":\"node0\"")
Expand Down Expand Up @@ -223,7 +228,7 @@ func TestValidatorSetByHeight(t *testing.T) {
}
}

func TestValidatorSetByHeight_GRPCRestGateway(t *testing.T) {
func TestValidatorSetByHeight_GRPCGateway(t *testing.T) {
systest.Sut.ResetChain(t)
systest.Sut.StartChain(t)

Expand Down Expand Up @@ -257,7 +262,9 @@ func TestValidatorSetByHeight_GRPCRestGateway(t *testing.T) {
}

func TestABCIQuery(t *testing.T) {
systest.Sut.ResetChain(t)
systest.Sut.StartChain(t)
_ = systest.Sut.AwaitNextBlock(t, time.Second*3)

qc := cmtservice.NewServiceClient(systest.Sut.RPCClient(t))
cdc := codec.NewProtoCodec(codectypes.NewInterfaceRegistry())
Expand Down

0 comments on commit f266328

Please sign in to comment.