Skip to content

Commit

Permalink
restore expected_clients
Browse files Browse the repository at this point in the history
  • Loading branch information
parketh committed Aug 6, 2024
1 parent e9eb77d commit c288422
Show file tree
Hide file tree
Showing 15 changed files with 363 additions and 531 deletions.
2 changes: 0 additions & 2 deletions bbnclient/bbnclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ type BabylonClient struct {
*query.QueryClient
}

var _ IBabylonClient = &BabylonClient{}

//////////////////////////////
// CONSTRUCTOR
//////////////////////////////
Expand Down
8 changes: 0 additions & 8 deletions bbnclient/interface.go

This file was deleted.

2 changes: 0 additions & 2 deletions btcclient/btcclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ type BitcoinClient struct {
cfg *BTCConfig
}

var _ IBitcoinClient = &BitcoinClient{}

//////////////////////////////
// CONSTRUCTOR
//////////////////////////////
Expand Down
14 changes: 0 additions & 14 deletions btcclient/interface.go

This file was deleted.

2 changes: 0 additions & 2 deletions cwclient/cwclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ type CosmWasmClient struct {
contractAddr string
}

var _ ICosmWasmClient = &CosmWasmClient{}

const (
// hardcode the timeout to 20 seconds. We can expose it to the params once needed
DefaultTimeout = 20 * time.Second
Expand Down
9 changes: 0 additions & 9 deletions cwclient/interface.go

This file was deleted.

2 changes: 0 additions & 2 deletions ethl2client/ethl2client.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import (
"github.com/ethereum/go-ethereum/ethclient"
)

var _ IEthL2Client = &EthL2Client{}

type EthL2Client struct {
client *ethclient.Client
}
Expand Down
13 changes: 0 additions & 13 deletions ethl2client/interface.go

This file was deleted.

37 changes: 37 additions & 0 deletions finalitygadget/expected_clients.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package finalitygadget

import (
"context"
"math/big"

"github.com/babylonlabs-io/finality-gadget/types"
"github.com/btcsuite/btcd/chaincfg/chainhash"
"github.com/btcsuite/btcd/wire"
eth "github.com/ethereum/go-ethereum/core/types"
)

type IBitcoinClient interface {
GetBlockCount() (uint64, error)
GetBlockHashByHeight(height uint64) (*chainhash.Hash, error)
GetBlockHeaderByHash(blockHash *chainhash.Hash) (*wire.BlockHeader, error)
GetBlockHeightByTimestamp(targetTimestamp uint64) (uint64, error)
GetBlockTimestampByHeight(height uint64) (uint64, error)
}

type IBabylonClient interface {
QueryAllFpBtcPubKeys(consumerId string) ([]string, error)
QueryFpPower(fpPubkeyHex string, btcHeight uint64) (uint64, error)
QueryMultiFpPower(fpPubkeyHexList []string, btcHeight uint64) (map[string]uint64, error)
QueryEarliestActiveDelBtcHeight(fpPubkeyHexList []string) (uint64, error)
}

type ICosmWasmClient interface {
QueryListOfVotedFinalityProviders(queryParams *types.Block) ([]string, error)
QueryConsumerId() (string, error)
QueryIsEnabled() (bool, error)
}

type IEthL2Client interface {
HeaderByNumber(ctx context.Context, number *big.Int) (*eth.Header, error)
Close()
}
10 changes: 5 additions & 5 deletions finalitygadget/finalitygadget.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ import (
var _ IFinalityGadget = &FinalityGadget{}

type FinalityGadget struct {
btcClient btcclient.IBitcoinClient
bbnClient bbnclient.IBabylonClient
cwClient cwclient.ICosmWasmClient
l2Client ethl2client.IEthL2Client
btcClient IBitcoinClient
bbnClient IBabylonClient
cwClient ICosmWasmClient
l2Client IEthL2Client

db db.IDatabaseHandler
logger *zap.Logger
Expand Down Expand Up @@ -62,7 +62,7 @@ func NewFinalityGadget(cfg *config.Config, db db.IDatabaseHandler, logger *zap.L
// Create bitcoin client
btcConfig := btcclient.DefaultBTCConfig()
btcConfig.RPCHost = cfg.BitcoinRPCHost
var btcClient btcclient.IBitcoinClient
var btcClient IBitcoinClient
switch cfg.BBNChainID {
// TODO: once we set up our own local BTC devnet, we don't need to use this mock BTC client
case config.BabylonLocalnetChainID:
Expand Down
99 changes: 0 additions & 99 deletions testutil/mocks/bbnclient_mock.go

This file was deleted.

116 changes: 0 additions & 116 deletions testutil/mocks/btcclient_mock.go

This file was deleted.

Loading

0 comments on commit c288422

Please sign in to comment.