Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(systemtest): fix cometbft client #22835

Merged
merged 1 commit into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading