## Change
Add a guard to the `disparate_dir` cleanup in `sync_instance` to
prevent accidental deletion of the contract state directory when
`DISPARATE_DIR` is not set.
## Background
The `disparate` directory feature was introduced in the beta devkit
image to support multisig deployments. The cluster script assumes
`DISPARATE_DIR` is always set, however older NPM packages (below
v0.6.8) do not pass this environment variable, leaving `$disparate_dir`
as an empty string.
With an empty `$disparate_dir` this line:
```bash
[ -d $contract_dir/contract_fs/seed/state/$disparate_dir ] && rm -r $contract_dir/contract_fs/seed/state/$disparate_dir
```
Evaluates to:
```bash
[ -d $contract_dir/contract_fs/seed/state/ ] && rm -r $contract_dir/contract_fs/seed/state/
```
Deleting the entire state directory immediately after the contract
bundle is copied in.
## Change
Add a guard so the deletion only runs when `$disparate_dir` is
actually set:
```bash
# Before
[ -d $contract_dir/contract_fs/seed/state/$disparate_dir ] && rm -r $contract_dir/contract_fs/seed/state/$disparate_dir
# After
[ -n "$disparate_dir" ] && [ -d $contract_dir/contract_fs/seed/state/$disparate_dir ] && rm -r $contract_dir/contract_fs/seed/state/$disparate_dir
```
## Notes
- NPM v0.6.8 correctly passes `DISPARATE_DIR=disparate` and is
required for full beta devkit compatibility
- This guard is defensive programming to protect against the state
directory being accidentally deleted if an older NPM package is used
with the beta image
- For non-multisig deployments the disparate directory cleanup is
skipped entirely which is the correct behaviour
The bind_mesh function is hardcoding contract.roundtime=2000 (2 seconds) into the configuration incorrectly causing a duplicate roundtime setting in the default of 1000 irrespective of what contract.roundtime=2000 or what the hp.cfg.override is set to.
It should be setting this to contract.consensus.roundtime
```
cat /var/lib/docker/volumes/hpdevkit_default_vol/_data/node1/cfg/hp.cfg | grep -A10 -B5 roundtime
"bin_args": "index.js",
"environment": {},
"max_input_ledger_offset": 10,
"consensus": {
"mode": "public",
"roundtime": 1000, <--------
"stage_slice": 25,
"threshold": 80
},
"npl": {
"mode": "private"
},
"round_limits": {
"user_input_bytes": 0,
"user_output_bytes": 0,
"npl_output_bytes": 0,
"proc_cpu_seconds": 0,
"proc_mem_bytes": 0,
"proc_ofd_count": 0,
"exec_timeout": 300000
},
"roundtime": 2000 <-------
},
"mesh": {
"port": 22861,
"listen": true,
"idle_timeout": 120000,
"known_peers": [
"node2:22862",
"node3:22863"
],
"msg_forwarding": true,
```