Skip to content

Commit

Permalink
testcases for validatorVoteBody and ID transaction prep
Browse files Browse the repository at this point in the history
  • Loading branch information
charithabandi committed Dec 13, 2024
1 parent 00329ee commit 45d3455
Show file tree
Hide file tree
Showing 7 changed files with 612 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func init() {
// It will search for a local extension configuration named "eth_deposit".
func Start(ctx context.Context, service *common.Service, eventStore listeners.EventStore) error {
config := &EthDepositConfig{}
listenerConfig, ok := service.LocalConfig.AppConfig.Extensions[ListenerName]
listenerConfig, ok := service.LocalConfig.Extensions[ListenerName]
if !ok {
service.Logger.Warn("no eth_deposit configuration found, eth_deposit oracle will not start")
return nil // no configuration, so we don't start the oracle
Expand Down Expand Up @@ -72,7 +72,7 @@ func Start(ctx context.Context, service *common.Service, eventStore listeners.Ev
if err != nil {
return fmt.Errorf("failed to get current block height: %w", err)
}
service.Logger.S.Infof("ETH best block: %v", currentHeight)
service.Logger.Infof("ETH best block: %v", currentHeight)

if lastHeight > currentHeight-config.RequiredConfirmations {
return fmt.Errorf("starting height is greater than the last confirmed eth block height")
Expand Down Expand Up @@ -135,7 +135,7 @@ func Start(ctx context.Context, service *common.Service, eventStore listeners.Ev
// height range. This means inserting any that have not already been processed
// for broadcast in a Kwil vote ID / approval transaction, and then storing the
// processed height.
func processEvents(ctx context.Context, from, to int64, client *ethClient, eventStore listeners.EventStore, logger log.SugaredLogger) error {
func processEvents(ctx context.Context, from, to int64, client *ethClient, eventStore listeners.EventStore, logger log.Logger) error {
logs, err := client.GetCreditEventLogs(ctx, from, to)
if err != nil {
return fmt.Errorf("failed to get credit event logs: %w", err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ var creditEventSignature ethcommon.Hash = crypto.Keccak256Hash([]byte("Credit(ad
type ethClient struct {
targetAddress ethcommon.Address
maxRetries int64
logger log.SugaredLogger
logger log.Logger
client *ethclient.Client
}

// newEthClient creates a new ethereum client
func newEthClient(ctx context.Context, rpcurl string, maxRetries int64, targetAddress ethcommon.Address, logger log.SugaredLogger) (*ethClient, error) {
func newEthClient(ctx context.Context, rpcurl string, maxRetries int64, targetAddress ethcommon.Address, logger log.Logger) (*ethClient, error) {
var client *ethclient.Client

// I don't set the max retries here because this only gets run on startup
Expand Down
20 changes: 19 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,30 @@ require (
)

require (
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/StackExchange/wmi v1.2.1 // indirect
github.com/antlr4-go/antlr/v4 v4.13.1 // indirect
github.com/bits-and-blooms/bitset v1.13.0 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect
github.com/chzyer/readline v1.5.1 // indirect
github.com/cockroachdb/apd/v3 v3.2.1 // indirect
github.com/consensys/bavard v0.1.13 // indirect
github.com/consensys/gnark-crypto v0.12.1 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect
github.com/crate-crypto/go-ipa v0.0.0-20240223125850-b1e8a79f509c // indirect
github.com/crate-crypto/go-kzg-4844 v1.0.0 // indirect
github.com/deckarep/golang-set/v2 v2.6.0 // indirect
github.com/decred/dcrd/certgen v1.2.0 // indirect
github.com/decred/dcrd/crypto/rand v1.0.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect
github.com/decred/slog v1.2.0 // indirect
github.com/ethereum/c-kzg-4844 v1.0.0 // indirect
github.com/ethereum/go-verkle v0.1.1-0.20240829091221-dffa7562dbe9 // indirect
github.com/fatih/structs v1.1.0 // indirect
github.com/fsnotify/fsnotify v1.8.0 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-ole/go-ole v1.3.0 // indirect
github.com/go-viper/mapstructure/v2 v2.2.1 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
Expand All @@ -68,14 +80,20 @@ require (
github.com/mattn/go-runewidth v0.0.16 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/mmcloughlin/addchain v0.4.0 // indirect
github.com/polydawn/refmt v0.89.0 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect
github.com/supranational/blst v0.3.13 // indirect
github.com/tklauser/go-sysconf v0.3.12 // indirect
github.com/tklauser/numcpus v0.6.1 // indirect
github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1 // indirect
go.opentelemetry.io/otel v1.32.0 // indirect
go.opentelemetry.io/otel/metric v1.32.0 // indirect
go.opentelemetry.io/otel/trace v1.32.0 // indirect
gonum.org/v1/gonum v0.15.1 // indirect
rsc.io/tmplfunc v0.0.3 // indirect
)

require (
Expand All @@ -90,7 +108,7 @@ require (
github.com/docker/go-units v0.5.0 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/elastic/gosigar v0.14.3 // indirect
github.com/ethereum/go-ethereum v1.14.11 // indirect
github.com/ethereum/go-ethereum v1.14.11
github.com/flynn/noise v1.1.0 // indirect
github.com/francoispqt/gojay v1.2.13 // indirect
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
Expand Down
Loading

0 comments on commit 45d3455

Please sign in to comment.