-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use ethereum_types instead of custom types where possible
- Loading branch information
Showing
7 changed files
with
102 additions
and
167 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,19 @@ | ||
#[derive(Debug, Clone)] | ||
pub struct FixedBytes<const N: usize>(pub [u8; N]); | ||
use rlp::{Encodable, RlpStream}; | ||
|
||
#[derive(Debug, Clone)] | ||
pub struct Bytes(pub Vec<u8>); | ||
#[derive(Debug, Clone)] | ||
pub struct Byte(pub u8); | ||
|
||
pub type U256 = FixedBytes<32>; | ||
pub type Address = FixedBytes<20>; | ||
pub type Bloom = FixedBytes<256>; | ||
#[derive(Debug, Clone, PartialEq)] | ||
pub struct U8(pub u8); | ||
|
||
impl Encodable for U8 { | ||
fn rlp_append(&self, s: &mut RlpStream) { | ||
self.0.rlp_append(s); | ||
} | ||
} | ||
|
||
impl Encodable for Bytes { | ||
fn rlp_append(&self, s: &mut RlpStream) { | ||
self.0.rlp_append(s); | ||
} | ||
} |
Oops, something went wrong.