docs: add comment about safety of u8 -> u64 cast in signature (#1704)
* docs: add comment about u8 -> u64 cast in signature * fix: format Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>
This commit is contained in:
parent
f208fb9cd3
commit
e034a8f979
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
### Unreleased
|
### Unreleased
|
||||||
|
|
||||||
|
- Add comment about safety of u8 -> u64 cast in `ethers_core::types::Signature`
|
||||||
- Stop defaulting to the `"latest"` block in `eth_estimateGas` params [#1657](https://github.com/gakonst/ethers-rs/pull/1657)
|
- Stop defaulting to the `"latest"` block in `eth_estimateGas` params [#1657](https://github.com/gakonst/ethers-rs/pull/1657)
|
||||||
- Fix geth trace types for debug_traceTransaction rpc
|
- Fix geth trace types for debug_traceTransaction rpc
|
||||||
- Fix RLP decoding of legacy `Transaction`
|
- Fix RLP decoding of legacy `Transaction`
|
||||||
|
|
|
@ -215,6 +215,11 @@ impl From<&Signature> for [u8; 65] {
|
||||||
sig[32..64].copy_from_slice(&s_bytes);
|
sig[32..64].copy_from_slice(&s_bytes);
|
||||||
// TODO: What if we try to serialize a signature where
|
// TODO: What if we try to serialize a signature where
|
||||||
// the `v` is not normalized?
|
// the `v` is not normalized?
|
||||||
|
|
||||||
|
// The u64 to u8 cast is safe because `sig.v` can only ever be 27 or 28
|
||||||
|
// here. Regarding EIP-155, the modification to `v` happens during tx
|
||||||
|
// creation only _after_ the transaction is signed using
|
||||||
|
// `ethers_signers::to_eip155_v`.
|
||||||
sig[64] = src.v as u8;
|
sig[64] = src.v as u8;
|
||||||
sig
|
sig
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue