Skip to content

feat: dot/rpc: Add support for submit and watch extrinisic#1415

Merged
edwardmack merged 32 commits intodevelopmentfrom
ed/author_submitAndWatchExtrinsic
Mar 12, 2021
Merged

feat: dot/rpc: Add support for submit and watch extrinisic#1415
edwardmack merged 32 commits intodevelopmentfrom
ed/author_submitAndWatchExtrinsic

Conversation

@edwardmack
Copy link
Copy Markdown
Contributor

@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
Copy Markdown

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
Copy Markdown

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
Copy Markdown

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

5 participants