Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 34 additions & 6 deletions core/chainio/avs_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ import (
contractERC20Mock "github.com/yetanotherco/aligned_layer/contracts/bindings/ERC20Mock"
"github.com/yetanotherco/aligned_layer/core/config"

"github.com/Layr-Labs/eigensdk-go/chainio/clients"
eigenClientsV0113 "github.com/Layr-Labs/eigensdk-go-v0.1.13/chainio/clients"
eigenClients "github.com/Layr-Labs/eigensdk-go/chainio/clients"

sdkavsregistry "github.com/Layr-Labs/eigensdk-go/chainio/clients/avsregistry"
"github.com/Layr-Labs/eigensdk-go/logging"
)
Expand All @@ -26,7 +28,7 @@ type AvsReader struct {

func NewAvsReaderFromConfig(baseConfig *config.BaseConfig) (*AvsReader, error) {

buildAllConfig := clients.BuildAllConfig{
buildAllConfig_v0113 := eigenClientsV0113.BuildAllConfig{
EthHttpUrl: baseConfig.EthRpcUrl,
EthWsUrl: baseConfig.EthWsUrl,
RegistryCoordinatorAddr: baseConfig.AlignedLayerDeploymentConfig.AlignedLayerRegistryCoordinatorAddr.String(),
Expand All @@ -35,12 +37,38 @@ func NewAvsReaderFromConfig(baseConfig *config.BaseConfig) (*AvsReader, error) {
PromMetricsIpPortAddress: baseConfig.EigenMetricsIpPortAddress,
}

clients, err := clients.BuildReadClients(buildAllConfig, baseConfig.Logger)
clients_v0113, err := eigenClientsV0113.BuildReadClients(buildAllConfig_v0113, baseConfig.Logger)
if err != nil {
return nil, err
}
baseConfig.Logger.Warn("Failed to build v0.1.13 clients, trying to build v0.2.0-beta.1 clients", "err", err)
// v0.1.13 failed,
// We build the V0.2.0-beta.1 clients
buildAllConfig := eigenClients.BuildAllConfig{
EthHttpUrl: baseConfig.EthRpcUrl,
EthWsUrl: baseConfig.EthWsUrl,
RegistryCoordinatorAddr: baseConfig.AlignedLayerDeploymentConfig.AlignedLayerRegistryCoordinatorAddr.String(),
OperatorStateRetrieverAddr: baseConfig.AlignedLayerDeploymentConfig.AlignedLayerOperatorStateRetrieverAddr.String(),
AvsName: "AlignedLayer",
PromMetricsIpPortAddress: baseConfig.EigenMetricsIpPortAddress,
}
clients, err := eigenClients.BuildReadClients(buildAllConfig, baseConfig.Logger)
if err != nil {
return nil, err
}
chainReader := clients.AvsRegistryChainReader

avsServiceBindings, err := NewAvsServiceBindings(baseConfig.AlignedLayerDeploymentConfig.AlignedLayerServiceManagerAddr, baseConfig.AlignedLayerDeploymentConfig.AlignedLayerOperatorStateRetrieverAddr, baseConfig.EthRpcClient, baseConfig.EthRpcClientFallback, baseConfig.Logger)
if err != nil {
return nil, err
}

chainReader := clients.AvsRegistryChainReader
return &AvsReader{
ChainReader: chainReader,
AvsContractBindings: avsServiceBindings,
AlignedLayerServiceManagerAddr: baseConfig.AlignedLayerDeploymentConfig.AlignedLayerServiceManagerAddr,
logger: baseConfig.Logger,
}, nil
}
chainReader := clients_v0113.AvsRegistryChainReader
Comment on lines +44 to +71
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe move this logic to a separate function.


avsServiceBindings, err := NewAvsServiceBindings(baseConfig.AlignedLayerDeploymentConfig.AlignedLayerServiceManagerAddr, baseConfig.AlignedLayerDeploymentConfig.AlignedLayerOperatorStateRetrieverAddr, baseConfig.EthRpcClient, baseConfig.EthRpcClientFallback, baseConfig.Logger)
if err != nil {
Expand Down
6 changes: 5 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@ module github.com/yetanotherco/aligned_layer
go 1.22.2

require (
github.com/Layr-Labs/eigensdk-go v0.1.13
github.com/Layr-Labs/eigensdk-go v0.2.0-beta.1
github.com/Layr-Labs/eigensdk-go-v0.1.13 v0.1.13 // We make GO believe this library exists
github.com/ethereum/go-ethereum v1.14.0
github.com/prometheus/client_golang v1.19.1
github.com/urfave/cli/v2 v2.27.1
golang.org/x/crypto v0.22.0
)

// And we make a replace of it to a specific version.
replace github.com/Layr-Labs/eigensdk-go-v0.1.13 => github.com/Layr-Labs/eigensdk-go v0.1.13
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may want a comment explaining the dark magic at play.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commented


require (
github.com/AdaLogics/go-fuzz-headers v0.0.0-20240806141605-e8a1dd7889d6
github.com/cenkalti/backoff/v4 v4.3.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ github.com/DataDog/zstd v1.5.2 h1:vUG4lAyuPCXO0TLbXvPv7EB7cNK1QV/luu55UHLrrn8=
github.com/DataDog/zstd v1.5.2/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw=
github.com/Layr-Labs/eigensdk-go v0.1.13 h1:llaDZW52AgrezJUpfqCzzgYuf47DK1HUOQLnI3jcVrA=
github.com/Layr-Labs/eigensdk-go v0.1.13/go.mod h1:aYdNURUhaqeYOS+Cq12TfSdPbjFfiLaHkxPdR4Exq/s=
github.com/Layr-Labs/eigensdk-go v0.2.0-beta.1 h1:vW7AKcvt7fGlIeOMl2Ft9Au/ib8Z9ush8fSrpFSVr10=
github.com/Layr-Labs/eigensdk-go v0.2.0-beta.1/go.mod h1:G4yqiK+5NfUuEMVGGncOEm7QskuGRPmKA7bKxpPzPT4=
github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY=
github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU=
github.com/Microsoft/hcsshim v0.11.4 h1:68vKo2VN8DE9AdN4tnkWnmdhqdbpUFM8OF3Airm7fz8=
Expand Down