Skip to content

Commit

Permalink
Parse r/s values from signTransaction as U256
Browse files Browse the repository at this point in the history
Parity Ethereum also returns the `r` and `s` values in the `RawTransactionDetails` response of
`personal_signTransaction`. These values are encoded as `U256` instead of fixed 32 byte strings. This results in
response values that have less uneven number of hex characters. For these cases deserialization of the response fails.

To accomodate this case we change the type the `r` and `s` fields in `RawTransactionDetails`.
  • Loading branch information
Thomas Scholtes committed Sep 6, 2019
1 parent b2aa733 commit b5f3c3b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/types/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ pub struct RawTransactionDetails {
/// ECDSA recovery id, set by Geth
pub v: Option<U64>,
/// ECDSA signature r, 32 bytes, set by Geth
pub r: Option<Bytes>,
pub r: Option<U256>,
/// ECDSA signature s, 32 bytes, set by Geth
pub s: Option<Bytes>,
pub s: Option<U256>,
}

#[cfg(test)]
Expand Down Expand Up @@ -180,7 +180,8 @@ mod tests {
"value": "0x7f110",
"gas": "0x7f110",
"gasPrice": "0x09184e72a000",
"input": "0x603880600c6000396000f300603880600c6000396000f3603880600c6000396000f360"
"input": "0x603880600c6000396000f300603880600c6000396000f3603880600c6000396000f360",
"s": "0x777",
}
}"#;

Expand Down

0 comments on commit b5f3c3b

Please sign in to comment.