paritytech / json-rpc-interface-spec

29 stars 3 forks source link

Is the `broadcasted` field of the `dropped` event redundant? #62

Closed josepot closed 1 year ago

josepot commented 1 year ago

Could the broadcasted field in the dropped event, generated by the transaction_unstable_submitAndWatch call, be considered redundant? Would it be possible to determine its value solely based on the occurrence of the broadcasted event?

In other words, are there any situations where the value of the broadcasted field in the dropped event couldn't be inferred from the emission of a broadcasted event? I am not doubting the usefulness of the field, I'm just trying to understand whether there is a situation in which it can't be derived.

cc @tomaka

tomaka commented 1 year ago

In case where the JSON-RPC client isn't reading from its socket quickly enough, the server can choose to not emit broadcasted events. If then the server emits a dropped event, the client might not be aware that the transaction has been broadcasted.

An alternative way to solve this problem would be making it mandatory for the server to generate a broadcasted event before a dropped event when relevant. But having a broadcasted field in the dropped event itself makes it more clear that the JSON-RPC client will get the information.

josepot commented 1 year ago

In case where the JSON-RPC client isn't reading from its socket quickly enough, the server can choose to not emit broadcasted events. If then the server emits a dropped event, the client might not be aware that the transaction has been broadcasted.

An alternative way to solve this problem would be making it mandatory for the server to generate a broadcasted event before a dropped event when relevant. But having a broadcasted field in the dropped event itself makes it more clear that the JSON-RPC client will get the information.

Awesome! That makes a lot of sense. I personally don't think we need to make the broadcasted event a must. Still, it could help to be a bit more explicit in the docs, and spell out that you might get a dropped event marked as broadcasted: true, even if you didn't see a broadcasted event before.

I will try to find the time to open a small PR with that later today. Thanks @tomaka !