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

v1/chain/get_finalizer_info not updating vote info #479

Closed
heifner opened this issue Aug 6, 2024 · 2 comments · Fixed by #500 or #512
Closed

v1/chain/get_finalizer_info not updating vote info #479

heifner opened this issue Aug 6, 2024 · 2 comments · Fixed by #500 or #512
Assignees
Labels
bug The product is not working as was intended. 👍 lgtm OCI Work exclusive to OCI team

Comments

@heifner
Copy link
Member

heifner commented Aug 6, 2024

As can be seen by: http://3.227.1.63:8888/v1/chain/get_finalizer_info
The votes are not updated after initial block timestamp of first vote.

@heifner heifner added the bug The product is not working as was intended. label Aug 6, 2024
@enf-ci-bot enf-ci-bot moved this to Todo in Team Backlog Aug 6, 2024
@heifner
Copy link
Member Author

heifner commented Aug 6, 2024

                  last_votes.emplace(f.fin_auth->public_key, std::move(v_info)); // track the voting information for the finalizer

Does not update as emplace does not update if already exists.

  • Should consolidate this and the existing Prometheus and text logging in producer plugin so that controller.vote_metrics is only called once.
  • Should not create tracked_votes if chain_api_plugin not enabled.

@heifner
Copy link
Member Author

heifner commented Aug 6, 2024

diff --git a/plugins/chain_plugin/tracked_votes.cpp b/plugins/chain_plugin/tracked_votes.cpp
index 5e4f39824e..faf4aa7a61 100644
--- a/plugins/chain_plugin/tracked_votes.cpp
+++ b/plugins/chain_plugin/tracked_votes.cpp
@@ -47,7 +47,7 @@ namespace eosio::chain_apis {
                      .voted_for_block_timestamp    = vm.voted_for_block_timestamp
                   };
 
-                  last_votes.emplace(f.fin_auth->public_key, std::move(v_info)); // track the voting information for the finalizer
+                  last_votes[f.fin_auth->public_key] = std::move(v_info); // track the voting information for the finalizer
                }
             };
 
diff --git a/tests/plugin_http_api_test_savanna.py b/tests/plugin_http_api_test_savanna.py
index dc2e9c8715..a0e5ed5b5b 100755
--- a/tests/plugin_http_api_test_savanna.py
+++ b/tests/plugin_http_api_test_savanna.py
@@ -61,8 +61,11 @@ try:
     ret_json = node.processUrllibRequest(resource, command, payload)
     assert type(ret_json["payload"]["active_finalizer_policy"]) == dict
     assert type(ret_json["payload"]["last_tracked_votes"]) == list
+    node.waitForLibToAdvance()
+    org_ret_json = ret_json
     # get_finalizer_info with empty content parameter
     ret_json = node.processUrllibRequest(resource, command, empty_content_dict, payload)
+    assert org_ret_json != ret_json, f"{ret_json}"
     assert type(ret_json["payload"]["active_finalizer_policy"]) == dict
     assert type(ret_json["payload"]["last_tracked_votes"]) == list
     # get_finalizer_info with invalid parameter

@arhag arhag added 👍 lgtm and removed triage labels Aug 6, 2024
@arhag arhag added this to the Savanna: Production-Ready milestone Aug 6, 2024
@heifner heifner added the OCI Work exclusive to OCI team label Aug 6, 2024
heifner added a commit that referenced this issue Aug 7, 2024
heifner added a commit that referenced this issue Aug 8, 2024
…d_votes. Only call controller.vote_metrics() once per block
@heifner heifner moved this from Todo to In Progress in Team Backlog Aug 8, 2024
@heifner heifner moved this from In Progress to Awaiting Review in Team Backlog Aug 8, 2024
heifner added a commit that referenced this issue Aug 8, 2024
Fix v1/chain/get_finalizer_info to update votes
@github-project-automation github-project-automation bot moved this from Awaiting Review to Done in Team Backlog Aug 8, 2024
@heifner heifner linked a pull request Aug 8, 2024 that will close this issue
heifner added a commit that referenced this issue Aug 9, 2024
Only track/log votes on recent blocks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The product is not working as was intended. 👍 lgtm OCI Work exclusive to OCI team
Projects
Archived in project
3 participants