Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Reecepbcups committed Sep 16, 2024
1 parent c99e78d commit 33cfa11
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 39 deletions.
2 changes: 1 addition & 1 deletion cclient/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ type ConsensusClient interface {
) (*ResultTxSearch, error)
DoBroadcastTxSync(ctx context.Context, tx []byte) (*TxResultResponse, error) // TODO: is tx []byte fine or does it need to be tx tmtypes.Tx?
DoBroadcastTxAsync(ctx context.Context, tx tmtypes.Tx) (*TxResultResponse, error)
GetTx(ctx context.Context, hash []byte, prove bool) (*coretypes.ResultTx, error)
GetTx(ctx context.Context, hash []byte, psrove bool) (*coretypes.ResultTx, error)
GetBlockSearch(
ctx context.Context,
query string,
Expand Down
67 changes: 29 additions & 38 deletions cclient/consensus_gordian.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ func NewGordianConsensus(addr string) *GordianConsensus {
}
}

// -----

// DoBroadcastTxAsync implements ConsensusClient.
func (g *GordianConsensus) DoBroadcastTxAsync(ctx context.Context, tx tmtypes.Tx) (*TxResultResponse, error) {
// TODO: fix me to be async
Expand Down Expand Up @@ -92,35 +90,6 @@ func (g *GordianConsensus) SimulateTransaction(ctx context.Context, tx []byte, c
}, nil
}

// GetABCIQuery implements ConsensusClient.
func (g *GordianConsensus) GetABCIQuery(ctx context.Context, queryPath string, data cmtbytes.HexBytes) (*ABCIQueryResponse, error) {
// res, err := cc.QueryABCI(ctx, abci.RequestQuery{
// Path: "store/upgrade/key",
// Height: int64(height - 1),
// Data: key,
// Prove: true,
// })
// if err != nil {
// return nil, clienttypes.Height{}, err
// }
panic("unimplemented")
}

// GetABCIQueryWithOptions implements ConsensusClient.
func (g *GordianConsensus) GetABCIQueryWithOptions(ctx context.Context, path string, data cmtbytes.HexBytes, opts client.ABCIQueryOptions) (*coretypes.ResultABCIQuery, error) {
panic("unimplemented")
}

// GetBlockResults implements ConsensusClient.
func (g *GordianConsensus) GetBlockResults(ctx context.Context, height uint64) (*BlockResults, error) {
panic("unimplemented")
}

// GetBlockSearch implements ConsensusClient.
func (g *GordianConsensus) GetBlockSearch(ctx context.Context, query string, page *int, perPage *int, orderBy string) (*coretypes.ResultBlockSearch, error) {
panic("unimplemented")
}

// GetBlockTime implements ConsensusClient.
func (g *GordianConsensus) GetBlockTime(ctx context.Context, height uint64) (time.Time, error) {
res, err := http.Get(fmt.Sprintf("%s/block/%d", g.addr, height))
Expand Down Expand Up @@ -241,16 +210,10 @@ func (g *GordianConsensus) GetTx(ctx context.Context, hash []byte, prove bool) (
}, nil
}

// GetTxSearch implements ConsensusClient.
func (g *GordianConsensus) GetTxSearch(ctx context.Context, query string, prove bool, page *int, perPage *int, orderBy string) (*ResultTxSearch, error) {
// TODO:
return nil, nil
}

// TODO: GetValidators needs pubkey -> address conversions
// GetValidators implements ConsensusClient.
func (g *GordianConsensus) GetValidators(ctx context.Context, height *int64, page *int, perPage *int) (*ResultValidators, error) {
// coppied & modified namespace to GordianValidator
// copied & modified namespace to GordianValidator
type GordianValidator struct {
EncodedPubKey []byte `protobuf:"bytes,1,opt,name=encoded_pub_key,json=encodedPubKey,proto3" json:"encoded_pub_key,omitempty"`
Power uint64 `protobuf:"varint,2,opt,name=power,proto3" json:"power,omitempty"`
Expand Down Expand Up @@ -322,3 +285,31 @@ func (t *tmPubKeyHack) Type() string {
func (t *tmPubKeyHack) VerifySignature(msg []byte, sig []byte) bool {
panic("unimplemented")
}

// --- Gordian Unimplimented ---

// GetABCIQuery implements ConsensusClient.
func (g *GordianConsensus) GetABCIQuery(ctx context.Context, queryPath string, data cmtbytes.HexBytes) (*ABCIQueryResponse, error) {
panic("unimplemented")
}

// GetABCIQueryWithOptions implements ConsensusClient.
func (g *GordianConsensus) GetABCIQueryWithOptions(ctx context.Context, path string, data cmtbytes.HexBytes, opts client.ABCIQueryOptions) (*coretypes.ResultABCIQuery, error) {
panic("unimplemented")
}

// GetTxSearch implements ConsensusClient.
func (g *GordianConsensus) GetTxSearch(ctx context.Context, query string, prove bool, page *int, perPage *int, orderBy string) (*ResultTxSearch, error) {
// TODO:
return nil, nil
}

// GetBlockResults implements ConsensusClient.
func (g *GordianConsensus) GetBlockResults(ctx context.Context, height uint64) (*BlockResults, error) {
panic("unimplemented")
}

// GetBlockSearch implements ConsensusClient.
func (g *GordianConsensus) GetBlockSearch(ctx context.Context, query string, page *int, perPage *int, orderBy string) (*coretypes.ResultBlockSearch, error) {
panic("unimplemented")
}

0 comments on commit 33cfa11

Please sign in to comment.