Skip to content

Commit

Permalink
refactor: move crate portal-bridge to bin/portal-bridge
Browse files Browse the repository at this point in the history
  • Loading branch information
KolbyML committed Jan 14, 2025
1 parent 80ddc06 commit 61c2781
Show file tree
Hide file tree
Showing 29 changed files with 17 additions and 16 deletions.
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
!Cargo.toml
!/bin
!/crates
!/portal-bridge
!/testing
!/trin-execution
!/utp-testing
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[workspace]
members = [
"bin/portal-bridge",
"bin/trin",
"crates/ethportal-api",
"crates/e2store",
Expand All @@ -13,7 +14,6 @@ members = [
"crates/subnetworks/state",
"crates/utils",
"crates/validation",
"portal-bridge",
"testing/ef-tests",
"testing/ethportal-peertest",
"trin-execution",
Expand Down Expand Up @@ -100,7 +100,7 @@ utp-rs = { tag = "v0.1.0-alpha.14", git = "https://github.com/ethereum/utp" }
e2store = { path = "crates/e2store" }
ethportal-api = { path = "crates/ethportal-api" }
light-client = { path = "crates/light-client" }
portal-bridge = { path = "portal-bridge" }
portal-bridge = { path = "bin/portal-bridge" }
portalnet = { path = "crates/portalnet" }
rpc = { path = "crates/rpc"}
trin = { path = "bin/trin"}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ mod tests {
#[test]
fn full_header_from_get_block_response() {
let body =
std::fs::read_to_string("../test_assets/mainnet/block_14764013_value.json").unwrap();
std::fs::read_to_string("../../test_assets/mainnet/block_14764013_value.json").unwrap();
let body: Value = serde_json::from_str(&body).unwrap();
let full_header = FullHeader::try_from(body["result"].clone()).unwrap();
let header: Header = serde_json::from_value(body["result"].clone()).unwrap();
Expand All @@ -135,7 +135,7 @@ mod tests {
#[test]
fn full_header_with_withdrawals() {
let body =
std::fs::read_to_string("../test_assets/mainnet/block_17034871_value.json").unwrap();
std::fs::read_to_string("../../test_assets/mainnet/block_17034871_value.json").unwrap();
let body: Value = serde_json::from_str(&body).unwrap();
let full_header = FullHeader::try_from(body["result"].clone()).unwrap();
let block_body = BlockBody::Shanghai(BlockBodyShanghai {
Expand All @@ -149,7 +149,7 @@ mod tests {
#[test]
fn full_header_with_empty_withdrawals() {
let body =
std::fs::read_to_string("../test_assets/mainnet/block_17034873_value.json").unwrap();
std::fs::read_to_string("../../test_assets/mainnet/block_17034873_value.json").unwrap();
let body: Value = serde_json::from_str(&body).unwrap();
let full_header = FullHeader::try_from(body["result"].clone()).unwrap();
let block_body = BlockBody::Shanghai(BlockBodyShanghai {
Expand All @@ -167,7 +167,7 @@ mod tests {
#[case("19433903")]
fn full_header_block_body_dencun(#[case] case: &str) {
let body =
std::fs::read_to_string(format!("../test_assets/mainnet/block_{case}_value.json"))
std::fs::read_to_string(format!("../../test_assets/mainnet/block_{case}_value.json"))
.unwrap();
let body: Value = serde_json::from_str(&body).unwrap();
let full_header = FullHeader::try_from(body["result"].clone()).unwrap();
Expand All @@ -188,7 +188,7 @@ mod tests {
// this block (15573637) was chosen since it contains all tx types (legacy, access list,
// eip1559) as well as contract creation txs
let expected: String =
std::fs::read_to_string("../test_assets/geth_batch/headers.json").unwrap();
std::fs::read_to_string("../../test_assets/geth_batch/headers.json").unwrap();
let full_headers: FullHeaderBatch = serde_json::from_str(&expected).unwrap();
for full_header in full_headers.headers {
let block_body = BlockBody::Legacy(BlockBodyLegacy {
Expand Down
File renamed without changes.
File renamed without changes.
18 changes: 10 additions & 8 deletions portal-bridge/src/utils.rs → bin/portal-bridge/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,11 @@ mod tests {

#[test]
fn test_read_test_assets_from_file_json() {
let assets: HistoryTestAssets =
read_test_assets_from_file(PathBuf::from("../test_assets/portalnet/bridge_data.json"))
.into_history_assets()
.unwrap();
let assets: HistoryTestAssets = read_test_assets_from_file(PathBuf::from(
"../../test_assets/portalnet/bridge_data.json",
))
.into_history_assets()
.unwrap();
let content_key =
HistoryContentKey::deserialize(json!(HEADER_WITH_PROOF_CONTENT_KEY)).unwrap();
let content_value =
Expand All @@ -243,10 +244,11 @@ mod tests {

#[test]
fn test_read_test_assets_from_file_yaml() {
let assets: HistoryTestAssets =
read_test_assets_from_file(PathBuf::from("../test_assets/portalnet/bridge_data.yaml"))
.into_history_assets()
.unwrap();
let assets: HistoryTestAssets = read_test_assets_from_file(PathBuf::from(
"../../test_assets/portalnet/bridge_data.yaml",
))
.into_history_assets()
.unwrap();
let content_key =
HistoryContentKey::deserialize(json!(HEADER_WITH_PROOF_CONTENT_KEY)).unwrap();
let content_value =
Expand Down

0 comments on commit 61c2781

Please sign in to comment.