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

Added an endpoint that provides data from the genesis file #4172

Merged
merged 4 commits into from
Jun 8, 2022

Conversation

bogdan-rosianu
Copy link
Contributor

@bogdan-rosianu bogdan-rosianu commented Jun 6, 2022

added the /network/genesis-balances endpoint that exposes the content of the genesis.json file

@bogdan-rosianu bogdan-rosianu added the type:feature New feature or request label Jun 6, 2022
@bogdan-rosianu bogdan-rosianu self-assigned this Jun 6, 2022
@bogdan-rosianu bogdan-rosianu marked this pull request as draft June 6, 2022 15:24
@bogdan-rosianu bogdan-rosianu changed the title added an endpoint that exposes data from the genesis file added an endpoint that provides data from the genesis file Jun 6, 2022
@bogdan-rosianu bogdan-rosianu marked this pull request as ready for review June 7, 2022 13:39
@andreibancioiu andreibancioiu self-requested a review June 7, 2022 14:27
@iulianpascalau iulianpascalau self-requested a review June 7, 2022 14:47
func (ng *networkGroup) getGenesisBalances(c *gin.Context) {
start := time.Now()
genesisBalances, err := ng.getFacade().GetGenesisBalances()
log.Debug(fmt.Sprintf("GetGenesisBalances took %s", time.Since(start)))
Copy link
Contributor

Choose a reason for hiding this comment

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

consider refactoring all these calls as following:

log.Debug("API call: GetGenesisBalances", "duration", time.Since(start))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done for the entire groups package

@@ -64,6 +65,7 @@ func (psh *PersistentStatusHandler) initMap() {
psh.persistentMetrics.Store(common.MetricTotalSupply, zeroString)
psh.persistentMetrics.Store(common.MetricTotalFees, zeroString)
psh.persistentMetrics.Store(common.MetricDevRewardsInEpoch, zeroString)
psh.persistentMetrics.Store(common.MetricGenesisBlockHash, emptyString)
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a bit misleading: we actually had 4 genesis block hashes
Where do we set this metric other than the empty string?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

forgotten code. removed that metric. thanks

@codecov-commenter
Copy link

Codecov Report

❗ No coverage uploaded for pull request base (feat/rosetta@972068e). Click here to learn what that means.
The diff coverage is n/a.

@@               Coverage Diff               @@
##             feat/rosetta    #4172   +/-   ##
===============================================
  Coverage                ?   75.29%           
===============================================
  Files                   ?      626           
  Lines                   ?    82690           
  Branches                ?        0           
===============================================
  Hits                    ?    62258           
  Misses                  ?    15715           
  Partials                ?     4717           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 972068e...7409838. Read the comment docs.

Copy link
Collaborator

@andreibancioiu andreibancioiu left a comment

Choose a reason for hiding this comment

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

🚀

@@ -414,6 +421,27 @@ func (ng *networkGroup) getGenesisNodesConfig(c *gin.Context) {
shared.RespondWith(c, http.StatusOK, gin.H{"nodes": nc}, "", shared.ReturnCodeSuccess)
}

// getGenesisBalances return genesis balances configuration
Copy link
Collaborator

Choose a reason for hiding this comment

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

Typo (returns) / (comment can also be dropped).

return nil, err
}
if len(initialAccounts) == 0 {
return nil, ErrNilGenesisBalances
Copy link
Collaborator

Choose a reason for hiding this comment

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

Perhaps "empty" instead of "nil" (works either way, though).

Copy link
Collaborator

@gabi-vuls gabi-vuls left a comment

Choose a reason for hiding this comment

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

System test passed.

@gabi-vuls gabi-vuls merged commit 253036c into feat/rosetta Jun 8, 2022
@gabi-vuls gabi-vuls deleted the genesis-balances-api-endpoint branch June 8, 2022 11:01
@schimih schimih changed the title added an endpoint that provides data from the genesis file Added an endpoint that provides data from the genesis file Aug 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants