ChainSafe / ChainSafe/gossamer
handle extrinsic status `broadcast` for rpc call author_submitAndWatchExtrinsic
- Dominant language
- Go
- Stars
- 454
- Forks
- 144
- PR merge metrics
- No merged PRs in 30d
Description
## Issue summary
- After a transaction has been moved from the ready queue, it gets broadcasted to peers. Wait for the transaction to get broadcasted, and then send the broadcast status along with list peers to which the transaction was broadcasted.
- From what I see, goroutines being used to broadcast transactions are left untracked. We will have to track those and send the extrinsic update after the broadcast finishes.
https://github.com/ChainSafe/gossamer/blob/1c989ad97d0db5f7aa8574c1f13c0432509615c0/dot/network/notifications.go#L378-L401
- polkadot throws an error if a subscription-based rpc method is accessed through curl
```
$ curl -H "Content-Type: application/json" -d '{"id":1, "jsonrpc":"2.0", "method": "author_submitAndWatchExtrinsic", "params":["0xa9018400d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d019e91c8d44bf01ffe36d54f9e43dade2b2fc653270a0e002daed1581435c2e1755bc4349f1434876089d99c9dac4d4128e511c2a3e0788a2a74dd686519cb7c83000000000104ab"]}' http://localhost:8545
{"jsonrpc":"2.0","error":{"code":-32090,"message":"Subscriptions are not available on this transport."},"id":1}
```
We don't do that at the moment
```
$ curl -H "Content-Type: application/json" -d '{"id":1, "jsonrpc":"2.0", "method": "author_submitAndWatchExtrinsic", "params":["0xa9018400d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d019e91c8d44bf01ffe36d54f9e43dade2b2fc653270a0e002daed1581435c2e1755bc4349f1434876089d99c9dac4d4128e511c2a3e0788a2a74dd686519cb7c83000000000104ab"]}' http://localhost:8545
{"jsonrpc":"2.0","result":{"IsFuture":false,"IsReady":false,"Isfinalised":false,"Asfinalised":"0x0000000000000000000000000000000000000000000000000000000000000000","IsUsurped":false,"AsUsurped":"0x0000000000000000000000000000000000000000000000000000000000000000","IsBroadcast":false,"AsBroadcast":null,"IsDropped":false,"IsInvalid":false},"id":1}
```
We should do the same and not support subscription based rpc calls through http requests.
## Other information and links
- look at spec reference of this rpc call https://github.com/w3f/PSPs/blob/master/PSPs/drafts/psp-6.md#189-author_submitandwatchextrinsic-pubsub
- look at https://github.com/ChainSafe/gossamer/issues/1535 for additional context
Contributor guide
Assessment
This issue has not been assessed yet.