Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
shrimalmadhur committed Jun 28, 2024
1 parent c3d40ed commit 350bc45
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 33 deletions.
43 changes: 23 additions & 20 deletions chainio/clients/avsregistry/bindings.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,22 +127,25 @@ func NewBindingsFromConfig(
client eth.Client,
logger logging.Logger,
) (*ContractBindings, error) {
var err error
var serviceManagerAddr gethcommon.Address
var registryCoordinatorAddr gethcommon.Address
var stakeRegistryAddr gethcommon.Address
var blsApkRegistryAddr gethcommon.Address
var indexRegistryAddr gethcommon.Address
var operatorStateRetrieverAddr gethcommon.Address
var delegationManagerAddr gethcommon.Address
var avsDirectoryAddr gethcommon.Address

var contractBlsRegistryCoordinator *regcoordinator.ContractRegistryCoordinator
var contractServiceManager *servicemanager.ContractServiceManagerBase
var contractStakeRegistry *stakeregistry.ContractStakeRegistry
var contractBlsApkRegistry *blsapkregistry.ContractBLSApkRegistry
var contractIndexRegistry *indexregistry.ContractIndexRegistry
var contractOperatorStateRetriever *opstateretriever.ContractOperatorStateRetriever
var (
err error

serviceManagerAddr gethcommon.Address
registryCoordinatorAddr gethcommon.Address
stakeRegistryAddr gethcommon.Address
blsApkRegistryAddr gethcommon.Address
indexRegistryAddr gethcommon.Address
operatorStateRetrieverAddr gethcommon.Address
delegationManagerAddr gethcommon.Address
avsDirectoryAddr gethcommon.Address

contractBlsRegistryCoordinator *regcoordinator.ContractRegistryCoordinator
contractServiceManager *servicemanager.ContractServiceManagerBase
contractStakeRegistry *stakeregistry.ContractStakeRegistry
contractBlsApkRegistry *blsapkregistry.ContractBLSApkRegistry
contractIndexRegistry *indexregistry.ContractIndexRegistry
contractOperatorStateRetriever *opstateretriever.ContractOperatorStateRetriever
)

if isZeroAddress(cfg.RegistryCoordinatorAddress) {
logger.Warn("RegistryCoordinator address not provided, the calls to the contract will not work")
Expand All @@ -164,7 +167,7 @@ func NewBindingsFromConfig(
client,
)
if err != nil {
return nil, utils.WrapError("Failed to fetch ServiceManager contract", err)
return nil, utils.WrapError("Failed to create ServiceManager contract", err)
}

stakeRegistryAddr, err = contractBlsRegistryCoordinator.StakeRegistry(&bind.CallOpts{})
Expand All @@ -176,7 +179,7 @@ func NewBindingsFromConfig(
client,
)
if err != nil {
return nil, utils.WrapError("Failed to fetch StakeRegistry contract", err)
return nil, utils.WrapError("Failed to create StakeRegistry contract", err)
}

blsApkRegistryAddr, err = contractBlsRegistryCoordinator.BlsApkRegistry(&bind.CallOpts{})
Expand All @@ -188,7 +191,7 @@ func NewBindingsFromConfig(
client,
)
if err != nil {
return nil, utils.WrapError("Failed to fetch BLSPubkeyRegistry contract", err)
return nil, utils.WrapError("Failed to create BLSPubkeyRegistry contract", err)
}

indexRegistryAddr, err = contractBlsRegistryCoordinator.IndexRegistry(&bind.CallOpts{})
Expand All @@ -197,7 +200,7 @@ func NewBindingsFromConfig(
}
contractIndexRegistry, err = indexregistry.NewContractIndexRegistry(indexRegistryAddr, client)
if err != nil {
return nil, utils.WrapError("Failed to fetch IndexRegistry contract", err)
return nil, utils.WrapError("Failed to create IndexRegistry contract", err)
}

delegationManagerAddr, err = contractStakeRegistry.Delegation(&bind.CallOpts{})
Expand Down
2 changes: 1 addition & 1 deletion chainio/clients/avsregistry/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func NewChainReader(
logger logging.Logger,
ethClient eth.Client,
) *ChainReader {
logger = logger.With("module", "avsregistry/ChainReader")
logger = logger.With(logging.ComponentKey, "avsregistry/ChainReader")

return &ChainReader{
blsApkRegistryAddr: blsApkRegistryAddr,
Expand Down
2 changes: 1 addition & 1 deletion chainio/clients/avsregistry/subscriber.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func NewChainSubscriber(
regCoord regcoord.ContractRegistryCoordinatorFilters,
blsApkRegistry blsapkreg.ContractBLSApkRegistryFilters,
) (*ChainSubscriber, error) {
logger = logger.With("module", "avsregistry/ChainSubscriber")
logger = logger.With(logging.ComponentKey, "avsregistry/ChainSubscriber")

return &ChainSubscriber{
logger: logger,
Expand Down
2 changes: 1 addition & 1 deletion chainio/clients/avsregistry/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func NewChainWriter(
ethClient eth.Client,
txMgr txmgr.TxManager,
) (*ChainWriter, error) {
logger = logger.With("module", "avsregistry/ChainWriter")
logger = logger.With(logging.ComponentKey, "avsregistry/ChainWriter")

return &ChainWriter{
serviceManagerAddr: serviceManagerAddr,
Expand Down
19 changes: 11 additions & 8 deletions chainio/clients/elcontracts/bindings.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,17 @@ func NewBindingsFromConfig(
client eth.Client,
logger logging.Logger,
) (*ContractBindings, error) {
var contractDelegationManager *delegationmanager.ContractDelegationManager
var contractSlasher *slasher.ContractISlasher
var contractStrategyManager *strategymanager.ContractStrategyManager
var slasherAddr gethcommon.Address
var strategyManagerAddr gethcommon.Address
var avsDirectory *avsdirectory.ContractAVSDirectory
var rewardsCoordinator *rewardscoordinator.ContractIRewardsCoordinator
var err error
var (
err error

contractDelegationManager *delegationmanager.ContractDelegationManager
contractSlasher *slasher.ContractISlasher
contractStrategyManager *strategymanager.ContractStrategyManager
slasherAddr gethcommon.Address
strategyManagerAddr gethcommon.Address
avsDirectory *avsdirectory.ContractAVSDirectory
rewardsCoordinator *rewardscoordinator.ContractIRewardsCoordinator
)

if isZeroAddress(cfg.DelegationManagerAddress) {
logger.Warn("DelegationManager address not provided, the calls to the contract will not work")
Expand Down
2 changes: 1 addition & 1 deletion chainio/clients/elcontracts/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func NewELChainReader(
logger logging.Logger,
ethClient eth.Client,
) *ELChainReader {
logger = logger.With("module", "elcontracts/reader")
logger = logger.With(logging.ComponentKey, "elcontracts/reader")

return &ELChainReader{
slasher: slasher,
Expand Down
2 changes: 1 addition & 1 deletion chainio/clients/elcontracts/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func NewELChainWriter(
eigenMetrics metrics.Metrics,
txMgr txmgr.TxManager,
) *ELChainWriter {
logger = logger.With("module", "elcontracts/writer")
logger = logger.With(logging.ComponentKey, "elcontracts/writer")

return &ELChainWriter{
slasher: slasher,
Expand Down
5 changes: 5 additions & 0 deletions logging/constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package logging

const (
ComponentKey = "component"
)

0 comments on commit 350bc45

Please sign in to comment.