Replace ssz with ssz2, adapt ssz_derive

This commit is contained in:
Paul Hauner
2019-05-04 14:11:48 +10:00
parent 7096d56749
commit 0bd5119f19
43 changed files with 351 additions and 16288 deletions

View File

@@ -0,0 +1,22 @@
use ssz_derive::Encode;
use ssz::Encodable;
#[derive(Debug, PartialEq, Encode)]
pub struct Foo {
a: u16,
b: Vec<u8>,
c: u16,
}
#[test]
fn encode() {
let foo = Foo {
a: 42,
b: vec![0, 1, 2, 3],
c: 11,
};
let bytes = vec![42, 0, 8, 0, 0, 0, 11, 0, 0, 1, 2, 3];
assert_eq!(foo.as_ssz_bytes(), bytes);
}