Skip to content

Commit

Permalink
refactor: move crates into crates folder and remove redundant prefixes
Browse files Browse the repository at this point in the history
  • Loading branch information
KolbyML committed Jan 9, 2025
1 parent f3e2e80 commit e4fa0f2
Show file tree
Hide file tree
Showing 283 changed files with 164 additions and 179 deletions.
15 changes: 1 addition & 14 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,10 @@
!Cargo.lock
!Cargo.toml
!/bin
!/e2store
!/ethportal-api
!/crates
!/ethportal-peertest
!/light-client
!/portalnet
!/portal-bridge
!/rpc
!/src
!/trin-beacon
!/trin-evm
!/trin-execution
!/trin-history
!/trin-metrics
!/trin-state
!/trin-storage
!/trin-utils
!/trin-validation
!/utp-testing

# include for vergen constants
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/book.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ jobs:
- name: Install mdbook
run: |
mkdir bin
curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.14/mdbook-v0.4.14-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=bin
echo "$(pwd)/bin" >> $GITHUB_PATH
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,13 @@ jobs:
# This is required to share artifacts between different jobs
# =======================================================================
- name: Upload artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: trin-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.arch }}.tar.gz
path: trin-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.arch }}.tar.gz

- name: Upload signature
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: trin-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.arch }}.tar.gz.asc
path: trin-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.arch }}.tar.gz.asc
Expand Down
50 changes: 25 additions & 25 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
[workspace]
members = [
"bin/trin",
"ethportal-api",
"crates/ethportal-api",
"crates/e2store",
"crates/evm",
"crates/light-client",
"crates/metrics",
"crates/rpc",
"crates/storage",
"crates/subnetworks/beacon",
"crates/subnetworks/history",
"crates/subnetworks/state",
"crates/utils",
"crates/validation",
"ethportal-peertest",
"e2store",
"light-client",
"trin-metrics",
"portal-bridge",
"rpc",
"trin-beacon",
"trin-evm",
"trin-execution",
"trin-history",
"trin-state",
"trin-storage",
"trin-utils",
"trin-validation",
"utp-testing",
]

Expand Down Expand Up @@ -94,19 +94,19 @@ url = "2.3.1"
utp-rs = { tag = "v0.1.0-alpha.14", git = "https://github.com/ethereum/utp" }

# Trin workspace crates
e2store = { path = "e2store" }
ethportal-api = { path = "ethportal-api" }
light-client = { path = "light-client" }
e2store = { path = "crates/e2store" }
ethportal-api = { path = "crates/ethportal-api" }
light-client = { path = "crates/light-client" }
portal-bridge = { path = "portal-bridge" }
portalnet = { path = "portalnet" }
rpc = { path = "rpc"}
portalnet = { path = "crates/portalnet" }
rpc = { path = "crates/rpc"}
trin = { path = "bin/trin"}
trin-beacon = { path = "trin-beacon" }
trin-evm = { path = "trin-evm" }
trin-beacon = { path = "crates/subnetworks/beacon" }
trin-evm = { path = "crates/evm" }
trin-execution = { path = "trin-execution" }
trin-history = { path = "trin-history" }
trin-metrics = { path = "trin-metrics" }
trin-state = { path = "trin-state" }
trin-storage = { path = "trin-storage" }
trin-utils = { path = "trin-utils" }
trin-validation = { path = "trin-validation" }
trin-history = { path = "crates/subnetworks/history" }
trin-metrics = { path = "crates/metrics" }
trin-state = { path = "crates/subnetworks/state" }
trin-storage = { path = "crates/storage" }
trin-utils = { path = "crates/utils" }
trin-validation = { path = "crates/validation" }
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ that the data is canonical.
## Accumulator distribution

The Accumulator is built once and then distributed in Trin (and other clients). It does not
change over time and so can be incorporated into the `trin-validation` (`./trin-validation/src/assets`) and
change over time and so can be incorporated into the `trin-validation` (`./crates/validation/src/assets`) and
included in binary releases.

The History network contains individual epoch hashes from the Master Accumulator and
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.
14 changes: 7 additions & 7 deletions e2store/src/era1.rs → crates/e2store/src/era1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -413,16 +413,16 @@ mod tests {
use super::*;

#[rstest::rstest]
#[case::era1("../test_assets/era1/mainnet-00000-5ec1ffb8.era1")]
#[case::era1("../test_assets/era1/mainnet-00001-a5364e9a.era1")]
#[case::era1("../../test_assets/era1/mainnet-00000-5ec1ffb8.era1")]
#[case::era1("../../test_assets/era1/mainnet-00001-a5364e9a.era1")]
// epoch #10 contains txs
#[case::era1("../test_assets/era1/mainnet-00010-5f5d4516.era1")]
#[case::era1("../../test_assets/era1/mainnet-00010-5f5d4516.era1")]
// this is a test era1 file that has been amended for size purposes,
// since era1 files that contain typed txs are quite large.
// it was created by copying the `mainnet-01600-c6a9ee35.era1` file
// - the first 10 block tuples are included, unchanged
// - the following 8182 block tuples contain empty bodies and receipts
#[case::era1("../test_assets/era1/test-mainnet-01600-xxxxxxxx.era1")]
#[case::era1("../../test_assets/era1/test-mainnet-01600-xxxxxxxx.era1")]
fn test_era1(#[case] path: &str) {
let era1 = Era1::read_from_file(path.to_string()).unwrap();
let actual = era1.write().unwrap();
Expand All @@ -433,9 +433,9 @@ mod tests {
}

#[rstest::rstest]
#[case("../test_assets/era1/mainnet-00000-5ec1ffb8.era1", 0)]
#[case("../test_assets/era1/mainnet-00001-a5364e9a.era1", 8192)]
#[case("../test_assets/era1/mainnet-00010-5f5d4516.era1", 81920)]
#[case("../../test_assets/era1/mainnet-00000-5ec1ffb8.era1", 0)]
#[case("../../test_assets/era1/mainnet-00001-a5364e9a.era1", 8192)]
#[case("../../test_assets/era1/mainnet-00010-5f5d4516.era1", 81920)]
fn test_era1_index(#[case] path: &str, #[case] index: u64) {
let era1 = Era1::read_from_file(path.to_string()).unwrap();
assert_eq!(era1.block_index.block_index.starting_number, index);
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.
1 change: 1 addition & 0 deletions crates/ethportal-api/src/test_utils/constants.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub const PORTAL_SPEC_TESTS_SUBMODULE_PATH: &str = "../../portal-spec-tests";
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ mod test {
#[case("case_1")]
fn serde_signed_beacon_block_bellatrix(#[case] case: &str) {
let value = std::fs::read_to_string(format!(
"../test_assets/beacon/bellatrix/SignedBeaconBlock/ssz_random/{case}/value.yaml"
"../../test_assets/beacon/bellatrix/SignedBeaconBlock/ssz_random/{case}/value.yaml"
))
.expect("cannot find test asset");
let value: Value = serde_yaml::from_str(&value).unwrap();
Expand All @@ -219,14 +219,14 @@ mod test {
#[case("case_1")]
fn ssz_signed_beacon_block_bellatrix(#[case] case: &str) {
let value = std::fs::read_to_string(format!(
"../test_assets/beacon/bellatrix/SignedBeaconBlock/ssz_random/{case}/value.yaml"
"../../test_assets/beacon/bellatrix/SignedBeaconBlock/ssz_random/{case}/value.yaml"
))
.expect("cannot find test asset");
let value: Value = serde_yaml::from_str(&value).unwrap();
let content: SignedBeaconBlockBellatrix = serde_json::from_value(value).unwrap();

let compressed = std::fs::read(format!(
"../test_assets/beacon/bellatrix/SignedBeaconBlock/ssz_random/{case}/serialized.ssz_snappy"
"../../test_assets/beacon/bellatrix/SignedBeaconBlock/ssz_random/{case}/serialized.ssz_snappy"
))
.expect("cannot find test asset");
let mut decoder = snap::raw::Decoder::new();
Expand All @@ -240,7 +240,7 @@ mod test {
#[case("case_1")]
fn serde_signed_beacon_block_capella(#[case] case: &str) {
let value = std::fs::read_to_string(format!(
"../test_assets/beacon/capella/SignedBeaconBlock/ssz_random/{case}/value.yaml"
"../../test_assets/beacon/capella/SignedBeaconBlock/ssz_random/{case}/value.yaml"
))
.expect("cannot find test asset");
let value: Value = serde_yaml::from_str(&value).unwrap();
Expand All @@ -254,14 +254,14 @@ mod test {
#[case("case_1")]
fn ssz_signed_beacon_block_capella(#[case] case: &str) {
let value = std::fs::read_to_string(format!(
"../test_assets/beacon/capella/SignedBeaconBlock/ssz_random/{case}/value.yaml"
"../../test_assets/beacon/capella/SignedBeaconBlock/ssz_random/{case}/value.yaml"
))
.expect("cannot find test asset");
let value: Value = serde_yaml::from_str(&value).unwrap();
let content: SignedBeaconBlockCapella = serde_json::from_value(value).unwrap();

let compressed = std::fs::read(format!(
"../test_assets/beacon/capella/SignedBeaconBlock/ssz_random/{case}/serialized.ssz_snappy"))
"../../test_assets/beacon/capella/SignedBeaconBlock/ssz_random/{case}/serialized.ssz_snappy"))
.expect("cannot find test asset");
let mut decoder = snap::raw::Decoder::new();
let expected = decoder.decompress_vec(&compressed).unwrap();
Expand All @@ -274,7 +274,7 @@ mod test {
#[case("case_1")]
fn serde_signed_beacon_block_deneb(#[case] case: &str) {
let value = std::fs::read_to_string(format!(
"../test_assets/beacon/deneb/SignedBeaconBlock/ssz_random/{case}/value.yaml"
"../../test_assets/beacon/deneb/SignedBeaconBlock/ssz_random/{case}/value.yaml"
))
.expect("cannot find test asset");
let value: Value = serde_yaml::from_str(&value).unwrap();
Expand All @@ -288,14 +288,14 @@ mod test {
#[case("case_1")]
fn ssz_signed_beacon_block_deneb(#[case] case: &str) {
let value = std::fs::read_to_string(format!(
"../test_assets/beacon/deneb/SignedBeaconBlock/ssz_random/{case}/value.yaml"
"../../test_assets/beacon/deneb/SignedBeaconBlock/ssz_random/{case}/value.yaml"
))
.expect("cannot find test asset");
let value: Value = serde_yaml::from_str(&value).unwrap();
let content: SignedBeaconBlockDeneb = serde_json::from_value(value).unwrap();

let compressed = std::fs::read(format!(
"../test_assets/beacon/deneb/SignedBeaconBlock/ssz_random/{case}/serialized.ssz_snappy"
"../../test_assets/beacon/deneb/SignedBeaconBlock/ssz_random/{case}/serialized.ssz_snappy"
))
.expect("cannot find test asset");
let mut decoder = snap::raw::Decoder::new();
Expand All @@ -308,7 +308,7 @@ mod test {
#[case("10232841")]
fn json_signed_beacon_block_deneb(#[case] case: &str) {
let value = std::fs::read_to_string(format!(
"../test_assets/beacon/deneb/SignedBeaconBlock/json/{case}.json"
"../../test_assets/beacon/deneb/SignedBeaconBlock/json/{case}.json"
))
.expect("cannot find test asset");
let value: Value = serde_json::from_str(&value).unwrap();
Expand All @@ -318,7 +318,7 @@ mod test {
#[test]
fn serde_beacon_block_bellatrix() {
let value = std::fs::read_to_string(
"../test_assets/beacon/bellatrix/BeaconBlock/ssz_random/case_0/value.yaml",
"../../test_assets/beacon/bellatrix/BeaconBlock/ssz_random/case_0/value.yaml",
)
.expect("cannot find test asset");
let value: Value = serde_yaml::from_str(&value).unwrap();
Expand All @@ -330,14 +330,14 @@ mod test {
#[test]
fn ssz_beacon_block_bellatrix() {
let value = std::fs::read_to_string(
"../test_assets/beacon/bellatrix/BeaconBlock/ssz_random/case_0/value.yaml",
"../../test_assets/beacon/bellatrix/BeaconBlock/ssz_random/case_0/value.yaml",
)
.expect("cannot find test asset");
let value: Value = serde_yaml::from_str(&value).unwrap();
let content: BeaconBlockBellatrix = serde_json::from_value(value).unwrap();

let compressed = std::fs::read(
"../test_assets/beacon/bellatrix/BeaconBlock/ssz_random/case_0/serialized.ssz_snappy",
"../../test_assets/beacon/bellatrix/BeaconBlock/ssz_random/case_0/serialized.ssz_snappy",
)
.expect("cannot find test asset");
let mut decoder = snap::raw::Decoder::new();
Expand All @@ -349,7 +349,7 @@ mod test {
#[test]
fn beacon_block_body_root_proof() {
let value = std::fs::read_to_string(
"../test_assets/beacon/bellatrix/BeaconBlock/ssz_random/case_0/value.yaml",
"../../test_assets/beacon/bellatrix/BeaconBlock/ssz_random/case_0/value.yaml",
)
.expect("cannot find test asset");
let value: Value = serde_yaml::from_str(&value).unwrap();
Expand Down
Loading

0 comments on commit e4fa0f2

Please sign in to comment.