-
Notifications
You must be signed in to change notification settings - Fork 492
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 validator id on bor_getSnapshot, bor_getSnapshotAtHash and bor_getCurrentValidators #1415
base: develop
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall, thanks! Could you please add some unit tests (for the new functions)?
Yeah, for sure. Unit tests included |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have added some comments. While logically it's completely fine but I do see some places where it can be improved / optimised.
I see that you've tried to mimic the getBorValidators
function but maybe we don't need to follow the exact steps.
Eg. it checks for first span but maybe we can do it locally instead of making a contract call. It iterates over all producers but maybe we can just query producers[span]
for a specific span id.
Also, it'd be worth checking deploying this on a mainnet node (or amoy) to confirm if doesn't break any checks and to measure the time it takes.
Completely agree. I not did a big validation on performance impact but what I can say is that running o matic-cli locally it not seemed to impact since all the queries on contract happens without any network layer. |
Description
The methods
bor_getSnapshot
,bor_getSnapshotAtHash
, andbor_getCurrentValidators
previously always returned the validator IDs as0
. Upon investigation, I identified two issues contributing to this behavior:ValidatorSet
contract.Fix:
ValidatorSet
contract to correctly retrieve validator IDs.Changes
Checklist
Cross repository changes
Testing
Manual tests
Runned the new rpc tests from matic-cli in local environment.