From 500525721c479832d25873954c584f52bf26ed60 Mon Sep 17 00:00:00 2001 From: Pablo Deymonnaz Date: Mon, 11 Nov 2024 18:35:17 -0300 Subject: [PATCH] errors about context fixed --- operator/registration.go | 16 +++++----------- plugin/cmd/main.go | 15 +++++---------- 2 files changed, 10 insertions(+), 21 deletions(-) diff --git a/operator/registration.go b/operator/registration.go index a1ddcbb9..389ac8e6 100644 --- a/operator/registration.go +++ b/operator/registration.go @@ -16,10 +16,7 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" - "github.com/Layr-Labs/eigensdk-go/crypto/bls" eigenSdkTypes "github.com/Layr-Labs/eigensdk-go/types" - - regcoord "github.com/Layr-Labs/eigensdk-go/contracts/bindings/RegistryCoordinator" ) func (o *Operator) registerOperatorOnStartup( @@ -63,7 +60,7 @@ func (o *Operator) RegisterOperatorWithEigenlayer() error { } func (o *Operator) DepositIntoStrategy(strategyAddr common.Address, amount *big.Int) error { - _, tokenAddr, err := o.eigenlayerReader.GetStrategyAndUnderlyingToken(&bind.CallOpts{}, strategyAddr) + _, tokenAddr, err := o.eigenlayerReader.GetStrategyAndUnderlyingToken(context.Background(), strategyAddr) if err != nil { o.logger.Error("Failed to fetch strategy contract", "err", err) return err @@ -74,6 +71,10 @@ func (o *Operator) DepositIntoStrategy(strategyAddr common.Address, amount *big. return err } txOpts, err := o.avsWriter.TxMgr.GetNoSendTxOpts() + if err != nil { + o.logger.Error("Failed to fetch GetNoSendTxOpts", "err", err) + return err + } tx, err := contractErc20Mock.Mint(txOpts, o.operatorAddr, amount) if err != nil { o.logger.Errorf("Error assembling Mint tx") @@ -175,10 +176,3 @@ func (o *Operator) PrintOperatorStatus() error { fmt.Println(string(operatorStatusJson)) return nil } - -func pubKeyG1ToBN254G1Point(p *bls.G1Point) regcoord.BN254G1Point { - return regcoord.BN254G1Point{ - X: p.X.BigInt(new(big.Int)), - Y: p.Y.BigInt(new(big.Int)), - } -} diff --git a/plugin/cmd/main.go b/plugin/cmd/main.go index 1cc9bafa..b022ab57 100644 --- a/plugin/cmd/main.go +++ b/plugin/cmd/main.go @@ -13,7 +13,6 @@ import ( sdkclients "github.com/Layr-Labs/eigensdk-go/chainio/clients" "github.com/Layr-Labs/eigensdk-go/chainio/clients/wallet" "github.com/Layr-Labs/eigensdk-go/chainio/txmgr" - regcoord "github.com/Layr-Labs/eigensdk-go/contracts/bindings/RegistryCoordinator" "github.com/Layr-Labs/eigensdk-go/crypto/bls" sdkecdsa "github.com/Layr-Labs/eigensdk-go/crypto/ecdsa" "github.com/Layr-Labs/eigensdk-go/logging" @@ -21,7 +20,6 @@ import ( sdktypes "github.com/Layr-Labs/eigensdk-go/types" "github.com/Layr-Labs/incredible-squaring-avs/core/chainio" "github.com/Layr-Labs/incredible-squaring-avs/types" - "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/ethclient" "github.com/urfave/cli" @@ -135,6 +133,10 @@ func plugin(ctx *cli.Context) { return } clients, err := sdkclients.BuildAll(buildClientConfig, operatorEcdsaPrivateKey, logger) + if err != nil { + fmt.Println(err) + return + } avsReader, err := chainio.BuildAvsReader( common.HexToAddress(avsConfig.AVSRegistryCoordinatorAddress), common.HexToAddress(avsConfig.OperatorStateRetrieverAddress), @@ -202,7 +204,7 @@ func plugin(ctx *cli.Context) { return } strategyAddr := common.HexToAddress(ctx.GlobalString(StrategyAddrFlag.Name)) - _, tokenAddr, err := clients.ElChainReader.GetStrategyAndUnderlyingToken(&bind.CallOpts{}, strategyAddr) + _, tokenAddr, err := clients.ElChainReader.GetStrategyAndUnderlyingToken(context.Background(), strategyAddr) if err != nil { logger.Error("Failed to fetch strategy contract", "err", err) return @@ -239,10 +241,3 @@ func plugin(ctx *cli.Context) { fmt.Println("Invalid operation type") } } - -func pubKeyG1ToBN254G1Point(p *bls.G1Point) regcoord.BN254G1Point { - return regcoord.BN254G1Point{ - X: p.X.BigInt(new(big.Int)), - Y: p.Y.BigInt(new(big.Int)), - } -}