chainlink
chainlink copied to clipboard
[BCI-3989][core] - CR methods err when service unstarted
Task Description:
CR methods should throw an error if service is unstarted
This PR:
- Adds
StartChainReaderandCloseChainReadermethods to the EVMChainReaderInterfaceTester. - Check if the service is already started before calling
GetLatestValue,BatchGetLatestValues, andQueryKey- Didn't add the check to
Bind, we can discuss later if it's needed there too. - Added an error case for each of the methods when calling without starting the service previously.
- Didn't add the check to
- Add
Start()call to consumers of CR before using it. - Modify EVM tests to include
StartChainReaderandCloseChainReadercalls
Ticket:
Depends on:
- https://github.com/smartcontractkit/chainlink-common/pull/705
Still need to
- Improve tests checking errors when calling the methods without the service started
- Find a workaround and prevent the breaking change + multiple repo PR
EDIT:
- done
- couldn't
Refactored the structure of EVMInterfaceTester for clarity and to make the proposed solution work:
-
Setupreceives thestartedflag to check if we should return CR started -
Setupdivided into small functions to make it easier to understand the purpose/responsibility of each one. -
Getfunctions now only return the instance.Setupis handled separately
Quality Gate passed
Issues
0 New issues
1 Fixed issue
0 Accepted issues
Measures
0 Security Hotspots
89.3% Coverage on New Code
0.0% Duplication on New Code