-
Notifications
You must be signed in to change notification settings - Fork 346
Fix for deserialization of BroadcastTx which was missing the type byte. #453
Fix for deserialization of BroadcastTx which was missing the type byte. #453
Conversation
Thanks for this. Indeed we seemed to be assuming a I'm a little wary though because presumably it will break what our javascript libraries must be doing for 0.12. @NodeGuy - what do you provide for "params" when calling rpc/v0 from your libaries? @benjaminbollen can you remember why this was like this? |
Silas,
It's a bit more than just a change from always assuming a CallTx to handling any types of Tx. The json representation of the asummed CallTx is also not consistent with how it's expected in the wire protocol (see txs/tx.go file, where the concrete type is defined for the wire protocol).
Ideally, this regression (introduced in 0.12.x) can be fixed for 0.16.0.
The way transaction types are handled (array with type byte followed by payload) is exactly the same as how pubkeys and signatures are handled so it should not be too hard to bring in line.
Let me know if/how I can help.
Alex
… On 25 Jan 2017, at 17:11, Silas Davis ***@***.***> wrote:
Thanks for this. Indeed we seemed to be assuming a CallTx, whereas with this change it can be any transactions type.
I'm a little wary of this change though because presumably it will break what our javascript libraries must be doing for 0.12. @NodeGuy - what do you provide for "params" when calling rpc/v0 from your libaries? @benjaminbollen can you remember why this was like this?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Here's what's provided for this.server.transact({
priv_key: privKey,
address,
data,
gas_limit: gasLimit,
fee
}, callback) |
David, awesome that you know exactly where the changes are. Could they be reverted for 0.16.0?
Thx,
Alex
… On 25 Jan 2017, at 19:51, David Braun ***@***.***> wrote:
Here's what's provided for params:
this.server.transact({
priv_key: privKey,
address,
data,
gas_limit: gasLimit,
fee
}, callback)
https://github.com/eris-ltd/eris-db.js/blob/ab3c1b4cd34a4ab4526cfb9f6cab5abbbb1dce3e/lib/unsafe.js#L82-L88
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Hi Alex, This is my fault, I got this mixed up in the 0.12 release. This RPC is marked for deprecation, but it is more complete to consider reverting it, before doing so. I will weigh in the opinion of the JS libs, but it seems a valid request. |
Awesome. you make my evening :)
… On 25 Jan 2017, at 22:56, Benjamin Bollen ***@***.***> wrote:
Hi Alex,
This is my fault, I got this mixed up in the 0.12 release. This RPC is marked for deprecation, but it is more complete to consider reverting it, before doing so. I will weigh in the opinion of the JS libs, but it seems a valid request.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <#453 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AQPPLX8M8KWiWORY9N3SGPiwniXvVm8Nks5rV8UDgaJpZM4Ls2F9>.
|
Strictly speaking we can merge this without breaking the JS libs as they call the transact method - not the broadcast method - but it is better to reduce complexity and have it aligned for less headaches. |
Actually the JavaScript libraries never sent the type byte so there's nothing for me to revert. |
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.
Could you check if this works without the method, I think it should.
@@ -9,5 +9,6 @@ type Codec interface { | |||
EncodeBytes(interface{}) ([]byte, error) | |||
Encode(interface{}, io.Writer) error | |||
DecodeBytes(interface{}, []byte) error | |||
DecodeBytesPtr(interface{}, []byte) error |
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.
I'm not sure we need this. I think it will work with DecodeBytes
, did you try that?
// Decode from a byte array pointer. | ||
func (this *TCodec) DecodeBytesPtr(v interface{}, bts []byte) error { | ||
var err error | ||
wire.ReadJSONPtr(v, bts, &err) |
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.
wire.ReadJSON
should delegate to ReadJSONPtr
if it gets a pointer.
@silasdavis I wanted to merge this into a feature branch and then we can work on it? cc @ratranqu |
7a21558
into
hyperledger-archives:feature-issue453_correct_rpcv0
good idea |
@silasdavis, yes, I think you are right, we can just use the DecodeBytes function. |
This fixes an issue when deserialising a BroadcastTx json-rpc request over websockets.
Until 0.11.4, such json would be valid:
In 0.12.0, the "params" value is wrongly expected to be a dictionary instead of the correct [ type, {dict}].