-
Notifications
You must be signed in to change notification settings - Fork 208
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make built-in indexer work for retrieval client (#110)
Co-authored-by: Wellington Barbosa <wellington@eigenlabs.org> Co-authored-by: Jian Xiao <iamjianxiao@gmail.com>
- Loading branch information
1 parent
319d87c
commit 03cd96a
Showing
15 changed files
with
309 additions
and
104 deletions.
There are no files selected for viewing
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
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
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
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,59 @@ | ||
package indexer | ||
|
||
import ( | ||
"fmt" | ||
|
||
dacommon "github.com/Layr-Labs/eigenda/common" | ||
"github.com/Layr-Labs/eigenda/indexer" | ||
indexereth "github.com/Layr-Labs/eigenda/indexer/eth" | ||
inmemstore "github.com/Layr-Labs/eigenda/indexer/inmem" | ||
"github.com/ethereum/go-ethereum/common" | ||
) | ||
|
||
func CreateNewIndexer( | ||
config *indexer.Config, | ||
gethClient dacommon.EthClient, | ||
rpcClient dacommon.RPCEthClient, | ||
eigenDAServiceManagerAddr string, | ||
logger dacommon.Logger, | ||
) (indexer.Indexer, error) { | ||
|
||
eigenDAServiceManager := common.HexToAddress(eigenDAServiceManagerAddr) | ||
|
||
pubKeyFilterer, err := NewOperatorPubKeysFilterer(eigenDAServiceManager, gethClient) | ||
if err != nil { | ||
return nil, fmt.Errorf("failed to create new operator pubkeys filter: %w", err) | ||
} | ||
|
||
socketsFilterer, err := NewOperatorSocketsFilterer(eigenDAServiceManager, gethClient) | ||
if err != nil { | ||
return nil, fmt.Errorf("failed to create new operator sockets filter: %w", err) | ||
} | ||
|
||
handlers := []indexer.AccumulatorHandler{ | ||
{ | ||
Acc: NewOperatorPubKeysAccumulator(logger), | ||
Filterer: pubKeyFilterer, | ||
Status: indexer.Good, | ||
}, | ||
{ | ||
Acc: NewOperatorSocketsAccumulator(logger), | ||
Filterer: socketsFilterer, | ||
Status: indexer.Good, | ||
}, | ||
} | ||
|
||
var ( | ||
upgrader = &Upgrader{} | ||
headerStore = inmemstore.NewHeaderStore() | ||
headerSrvc = indexereth.NewHeaderService(logger, rpcClient) | ||
) | ||
return indexer.New( | ||
config, | ||
handlers, | ||
headerSrvc, | ||
headerStore, | ||
upgrader, | ||
logger, | ||
), 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.