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

Expose ValidatorInfo struct #1162

Conversation

Stefan-Ethernal
Copy link
Collaborator

@Stefan-Ethernal Stefan-Ethernal commented Jan 25, 2023

Description

This PR exposes and utilizes the ValidatorInfo struct. It represents a data transfer object, which is used to hold all validator data retrieved from the smart contract.
Note: It is worth to consider merging it with the ValidatorMetadata object at some point.

Changes include

  • Bugfix (non-breaking change that solves an issue)
  • Hotfix (change that solves an urgent issue, and requires immediate attention)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (change that is not backward-compatible and/or changes current functionality)

Checklist

  • I have assigned this PR to myself
  • I have added at least 1 reviewer
  • I have added the relevant labels
  • I have updated the official documentation
  • I have added sufficient documentation in the code

Testing

  • I have tested this code with the official test suite
  • I have tested this code manually

@Stefan-Ethernal Stefan-Ethernal added the feature New update to Polygon Edge label Jan 25, 2023
@Stefan-Ethernal Stefan-Ethernal self-assigned this Jan 25, 2023
@Stefan-Ethernal Stefan-Ethernal marked this pull request as ready for review January 25, 2023 13:58
@@ -14,6 +14,17 @@ import (
"github.com/umbracle/ethgo/contract"
)

// ValidatorInfo is data transfer object which holds validator information,
// provided by smart contract
type ValidatorInfo struct {
Copy link
Collaborator Author

@Stefan-Ethernal Stefan-Ethernal Jan 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it be merged with ValidatorMetadata at some point?

@codecov
Copy link

codecov bot commented Jan 25, 2023

Codecov Report

❗ No coverage uploaded for pull request base (feature/v3-parity@bf5ac4d). Click here to learn what that means.
The diff coverage is n/a.

@@                 Coverage Diff                  @@
##             feature/v3-parity    #1162   +/-   ##
====================================================
  Coverage                     ?   54.51%           
====================================================
  Files                        ?      173           
  Lines                        ?    23179           
  Branches                     ?        0           
====================================================
  Hits                         ?    12636           
  Misses                       ?     9545           
  Partials                     ?      998           

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@ferranbt
Copy link
Contributor

What is the problem being solved here?

@Stefan-Ethernal
Copy link
Collaborator Author

What is the problem being solved here?

What we want to achieve here is returning an object representation of validator info instead of map (https://github.com/0xPolygon/polygon-edge/pull/1162/files#diff-090d11924b8e0865632ddb3e8da73ceb5b944c6ee26ee8be367f8e626097480aR46), which is more error prone when extracting values and it has some repetitions in code.

So far this was mostly used in e2e tests, so instead of remembering the keys for extracting values for map (https://github.com/0xPolygon/polygon-edge/pull/1162/files#diff-35f7a314332bee5e2f8472071db16a9916b25e85662af4cca846deb81b78800cL635-L636), we already have object representation which is more straight-forward to use.

@Stefan-Ethernal Stefan-Ethernal merged commit f0275ea into feature/v3-parity Jan 26, 2023
@Stefan-Ethernal Stefan-Ethernal deleted the fix/encapsulate-sidechain-cmd-validator-info branch January 26, 2023 11:17
@github-actions github-actions bot locked and limited conversation to collaborators Jan 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature New update to Polygon Edge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants