Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 17 additions & 35 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,41 +11,23 @@ jobs:
name: ci
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{github.event.pull_request.head.repo.full_name}}
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2022-10-22
components: rustfmt, clippy
- uses: actions-rs/cargo@v1
name: format check
with:
command: fmt
args: --all -- --check
- uses: actions-rs/cargo@v1
name: clippy check
with:
command: clippy
args: -- -D warnings
- uses: actions-rs/cargo@v1
name: unit-test
with:
command: test
args: --release --features=std --manifest-path light-client/Cargo.toml
- uses: actions-rs/cargo@v1
name: unit-test-dev-test-min
with:
command: test
args: --release --features=dev --manifest-path light-client/Cargo.toml --lib test::dev_test_min
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: Swatinem/rust-cache@v2
- name: Install components
run: |
rustup component add rustfmt clippy
cargo install cargo-machete --version 0.8.0
- name: Check format
run: cargo fmt --all -- --check
- name: Check clippy
run: cargo clippy --locked -- -D warnings
- name: Check deps
run: cargo machete
- name: unit-test
run: cargo test --release --features=std --manifest-path light-client/Cargo.toml
- name: unit-test-dev-test-min
run: cargo test --release --features=dev --manifest-path light-client/Cargo.toml --lib test::dev_test_min
env:
MINIMUM_TIMESTAMP_SUPPORTED: 110
MINIMUM_HEIGHT_SUPPORTED: 100
20 changes: 9 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
NOTE: This project is currently under heavy development. Features may change or break.

## Supported Versions
- [lcp v0.2.12](https://github.com/datachainlab/lcp/releases/tag/v0.2.12)
- [lcp v0.2.17](https://github.com/datachainlab/lcp/releases/tag/v0.2.17)
- [BSC v1.5.5](https://github.com/bnb-chain/bsc/releases/tag/v1.5.5)

## Documents
Expand Down
10 changes: 4 additions & 6 deletions light-client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
[package]
name = "parlia-elc"
version = "0.2.9"
version = "0.4.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
light-client = { git = "https://github.com/datachainlab/lcp", rev = "v0.2.12", default-features = false }
light-client = { git = "https://github.com/datachainlab/lcp", rev = "v0.2.17", default-features = false }

rlp = { version = "0.5.2", default-features = false }
prost = { version = "0.11", default-features = false }

parlia-ibc-proto = { version = "0.2.0", path = "../proto", default-features = false }
parlia-ibc-proto = { version = "0.4.0", path = "../proto", default-features = false }

tiny-keccak = { version = "2.0.2", default-features = false, features = ["keccak"] }
trie-db = { version= "0.24.0", default-features = false }
patricia-merkle-trie = { git = "https://github.com/bluele/patricia-merkle-trie", branch = "no-std-keccak-hasher", default-features = false, features = ["keccak"] }
primitive-types = { version = "0.12.1", default-features = false }
Expand All @@ -22,13 +21,12 @@ k256 = { version = "0.13.1", default-features = false, features = ["alloc", "ecd
elliptic-curve = { version = "0.13.5", default-features = false, features = ["hazmat", "sec1"] }

serde = { version = "1.0", default-features = false, features = ["alloc"] }
serde_json = { version = "1.0", default-features = false, features = ["alloc"] }

milagro_bls = { git = "https://github.com/datachainlab/milagro_bls", rev = "bc2b5b5e8d48b7e2e1bfaa56dc2d93e13cb32095", default-features = false }
hex-literal = "0.4.1"

[dev-dependencies]
store = { git = "https://github.com/datachainlab/lcp.git", rev = "v0.2.12", default-features = false }
store = { git = "https://github.com/datachainlab/lcp.git", rev = "v0.2.17", default-features = false }
time = { version = "0.3", default-features = false }
rstest = "0.18"

Expand Down
6 changes: 2 additions & 4 deletions light-client/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@ fn main() {
let minimum_time_stamp_supported =
std::env::var("MINIMUM_TIMESTAMP_SUPPORTED").unwrap_or_else(|_| "0".to_string());
values.push(format!(
"pub const MINIMUM_TIMESTAMP_SUPPORTED: u64 = {};",
minimum_time_stamp_supported
"pub const MINIMUM_TIMESTAMP_SUPPORTED: u64 = {minimum_time_stamp_supported};",
));
let minimum_height_supported =
std::env::var("MINIMUM_HEIGHT_SUPPORTED").unwrap_or_else(|_| "0".to_string());
values.push(format!(
"pub const MINIMUM_HEIGHT_SUPPORTED: u64 = {};",
minimum_height_supported
"pub const MINIMUM_HEIGHT_SUPPORTED: u64 = {minimum_height_supported};",
));

writeln!(file, "{}", values.join("\n")).unwrap();
Expand Down
9 changes: 6 additions & 3 deletions light-client/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,7 @@ mod test {
header.timestamp().unwrap(),
trusted_cs.timestamp,
);
assert_eq!(format!("{}", actual), format!("{}", expected));
assert_eq!(format!("{actual}"), format!("{}", expected));
}
_ => unreachable!("invalid commitment context {:?}", data.context),
}
Expand Down Expand Up @@ -1113,7 +1113,7 @@ mod test {
true,
)
.unwrap_err();
let expected = format!("{:?}", err).contains("ClientFrozen: xx-parlia-0");
let expected = format!("{err:?}").contains("ClientFrozen: xx-parlia-0");
assert!(expected, "{}", err);
}

Expand Down Expand Up @@ -1309,7 +1309,7 @@ mod test {
}

fn assert_err(err: light_client::Error, contains: &str) {
assert!(format!("{:?}", err).contains(contains), "{}", err);
assert!(format!("{err:?}").contains(contains), "{}", err);
}

#[cfg(feature = "dev")]
Expand Down Expand Up @@ -1374,6 +1374,7 @@ mod test {
max_turn_length: 9,
enable_header_msec: false,
gas_limit_bound_divider: 256,
k_ancestor_generation_depth: 1,
}];
(client_state, cons_state)
}));
Expand All @@ -1389,6 +1390,7 @@ mod test {
max_turn_length: 9,
enable_header_msec: false,
gas_limit_bound_divider: 256,
k_ancestor_generation_depth: 1,
}];
(client_state, cons_state)
}));
Expand All @@ -1405,6 +1407,7 @@ mod test {
max_turn_length: 9,
enable_header_msec: false,
gas_limit_bound_divider: 256,
k_ancestor_generation_depth: 1,
}];
(client_state, cons_state)
}))
Expand Down
1 change: 1 addition & 0 deletions light-client/src/client_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ mod test {
max_turn_length: 9,
enable_header_msec: false,
gas_limit_bound_divider: 256,
k_ancestor_generation_depth: 1,
}
}

Expand Down
Loading