Skip to content

Commit

Permalink
Wait for disperser address transaction to be handled.
Browse files Browse the repository at this point in the history
Signed-off-by: Cody Littley <[email protected]>
  • Loading branch information
cody-littley committed Jan 3, 2025
1 parent 262e1a9 commit d32d0a8
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions inabox/tests/integration_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,30 @@ var _ = BeforeSuite(func() {

// updateDisperserAddress updates the disperser address in the retriever contract
func updateDisperserAddress() {
tx, err := eth.NewWriter(
writer, err := eth.NewWriter(
logger,
ethClient,
testConfig.Retriever.RETRIEVER_BLS_OPERATOR_STATE_RETRIVER,
testConfig.Retriever.RETRIEVER_EIGENDA_SERVICE_MANAGER)
Expect(err).To(BeNil())
err = tx.SetDisperserAddress(context.Background(), testConfig.DisperserAddress)
err = writer.SetDisperserAddress(context.Background(), testConfig.DisperserAddress)
Expect(err).To(BeNil())

maxWaitTime := time.Minute
start := time.Now()
ticker := time.NewTicker(time.Second)
for time.Since(start) < maxWaitTime {
address, err := writer.GetDisperserAddress(context.Background(), 0)
if err == nil {
Expect(address).To(Equal(testConfig.DisperserAddress))
return
}

fmt.Printf("Error reading disperser address. Will keep retrying for %v. %s\n",
maxWaitTime-time.Since(start), err)
<-ticker.C
}
Fail("Failed to get disperser address")
}

func setupRetrievalClient(testConfig *deploy.Config) error {
Expand Down Expand Up @@ -182,11 +198,6 @@ func setupRetrievalClient(testConfig *deploy.Config) error {
return err
}

err = tx.SetDisperserAddress(context.Background(), testConfig.DisperserAddress)
if err != nil {
return fmt.Errorf("could not set disperser address: %w", err)
}

cs := eth.NewChainState(tx, ethClient)
agn := &core.StdAssignmentCoordinator{}
nodeClient := clients.NewNodeClient(20 * time.Second)
Expand Down

0 comments on commit d32d0a8

Please sign in to comment.