[CRE-491] Cleanup LLO folder: testutils + logger#21692
Conversation
|
I see you updated files related to
|
|
✅ No conflicts with other open PRs targeting |
|
There was a problem hiding this comment.
Pull request overview
Risk Rating: MEDIUM
This PR cleans up the LLO code/tests to use chainlink-common logger + test helpers (instead of core/logger and core/internal/testutils) and scopes a previously shared HTTP backoff helper into the channel definitions cache.
Changes:
- Migrates LLO-related tests to
testing.T.Context()andchainlink-common/pkg/logger+chainlink-common/pkg/utils/tests. - Updates mercury transmitter server to use
logger.Nop()instead of the core null logger. - Removes
core/utils.NewHTTPFetchBackoffand adds an equivalent private helper in the channel definitions cache; removesMustRandBytesfromcore/internal/testutils.
Scrupulous human review areas:
core/services/llo/keyring.go: logger type/behavior change (logger.Sugared(lggr).Named(...)) in a security-adjacent component (sign/verify).core/services/llo/mercurytransmitter/server.go: change fromcorelogger.NullLoggertologger.Nop()(ensure equivalent behavior for codec logging).core/services/llo/channeldefinitions/onchain_channel_definition_cache.go: retry/backoff behavior relocation (ensure no behavioral drift in fetch retry timing).
Suggested reviewers (per CODEOWNERS):
/core/services/llo/**:@smartcontractkit/data-streams-engineers,@smartcontractkit/corecore/utils/**(falls back to root):@smartcontractkit/foundations,@smartcontractkit/core
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| core/utils/utils.go | Removes shared NewHTTPFetchBackoff helper from core utils. |
| core/services/llo/retirement/retirement_report_cache_test.go | Switches to chainlink-common logger in tests. |
| core/services/llo/report_codecs_test.go | Uses chainlink-common test logger helper. |
| core/services/llo/orm_test.go | Replaces internal testutils usage with t.Context() and evm testutils address helper. |
| core/services/llo/mercurytransmitter/transmitter_test.go | Migrates logger/context/timeout helpers to chainlink-common. |
| core/services/llo/mercurytransmitter/server.go | Swaps null logger to logger.Nop() and uses chainlink-common/pkg/utils. |
| core/services/llo/mercurytransmitter/queue_test.go | Migrates observed logger + log assertions to chainlink-common helpers. |
| core/services/llo/mercurytransmitter/persistence_manager_test.go | Migrates observed logger + context/log assertions to chainlink-common. |
| core/services/llo/mercurytransmitter/orm_test.go | Uses t.Context() instead of internal testutils. |
| core/services/llo/keyring_test.go | Switches to chainlink-common logger and replaces removed random-bytes helper. |
| core/services/llo/keyring.go | Switches logger import to chainlink-common and adjusts logger wrapping. |
| core/services/llo/cre/transmitter_test.go | Migrates tests to chainlink-common logger helper. |
| core/services/llo/cleanup_test.go | Migrates cleanup tests to t.Context() and chainlink-common logger. |
| core/services/llo/channeldefinitions/static_channel_definitions_cache.go | Import cleanup/reorder while standardizing logger usage. |
| core/services/llo/channeldefinitions/onchain_channel_definition_cache_test.go | Uses evm testutils import for addresses. |
| core/services/llo/channeldefinitions/onchain_channel_definition_cache.go | Replaces core utils backoff call with local helper; import cleanup. |
| core/services/llo/channeldefinitions/channel_definition_cache_factory_test.go | Migrates test logger to chainlink-common. |
| core/services/llo/bm/dummy_transmitter_test.go | Migrates benchmark transmitter test to chainlink-common logger/tests helpers. |
| core/internal/testutils/testutils.go | Removes MustRandBytes from internal testutils. |
| "github.com/smartcontractkit/libocr/offchainreporting2plus/ocr3types" | ||
| "github.com/smartcontractkit/libocr/offchainreporting2plus/types" | ||
| ocrtypes "github.com/smartcontractkit/libocr/offchainreporting2plus/types" | ||
|
|
There was a problem hiding this comment.
This file imports github.com/smartcontractkit/libocr/offchainreporting2plus/types twice (once unaliased as types and again as ocrtypes). Duplicate import paths are a compile error. Keep a single import (either use types.* everywhere or alias it once, e.g. ocrtypes, and update types.OnchainPublicKey accordingly).
| @@ -14,10 +14,9 @@ import ( | |||
| "github.com/smartcontractkit/libocr/offchainreporting2plus/types" | |||
There was a problem hiding this comment.
The import block includes github.com/smartcontractkit/libocr/offchainreporting2plus/types twice (unaliased and as ocrtypes). Go forbids importing the same path multiple times, so this test will not compile. Import it once and use a single package name throughout (e.g. replace ocrtypes.Report with types.Report, or vice versa).
| "github.com/smartcontractkit/libocr/offchainreporting2plus/types" |
| llotypes "github.com/smartcontractkit/chainlink-common/pkg/types/llo" | ||
| "github.com/smartcontractkit/chainlink-data-streams/llo/reportcodecs/evm" | ||
|
|
||
| "github.com/smartcontractkit/chainlink/v2/core/logger" | ||
| "github.com/smartcontractkit/chainlink-common/pkg/logger" | ||
| "github.com/smartcontractkit/chainlink/v2/core/utils/crypto" |
There was a problem hiding this comment.
github.com/smartcontractkit/libocr/offchainreporting2plus/types is imported twice in this file (once as types and again as ocrtypes). That is a compile error. Import the package only once (choose one name) and update the types.*/ocrtypes.* references accordingly.
| "github.com/smartcontractkit/chainlink-common/pkg/logger" | ||
| "github.com/smartcontractkit/chainlink-common/pkg/services" | ||
| llotypes "github.com/smartcontractkit/chainlink-common/pkg/types/llo" | ||
| "github.com/smartcontractkit/chainlink-common/pkg/utils" | ||
| "github.com/smartcontractkit/chainlink-data-streams/llo" |
There was a problem hiding this comment.
The import block currently includes github.com/smartcontractkit/libocr/offchainreporting2plus/types twice (once as types and once as ocr2types). Go does not allow duplicate import paths, so this file will not compile. Import it once (e.g. as ocr2types) and update the single types.ConfigDigest usage to the chosen name.
| @@ -10,7 +10,7 @@ import ( | |||
| ocr2types "github.com/smartcontractkit/libocr/offchainreporting2plus/types" | |||
| ocrtypes "github.com/smartcontractkit/libocr/offchainreporting2plus/types" | |||
There was a problem hiding this comment.
The import block brings in github.com/smartcontractkit/libocr/offchainreporting2plus/types twice (as ocr2types and ocrtypes). Go does not allow duplicate import paths, so this test will not compile. Import it once (pick one alias) and update the references accordingly.
| ocrtypes "github.com/smartcontractkit/libocr/offchainreporting2plus/types" |




No description provided.