dexcctl: add simnet configuration script#587
Conversation
Adds command line passwords to dexcctl. The Decred simnet password is changed to 'abc' to be consistent with the BTC harness.
| ALPHA_WALLET_SEED="b280922d2cffda44648346412c5ec97f429938105003730414f10b01e1402eac" | ||
| BETA_WALLET_SEED="aabbcaabbcaabbcaabbcaabbcaabbcaabbcaabbcaabbcaabbcaabbcaabbcaabbc" | ||
| WALLET_PASS=123 | ||
| WALLET_PASS=abc |
There was a problem hiding this comment.
This looks really handy.
One thing I had shashed for harness.sh was this:
@@ -103,6 +103,11 @@ chmod +x "${NODES_ROOT}/harness-ctl/reorg"
# Shutdown script
cat > "${NODES_ROOT}/harness-ctl/quit" <<EOF
#!/bin/sh
+tmux send-keys -t $SESSION:3 C-c
+tmux send-keys -t $SESSION:4 C-c
+tmux send-keys -t $SESSION:5 C-c
+tmux send-keys -t $SESSION:6 C-c
+sleep 0.2
tmux send-keys -t $SESSION:1 C-c
tmux send-keys -t $SESSION:2 C-c
tmux wait-for alphadcrI didn't understand how we were getting away with only interrupting the alpha and beta dcrd procs, but not the dcrwallets.
|
|
||
| const ( | ||
| walletPassword = "123" | ||
| walletPassword = "abc" |
There was a problem hiding this comment.
Another thing I has stashed for simnet_test.go (I think we were both looking into these) was:
--- a/client/asset/dcr/simnet_test.go
+++ b/client/asset/dcr/simnet_test.go
@@ -58,6 +58,7 @@ func mineAlpha() error {
}
func tBackend(t *testing.T, name string, blkFunc func(string, error)) (*ExchangeWallet, *dex.ConnectionMaster) {
+ t.Helper()
user, err := user.Current()
if err != nil {
t.Fatalf("error getting current user: %v", err)
@@ -93,6 +94,7 @@ type testRig struct {
}
func newTestRig(t *testing.T, blkFunc func(string, error)) *testRig {
+ t.Helper()
rig := &testRig{
backends: make(map[string]*ExchangeWallet),
connectionMasters: make(map[string]*dex.ConnectionMaster, 3),
@@ -109,6 +111,7 @@ func (rig *testRig) beta() *ExchangeWallet {
return rig.backends["beta"]
}
func (rig *testRig) close(t *testing.T) {
+ t.Helper()
for name, cm := range rig.connectionMasters {
closed := make(chan struct{})
go func() {
@@ -247,6 +250,7 @@ func TestWallet(t *testing.T) {
confCoin := receipts[0].Coin()
checkConfs := func(n uint32) {
+ t.Helper()
confs, err := rig.beta().Confirmations(confCoin.ID())
if err != nil {
t.Fatalf("error getting %d confs: %v", n, err)Wanna sneak those in too?
| # calling this script. | ||
| set -e | ||
| echo initializing | ||
| ./dexcctl -p abc init |
There was a problem hiding this comment.
Recently I've been running dexc with --rpcaddr=localhost:6757 --webaddr=localhost:6758 for simnet, which goes back to #557. This makes me realize the network dependent ports would need to be coordinated with dexcctl. That is, do you think it would make sense to have a --testnet/--simnet flag for dexcctl that switches these ports automatically? (but not in this PR ofc)
| echo mining fee confirmation blocks | ||
| tmux send-keys -t dcr-harness:0 "./mine-alpha 1" C-m | ||
| sleep 2 | ||
| tmux send-keys -t dcr-harness:0 "./mine-alpha 1" C-m No newline at end of file |
There was a problem hiding this comment.
5 seconds to register and authenticate!
$ time ./simnet-setup.sh
initializing
app initialized
configuring Decred wallet
dcr wallet created and unlocked
configuring Bitcoin wallet
btc wallet created and unlocked
registering with DEX
{
"feeID": "ec77729e4dec81bfb1e1f9212f89e2c336d8b353d4cca5764cb0c1f56b7a0233:0",
"reqConfirms": 1
}
mining fee confirmation blocks
real 0m5.346s
user 0m1.931s
sys 0m0.108s
| echo configuring Bitcoin wallet | ||
| ./dexcctl -p abc -p abc newwallet 0 ~/dextest/btc/harness-ctl/alpha.conf '{"walletname":"gamma"}' | ||
| echo registering with DEX | ||
| ./dexcctl -p abc register 127.0.0.1:7232 100000000 ~/.dcrdex/rpc.cert |
There was a problem hiding this comment.
The simnet test dcrdex is on port 17273 and certificate is at ~/dextest/dcrdex/rpc.cert
There was a problem hiding this comment.
Good point about the cert, but dcrdex doesn't change the port, at least not automatically, depending on net. Same with dexc BTW, and I'd welcome resolutions to that.
There was a problem hiding this comment.
The simnet test dcrdex is on port 17273 and certificate is at ~/dextest/dcrdex/rpc.cert
Good point. I've only been using the dcrdex simnet server for the core -tags harness test, but I'll start using it for manual testing too.
There was a problem hiding this comment.
Yeah, I haven't been using any of the harnesses when not specifically testing them because I hate having a folder called "dextest" in my home, but I guess I'll just have to get over it because it's not worth keeping up with changes.
There was a problem hiding this comment.
So a problem with using that harness for general testing is the 1min/30sec lock times (the script builds dcrdex with special flags). I don't think we should encourage using the harness for general testing, especially interactive, unless we make the dex/testing/dcrdex/harness.sh lock times longer by default
There was a problem hiding this comment.
That is, we should revert this change to client/cmd/dexcctl/simnet-setup.sh or we should modify dex/testing/dcrdex/harness.sh with a flag to change the lock times only if requested.
A script to set up simnet wallets and register with the DEX. Adds command line passwords to dexcctl.
The Decred simnet password is changed to
"abc"to be consistent with the BTC harness.