Skip to content

Commit

Permalink
Fixing tests + cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
sdrug committed Jun 20, 2022
1 parent 9e233c5 commit 33f717f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions pkg/chainlink/ocr2/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ func TestOCR2Client(t *testing.T) {
assert.NoError(t, err)

t.Run("get billing details", func(t *testing.T) {
_, err := client.OCR2BillingDetails(context.Background(), ocr2ContractAddress)
_, err := client.BillingDetails(context.Background(), ocr2ContractAddress)
assert.NoError(t, err)
})

t.Run("get latest config details", func(t *testing.T) {
details, err := client.OCR2LatestConfigDetails(context.Background(), ocr2ContractAddress)
details, err := client.LatestConfigDetails(context.Background(), ocr2ContractAddress)
assert.NoError(t, err)

_, err = client.OCR2LatestConfig(context.Background(), ocr2ContractAddress, details.Block)
_, err = client.ConfigFromEventAt(context.Background(), ocr2ContractAddress, details.Block)
assert.NoError(t, err)
})
}
6 changes: 3 additions & 3 deletions pkg/chainlink/ocr2/contract_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ func (c *contractCache) updateConfig(ctx context.Context) error {
}

c.ccLock.RLock()
isSameConfig := c.contractConfig.ConfigBlock == configBlock && c.contractConfig.Config.ConfigDigest == configDigest
isSame := c.contractConfig.ConfigBlock == configBlock && c.contractConfig.Config.ConfigDigest == configDigest
c.ccLock.RUnlock()

var newConfig types.ContractConfig
if !isSameConfig {
if !isSame {
newConfig, err = c.reader.LatestConfig(ctx, configBlock)
if err != nil {
return errors.Wrap(err, "couldn't fetch latest config")
Expand All @@ -66,7 +66,7 @@ func (c *contractCache) updateConfig(ctx context.Context) error {
c.ccLock.Lock()
defer c.ccLock.Unlock()
c.ccLastCheckedAt = time.Now()
if !isSameConfig {
if !isSame {
c.contractConfig = ContractConfig{
Config: newConfig,
ConfigBlock: configBlock,
Expand Down
4 changes: 2 additions & 2 deletions pkg/chainlink/ocr2/contract_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ type contractReader struct {
lggr logger.Logger
}

func NewContractReader(address string, chainReader OCR2Reader, lggr logger.Logger) *contractReader {
func NewContractReader(address string, reader OCR2Reader, lggr logger.Logger) *contractReader {
return &contractReader{
address: address,
reader: chainReader,
reader: reader,
lggr: lggr,
}
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/chainlink/ocr2/providers.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (p *configProvider) Close() error {
}

func (p *configProvider) ContractConfigTracker() types.ContractConfigTracker {
return p.reader
return p.contractCache
}

func (p *configProvider) OffchainConfigDigester() types.OffchainConfigDigester {
Expand Down

0 comments on commit 33f717f

Please sign in to comment.