Skip to main content

tempo_bench/cmd/max_tps/
virtual_address.rs

1use alloy::primitives::{Address, B256, address, hex_literal::hex};
2use tempo_alloy::primitives::{MasterId, TempoAddressExt, UserTag};
3
4/// Pre-mined TIP-1022 PoW salts for the first 7 anvil mnemonic accounts.
5///
6/// These match the `POW_SALTS` in `tips/verify/test/invariants/VirtualAddresses.t.sol`
7/// and the `VIRTUAL_SALT` in `crates/precompiles/src/test_util.rs`.
8///
9/// Mnemonic: `"test test test test test test test test test test test junk"`
10pub(crate) const ANVIL_VIRTUAL_SALTS: [(Address, B256); 6] = [
11    (
12        address!("f39Fd6e51aad88F6F4ce6aB8827279cffFb92266"),
13        B256::new(hex!(
14            "00000000000000000000000000000000000000000000000000000000abf52baf"
15        )),
16    ),
17    (
18        address!("70997970C51812dc3A010C7d01b50e0d17dc79C8"),
19        B256::new(hex!(
20            "0000000000000000000000000000000000000000000000000000000213f67626"
21        )),
22    ),
23    (
24        address!("3C44CdDdB6a900fa2b585dd299e03d12FA4293BC"),
25        B256::new(hex!(
26            "00000000000000000000000000000000000000000000000000000000490a6a7e"
27        )),
28    ),
29    (
30        address!("90F79bf6EB2c4f870365E785982E1f101E93b906"),
31        B256::new(hex!(
32            "00000000000000000000000000000000000000000000000000000000e9380f73"
33        )),
34    ),
35    (
36        address!("15d34AAf54267DB7D7c367839AAf71A00a2C6A65"),
37        B256::new(hex!(
38            "00000000000000000000000000000000000000000000000000000000bf34bdba"
39        )),
40    ),
41    (
42        address!("9965507D1a55bcC2695C58ba16FB37d819B0A4dc"),
43        B256::new(hex!(
44            "000000000000000000000000000000000000000000000000000000011e93c2f3"
45        )),
46    ),
47];
48
49/// Builds a virtual address from a `masterId` and a random `userTag`.
50///
51/// Layout: `[4-byte masterId][10-byte 0xFD MAGIC][6-byte random userTag]`.
52pub(crate) fn make_virtual_address(master_id: MasterId) -> Address {
53    Address::new_virtual(master_id, UserTag::random())
54}