mirror of
https://github.com/0glabs/0g-storage-node.git
synced 2024-12-24 07:15:17 +00:00
Compare commits
3 Commits
c54346ba5f
...
dd0ab79f31
Author | SHA1 | Date | |
---|---|---|---|
|
dd0ab79f31 | ||
|
bfe434972d | ||
|
a83e518bfb |
37
README.md
37
README.md
@ -28,42 +28,7 @@ Please refer to [Deployment](docs/run.md) page for detailed steps to compile and
|
|||||||
|
|
||||||
## Test
|
## Test
|
||||||
|
|
||||||
### Prerequisites
|
Please refer to the [One Box Test](docs/onebox-test.md) page for local testing purpose.
|
||||||
|
|
||||||
* Required python version: 3.8, 3.9, 3.10, higher version is not guaranteed (e.g. failed to install `pysha3`).
|
|
||||||
* Install dependencies under root folder: `pip3 install -r requirements.txt`
|
|
||||||
|
|
||||||
### Dependencies
|
|
||||||
|
|
||||||
Python test framework will launch blockchain fullnodes at local for storage node to interact with. There are 2 kinds of fullnodes supported:
|
|
||||||
|
|
||||||
* Conflux eSpace node (by default).
|
|
||||||
* BSC node (geth).
|
|
||||||
|
|
||||||
For Conflux eSpace node, the test framework will automatically compile the binary at runtime, and copy the binary to `tests/tmp` folder. For BSC node, the test framework will automatically download the latest version binary from [github](https://github.com/bnb-chain/bsc/releases) to `tests/tmp` folder.
|
|
||||||
|
|
||||||
Alternatively, you could also manually copy specific version binaries (conflux or geth) to the `tests/tmp` folder. Note, do **NOT** copy released conflux binary on github, since block height of some CIPs are hardcoded.
|
|
||||||
|
|
||||||
For testing, it's also dependent on the following repos:
|
|
||||||
|
|
||||||
* [0G Storage Contract](https://github.com/0glabs/0g-storage-contracts): It essentially provides two abi interfaces for 0G Storage Node to interact with the on-chain contracts.
|
|
||||||
* ZgsFlow: It contains apis to submit chunk data.
|
|
||||||
* PoraMine: It contains apis to submit PoRA answers.
|
|
||||||
* [0G Storage Client](https://github.com/0glabs/0g-storage-client): It is used to interact with certain 0G Storage Nodes to upload/download files.
|
|
||||||
|
|
||||||
### Run Tests
|
|
||||||
|
|
||||||
Go to the `tests` folder and run the following command to run all tests:
|
|
||||||
|
|
||||||
```
|
|
||||||
python test_all.py
|
|
||||||
```
|
|
||||||
|
|
||||||
or, run any single test, e.g.
|
|
||||||
|
|
||||||
```
|
|
||||||
python sync_test.py
|
|
||||||
```
|
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
|
38
docs/onebox-test.md
Normal file
38
docs/onebox-test.md
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
# One Box Test
|
||||||
|
|
||||||
|
0G storage node provides one box test framework for developers to verify system functionalities via RPC.
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
- Requires python version: 3.8, 3.9 or 3.10, higher version is not guaranteed (e.g. failed to install `pysha3`).
|
||||||
|
- Installs dependencies under root folder: `pip3 install -r requirements.txt`
|
||||||
|
|
||||||
|
## Install Blockchain Nodes
|
||||||
|
|
||||||
|
Python test framework will launch blockchain nodes at local machine for storage nodes to interact with. There are 3 kinds of blockchains available:
|
||||||
|
|
||||||
|
- 0G blockchain (by default).
|
||||||
|
- Conflux eSpace (for chain reorg test purpose).
|
||||||
|
- BSC node (geth).
|
||||||
|
|
||||||
|
The blockchain node binaries will be compiled or downloaded from github to `tests/tmp` folder automatically. Alternatively, developers could also manually copy binaries of specific version to the `tests/tmp` folder.
|
||||||
|
|
||||||
|
## Run Tests
|
||||||
|
|
||||||
|
Changes to the `tests` folder and run following command to run all tests:
|
||||||
|
|
||||||
|
```
|
||||||
|
python test_all.py
|
||||||
|
```
|
||||||
|
|
||||||
|
or, run any single test, e.g.
|
||||||
|
|
||||||
|
```
|
||||||
|
python example_test.py
|
||||||
|
```
|
||||||
|
|
||||||
|
*Note, please ensure blockchain nodes installed before running any single test, e.g. run all tests at first.*
|
||||||
|
|
||||||
|
## Add New Test
|
||||||
|
|
||||||
|
Please follow the `example_test.py` to add a new `xxx_test.py` file under `tests` folder.
|
@ -2,7 +2,6 @@
|
|||||||
extern crate tracing;
|
extern crate tracing;
|
||||||
|
|
||||||
use anyhow::bail;
|
use anyhow::bail;
|
||||||
use backtrace::Backtrace;
|
|
||||||
use shared_types::{
|
use shared_types::{
|
||||||
Chunk, ChunkArray, ChunkArrayWithProof, DataRoot, FlowProof, FlowRangeProof, Transaction,
|
Chunk, ChunkArray, ChunkArrayWithProof, DataRoot, FlowProof, FlowRangeProof, Transaction,
|
||||||
};
|
};
|
||||||
@ -140,9 +139,6 @@ impl Store {
|
|||||||
{
|
{
|
||||||
let store = self.store.clone();
|
let store = self.store.clone();
|
||||||
let (tx, rx) = oneshot::channel();
|
let (tx, rx) = oneshot::channel();
|
||||||
let mut backtrace = Backtrace::new();
|
|
||||||
let frames = backtrace.frames().to_vec();
|
|
||||||
backtrace = frames.into();
|
|
||||||
|
|
||||||
self.executor.spawn_blocking(
|
self.executor.spawn_blocking(
|
||||||
move || {
|
move || {
|
||||||
@ -150,7 +146,6 @@ impl Store {
|
|||||||
let res = f(&*store);
|
let res = f(&*store);
|
||||||
|
|
||||||
if tx.send(res).is_err() {
|
if tx.send(res).is_err() {
|
||||||
warn!("Backtrace: {:?}", backtrace);
|
|
||||||
error!("Unable to complete async storage operation: the receiver dropped");
|
error!("Unable to complete async storage operation: the receiver dropped");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user