Expand description
Various helpers used in the ZKsync stack.
Re-exports§
pub use self::misc::*;
Modules§
Structs§
- Bytes
ToHex Serde - Used to annotate
Vec<u8>
fields that you want to serialize like hex-encoded string with prefix Use this struct in annotation like that[serde(with = "BytesToHexSerde::<T>"]
where T is concrete prefix type (e.g.SyncBlockPrefix
) - Zerox
Prefix - “0x” hex prefix
Traits§
- Prefix
- Trait for specifying prefix for bytes to hex serialization
Functions§
- address_
to_ h256 - address_
to_ u256 - be_
bytes_ to_ safe_ address - be_
chunks_ to_ h256_ words - be_
words_ to_ bytes - bigdecimal_
to_ u256 - Converts
BigDecimal
value into the correspondingU256
value. - bytes_
to_ be_ words - bytes_
to_ chunks - h256_
to_ account_ address - Converts
H256
value into the Address - h256_
to_ u32 - Converts
h256
value as BE into the u32 - h256_
to_ u256 - locate_
workspace - Find the location of the current workspace, if this code works in workspace
then it will return the correct folder if, it’s binary e.g. in docker container
you have to use fallback to another directory
The code has been inspired by
insta
https://github.com/mitsuhiko/insta/blob/master/insta/src/env.rs
- u32_
to_ h256 - Converts u32 into the H256 as BE bytes
- u256_
to_ account_ address - Converts
U256
value into the Address - u256_
to_ big_ decimal - u256_
to_ bytes_ be - Converts
U256
value into bytes array - u256_
to_ h256 - workspace_
dir_ or_ current_ dir - Returns
locate_workspace()
output with the “.” fallback.