add more tx tests (#11038)
This commit is contained in:
parent
5e2def1b23
commit
ad9a53f486
@ -54,7 +54,11 @@ impl Default for Action {
|
||||
impl rlp::Decodable for Action {
|
||||
fn decode(rlp: &Rlp) -> Result<Self, DecoderError> {
|
||||
if rlp.is_empty() {
|
||||
if rlp.is_data() {
|
||||
Ok(Action::Create)
|
||||
} else {
|
||||
Err(DecoderError::RlpExpectedToBeData)
|
||||
}
|
||||
} else {
|
||||
Ok(Action::Call(rlp.as_val()?))
|
||||
}
|
||||
@ -571,6 +575,20 @@ mod tests {
|
||||
assert_eq!(t.chain_id(), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn empty_atom_as_create_action() {
|
||||
let empty_atom = [0x80];
|
||||
let action: Action = rlp::decode(&empty_atom).unwrap();
|
||||
assert_eq!(action, Action::Create);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn empty_list_as_create_action_rejected() {
|
||||
let empty_list = [0xc0];
|
||||
let action: Result<Action, DecoderError> = rlp::decode(&empty_list);
|
||||
assert_eq!(action, Err(DecoderError::RlpExpectedToBeData));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn signing_eip155_zero_chainid() {
|
||||
use ethkey::{Random, Generator};
|
||||
|
Loading…
Reference in New Issue
Block a user