smartcontractkit / ccip

Cross Chain Interoperability Protocol
Other
119 stars 47 forks source link

fix when contract reader fails on latestRoundData call #1476

Closed patrickhuie19 closed 2 weeks ago

patrickhuie19 commented 2 weeks ago

Motivation

https://github.com/smartcontractkit/ccip/blob/b71329d41b803ca16dc9a1f9d5247c87fd6fbc32/core/services/ocr2/plugins/ccip/internal/pricegetter/evm.go#L209 will panic with

panic: runtime error: index out of range [1] with length 1

goroutine 3683 [running]:
github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/internal/pricegetter.(*DynamicPriceGetter).performBatchCall(0x8?, {0x46d85c0, 0x67ae360}, 0xa77ab4f8?, 0xc0174776d0, 0xc017475aa0)
    /chainlink/core/services/ocr2/plugins/ccip/internal/pricegetter/evm.go:209 +0x1998

This can happen when the contract reader fails on a LatestRoundData call when only one aggregator contract is requested in the batch call.

Solution

Use read.ReadName

cl-sonarqube-production[bot] commented 2 weeks ago

Quality Gate passed Quality Gate passed

Issues
0 New issues
0 Fixed issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarQube