-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #784 from AloeareV/binary_location_stabalized
Binary location stabilized
- Loading branch information
Showing
13 changed files
with
206 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,22 @@ | ||
zingocli/regtest/data/zcashd/regtest/ | ||
zingocli/regtest/data/lightwalletd/ | ||
zingocli/regtest/data/zingo/ | ||
!zingolib/test-data/README | ||
!zingolib/test-data/openssl_cfg | ||
*.json.txt | ||
.DS_Store | ||
/procgov | ||
/testdata | ||
cobertura.xml | ||
docker-ci/lightwalletd | ||
target | ||
wallets/* | ||
zingocli/regtest/logs/ | ||
zingocli/regtest/zingo-wallet.dat | ||
zingocli/regtest/bin | ||
integration-tests/regtest/bin | ||
target | ||
zingolib/target | ||
zingocli/target | ||
/testdata | ||
/procgov | ||
.DS_Store | ||
*.json.txt | ||
docker-ci/lightwalletd | ||
zingolib/test-data/* | ||
!zingolib/test-data/README | ||
!zingolib/test-data/openssl_cfg | ||
zingocli/tests/data/basic_zcashd.conf | ||
zingocli/tests/data/externalwallet_coinbaseaddress.conf | ||
zingocli/tests/data/lightwalletd.yml | ||
zingocli/tests/data/basic_zcashd.conf | ||
cobertura.xml | ||
zingocli/tests/times/* | ||
wallets/* | ||
zingocli/wallets/* | ||
darkside-tests/lightwalletd_bin/ | ||
zingolib/target | ||
zingolib/test-data/* | ||
zingo-testutils/test_binaries | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,153 @@ | ||
`G=$(git rev-parse --show-toplevel)` | ||
|
||
## Regtest Mode | ||
WARNING Experimental! | ||
Zingocli has a set of tests based on zcashd regtest mode, by locally running a `zcashd` and `lightwalletd`. | ||
This is now working with a simple `zingo-cli` invocation flag. | ||
|
||
There are pre-made directories in this repo to support ready use of regtest mode. These are found in the `$G/zingocli/regtest/` subdirectory. | ||
|
||
There are default config files for these binaries already in place in `$G/zingocli/regtest/conf/` which can also be edited. | ||
|
||
Because regtest mode has no ability to cope with an initial `zcashd` state without any blocks, | ||
we have included files to produce an initial block height of one, with no variation between runs. | ||
These files are copied from a 'passive' directory (`$G/zingocli/regtest/data/regtestvectors/`) | ||
into a newly cleared 'active' data directory at the beginning of each time regtest mode is run. | ||
This means, by default, any blocks added while zcashd is running are not retained for subsequent runs. | ||
|
||
The default config includes all network upgrades set to block height 1, therefore all network upgrades are active by default in regtest mode. | ||
|
||
# Usage example: | ||
You must copy your compiled `zcashd`, `zcash-cli` and `lightwalletd` binaries to `$G/zingocli/regtest/bin/` or set up symlinks, etc. `zcash-cli` is also needed if you wish | ||
to interact with your `zcashd` instance while it is running. | ||
|
||
From your `$G/` directory, you can run: | ||
`cargo run --release -- --regtest` | ||
|
||
Note: Regtest mode only works when invoked with `cargo run`. Running `cargo build` followed by an invocation of the compiled binary will fail. | ||
|
||
This will start an interactive session. Individual commands can be passed to zingolib (via the cli), for example: | ||
|
||
`cargo run --release -- --regtest help` | ||
|
||
This will start `zcashd` and `lightwalletd` and then connect to these tools with an interactive `zingo-cli`. | ||
It currently takes a few seconds to do so, even on a fast machine, to give the daemons time to boot. | ||
|
||
These daemons will be killed when the user exits `zingo-cli` using the `quit` command. | ||
However, if there is an issue starting or shutting down regtest mode, it's possible you will have to shut down the daemons manually. | ||
|
||
You should see several diagnostic messages, and then: | ||
`regtest detected and network set correctly! | ||
Lightclient connecting to http://127.0.0.1:9067/` | ||
at which point the interactive cli application should work with your regtest network. | ||
|
||
`zcashd`'s stdout logfile should quickly have an output of several dozen lines, and show network upgrade activation parameters at `height=1`. | ||
`lightwalletd`'s stdout log file will show something like: | ||
`{"app":"lightwalletd","level":"info","msg":"Got sapling height 1 block height 1 chain regtest branchID ..."}` | ||
...which you can view with `tail -f` or your favorite tool. | ||
|
||
Once regtest mode is running, you can manipulate the simulated chain with `zcash-cli`. | ||
|
||
For example, in still another terminal instance in the `$G/zingocli/regtest/bin/` directory, you can run | ||
`./zcash-cli -regtest -rpcuser=xxxxxx -rpcpassword=xxxxxx generate 11` to generate 11 blocks. | ||
Please note that by adding more than 100 blocks it is difficult or impossible to rewind the chain. The config means that after the first block all network upgrades should be in place. | ||
Other `zcash-cli` commands should work similarly. | ||
|
||
Invocation currently only works when being launched within a `zingolib` repo's worktree | ||
(The paths have to know where to look for the subdirectories, they start with the top level of a `zingolib` repo, or fail immediately). | ||
|
||
Have fun! | ||
|
||
# Tree Diagrams | ||
In `$G/zingocli`, running `tree ./regtest` | ||
after moving binaries and running: | ||
./regtest/ | ||
├── bin | ||
│ ├── lightwalletd | ||
│ ├── zcash-cli | ||
│ └── zcashd | ||
├── conf | ||
│ ├── lightwalletd.yml | ||
│ └── zcash.conf | ||
├── data | ||
│ ├── lightwalletd | ||
│ │ └── db | ||
│ │ └── regtest | ||
│ │ ├── blocks | ||
│ │ └── lengths | ||
│ ├── regtestvectors | ||
│ │ └── regtest | ||
│ │ ├── banlist.dat | ||
│ │ ├── blocks | ||
│ │ │ ├── blk00000.dat | ||
│ │ │ ├── index | ||
│ │ │ │ ├── 000005.ldb | ||
│ │ │ │ ├── 000008.ldb | ||
│ │ │ │ ├── 000009.log | ||
│ │ │ │ ├── CURRENT | ||
│ │ │ │ ├── LOCK | ||
│ │ │ │ ├── LOG | ||
│ │ │ │ ├── LOG.old | ||
│ │ │ │ └── MANIFEST-000007 | ||
│ │ │ └── rev00000.dat | ||
│ │ ├── chainstate | ||
│ │ │ ├── 000005.ldb | ||
│ │ │ ├── 000008.ldb | ||
│ │ │ ├── 000009.log | ||
│ │ │ ├── CURRENT | ||
│ │ │ ├── LOCK | ||
│ │ │ ├── LOG | ||
│ │ │ ├── LOG.old | ||
│ │ │ └── MANIFEST-000007 | ||
│ │ ├── database | ||
│ │ │ └── log.0000000001 | ||
│ │ ├── db.log | ||
│ │ ├── fee_estimates.dat | ||
│ │ ├── peers.dat | ||
│ │ └── wallet.dat | ||
│ ├── zcashd | ||
│ │ └── regtest | ||
│ │ ├── banlist.dat | ||
│ │ ├── blocks | ||
│ │ │ ├── blk00000.dat | ||
│ │ │ ├── index | ||
│ │ │ │ ├── 000005.ldb | ||
│ │ │ │ ├── 000008.ldb | ||
│ │ │ │ ├── 000011.ldb | ||
│ │ │ │ ├── 000012.log | ||
│ │ │ │ ├── CURRENT | ||
│ │ │ │ ├── LOCK | ||
│ │ │ │ ├── LOG | ||
│ │ │ │ ├── LOG.old | ||
│ │ │ │ └── MANIFEST-000010 | ||
│ │ │ └── rev00000.dat | ||
│ │ ├── chainstate | ||
│ │ │ ├── 000005.ldb | ||
│ │ │ ├── 000008.ldb | ||
│ │ │ ├── 000011.ldb | ||
│ │ │ ├── 000012.log | ||
│ │ │ ├── CURRENT | ||
│ │ │ ├── LOCK | ||
│ │ │ ├── LOG | ||
│ │ │ ├── LOG.old | ||
│ │ │ └── MANIFEST-000010 | ||
│ │ ├── database | ||
│ │ │ └── log.0000000001 | ||
│ │ ├── db.log | ||
│ │ ├── fee_estimates.dat | ||
│ │ ├── peers.dat | ||
│ │ ├── wallet.dat | ||
│ │ └── zcashd.pid | ||
│ └── zingo | ||
│ ├── zingo-wallet.dat | ||
│ └── zingo-wallet.debug.log | ||
├── logs | ||
│ ├── lightwalletd | ||
│ │ ├── stderr.log | ||
│ │ └── stdout.log | ||
│ └── zcashd | ||
│ └── stdout.log | ||
└── README.md | ||
|
||
# Working Commits | ||
Tested with `zcash` commit `d6d209`, `lightwalletd` commit `f53511c`, and `zingolib` commit `89fbe118f8305051d5f1d1d95903ba3ccaec586b` or better. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
use std::path::PathBuf; | ||
|
||
pub fn get_cargo_manifest_dir() -> PathBuf { | ||
PathBuf::from(std::env::var("CARGO_MANIFEST_DIR").expect("To be inside a manifested space.")) | ||
} | ||
|
||
pub fn get_regtest_dir() -> PathBuf { | ||
get_cargo_manifest_dir().join("regtest") | ||
} | ||
|
||
pub fn get_bin_dir() -> PathBuf { | ||
let mut dir = get_cargo_manifest_dir(); | ||
dir.pop(); | ||
dir.join("zingo-testutils") | ||
.join("test_binaries") | ||
.join("bins") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters