chainlink icon indicating copy to clipboard operation
chainlink copied to clipboard

[BCI-3989][core] - CR methods err when service unstarted

Open Farber98 opened this issue 1 year ago • 2 comments

Task Description:

CR methods should throw an error if service is unstarted

This PR:

  • Adds StartChainReader and CloseChainReader methods to the EVM ChainReaderInterfaceTester.
  • Check if the service is already started before calling GetLatestValue, BatchGetLatestValues, and QueryKey
    • 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.
  • Add Start() call to consumers of CR before using it.
  • Modify EVM tests to include StartChainReader and CloseChainReader calls

Ticket:

Depends on:

  • https://github.com/smartcontractkit/chainlink-common/pull/705

Farber98 avatar Aug 14 '24 17:08 Farber98

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

Farber98 avatar Aug 15 '24 21:08 Farber98

Refactored the structure of EVMInterfaceTester for clarity and to make the proposed solution work:

  • Setup receives the started flag to check if we should return CR started
  • Setup divided into small functions to make it easier to understand the purpose/responsibility of each one.
  • Get functions now only return the instance. Setup is handled separately

Farber98 avatar Sep 16 '24 12:09 Farber98