Skip to content

Commit

Permalink
remove vigilante from gomod
Browse files Browse the repository at this point in the history
  • Loading branch information
Lazar955 committed Oct 31, 2024
1 parent 804cf23 commit d9cdd36
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ ldflags := $(LDFLAGS) -X github.com/babylonlabs-io/babylon-benchmark/lib/version


BUILD_TARGETS := build install
BUILD_FLAGS := --tags "$(build_tags)" --ldflags '$(ldflags)'
BUILD_FLAGS := --tags "$(build_tags)" --ldflags '$(ldflags)' -race

build-babylond:
$(MAKE) -C $(GIT_TOPLEVEL)/submodules/babylon/contrib/images babylond
Expand Down
57 changes: 57 additions & 0 deletions config/bitcoin.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package config

import (
"github.com/babylonlabs-io/babylon/types"
"github.com/lightningnetwork/lnd/lnwallet/chainfee"
)

// BTCConfig defines configuration for the Bitcoin client
type BTCConfig struct {
Endpoint string `mapstructure:"endpoint"`
WalletPassword string `mapstructure:"wallet-password"`
WalletName string `mapstructure:"wallet-name"`
WalletLockTime int64 `mapstructure:"wallet-lock-time"` // time duration in which the wallet remains unlocked, in seconds
TxFeeMin chainfee.SatPerKVByte `mapstructure:"tx-fee-min"` // minimum tx fee, sat/kvb
TxFeeMax chainfee.SatPerKVByte `mapstructure:"tx-fee-max"` // maximum tx fee, sat/kvb
DefaultFee chainfee.SatPerKVByte `mapstructure:"default-fee"` // default BTC tx fee in case estimation fails, sat/kvb
EstimateMode string `mapstructure:"estimate-mode"` // the BTC tx fee estimate mode, which is only used by bitcoind, must be either ECONOMICAL or CONSERVATIVE
TargetBlockNum int64 `mapstructure:"target-block-num"` // this implies how soon the tx is estimated to be included in a block, e.g., 1 means the tx is estimated to be included in the next block
NetParams string `mapstructure:"net-params"`
Username string `mapstructure:"username"`
Password string `mapstructure:"password"`
ReconnectAttempts int `mapstructure:"reconnect-attempts"`
ZmqSeqEndpoint string `mapstructure:"zmq-seq-endpoint"`
ZmqBlockEndpoint string `mapstructure:"zmq-block-endpoint"`
ZmqTxEndpoint string `mapstructure:"zmq-tx-endpoint"`
}

const (
DefaultRpcBtcNodeHost = "127.0.01:18556"
DefaultBtcNodeRpcUser = "rpcuser"
DefaultBtcNodeRpcPass = "rpcpass"
DefaultBtcNodeEstimateMode = "CONSERVATIVE"
DefaultZmqSeqEndpoint = "tcp://127.0.0.1:28333"
DefaultZmqBlockEndpoint = "tcp://127.0.0.1:29001"
DefaultZmqTxEndpoint = "tcp://127.0.0.1:29002"
)

func DefaultBTCConfig() BTCConfig {
return BTCConfig{
Endpoint: DefaultRpcBtcNodeHost,
WalletPassword: "walletpass",
WalletName: "default",
WalletLockTime: 10,
TxFeeMax: chainfee.SatPerKVByte(20 * 1000), // 20,000sat/kvb = 20sat/vbyte
TxFeeMin: chainfee.SatPerKVByte(1 * 1000), // 1,000sat/kvb = 1sat/vbyte
DefaultFee: chainfee.SatPerKVByte(1 * 1000), // 1,000sat/kvb = 1sat/vbyte
EstimateMode: DefaultBtcNodeEstimateMode,
TargetBlockNum: 1,
NetParams: string(types.BtcSimnet),
Username: DefaultBtcNodeRpcUser,
Password: DefaultBtcNodeRpcPass,
ReconnectAttempts: 3,
ZmqSeqEndpoint: DefaultZmqSeqEndpoint,
ZmqBlockEndpoint: DefaultZmqBlockEndpoint,
ZmqTxEndpoint: DefaultZmqTxEndpoint,
}
}
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ require (
github.com/avast/retry-go/v4 v4.6.0
github.com/babylonlabs-io/babylon v0.14.0
github.com/babylonlabs-io/finality-provider v0.9.1
github.com/babylonlabs-io/vigilante v0.14.0
github.com/btcsuite/btcd v0.24.2
github.com/btcsuite/btcd/btcec/v2 v2.3.4
github.com/btcsuite/btcd/btcutil v1.1.6
Expand Down
22 changes: 17 additions & 5 deletions harness/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
"github.com/babylonlabs-io/babylon-benchmark/container"
"github.com/babylonlabs-io/babylon-benchmark/lib"
bbnclient "github.com/babylonlabs-io/babylon/client/client"
bbncfg "github.com/babylonlabs-io/babylon/client/config"
finalitytypes "github.com/babylonlabs-io/babylon/x/finality/types"
"github.com/babylonlabs-io/vigilante/config"
"github.com/btcsuite/btcd/btcec/v2"
"github.com/btcsuite/btcd/btcjson"
"github.com/btcsuite/btcd/btcutil"
Expand Down Expand Up @@ -40,14 +40,26 @@ const (
chainId = "chain-test"
)

func defaultConfig() *config.Config {
cfg := config.DefaultConfig()
type Config struct {
BTC benchcfg.BTCConfig `mapstructure:"btc"`
Babylon bbncfg.BabylonConfig `mapstructure:"babylon"`
}

func DefaultConfig() *Config {
return &Config{
BTC: benchcfg.DefaultBTCConfig(),
Babylon: bbncfg.DefaultBabylonConfig(),
}
}

func defaultConfig() *Config {
cfg := DefaultConfig()
cfg.BTC.NetParams = regtestParams.Name
cfg.BTC.Endpoint = "127.0.0.1:18443"
cfg.BTC.WalletPassword = "pass"
cfg.BTC.Username = "user"
cfg.BTC.Password = "pass"
cfg.BTC.ZmqSeqEndpoint = config.DefaultZmqSeqEndpoint
cfg.BTC.ZmqSeqEndpoint = benchcfg.DefaultZmqSeqEndpoint

return cfg
}
Expand All @@ -56,7 +68,7 @@ type TestManager struct {
TestRpcClient *rpcclient.Client
BitcoindHandler *BitcoindTestHandler
BabylonClient *bbnclient.Client
Config *config.Config
Config *Config
WalletPrivKey *btcec.PrivateKey
manger *container.Manager
babylonDir string
Expand Down

0 comments on commit d9cdd36

Please sign in to comment.