-
Notifications
You must be signed in to change notification settings - Fork 0
Integration tests, unit tests, key import, github workflow - all-in-one changeset #11
Conversation
a7c7b87
to
4a7c989
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A lot of awesome additions in this PR, great work. Commit structure has room for improvement.
69781dd
to
386191f
Compare
I'm still working on addressing the comments but have improved commit structure in a couple of cases. |
4d6e9a5
to
1975a62
Compare
More progress, but not all there yet. |
c8b2d67
to
f6a2c88
Compare
Almost there now, just need to dockerize the itests, create a docker build (#12), and add linters (#18). |
4be1e26
to
427bd17
Compare
Integration tests are dockerized, and I think I'm going to need @Jawshua's help to build an image and store it in a registry. I'll work on linting (#18) and unix sockets (#19) tomorrow. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is again really good. You've picked up all the remarks so well, I am impressed.
Commit structure is nice and clean now too. I don't think there is much to be done on this PR.
itest/lndsigner_test.go
Outdated
lncliPath string | ||
bitcoincliPath string | ||
|
||
lndMtx sync.RWMutex |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you really need this mutex for anything other than the initial creation? It seems that test parallelization happens mostly after lnds
has already been accessed, and also lnds
is static at that point?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tests still give me a race condition because these accesses happen from different goroutines without being gated by a mutex, even if it's technically not possible that it happens at the same time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've fixed this and eliminated the mutex. I'm gating API calls with a channel after watching the log file, and managing the whole command lifecycle in a separate goroutine inside waitProc
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like passing t
into waitProc
is a bad idea. Will fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the error was caused by calling t.Logf
with a saved t
all along. Fixed in https://github.com/bottlepay/lndsigner/compare/b1998d79e511c3bf6ceecdf829d711b6323fe512..b03297c3e6a00d67a20495218d804f98dc721d86 by replacing zap
's test logger with a development logger that doesn't rely on a *testing.T
.
However, this is a good sign to stop lnd
and bitcoind
via RPC instead of OS signal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've replaced the OS interrupt signal to lnd
and bitcoind
with a lncli stop
and bitcoin-cli stop
, which still ends up with the processes being killed as the main test exits, and blurting out a warning. I silenced it on signal: killed
errors now, so if the daemons are too slow to shut down after the tests, we don't need to hear about it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the error was caused by calling t.Logf with a saved t all along.
What was the root cause of this failing? t
being used in a goroutine? I think that should be possible.
d2193be
to
4355bbd
Compare
You can un-request review and re-request when ready ready 😄 |
29e80e9
to
c8d4e21
Compare
OK, now really ready for review. It was ready before, but I thought I'd try to sneak in a fix for the Unix socket issue (#19) before you got to it, and ran into a new security check that |
itest/itest_lndharness_test.go
Outdated
"--remotesigner.enable", | ||
"--remotesigner.rpchost="+signerAddr, | ||
"--remotesigner.tlscertpath=./testdata/tls.cert", | ||
"--remotesigner.macaroonpath=./testdata/signer.custom.macaroon", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: we could generate TLS and macroons dynamically
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added TLS key/cert generation in e2b734c. If you're good with this, I'll squash it into the previous commit (adding integration tests). Now I'm going to look at generating a dummy macaroon without using the macaroon libraries.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I've also added dynamic macaroon generation using just manual byte slice ops in b9af6b2. If you're good with this, I'll squash it into the main integration test commit as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
c8d4e21
to
2471acc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I must say that I didn't do another full pass because of the size of the change set. For the future, I think that smaller PRs that only do a single thing are better for review efficiency. Also things like refactorings can be spun out pretty quickly, and get reviewed and merged.
- [x] sign messages for network announcements | ||
- [x] derive shared keys for peer connections | ||
- [x] sign PSBTs for on-chain transactions, channel openings/closes, HTLC updates, etc. | ||
- [ ] run itests | ||
- [ ] do automated builds | ||
- [ ] do reproducible builds |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this todo list can be a link to the repo issues with a filter by label?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opened #25 to do this in a separate PR so as not to delay this one any longer.
|
||
# docker-test-all runs unit and integration tests in a docker container, then | ||
# removes the container. | ||
docker-test-all: docker |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make docker-test-all
still fails for me at b9af6b2
go: downloading github.com/decred/dcrd/crypto/blake256 v1.0.0
go: downloading github.com/mitchellh/reflectwalk v1.0.0
go: downloading github.com/hashicorp/go-immutable-radix v1.3.1
go: downloading golang.org/x/text v0.3.7
error obtaining VCS status: exit status 128
Use -buildvcs=false to disable VCS stamping.
error obtaining VCS status: exit status 128
Use -buildvcs=false to disable VCS stamping.
make: *** [Makefile:50: test-all] Error 1
@@ -366,3 +370,28 @@ func mustGenCertPair(t *testing.T, certFile, keyFile string) { | |||
|
|||
require.NoError(t, os.WriteFile(keyFile, keyBuf.Bytes(), 0600)) | |||
} | |||
|
|||
func mustGenMacaroon(t *testing.T, macPath string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can squash the itest commits to a single one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. ✔️
b9af6b2
to
96f91e4
Compare
@joostjager @jwelsh-nydig Thank you for the reviews! Can one of you please give me an approval to merge? |
@aakselrod it's not very important, but still interested in #11 (comment) |
Vault package cleanup
The first commit adds exported error variables to the
vault
package and uses them to replace ad-hoc error messages.The next commit breaks up the
paths
function into multiple functions that can be used for unit tests in future commits.The following commit removes redundant
CreateOperation
entries from the paths.Backend tests
The next commit adds initial tests to the vault plugin backend, bringing the test coverage of the package over 50%. It doesn't exercise everything as it's difficult without deterministic test support, which will be enabled by key import in a later commit.
Key import
The following commit changes the seed length from 32 to 16 to match LND in preparation for key import support.
The commit after that moves definitions from
paths.go
tokeys.go
andbackend.go
, where they are used.The next commit factors out a new function,
newNode()
, fromcreateNode()
. The function will be used in a later commit to import a node.The following commit implements key import. The following is added:
This fixes https://github.com/bottlepay/lndsigner/issues/3.
Keyring tests
The following commit refactors the
keyring
package by adding some logging statements and changing ad-hoc errors to exported error variables in preparation for tests added in a later commit.The next commit adds unit tests to the
keyring
package and brings test coverage over 70% for the package. I've added #17 to follow up on additional improvements that can be made here.Integration tests
The commit after that fixes a minor typo in a string displayed on startup.
The final commit adds integration tests. They demonstrate end-to-end functioning of the system, including:
master
(can we change this branch name tomain
?)I hope that this changeset gets us close to deploying in a testnet infrastructure with blind signing support. I've created the following issues to follow up on this PR: #12, #13, #14, #15, #16, #17, #18, and #19.