Skip to content

Commit 4c976e2

Browse files
committed
erc20_params: fix deterministic builds
Looping through a HashMap is not deterministic, so the order of the token vars was not deterministic in the generated tokens.rs, breaking deterministic builds. Using BTreeMap instead fixes it, as looping through a BTreeMap happens in key order.
1 parent 523f0de commit 4c976e2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/rust/erc20_params/build.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
#![allow(clippy::format_collect)]
1616

17-
use std::collections::HashMap;
17+
use std::collections::BTreeMap;
1818
use std::fs::{File, OpenOptions};
1919
use std::io::{self, BufRead, Write};
2020
use std::path::Path;
@@ -53,7 +53,7 @@ fn main() {
5353
}
5454

5555
// Group tokens by decimals
56-
let mut grouped_tokens: HashMap<(u8, u8), Vec<&Token>> = HashMap::new();
56+
let mut grouped_tokens: BTreeMap<(u8, u8), Vec<&Token>> = BTreeMap::new();
5757
for token in &tokens {
5858
grouped_tokens
5959
.entry((token.decimals, token.unit.len().try_into().unwrap()))

0 commit comments

Comments
 (0)