-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated bindings to use m2-mainnet contracts and fixed all broken dep…
…endencies (#91) * updated bindings to use m2-mainnet contracts and fixed all broken dependencies * fix linting error - missing error handling * delete old pubkeycompendium mock * removed all notions of pubkey compendium also added builders for the avsregistry clients * fixed compilation errors and ran go fmt * fixed builder to return structs instead of interfaces * fixed builder avs subscriber bug - was using http instead of ws client * fixed buildall txmgr * fixed bug - slasher no longer points to delegationManager so bindings creation logic was broken * fixed avs registration function * fix QueryExistingRegisteredOperatorPubkeys bug * fix builder bug (was passing coordinator addr instead of apkreg addr) * fix variable name keypair->privatekey * update to updateStakes functions in avsregistry writer * added quorumCount() function to avs reader * added GetOperatorIdsInQuorumsAtCurrentBlock function to avs reader * fix context bug in avs reader * git pulled m2-mainnet for latest operatorStateRetriever changes and updated avs reader * added comments explaining RegisterOperatorWithAVSRegistryCoordinator * added GetOperatorsStakeInQuorumsAtCurrentBlock to avsregistry reader * make mocks to fix tests * remove "deleteme" debug log statement * rename log->transactionLog in log output * added comment explaining why we need to pass EcdsaPrivateKey in RegisterOperatorWithAVSRegistryCoordinator function * remove all yaml names in BuildAllConfig struct - don't see why we would need to read this from config file * remove TODO that was previously fixed * added todo comment to update signFn and txmgr to be able to sign generic messages (not only txs)
- Loading branch information
Showing
57 changed files
with
10,482 additions
and
9,864 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package avsregistry | ||
|
||
import ( | ||
"github.com/ethereum/go-ethereum/accounts/abi/bind" | ||
"github.com/ethereum/go-ethereum/common" | ||
"github.com/ethereum/go-ethereum/event" | ||
|
||
"github.com/Layr-Labs/eigensdk-go/chainio/clients/eth" | ||
blsapkreg "github.com/Layr-Labs/eigensdk-go/contracts/bindings/BLSApkRegistry" | ||
"github.com/Layr-Labs/eigensdk-go/logging" | ||
) | ||
|
||
type AvsRegistrySubscriber interface { | ||
SubscribeToNewPubkeyRegistrations() (chan *blsapkreg.ContractBLSApkRegistryNewPubkeyRegistration, event.Subscription, error) | ||
} | ||
|
||
type AvsRegistryChainSubscriber struct { | ||
logger logging.Logger | ||
blsApkRegistry blsapkreg.ContractBLSApkRegistryFilters | ||
} | ||
|
||
// forces EthSubscriber to implement the chainio.Subscriber interface | ||
var _ AvsRegistrySubscriber = (*AvsRegistryChainSubscriber)(nil) | ||
|
||
func NewAvsRegistryChainSubscriber( | ||
blsApkRegistry blsapkreg.ContractBLSApkRegistryFilters, | ||
logger logging.Logger, | ||
) (*AvsRegistryChainSubscriber, error) { | ||
return &AvsRegistryChainSubscriber{ | ||
logger: logger, | ||
blsApkRegistry: blsApkRegistry, | ||
}, nil | ||
} | ||
|
||
func BuildAvsRegistryChainSubscriber( | ||
blsApkRegistryAddr common.Address, | ||
ethWsClient eth.EthClient, | ||
logger logging.Logger, | ||
) (*AvsRegistryChainSubscriber, error) { | ||
blsapkreg, err := blsapkreg.NewContractBLSApkRegistry(blsApkRegistryAddr, ethWsClient) | ||
if err != nil { | ||
logger.Error("Failed to create BLSApkRegistry contract", "err", err) | ||
return nil, err | ||
} | ||
return NewAvsRegistryChainSubscriber(blsapkreg, logger) | ||
} | ||
|
||
func (s *AvsRegistryChainSubscriber) SubscribeToNewPubkeyRegistrations() (chan *blsapkreg.ContractBLSApkRegistryNewPubkeyRegistration, event.Subscription, error) { | ||
newPubkeyRegistrationChan := make(chan *blsapkreg.ContractBLSApkRegistryNewPubkeyRegistration) | ||
sub, err := s.blsApkRegistry.WatchNewPubkeyRegistration( | ||
&bind.WatchOpts{}, newPubkeyRegistrationChan, nil, | ||
) | ||
if err != nil { | ||
s.logger.Error("Failed to subscribe to NewPubkeyRegistration events", "err", err) | ||
return nil, nil, err | ||
} | ||
return newPubkeyRegistrationChan, sub, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.