Skip to content

Commit add371c

Browse files
committed
fixes
1 parent 2a9a863 commit add371c

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

ethereum/circuits/lib/Nargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,5 @@ authors = ["Arkadiusz Konior, Marek Kirejczyk"]
55
compiler_version = ">=0.30.0"
66

77
[dependencies]
8-
u2b = { tag = "v0.3.4", git = "https://github.com/vlayer-xyz/noir-u2b" }
98
bignum = { tag = "v0.8.2", git = "https://github.com/noir-lang/noir-bignum" }
109
keccak256 = {tag = "v0.1.1", git = "https://github.com/noir-lang/keccak256" }

ethereum/circuits/lib/src/rlp/types.nr

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
use crate::misc::bytes::byte_value;
22
use crate::misc::fragment::Fragment;
33
use 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
78
pub(crate) global STRING: u32 = 0;

ethereum/circuits/lib/src/verifiers/tx_helpers/idx.nr

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use crate::misc::arrays::{memcpy, sub_array_equals_up_to_length};
22
use crate::misc::bytes::{left_to_right_padding, nibbles_to_bytes, right_pad};
33
use crate::misc::fragment::Fragment;
44
use crate::rlp::{decode::decode_string, types::RlpFragment};
5-
use dep::u2b::u32_to_u8;
65

76
global KEY_NIBBLE_LEN: u32 = 6;
87
global 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+
}

0 commit comments

Comments
 (0)