Summary
TransactionRequest::to uses an outer Option<TxKind>. A creation request represented as Some(TxKind::Create) serializes to the JSON/RPC form to: null, but deserializing that JSON produces to == None.
This collapses the distinction between a known contract creation and an incomplete request without a destination.
Reproduction
let request = TransactionRequest::default().create();
let json = serde_json::to_value(&request).unwrap();
let decoded: TransactionRequest = serde_json::from_value(json).unwrap();
assert_eq!(decoded.to, Some(TxKind::Create));
The assertion currently fails because decoded.to is None.
Expected JSON/RPC behavior
- omitted
to deserializes as None;
- present
to: null deserializes as Some(TxKind::Create);
- present address deserializes as
Some(TxKind::Call(address)).
The binary bincode format must retain its existing decoding behavior.
Related
#4071 correctly preserves TxKind::Create when converting concrete consensus transactions into TransactionRequest and emits to: null. This issue tracks the pre-existing inbound JSON/RPC round-trip loss separately to keep that PR scoped.
Summary
TransactionRequest::touses an outerOption<TxKind>. A creation request represented asSome(TxKind::Create)serializes to the JSON/RPC formto: null, but deserializing that JSON producesto == None.This collapses the distinction between a known contract creation and an incomplete request without a destination.
Reproduction
The assertion currently fails because
decoded.toisNone.Expected JSON/RPC behavior
todeserializes asNone;to: nulldeserializes asSome(TxKind::Create);Some(TxKind::Call(address)).The binary bincode format must retain its existing decoding behavior.
Related
#4071 correctly preserves
TxKind::Createwhen converting concrete consensus transactions intoTransactionRequestand emitsto: null. This issue tracks the pre-existing inbound JSON/RPC round-trip loss separately to keep that PR scoped.