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: dot/rpc: Add support for submit and watch extrinisic #1415

Merged
merged 32 commits into from
Mar 12, 2021

Conversation

edwardmack
Copy link
Member

@edwardmack edwardmack commented Feb 25, 2021

Changes

  • Implementation for author_submitAndWatchExtrinsic, for status ready, inBlock and finalized.
  • Added unit tests for submitExtrinsic

Tests

I need to build tests, any suggestions on how I can init a test so that submit extrinsic I can follow it through all the steps.

go test ./dot/core/...

Checklist

  • I have read CODE_OF_CONDUCT and CONTRIBUTING
  • I have provided as much information as possible and necessary
  • I have reviewed my own pull request before requesting a review
  • All integration tests and required coverage checks are passing

Issues

@lgtm-com
Copy link

lgtm-com bot commented Mar 1, 2021

This pull request introduces 1 alert when merging a066327 into f9a40ff - view on LGTM.com

new alerts:

  • 1 for Useless assignment to local variable

@lgtm-com
Copy link

lgtm-com bot commented Mar 2, 2021

This pull request introduces 1 alert when merging 276e61b into 7f506cf - view on LGTM.com

new alerts:

  • 1 for Useless assignment to local variable

@lgtm-com
Copy link

lgtm-com bot commented Mar 3, 2021

This pull request introduces 1 alert when merging b03cde1 into 451474b - view on LGTM.com

new alerts:

  • 1 for Useless assignment to local variable

@edwardmack edwardmack changed the title Ed/author submit and watch extrinsic feat: dot/rpc: Add support for submit and watch extrinisic Mar 11, 2021
@edwardmack edwardmack marked this pull request as ready for review March 11, 2021 23:01
dot/core/service.go Show resolved Hide resolved
dot/rpc/modules/author_test.go Outdated Show resolved Hide resolved
return c.wsconn.WriteJSON(msg)
err := c.wsconn.WriteJSON(msg)
if err != nil {
logger.Warn("error sending websocket message", "error", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if this should be warn or debug, since warn will pollute the logs if there's some issue... what do you think?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good idea.

return c.wsconn.WriteJSON(res)
err := c.wsconn.WriteJSON(res)
if err != nil {
logger.Warn("error sending websocket message", "error", err)
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

}

// ExtrinsicSubmitListener to handle listening for extrinsic events
type ExtrinsicSubmitListener struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe this and the related logic could go into another file?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, I was thinking I should move the listener logic into another file, I'll clean-up in another PR.

Copy link
Contributor

@noot noot left a comment

Choose a reason for hiding this comment

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

looks good! in terms of tests, is it possible to add a polkadot.js test that explicitly tests submitAndWatchExtrinsic?

@edwardmack edwardmack merged commit 4d432d9 into development Mar 12, 2021
@edwardmack edwardmack deleted the ed/author_submitAndWatchExtrinsic branch March 12, 2021 16:51
github-actions bot pushed a commit that referenced this pull request Mar 12, 2021
Edward Mack: feat: dot/rpc: Add support for submit and watch extrinisic (#1415)

* add check for call to websocket

* stub rpc author_submitAndWatchExtrinsic

* add block import listener

* implement state_subscribeRuntimeVersion

* add test for apply extrinsic

* implement inBlock status for author_submitAndWatchExtrinsic

* handle submit extrinsic in HandleSubmittedExtrinsic

* remove print lines

* add unit tests

* add tests for apply extrinsic

* add test to build and apply extrinsic

* add tests

* add subkey to tests.yml

* fix SubscriptionParams parameter

* skip test failing in CI due to subkey setup

* remove unused reference

* address comments

* remove unused comments

* change logging level for websocket issues
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.

None yet

5 participants