Skip to content

Commit ddfd92e

Browse files
authored
Support Lorentz HF (#87)
1 parent b83c842 commit ddfd92e

File tree

20 files changed

+2037
-682
lines changed

20 files changed

+2037
-682
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -47,23 +47,5 @@ jobs:
4747
command: test
4848
args: --release --features=dev --manifest-path light-client/Cargo.toml --lib test::dev_test_min
4949
env:
50-
MINIMUM_TIMESTAMP_SUPPORTED: 1731495592
50+
MINIMUM_TIMESTAMP_SUPPORTED: 110
5151
MINIMUM_HEIGHT_SUPPORTED: 100
52-
- uses: actions-rs/cargo@v1
53-
name: unit-test-dev-test-pascal
54-
with:
55-
command: test
56-
args: --release --features=dev --manifest-path light-client/Cargo.toml --lib test::dev_test_after_pascal
57-
env:
58-
MINIMUM_TIMESTAMP_SUPPORTED: 1
59-
MINIMUM_HEIGHT_SUPPORTED: 1
60-
PASCAL_TIMESTAMP: 1
61-
- uses: actions-rs/cargo@v1
62-
name: unit-test-dev-test-pascal
63-
with:
64-
command: test
65-
args: --release --features=dev --manifest-path light-client/Cargo.toml --lib test::dev_test_before_pascal
66-
env:
67-
MINIMUM_TIMESTAMP_SUPPORTED: 1
68-
MINIMUM_HEIGHT_SUPPORTED: 1
69-
PASCAL_TIMESTAMP: 1800000000

README.md

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
NOTE: This project is currently under heavy development. Features may change or break.
88

99
## Supported Versions
10-
- [lcp v0.2.9](https://github.com/datachainlab/lcp/releases/tag/v0.2.9)
11-
- [BSC v1.4.13](https://github.com/bnb-chain/bsc/releases/tag/v1.4.13)
10+
- [lcp v0.2.12](https://github.com/datachainlab/lcp/releases/tag/v0.2.12)
11+
- [BSC v1.5.5](https://github.com/bnb-chain/bsc/releases/tag/v1.5.5)
1212

1313
## Documents
1414

@@ -19,20 +19,11 @@ NOTE: This project is currently under heavy development. Features may change or
1919
Environment variables can be used to change settings.
2020
Each configuration must be determined at build time, not at run time.
2121

22-
### Blocks per epoch
23-
You can change the blocks per epoch for localnet.
24-
This is available in dev feature only.
25-
26-
```sh
27-
BSC_BLOCKS_PER_EPOCH=20 cargo build --features=dev
28-
```
29-
3022
### Build Parameters
3123

3224
Parameters can be specified to check for acceptable headers at build time.
3325

34-
| Name | Description |
35-
| --- |-------------------------------------------------------------------------------------------------------------------------------------------------|
36-
| `MINIMUM_TIMESTAMP_SUPPORTED` | Timestamp of the lowest header this light client will accept |
37-
| `MINIMUM_HEIGHT_SUPPORTED` | Height of the lowest header this light client will accept |
38-
| `PASCAL_TIMESTAMP` | Timestamp of the first Pascal Hardfork header, used to check the header structure after Pascal Hardfork; if 0 is specified, no check is made. |
26+
| Name | Description |
27+
| --- |------------------------------------------------------------------------------------------------------------------------------|
28+
| `MINIMUM_TIMESTAMP_SUPPORTED` | Timestamp(millisecond) of the lowest header this light client will accept. All the ForkSpec must be greater than or equal to this value. |
29+
| `MINIMUM_HEIGHT_SUPPORTED` | Height of the lowest header this light client will accept. All the ForkSpec must be greater than or equal to this value. |

light-client/build.rs

Lines changed: 16 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,19 @@
11
fn main() {
2-
#[cfg(feature = "dev")]
3-
{
4-
use std::io::Write;
5-
let mut file = std::fs::File::create("src/header/constant.rs").unwrap();
6-
let blocks_per_epoch =
7-
std::env::var("BSC_BLOCKS_PER_EPOCH").unwrap_or_else(|_| "200".to_string());
8-
writeln!(
9-
file,
10-
"pub const BLOCKS_PER_EPOCH: u64 = {};",
11-
blocks_per_epoch,
12-
)
13-
.unwrap();
14-
}
2+
use std::io::Write;
3+
let mut file = std::fs::File::create("src/header/constant.rs").unwrap();
4+
let mut values: Vec<String> = vec![];
5+
let minimum_time_stamp_supported =
6+
std::env::var("MINIMUM_TIMESTAMP_SUPPORTED").unwrap_or_else(|_| "0".to_string());
7+
values.push(format!(
8+
"pub const MINIMUM_TIMESTAMP_SUPPORTED: u64 = {};",
9+
minimum_time_stamp_supported
10+
));
11+
let minimum_height_supported =
12+
std::env::var("MINIMUM_HEIGHT_SUPPORTED").unwrap_or_else(|_| "0".to_string());
13+
values.push(format!(
14+
"pub const MINIMUM_HEIGHT_SUPPORTED: u64 = {};",
15+
minimum_height_supported
16+
));
1517

16-
{
17-
use std::io::Write;
18-
let mut file = std::fs::File::create("src/header/hardfork.rs").unwrap();
19-
let minimum_time_stamp_supported =
20-
std::env::var("MINIMUM_TIMESTAMP_SUPPORTED").unwrap_or_else(|_| "0".to_string());
21-
let minimum_height_supported =
22-
std::env::var("MINIMUM_HEIGHT_SUPPORTED").unwrap_or_else(|_| "0".to_string());
23-
let pascal_timestamp =
24-
std::env::var("PASCAL_TIMESTAMP").unwrap_or_else(|_| "0".to_string());
25-
writeln!(
26-
file,
27-
"pub const MINIMUM_TIMESTAMP_SUPPORTED: u64 = {};\npub const MINIMUM_HEIGHT_SUPPORTED: u64 = {};\npub const PASCAL_TIMESTAMP: u64 = {};",
28-
minimum_time_stamp_supported,
29-
minimum_height_supported,
30-
pascal_timestamp
31-
)
32-
.unwrap();
33-
}
18+
writeln!(file, "{}", values.join("\n")).unwrap();
3419
}

0 commit comments

Comments
 (0)