-
Notifications
You must be signed in to change notification settings - Fork 2.7k
API for constructing transactions from Calls #3063
Conversation
rphmeier
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some problems with the interface
|
fyi: the signature payload is changing in #3102. |
|
Some general questions, why do we need two methods? Don't you normally just want create a signed transaction in one call? Next question would be, do we really need this? If we take the current design, we probably need 3 calls into the runtime for creating the transaction. Can we not directly return a transaction from the misbehavior construction call? As you always need to call into the runtime to get the correct call, we could just return the signed transaction and be done. |
I think the problem is that we can't sign a transaction in |
andresilva
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My understanding for this API is that the consensus engine needs a way to send transactions for reporting misbehavior. These transactions must be signed outside of the runtime (potentially with different keys and crypto from what the consensus engine is using).
How do we fill encoded_call parameter? Isn't that what we want to abstract over? Otherwise the consensus engine still needs to find a way to figure out which method to call (which is specific to the runtime). If you note on #2181, @rphmeier mentioned that consensus runtime APIs should get a method like construct_report_call which would return the encoded call.
Yes, I'm not sure that is enough though, I can imagine we may want to pass more parameters to the |
Yeah, that would be nice. But the runtime controls transaction & signing format, not consensus code. I don't see an obvious way to get the runtime to sign transactions either. |
By "one call", I mean on runtime call. I know that we need to call into the runtime anway, to at least get the correct |
Why would consensus keys be available within the runtime? That would require some offchain magic. |
Demi-Marie
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good, especially the runtime API. My one suggestion would be to consolidate the two functions into one function that takes a signing callback. I do not think this would make the consensus engine implementation significantly harder, and I do think it would significantly ease the jobs of runtime authors.
With this pr: #3213 We will be able to sign from the runtime. |
Ok, then this PR is not needed and we can close, right? |
|
Closing for now. Can reopen if turns out to be needed. |
Initial proposal for an API for constructing transactions from Calls.
This will be used, for instance, for constructing misbehavior report transactions.
Context: #2181
Example usage
Example definitions
Signing Payload
Build Transaction