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

Add network config endpoint #2016

Merged
merged 2 commits into from
Aug 13, 2024
Merged

Add network config endpoint #2016

merged 2 commits into from
Aug 13, 2024

Conversation

zkokelj
Copy link
Contributor

@zkokelj zkokelj commented Aug 13, 2024

Why this change is needed

We need gateway endpoint for getting network config:
Ticket

What changes were made as part of this PR

Please provide a high level list of the changes made

PR checks pre-merging

Please indicate below by ticking the checkbox that you have read and performed the required
PR checks

  • PR checks reviewed and performed

@zkokelj zkokelj changed the title add network config path Add network config endpoint Aug 13, 2024
Copy link
Collaborator

@BedrockSquirrel BedrockSquirrel left a comment

Choose a reason for hiding this comment

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

LGTM

}

// Define a struct to represent the response
type NetworkConfigResponse struct {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Bit of a shame that we can't use ObscuroNetworkInfo like the ObsClient but I guess it's for json compatibility? Maybe better to have separate control over it anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, it is because of that + we need to convert data fields to strings. I was also asking ChatGPT if there is a good way, but unfortunately nothing simpler than that :/

@@ -283,6 +283,14 @@ func (w *Services) GetTenNodeHealthStatus() (bool, error) {
return *res, err
}

func (w *Services) GetTenNetworkConfig() (tencommon.TenNetworkInfo, error) {
res, err := withPlainRPCConnection[tencommon.TenNetworkInfo](context.Background(), w, func(client *gethrpc.Client) (*tencommon.TenNetworkInfo, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this do any caching by default? Maybe safer not to cache for now I guess, there are some edge cases when network starts up before L2 contract deployment maybe.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, it doesn't do any caching. I was thinking about it, but it's not an expensive call to the node and we can add it later if needed.

@zkokelj zkokelj merged commit 86ee410 into main Aug 13, 2024
1 of 2 checks passed
@zkokelj zkokelj deleted the ziga/gateway_get_config branch August 13, 2024 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants