Skip to content
This repository has been archived by the owner on Dec 20, 2023. It is now read-only.

Add RPC client #103

Merged
merged 7 commits into from
Mar 9, 2023
Merged

Add RPC client #103

merged 7 commits into from
Mar 9, 2023

Conversation

dnkolegov
Copy link
Contributor

@dnkolegov dnkolegov commented Mar 8, 2023

This PR adds a JSON RPC client to request IPC Agent, adds support for onchain reconfiguration, adds a basic test to check that onchain reconfiguration can be received via a stub JSOn RPC client, adapts CLI.

@dnkolegov dnkolegov requested a review from adlrocha March 8, 2023 12:57
Copy link
Contributor

@adlrocha adlrocha left a comment

Choose a reason for hiding this comment

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

Great work! A few suggestions and potential bugs. It would also be great if we can actually test it against the IPC agent to be sure that it works (at least the call, we can plan the end-to-end tests in a follow-up PR).

}

func (c *JSONRPCClient) SendRequest(method string, params interface{}, reply interface{}) error {
paramBytes, err := rpc.EncodeClientRequest(method, params)
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we sure that the method an parameters generated from this package are compatible with our implementation in the IPC agent?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I asked @cryptoAtwill to create a string-based test in the JSON RPC server repo. Then I can use the same strings (serialized requests) to test them here.
Do you have other ideas?

Copy link
Contributor

Choose a reason for hiding this comment

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

This works for now, just to double-check before we get integration tests ready.

chain/consensus/mir/rpc/rpc.go Outdated Show resolved Hide resolved
return fmt.Errorf("received status code: %d", resp.StatusCode)
}

if err := rpc.DecodeClientResponse(resp.Body, reply); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here, we should ensure that is compatible with our implementation.

chain/consensus/mir/validator/membership.go Show resolved Hide resolved
// GetValidatorSet gets the membership config from the actor state.
func (c *ActorMembership) GetValidatorSet() (*Set, error) {
var set Set
err := c.client.SendRequest("Filecoin.GetValidatorSet", nil, &set)
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

cmd/eudico/mirvalidator/run.go Show resolved Hide resolved
Copy link
Contributor

@adlrocha adlrocha left a comment

Choose a reason for hiding this comment

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

Thank you for the changes. LGTM.

@dnkolegov dnkolegov merged commit c6bc7db into spacenet Mar 9, 2023
@dnkolegov dnkolegov deleted the onchain-reconfiguration branch March 9, 2023 13:21
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants