From 33cfa1150fc8d85ad7497cae37738a5d30d04241 Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Mon, 16 Sep 2024 11:59:38 -0500 Subject: [PATCH] wip --- cclient/consensus.go | 2 +- cclient/consensus_gordian.go | 67 ++++++++++++++++-------------------- 2 files changed, 30 insertions(+), 39 deletions(-) diff --git a/cclient/consensus.go b/cclient/consensus.go index b8b0f082d..cbb376140 100644 --- a/cclient/consensus.go +++ b/cclient/consensus.go @@ -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, diff --git a/cclient/consensus_gordian.go b/cclient/consensus_gordian.go index c8874db76..3742ac63a 100644 --- a/cclient/consensus_gordian.go +++ b/cclient/consensus_gordian.go @@ -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 @@ -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)) @@ -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"` @@ -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") +}