Skip to content

Commit 8a7f0ab

Browse files
authored
Merge branch 'master' into GH-524
2 parents 0e02fb9 + 91f3b8c commit 8a7f0ab

File tree

21 files changed

+287
-106
lines changed

21 files changed

+287
-106
lines changed

README.md

+2-5
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ stage - MASQ Network and it's developers are not responsible for any activity, o
3939
## Source
4040
The MASQ project was forked from Substratum's Node project in order to carry on development after Substratum ceased
4141
operations in October of 2019. In 2021, Substratum's Node repositories were removed from GitHub, so the fork link
42-
with MASQ was broken, but all credit for the original idea, the original design, and the first two years of MASQ's
43-
development belongs to Substratum.
42+
with MASQ was broken, but all credit for the original idea and the original design belongs to Substratum (and properly attributed through GPLv3 license)
4443

4544
## Running the MASQ Node
4645

@@ -452,6 +451,4 @@ recommend using a 64-bit version to build.
452451

453452
We do plan to release binaries that will run on 32-bit Windows, but they will likely be built on 64-bit Windows.
454453

455-
Copyright (c) 2019-2022, MASQ Network
456-
457-
Copyright (c) 2017-2019, Substratum LLC and/or its affiliates. All rights reserved.
454+
Copyright (c) 2019-2024, MASQ Network

automap/Cargo.lock

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

automap/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "automap"
3-
version = "0.8.0"
3+
version = "0.8.1"
44
authors = ["Dan Wiebe <[email protected]>", "MASQ"]
55
license = "GPL-3.0-only"
66
description = "Library full of code to make routers map ports through firewalls"

dns_utility/Cargo.lock

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dns_utility/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "dns_utility"
3-
version = "0.8.0"
3+
version = "0.8.1"
44
license = "GPL-3.0-only"
55
authors = ["Dan Wiebe <[email protected]>", "MASQ"]
66
copyright = "Copyright (c) 2019, MASQ (https://masq.ai) and/or its affiliates. All rights reserved."

masq/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "masq"
3-
version = "0.8.0"
3+
version = "0.8.1"
44
authors = ["Dan Wiebe <[email protected]>", "MASQ"]
55
license = "GPL-3.0-only"
66
description = "Reference implementation of user interface for MASQ Node"

masq_lib/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "masq_lib"
3-
version = "0.8.0"
3+
version = "0.8.1"
44
authors = ["Dan Wiebe <[email protected]>", "MASQ"]
55
license = "GPL-3.0-only"
66
description = "Code common to Node and masq; also, temporarily, to dns_utility"

masq_lib/src/blockchains/blockchain_records.rs

+97-30
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,17 @@
22

33
use crate::blockchains::chains::Chain;
44
use crate::constants::{
5-
AMOY_TESTNET_CONTRACT_CREATION_BLOCK, DEV_CHAIN_FULL_IDENTIFIER,
6-
ETH_MAINNET_CONTRACT_CREATION_BLOCK, ETH_MAINNET_FULL_IDENTIFIER, ETH_ROPSTEN_FULL_IDENTIFIER,
7-
MULTINODE_TESTNET_CONTRACT_CREATION_BLOCK, POLYGON_AMOY_FULL_IDENTIFIER,
8-
POLYGON_MAINNET_CONTRACT_CREATION_BLOCK, POLYGON_MAINNET_FULL_IDENTIFIER,
9-
ROPSTEN_TESTNET_CONTRACT_CREATION_BLOCK,
5+
BASE_MAINNET_CONTRACT_CREATION_BLOCK, BASE_MAINNET_FULL_IDENTIFIER,
6+
BASE_SEPOLIA_CONTRACT_CREATION_BLOCK, BASE_SEPOLIA_FULL_IDENTIFIER, DEV_CHAIN_FULL_IDENTIFIER,
7+
ETH_MAINNET_CONTRACT_CREATION_BLOCK, ETH_MAINNET_FULL_IDENTIFIER,
8+
ETH_ROPSTEN_CONTRACT_CREATION_BLOCK, ETH_ROPSTEN_FULL_IDENTIFIER,
9+
MULTINODE_TESTNET_CONTRACT_CREATION_BLOCK, POLYGON_AMOY_CONTRACT_CREATION_BLOCK,
10+
POLYGON_AMOY_FULL_IDENTIFIER, POLYGON_MAINNET_CONTRACT_CREATION_BLOCK,
11+
POLYGON_MAINNET_FULL_IDENTIFIER,
1012
};
1113
use ethereum_types::{Address, H160};
1214

13-
pub const CHAINS: [BlockchainRecord; 5] = [
15+
pub const CHAINS: [BlockchainRecord; 7] = [
1416
BlockchainRecord {
1517
self_id: Chain::PolyMainnet,
1618
num_chain_id: 137,
@@ -25,19 +27,33 @@ pub const CHAINS: [BlockchainRecord; 5] = [
2527
contract: ETH_MAINNET_CONTRACT_ADDRESS,
2628
contract_creation_block: ETH_MAINNET_CONTRACT_CREATION_BLOCK,
2729
},
30+
BlockchainRecord {
31+
self_id: Chain::BaseMainnet,
32+
num_chain_id: 8453,
33+
literal_identifier: BASE_MAINNET_FULL_IDENTIFIER,
34+
contract: BASE_MAINNET_CONTRACT_ADDRESS,
35+
contract_creation_block: BASE_MAINNET_CONTRACT_CREATION_BLOCK,
36+
},
37+
BlockchainRecord {
38+
self_id: Chain::BaseSepolia,
39+
num_chain_id: 84532,
40+
literal_identifier: BASE_SEPOLIA_FULL_IDENTIFIER,
41+
contract: BASE_SEPOLIA_TESTNET_CONTRACT_ADDRESS,
42+
contract_creation_block: BASE_SEPOLIA_CONTRACT_CREATION_BLOCK,
43+
},
2844
BlockchainRecord {
2945
self_id: Chain::PolyAmoy,
3046
num_chain_id: 80002,
3147
literal_identifier: POLYGON_AMOY_FULL_IDENTIFIER,
32-
contract: AMOY_TESTNET_CONTRACT_ADDRESS,
33-
contract_creation_block: AMOY_TESTNET_CONTRACT_CREATION_BLOCK,
48+
contract: POLYGON_AMOY_TESTNET_CONTRACT_ADDRESS,
49+
contract_creation_block: POLYGON_AMOY_CONTRACT_CREATION_BLOCK,
3450
},
3551
BlockchainRecord {
3652
self_id: Chain::EthRopsten,
3753
num_chain_id: 3,
3854
literal_identifier: ETH_ROPSTEN_FULL_IDENTIFIER,
39-
contract: ROPSTEN_TESTNET_CONTRACT_ADDRESS,
40-
contract_creation_block: ROPSTEN_TESTNET_CONTRACT_CREATION_BLOCK,
55+
contract: ETH_ROPSTEN_TESTNET_CONTRACT_ADDRESS,
56+
contract_creation_block: ETH_ROPSTEN_CONTRACT_CREATION_BLOCK,
4157
},
4258
BlockchainRecord {
4359
self_id: Chain::Dev,
@@ -68,17 +84,27 @@ const ETH_MAINNET_CONTRACT_ADDRESS: Address = H160([
6884
]);
6985

7086
// $tMASQ (Amoy)
71-
const AMOY_TESTNET_CONTRACT_ADDRESS: Address = H160([
87+
const POLYGON_AMOY_TESTNET_CONTRACT_ADDRESS: Address = H160([
7288
0xd9, 0x8c, 0x3e, 0xbd, 0x6b, 0x7f, 0x9b, 0x7c, 0xda, 0x24, 0x49, 0xec, 0xac, 0x00, 0xd1, 0xe5,
7389
0xf4, 0x7a, 0x81, 0x93,
7490
]);
7591

7692
// SHRD (Ropsten)
77-
const ROPSTEN_TESTNET_CONTRACT_ADDRESS: Address = H160([
93+
const ETH_ROPSTEN_TESTNET_CONTRACT_ADDRESS: Address = H160([
7894
0x38, 0x4d, 0xec, 0x25, 0xe0, 0x3f, 0x94, 0x93, 0x17, 0x67, 0xce, 0x4c, 0x35, 0x56, 0x16, 0x84,
7995
0x68, 0xba, 0x24, 0xc3,
8096
]);
8197

98+
const BASE_MAINNET_CONTRACT_ADDRESS: Address = H160([
99+
0x45, 0xD9, 0xC1, 0x01, 0xa3, 0x87, 0x0C, 0xa5, 0x02, 0x45, 0x82, 0xfd, 0x78, 0x8F, 0x4E, 0x1e,
100+
0x8F, 0x79, 0x71, 0xc3,
101+
]);
102+
103+
const BASE_SEPOLIA_TESTNET_CONTRACT_ADDRESS: Address = H160([
104+
0x89, 0x8e, 0x1c, 0xe7, 0x20, 0x08, 0x4A, 0x90, 0x2b, 0xc3, 0x7d, 0xd8, 0x22, 0xed, 0x6d, 0x6a,
105+
0x5f, 0x02, 0x7e, 0x10,
106+
]);
107+
82108
const MULTINODE_TESTNET_CONTRACT_ADDRESS: Address = H160([
83109
0x59, 0x88, 0x2e, 0x4a, 0x8f, 0x5d, 0x24, 0x64, 0x3d, 0x4d, 0xda, 0x42, 0x29, 0x22, 0xa8, 0x70,
84110
0xf1, 0xb3, 0xe6, 0x64,
@@ -88,20 +114,20 @@ const MULTINODE_TESTNET_CONTRACT_ADDRESS: Address = H160([
88114
mod tests {
89115
use super::*;
90116
use crate::blockchains::chains::chain_from_chain_identifier_opt;
91-
use crate::constants::{
92-
AMOY_TESTNET_CONTRACT_CREATION_BLOCK, POLYGON_MAINNET_CONTRACT_CREATION_BLOCK,
93-
};
117+
use crate::constants::BASE_MAINNET_CONTRACT_CREATION_BLOCK;
94118
use std::collections::HashSet;
95119
use std::iter::FromIterator;
96120

97121
#[test]
98122
fn record_returns_correct_blockchain_record() {
99123
let test_array = [
100124
assert_returns_correct_record(Chain::EthMainnet, 1),
101-
assert_returns_correct_record(Chain::Dev, 2),
102125
assert_returns_correct_record(Chain::EthRopsten, 3),
103126
assert_returns_correct_record(Chain::PolyMainnet, 137),
104127
assert_returns_correct_record(Chain::PolyAmoy, 80002),
128+
assert_returns_correct_record(Chain::BaseMainnet, 8453),
129+
assert_returns_correct_record(Chain::BaseSepolia, 84532),
130+
assert_returns_correct_record(Chain::Dev, 2),
105131
];
106132
assert_exhaustive(&test_array)
107133
}
@@ -118,6 +144,8 @@ mod tests {
118144
assert_from_str(Chain::PolyAmoy),
119145
assert_from_str(Chain::EthMainnet),
120146
assert_from_str(Chain::EthRopsten),
147+
assert_from_str(Chain::BaseMainnet),
148+
assert_from_str(Chain::BaseSepolia),
121149
assert_from_str(Chain::Dev),
122150
];
123151
assert_exhaustive(&test_array)
@@ -137,18 +165,23 @@ mod tests {
137165
#[test]
138166
fn chains_are_ordered_by_their_significance_for_users() {
139167
let test_array = [
140-
assert_chain_significance(0, Chain::PolyMainnet),
141-
assert_chain_significance(1, Chain::EthMainnet),
142-
assert_chain_significance(2, Chain::PolyAmoy),
143-
assert_chain_significance(3, Chain::EthRopsten),
144-
assert_chain_significance(4, Chain::Dev),
168+
Chain::PolyMainnet,
169+
Chain::EthMainnet,
170+
Chain::BaseMainnet,
171+
Chain::BaseSepolia,
172+
Chain::PolyAmoy,
173+
Chain::EthRopsten,
174+
Chain::Dev,
145175
];
176+
test_array
177+
.iter()
178+
.enumerate()
179+
.for_each(assert_chain_significance);
146180
assert_exhaustive(&test_array)
147181
}
148182

149-
fn assert_chain_significance(idx: usize, chain: Chain) -> Chain {
150-
assert_eq!(CHAINS[idx].self_id, chain, "Error at index {}", idx);
151-
chain
183+
fn assert_chain_significance((idx, chain): (usize, &Chain)) {
184+
assert_eq!(CHAINS[idx].self_id, *chain, "Error at index {}", idx);
152185
}
153186

154187
#[test]
@@ -177,8 +210,8 @@ mod tests {
177210
num_chain_id: 3,
178211
self_id: examined_chain,
179212
literal_identifier: "eth-ropsten",
180-
contract: ROPSTEN_TESTNET_CONTRACT_ADDRESS,
181-
contract_creation_block: ROPSTEN_TESTNET_CONTRACT_CREATION_BLOCK,
213+
contract: ETH_ROPSTEN_TESTNET_CONTRACT_ADDRESS,
214+
contract_creation_block: ETH_ROPSTEN_CONTRACT_CREATION_BLOCK,
182215
}
183216
);
184217
}
@@ -209,8 +242,40 @@ mod tests {
209242
num_chain_id: 80002,
210243
self_id: examined_chain,
211244
literal_identifier: "polygon-amoy",
212-
contract: AMOY_TESTNET_CONTRACT_ADDRESS,
213-
contract_creation_block: AMOY_TESTNET_CONTRACT_CREATION_BLOCK,
245+
contract: POLYGON_AMOY_TESTNET_CONTRACT_ADDRESS,
246+
contract_creation_block: POLYGON_AMOY_CONTRACT_CREATION_BLOCK,
247+
}
248+
);
249+
}
250+
251+
#[test]
252+
fn base_mainnet_record_is_properly_declared() {
253+
let examined_chain = Chain::BaseMainnet;
254+
let chain_record = return_examined(examined_chain);
255+
assert_eq!(
256+
chain_record,
257+
&BlockchainRecord {
258+
num_chain_id: 8453,
259+
self_id: examined_chain,
260+
literal_identifier: "base-mainnet",
261+
contract: BASE_MAINNET_CONTRACT_ADDRESS,
262+
contract_creation_block: BASE_MAINNET_CONTRACT_CREATION_BLOCK,
263+
}
264+
);
265+
}
266+
267+
#[test]
268+
fn base_sepolia_record_is_properly_declared() {
269+
let examined_chain = Chain::BaseSepolia;
270+
let chain_record = return_examined(examined_chain);
271+
assert_eq!(
272+
chain_record,
273+
&BlockchainRecord {
274+
num_chain_id: 84532,
275+
self_id: examined_chain,
276+
literal_identifier: "base-sepolia",
277+
contract: BASE_SEPOLIA_TESTNET_CONTRACT_ADDRESS,
278+
contract_creation_block: BASE_SEPOLIA_CONTRACT_CREATION_BLOCK,
214279
}
215280
);
216281
}
@@ -226,7 +291,7 @@ mod tests {
226291
self_id: examined_chain,
227292
literal_identifier: "dev",
228293
contract: MULTINODE_TESTNET_CONTRACT_ADDRESS,
229-
contract_creation_block: 0,
294+
contract_creation_block: MULTINODE_TESTNET_CONTRACT_CREATION_BLOCK,
230295
}
231296
);
232297
}
@@ -240,9 +305,11 @@ mod tests {
240305
let test_array = [
241306
assert_chain_from_chain_identifier_opt("eth-mainnet", Some(Chain::EthMainnet)),
242307
assert_chain_from_chain_identifier_opt("eth-ropsten", Some(Chain::EthRopsten)),
243-
assert_chain_from_chain_identifier_opt("dev", Some(Chain::Dev)),
244308
assert_chain_from_chain_identifier_opt("polygon-mainnet", Some(Chain::PolyMainnet)),
245309
assert_chain_from_chain_identifier_opt("polygon-amoy", Some(Chain::PolyAmoy)),
310+
assert_chain_from_chain_identifier_opt("base-mainnet", Some(Chain::BaseMainnet)),
311+
assert_chain_from_chain_identifier_opt("base-sepolia", Some(Chain::BaseSepolia)),
312+
assert_chain_from_chain_identifier_opt("dev", Some(Chain::Dev)),
246313
];
247314
assert_exhaustive(&test_array)
248315
}

masq_lib/src/blockchains/chains.rs

+10-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22

33
use crate::blockchains::blockchain_records::{BlockchainRecord, CHAINS};
44
use crate::constants::{
5-
DEFAULT_CHAIN, DEV_CHAIN_FULL_IDENTIFIER, ETH_MAINNET_FULL_IDENTIFIER,
6-
ETH_ROPSTEN_FULL_IDENTIFIER, POLYGON_AMOY_FULL_IDENTIFIER, POLYGON_MAINNET_FULL_IDENTIFIER,
5+
BASE_MAINNET_FULL_IDENTIFIER, BASE_SEPOLIA_FULL_IDENTIFIER, DEFAULT_CHAIN,
6+
DEV_CHAIN_FULL_IDENTIFIER, ETH_MAINNET_FULL_IDENTIFIER, ETH_ROPSTEN_FULL_IDENTIFIER,
7+
POLYGON_AMOY_FULL_IDENTIFIER, POLYGON_MAINNET_FULL_IDENTIFIER,
78
};
89
use serde_derive::{Deserialize, Serialize};
910

@@ -13,6 +14,8 @@ pub enum Chain {
1314
EthRopsten,
1415
PolyMainnet,
1516
PolyAmoy,
17+
BaseMainnet,
18+
BaseSepolia,
1619
Dev,
1720
}
1821

@@ -28,6 +31,10 @@ impl From<&str> for Chain {
2831
Chain::PolyMainnet
2932
} else if str == ETH_MAINNET_FULL_IDENTIFIER {
3033
Chain::EthMainnet
34+
} else if str == BASE_MAINNET_FULL_IDENTIFIER {
35+
Chain::BaseMainnet
36+
} else if str == BASE_SEPOLIA_FULL_IDENTIFIER {
37+
Chain::BaseSepolia
3138
} else if str == POLYGON_AMOY_FULL_IDENTIFIER {
3239
Chain::PolyAmoy
3340
} else if str == ETH_ROPSTEN_FULL_IDENTIFIER {
@@ -56,7 +63,7 @@ impl Chain {
5663
}
5764

5865
fn mainnets() -> &'static [Chain] {
59-
&[Chain::PolyMainnet, Chain::EthMainnet]
66+
&[Chain::PolyMainnet, Chain::BaseMainnet, Chain::EthMainnet]
6067
}
6168
}
6269

0 commit comments

Comments
 (0)