-
Notifications
You must be signed in to change notification settings - Fork 197
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
Conversation
api/groups/networkGroup.go
Outdated
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))) |
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.
consider refactoring all these calls as following:
log.Debug("API call: GetGenesisBalances", "duration", time.Since(start))
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.
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) |
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.
This is a bit misleading: we actually had 4 genesis block hashes
Where do we set this metric other than the empty string?
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.
forgotten code. removed that metric. thanks
Codecov Report
@@ 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.
|
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.
🚀
@@ -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 |
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.
Typo (returns) / (comment can also be dropped).
return nil, err | ||
} | ||
if len(initialAccounts) == 0 { | ||
return nil, ErrNilGenesisBalances |
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.
Perhaps "empty" instead of "nil" (works either way, though).
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.
System test passed.
added the
/network/genesis-balances
endpoint that exposes the content of thegenesis.json
file