diff --git a/cli/actions/deposit_into_strategy.go b/cli/actions/deposit_into_strategy.go index 0ccf9bdf..06a2235f 100644 --- a/cli/actions/deposit_into_strategy.go +++ b/cli/actions/deposit_into_strategy.go @@ -6,7 +6,6 @@ import ( "log" "math/big" - sdkutils "github.com/Layr-Labs/eigensdk-go/utils" "github.com/Layr-Labs/incredible-squaring-avs/core/config" "github.com/Layr-Labs/incredible-squaring-avs/operator" "github.com/Layr-Labs/incredible-squaring-avs/types" @@ -18,7 +17,7 @@ func DepositIntoStrategy(ctx *cli.Context) error { configPath := ctx.GlobalString(config.ConfigFileFlag.Name) nodeConfig := types.NodeConfig{} - err := sdkutils.ReadYamlConfig(configPath, &nodeConfig) + err := ReadYamlConfig(configPath, &nodeConfig) if err != nil { return err } diff --git a/cli/actions/print_operator_status.go b/cli/actions/print_operator_status.go index 88bdcf95..e40e98c3 100644 --- a/cli/actions/print_operator_status.go +++ b/cli/actions/print_operator_status.go @@ -4,7 +4,6 @@ import ( "encoding/json" "log" - sdkutils "github.com/Layr-Labs/eigensdk-go/utils" "github.com/Layr-Labs/incredible-squaring-avs/core/config" "github.com/Layr-Labs/incredible-squaring-avs/operator" "github.com/Layr-Labs/incredible-squaring-avs/types" @@ -15,7 +14,7 @@ func PrintOperatorStatus(ctx *cli.Context) error { configPath := ctx.GlobalString(config.ConfigFileFlag.Name) nodeConfig := types.NodeConfig{} - err := sdkutils.ReadYamlConfig(configPath, &nodeConfig) + err := ReadYamlConfig(configPath, &nodeConfig) if err != nil { return err } diff --git a/cli/actions/read_config.go b/cli/actions/read_config.go new file mode 100644 index 00000000..b01f2455 --- /dev/null +++ b/cli/actions/read_config.go @@ -0,0 +1,35 @@ +package actions + +import ( + "errors" + "log" + "os" + "path/filepath" + + "gopkg.in/yaml.v3" +) + +func ReadYamlConfig(path string, o interface{}) error { + if _, err := os.Stat(path); errors.Is(err, os.ErrNotExist) { + log.Fatal("Path ", path, " does not exist") + } + b, err := ReadFile(path) + if err != nil { + return err + } + + err = yaml.Unmarshal(b, o) + if err != nil { + log.Fatalf("unable to parse file with error %#v", err) + } + + return nil +} + +func ReadFile(path string) ([]byte, error) { + b, err := os.ReadFile(filepath.Clean(path)) + if err != nil { + return nil, err + } + return b, nil +} diff --git a/cli/actions/register_operator_with_avs.go b/cli/actions/register_operator_with_avs.go index e2a19342..8f8e14dd 100644 --- a/cli/actions/register_operator_with_avs.go +++ b/cli/actions/register_operator_with_avs.go @@ -6,7 +6,6 @@ import ( "os" sdkecdsa "github.com/Layr-Labs/eigensdk-go/crypto/ecdsa" - sdkutils "github.com/Layr-Labs/eigensdk-go/utils" "github.com/Layr-Labs/incredible-squaring-avs/core/config" "github.com/Layr-Labs/incredible-squaring-avs/operator" "github.com/Layr-Labs/incredible-squaring-avs/types" @@ -17,7 +16,7 @@ func RegisterOperatorWithAvs(ctx *cli.Context) error { configPath := ctx.GlobalString(config.ConfigFileFlag.Name) nodeConfig := types.NodeConfig{} - err := sdkutils.ReadYamlConfig(configPath, &nodeConfig) + err := ReadYamlConfig(configPath, &nodeConfig) if err != nil { return err } diff --git a/cli/actions/register_operator_with_eigenlayer.go b/cli/actions/register_operator_with_eigenlayer.go index 53ff3134..12bda8c3 100644 --- a/cli/actions/register_operator_with_eigenlayer.go +++ b/cli/actions/register_operator_with_eigenlayer.go @@ -2,10 +2,10 @@ package actions import ( "encoding/json" - "github.com/urfave/cli" "log" - sdkutils "github.com/Layr-Labs/eigensdk-go/utils" + "github.com/urfave/cli" + "github.com/Layr-Labs/incredible-squaring-avs/core/config" "github.com/Layr-Labs/incredible-squaring-avs/operator" "github.com/Layr-Labs/incredible-squaring-avs/types" @@ -15,7 +15,7 @@ func RegisterOperatorWithEigenlayer(ctx *cli.Context) error { configPath := ctx.GlobalString(config.ConfigFileFlag.Name) nodeConfig := types.NodeConfig{} - err := sdkutils.ReadYamlConfig(configPath, &nodeConfig) + err := ReadYamlConfig(configPath, &nodeConfig) if err != nil { return err } diff --git a/go.mod b/go.mod index f250db6f..d1ec0907 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.21 toolchain go1.21.0 require ( - github.com/Layr-Labs/eigensdk-go v0.1.12 + github.com/Layr-Labs/eigensdk-go v0.1.13-0.20241108213203-a5ad59992469 github.com/ethereum/go-ethereum v1.14.0 github.com/prometheus/client_golang v1.19.0 github.com/stretchr/testify v1.9.0 @@ -59,7 +59,7 @@ require ( github.com/deckarep/golang-set/v2 v2.1.0 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect github.com/distribution/reference v0.5.0 // indirect - github.com/docker/docker v25.0.5+incompatible // indirect + github.com/docker/docker v25.0.6+incompatible // indirect github.com/docker/go-connections v0.5.0 // indirect github.com/docker/go-units v0.5.0 // indirect github.com/ethereum/c-kzg-4844 v1.0.0 // indirect @@ -108,6 +108,7 @@ require ( github.com/opencontainers/image-spec v1.1.0 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/posthog/posthog-go v1.2.24 // indirect github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect github.com/prometheus/client_model v0.5.0 // indirect github.com/prometheus/common v0.48.0 // indirect diff --git a/go.sum b/go.sum index 435f6b31..d88711d7 100644 --- a/go.sum +++ b/go.sum @@ -18,6 +18,8 @@ github.com/Layr-Labs/eigensdk-go v0.1.7-0.20240425202952-954cd7661775 h1:xQQ4xnl github.com/Layr-Labs/eigensdk-go v0.1.7-0.20240425202952-954cd7661775/go.mod h1:ECU8/Ocsf+dGcN2rs8I1PScq4dOkQqY+vgwnq30Ov4M= github.com/Layr-Labs/eigensdk-go v0.1.12 h1:Drf59iJLvnTm2Om9AwAyUMiZeJaTI8ZameIrnhjopSY= github.com/Layr-Labs/eigensdk-go v0.1.12/go.mod h1:XcLVDtlB1vOPj63D236b451+SC75B8gwgkpNhYHSxNs= +github.com/Layr-Labs/eigensdk-go v0.1.13-0.20241108213203-a5ad59992469 h1:zBmTZdIio/xzftdBvyCOLMGtRhmmqRbwSufHjL5dNbI= +github.com/Layr-Labs/eigensdk-go v0.1.13-0.20241108213203-a5ad59992469/go.mod h1:QsDfVTmN1BCYl3OAZKMRqdloyXUQ6UOYjS1QZbB9aP4= github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/Microsoft/hcsshim v0.11.4 h1:68vKo2VN8DE9AdN4tnkWnmdhqdbpUFM8OF3Airm7fz8= @@ -140,6 +142,8 @@ github.com/docker/docker v25.0.3+incompatible h1:D5fy/lYmY7bvZa0XTZ5/UJPljor41F+ github.com/docker/docker v25.0.3+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/docker v25.0.5+incompatible h1:UmQydMduGkrD5nQde1mecF/YnSbTOaPeFIeP5C4W+DE= github.com/docker/docker v25.0.5+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v25.0.6+incompatible h1:5cPwbwriIcsua2REJe8HqQV+6WlWc1byg2QSXzBxBGg= +github.com/docker/docker v25.0.6+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-connections v0.5.0 h1:USnMq7hx7gwdVZq1L49hLXaFtUdTADjXGp+uj1Br63c= github.com/docker/go-connections v0.5.0/go.mod h1:ov60Kzw0kKElRwhNs9UlUHAE/F9Fe6GLaXnqyDdmEXc= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= @@ -390,6 +394,8 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/posthog/posthog-go v1.2.24 h1:A+iG4saBJemo++VDlcWovbYf8KFFNUfrCoJtsc40RPA= +github.com/posthog/posthog-go v1.2.24/go.mod h1:uYC2l1Yktc8E+9FAHJ9QZG4vQf/NHJPD800Hsm7DzoM= github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF4JjgDlrVEn3C11VoGHZN7m8qihwgMEtzYw= github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/prometheus/client_golang v1.19.0 h1:ygXvpU1AoN1MhdzckN+PyD9QJOSD4x7kmXYlnfbA6JU=