Skip to content

Commit

Permalink
test passing with new Consensus Interface
Browse files Browse the repository at this point in the history
  • Loading branch information
Reecepbcups committed Sep 2, 2024
1 parent 685a81e commit 5081e22
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 15 deletions.
13 changes: 5 additions & 8 deletions client/client_wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ type CometRPCClient struct {
c *client.Client
}



func NewRPCClient(c *client.Client) CometRPCClient {
return CometRPCClient{c: c}
}
Expand Down Expand Up @@ -67,13 +65,12 @@ func (r CometRPCClient) ABCIQuery(
path string,
data bytes.HexBytes,
) (*coretypes.ResultABCIQuery, error) {
// res, err := r.c.ABCIQuery(ctx, path, slbytes.HexBytes(data))
// if err != nil {
// return nil, err
// }
res, err := r.c.ABCIQuery(ctx, path, slbytes.HexBytes(data))
if err != nil {
return nil, err
}

// return convertResultABCIQuery(res), nil
panic("ABCIQuery unimplemented (hardcoded fee_market.go base fee for now)")
return convertResultABCIQuery(res), nil
}

func (r CometRPCClient) ABCIQueryWithOptions(
Expand Down
36 changes: 30 additions & 6 deletions client/cometbft_consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,30 +74,54 @@ func (r CometRPCClient) GetBlockSearch(ctx context.Context, query string, page *

// GetCommit implements ConsensusRelayerI.
func (r CometRPCClient) GetCommit(ctx context.Context, height *int64) (*coretypes.ResultCommit, error) {
panic("unimplemented")
c, err := r.Commit(ctx, height)
if err != nil {
return nil, fmt.Errorf("failed to get commit: %w", err)
}
return c, nil
}

// GetValidators implements ConsensusRelayerI.
func (r CometRPCClient) GetValidators(ctx context.Context, height *int64, page *int, perPage *int) (*coretypes.ResultValidators, error) {
panic("unimplemented")
v, err := r.Validators(ctx, height, page, perPage)
if err != nil {
return nil, fmt.Errorf("failed to get validators: %w", err)
}
return v, nil
}

// DoBroadcastTxAsync implements ConsensusRelayerI.
func (r CometRPCClient) DoBroadcastTxAsync(ctx context.Context, tx tmtypes.Tx) (*coretypes.ResultBroadcastTx, error) {
panic("unimplemented")
b, err := r.BroadcastTxAsync(ctx, tx)
if err != nil {
return nil, fmt.Errorf("failed to broadcast tx async: %w", err)
}
return b, nil
}

// DoBroadcastTxSync implements ConsensusRelayerI.
func (r CometRPCClient) DoBroadcastTxSync(ctx context.Context, tx tmtypes.Tx) (*coretypes.ResultBroadcastTx, error) {
panic("unimplemented")
b, err := r.BroadcastTxSync(ctx, tx)
if err != nil {
return nil, fmt.Errorf("failed to broadcast tx sync: %w", err)
}
return b, nil
}

// GetABCIQueryWithOptions implements ConsensusRelayerI.
func (r CometRPCClient) GetABCIQueryWithOptions(ctx context.Context, path string, data bytes.HexBytes, opts rpcclient.ABCIQueryOptions) (*coretypes.ResultABCIQuery, error) {
panic("unimplemented")
q, err := r.ABCIQueryWithOptions(ctx, path, data, opts)
if err != nil {
return nil, fmt.Errorf("failed to get ABCI query with options: %w", err)
}
return q, nil
}

// GetStatus implements ConsensusRelayerI.
func (r CometRPCClient) GetStatus(ctx context.Context) (*coretypes.ResultStatus, error) {
panic("unimplemented")
s, err := r.Status(ctx)
if err != nil {
return nil, fmt.Errorf("failed to get status: %w", err)
}
return s, nil
}
1 change: 0 additions & 1 deletion relayer/chains/cosmos/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ type CosmosProvider struct {
PCfg CosmosProviderConfig
Keybase keyring.Keyring
KeyringOptions []keyring.Option
// RPCClient cwrapper.RPCClient
ConsensusClient relayerclient.ConsensusRelayerI

LightProvider provtypes.Provider
Expand Down

0 comments on commit 5081e22

Please sign in to comment.