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

feat(rpc): new endpoint for validation status #1129

Open
wants to merge 44 commits into
base: srene/1109-state-update-validation
Choose a base branch
from

Conversation

srene
Copy link
Contributor

@srene srene commented Oct 10, 2024

PR Standards

Opening a pull request should be able to meet the following requirements

--

PR naming convention: https://hackmd.io/@nZpxHZ0CT7O5ngTp0TP9mg/HJP_jrm7A


Close #1128

<-- Briefly describe the content of this pull request -->

For Author:

  • Targeted PR against correct branch
  • included the correct type prefix in the PR title
  • Linked to Github issue with discussion and accepted design
  • Targets only one github issue
  • Wrote unit and integration tests
  • All CI checks have passed
  • Added relevant godoc comments

For Reviewer:

  • confirmed the correct type prefix in the PR title
  • Reviewers assigned
  • confirmed all author checklist items have been addressed

After reviewer approval:

  • In case targets main branch, PR should be squashed and merged.
  • In case PR targets a release branch, PR should be rebased.

@srene srene self-assigned this Oct 10, 2024
@srene srene requested a review from a team as a code owner October 10, 2024 14:48
@srene srene linked an issue Oct 14, 2024 that may be closed by this pull request
@@ -817,6 +821,24 @@ func (c *Client) CheckTx(ctx context.Context, tx tmtypes.Tx) (*ctypes.ResultChec
return &ctypes.ResultCheckTx{ResponseCheckTx: *res}, nil
}

// BlockValidated returns the settlement validation status for a specific height: 0: Not validated, 1: Validated from P2P, 2: Validated from settlement, -1: node is still syncing.
Copy link
Contributor

Choose a reason for hiding this comment

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

should probably an enum vs hardcoded

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

Copy link
Contributor

@danwt danwt left a comment

Choose a reason for hiding this comment

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

I'm not exactly sure in what context this is used, but might it be desirable for the caller to also pass the header hash to check that the block the caller refers to is the same one the node is referring to?

To stop the caller and the callee confusing two different blocks with the same height

Basically the caller wants to know he has the same block the verifier has? or not?

@@ -53,6 +61,10 @@ type Client struct {
genChunks []string
}

type ResultBlockValidated struct {
Result int
Copy link
Contributor

Choose a reason for hiding this comment

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

why not use the custom type here?

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

@@ -193,6 +194,7 @@ func (s *service) NetInfo(req *http.Request, args *netInfoArgs) (*ctypes.ResultN
}

func (s *service) BlockchainInfo(req *http.Request, args *blockchainInfoArgs) (*ctypes.ResultBlockchainInfo, error) {
fmt.Println(args)
Copy link
Contributor

Choose a reason for hiding this comment

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

remove

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

@srene
Copy link
Contributor Author

srene commented Oct 14, 2024

I'm not exactly sure in what context this is used, but might it be desirable for the caller to also pass the header hash to check that the block the caller refers to is the same one the node is referring to?

To stop the caller and the callee confusing two different blocks with the same height

Basically the caller wants to know he has the same block the verifier has? or not?

that is a good point but i dont think that the software that requires this rpc has the block itself with the hash, just the height.

@@ -817,6 +829,24 @@ func (c *Client) CheckTx(ctx context.Context, tx tmtypes.Tx) (*ctypes.ResultChec
return &ctypes.ResultCheckTx{ResponseCheckTx: *res}, nil
}

// BlockValidated returns the settlement validation status for a specific height: 0: Not validated, 1: Validated from P2P, 2: Validated from settlement, -1: node is still syncing.
func (c *Client) BlockValidated(ctx context.Context, height *int64) (*ResultBlockValidated, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

why is height a pointer?

@srene srene force-pushed the srene/1109-state-update-validation branch from d845738 to b40009f Compare October 19, 2024 05:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add rpc endpoint to check validation status
4 participants