File tree Expand file tree Collapse file tree 3 files changed +22
-3
lines changed
Expand file tree Collapse file tree 3 files changed +22
-3
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,5 @@ authors = ["Arkadiusz Konior, Marek Kirejczyk"]
55compiler_version = " >=0.30.0"
66
77[dependencies ]
8- u2b = { tag = " v0.3.4" , git = " https://github.com/vlayer-xyz/noir-u2b" }
98bignum = { tag = " v0.8.2" , git = " https://github.com/noir-lang/noir-bignum" }
109keccak256 = {tag = " v0.1.1" , git = " https://github.com/noir-lang/keccak256" }
Original file line number Diff line number Diff line change 11use crate::misc::bytes::byte_value ;
22use crate::misc::fragment::Fragment ;
33use crate::misc::types:: {Address , Bytes32 };
4- use dep::u2b:: {u32_to_u8 , u64_to_u8 };
4+ use crate::verifiers::tx_helpers::idx::u32_to_u8 ;
5+ use crate::verifiers::tx_helpers::idx::u64_to_u8 ;
56
67// Enum for RLP data type
78pub (crate ) global STRING : u32 = 0 ;
Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ use crate::misc::arrays::{memcpy, sub_array_equals_up_to_length};
22use crate::misc::bytes:: {left_to_right_padding , nibbles_to_bytes , right_pad };
33use crate::misc::fragment::Fragment ;
44use crate::rlp:: {decode:: decode_string , types::RlpFragment };
5- use dep::u2b::u32_to_u8 ;
65
76global KEY_NIBBLE_LEN : u32 = 6 ;
87global MAX_TX_IDX_BYTES_LEN : u32 = 2 ;
@@ -24,3 +23,23 @@ pub fn assert_tx_idx_equals<let MAX_KEY_LEN: u32>(
2423 );
2524 }
2625}
26+
27+ pub fn u32_to_u8 (num : u32 ) -> [u8 ; 4 ] {
28+ let mut out : [u8 ; 4 ] = [0 ; 4 ];
29+ for i in 0 ..4 {
30+ let shift : u32 = (24 - (i * 8 ));
31+ out [i ] = (num >> shift ) as u8 ;
32+ }
33+
34+ out
35+ }
36+
37+ pub fn u64_to_u8 (num : u64 ) -> [u8 ; 8 ] {
38+ let mut out : [u8 ; 8 ] = [0 ; 8 ];
39+ for i in 0 ..8 {
40+ let shift : u32 = 56 - (i * 8 );
41+ out [i ] = (num >> (shift as u64 )) as u8 ;
42+ }
43+
44+ out
45+ }
You can’t perform that action at this time.
0 commit comments