Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update the cache used for LatestRoundRequested #503

Merged
merged 3 commits into from
Aug 5, 2024
Merged
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
9 changes: 2 additions & 7 deletions relayer/pkg/chainlink/ocr2/contract_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ func (c *contractReader) LatestTransmissionDetails(
return
}

// round will never be requested on Starknet so we return 0 values
func (c *contractReader) LatestRoundRequested(
ctx context.Context,
lookback time.Duration,
Expand All @@ -110,15 +111,9 @@ func (c *contractReader) LatestRoundRequested(
round uint8,
err error,
) {
transmissionDetails, err := c.reader.LatestTransmissionDetails(ctx, c.address)
if err != nil {
err = fmt.Errorf("couldn't get transmission details: %w", err)
}

configDigest = transmissionDetails.Digest
configDigest = types.ConfigDigest{}
epoch = 0
round = 0

return
}

Expand Down
8 changes: 1 addition & 7 deletions relayer/pkg/chainlink/ocr2/transmissions_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,7 @@ func (c *transmissionsCache) LatestRoundRequested(
round uint8,
err error,
) {
c.tdLock.RLock()
defer c.tdLock.RUnlock()
configDigest = c.transmissionDetails.Digest
epoch = c.transmissionDetails.Epoch
round = c.transmissionDetails.Round
err = c.assertTransmissionsNotStale()
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

got rid of the error check because we don't actually care what the config digest is and asserting an error would actually cause you to transmit more rounds

return
return c.reader.LatestRoundRequested(ctx, lookback)
}

func (c *transmissionsCache) assertTransmissionsNotStale() error {
Expand Down
Loading