Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Node Lifecycle OutOfSync bug #14963

Closed
wants to merge 1 commit into from

Conversation

DylanTinianov
Copy link
Contributor

@DylanTinianov DylanTinianov commented Oct 25, 2024

A bug is causing nodes to be incorrectly declared OutOfSync due to checking isOutOfSyncWithPool() on each version check instead of when receiving a new head. This caused the localChainInfo to be behind the actual latest seen head for this node.

Ticket: https://smartcontract-it.atlassian.net/browse/BCI-4174

@DylanTinianov DylanTinianov self-assigned this Oct 25, 2024
@DylanTinianov DylanTinianov requested a review from a team as a code owner October 25, 2024 18:33
@cl-sonarqube-production
Copy link

Quality Gate failed Quality Gate failed

Failed conditions
B Maintainability Rating on New Code (required ≥ A)
5.78% Technical Debt Ratio on New Code (required ≤ 4%)

See analysis details on SonarQube

Catch issues before they fail your Quality Gate with our IDE extension SonarLint SonarLint

Copy link
Contributor

AER Report: CI Core

aer_workflow , commit , Detect Changes , Clean Go Tidy & Generate , lint , Core Tests (go_core_tests) , Core Tests (go_core_ccip_deployment_tests) , Core Tests (go_core_race_tests) , Core Tests (go_core_fuzz) , SonarQube Scan , Flakey Test Detection

1. Condition never satisfied:go_core_tests

Source of Error:
Print Filtered Test Results	2024-10-25T18:46:17.4680834Z �[0;31m 	Error Trace:	/home/runner/go/pkg/mod/github.com/smartcontractkit/[email protected]/pkg/utils/tests/tests.go:59 �[0m
Print Filtered Test Results	2024-10-25T18:46:17.4682705Z �[0;31m 	 				/home/runner/go/pkg/mod/github.com/smartcontractkit/[email protected]/pkg/utils/tests/logs.go:26 �[0m
Print Filtered Test Results	2024-10-25T18:46:17.4684405Z �[0;31m 	 				/home/runner/go/pkg/mod/github.com/smartcontractkit/[email protected]/pkg/utils/tests/logs.go:20 �[0m
Print Filtered Test Results	2024-10-25T18:46:17.4685852Z �[0;31m 	 				/home/runner/work/chainlink/chainlink/common/client/node_lifecycle_test.go:265 �[0m
Print Filtered Test Results	2024-10-25T18:46:17.4686681Z �[0;31m 	Error: 	Condition never satisfied �[0m
Print Filtered Test Results	2024-10-25T18:46:17.4687810Z �[0;31m 	Test: 	TestUnit_NodeLifecycle_aliveLoop/when_behind_more_than_SyncThreshold_but_we_are_the_last_live_node,_forcibly_stays_alive �[0m
Print Filtered Test Results	2024-10-25T18:46:17.4688890Z FAIL:	LatestChainInfo()
Print Filtered Test Results	2024-10-25T18:46:17.4689719Z 		at: [/home/runner/work/chainlink/chainlink/common/client/node_lifecycle_test.go:259]
Print Filtered Test Results	2024-10-25T18:46:17.4690439Z FAIL: 0 out of 1 expectation(s) were met.
Print Filtered Test Results	2024-10-25T18:46:17.4691063Z 	The code you are testing needs to make 1 more call(s).
Print Filtered Test Results	2024-10-25T18:46:17.4693493Z 	at: [/home/runner/work/chainlink/chainlink/common/client/mock_pool_chain_info_provider_test.go:129 /opt/hostedtoolcache/go/1.22.8/x64/src/testing/testing.go:1175 /opt/hostedtoolcache/go/1.22.8/x64/src/testing/testing.go:1353 /opt/hostedtoolcache/go/1.22.8/x64/src/testing/testing.go:1683]

Why: The test TestUnit_NodeLifecycle_aliveLoop failed because a condition was never satisfied. Specifically, the LatestChainInfo() function did not meet the expected number of calls, indicating that the code under test did not behave as expected.

Suggested fix: Ensure that the LatestChainInfo() function is called the expected number of times within the test. This might involve checking the logic that triggers these calls and ensuring it aligns with the test's expectations.

2. Unexpected method call:go_core_tests

Source of Error:
Print Filtered Test Results	2024-10-25T18:46:17.4708691Z assert: mock: The method has been called over 1 times.
Print Filtered Test Results	2024-10-25T18:46:17.4709680Z 	Either do one more Mock.On("GetInterceptedChainInfo").Return(...), or remove extra call.
Print Filtered Test Results	2024-10-25T18:46:17.4710379Z 	This call was unexpected:
Print Filtered Test Results	2024-10-25T18:46:17.4710825Z 		GetInterceptedChainInfo()
Print Filtered Test Results	2024-10-25T18:46:17.4713230Z 	at: [/home/runner/work/chainlink/chainlink/common/client/mock_rpc_client_test.go:161 /home/runner/work/chainlink/chainlink/common/client/node_fsm.go:163 /home/runner/work/chainlink/chainlink/common/client/node_lifecycle.go:181 /opt/hostedtoolcache/go/1.22.8/x64/src/runtime/asm_amd64.s:1695]

Why: The test TestUnit_NodeLifecycle_aliveLoop/If_finality_tag_is_not_enabled_updates_finalized_block_metric_using_finality_depth_and_latest_head failed because the GetInterceptedChainInfo() method was called more times than expected.

Suggested fix: Adjust the mock setup to either allow for the additional call(s) or review the test logic to ensure it aligns with the expected number of method calls. This might involve adding Mock.On("GetInterceptedChainInfo").Return(...) for the additional calls or modifying the test to match the actual behavior.

@DylanTinianov DylanTinianov deleted the BCI-4174-Fix-MultiNode-OutOfSync branch October 25, 2024 19:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant