Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Electrum integration tests for mainnet servers #3599

Merged
merged 30 commits into from
Jun 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
96aeb5f
Add more bitcoin testdata
nkuba Jun 2, 2023
6d54bb2
Extract server's error message assertions
nkuba Jun 2, 2023
2c38452
Define a generic assertNumberCloseTo function
nkuba Jun 2, 2023
473132b
Use invalidTxID defined on the package scope
nkuba Jun 2, 2023
d508c04
Cancel context for connections in test
nkuba Jun 2, 2023
0e89bf7
Read embeded electrum servers in the electrum integration tests
nkuba Jun 2, 2023
960ee65
Improve integration tests for electrum
nkuba Jun 2, 2023
4c4cd19
Remove config electrum integration tests
nkuba Jun 2, 2023
b675222
Fix for loop
nkuba Jun 5, 2023
36949fa
Make timeout 4 seconds
nkuba Jun 5, 2023
7d2a277
Merge remote-tracking branch 'origin/main' into integration-tests-mai…
nkuba Jun 6, 2023
1942c1f
Set 20m timeout for integration tests execution
nkuba Jun 6, 2023
00af3a9
Align timeouts for esplora
nkuba Jun 8, 2023
0eb9560
Add parallel execution for transactions test
nkuba Jun 8, 2023
68c9b7b
Update golang version in Dockerfile to 1.18.10
nkuba Jun 8, 2023
6039d49
Cancel context after all sub tests are completed
nkuba Jun 8, 2023
4e1a767
Remove electrum tcp server
nkuba Jun 8, 2023
5045e30
Add script for running integration tests
nkuba Jun 8, 2023
cbb601b
Add details of actual sweep transactions
nkuba Jun 13, 2023
6dec1b9
Use deep.Equal to compare
nkuba Jun 13, 2023
2c890ee
Try sleep before cancel
nkuba Jun 13, 2023
69ce129
Merge remote-tracking branch 'origin/main' into integration-tests-mai…
nkuba Jun 13, 2023
4298722
Use consistent timeouts
nkuba Jun 13, 2023
edc100a
Fix duplicate servers removal
nkuba Jun 13, 2023
6a69437
Capture vars for parallel test execution
nkuba Jun 13, 2023
040ba33
Use longer timeouts in tests
nkuba Jun 13, 2023
e071a74
Add integration test build tag
nkuba Jun 13, 2023
5d081d1
Add more context for error message
nkuba Jun 13, 2023
9ba2d3c
Remove space from go build tag comment
nkuba Jun 15, 2023
a0dd61e
Clarify why we add sleep in test
nkuba Jun 15, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -323,4 +323,4 @@ jobs:
docker run \
--workdir /go/src/github.com/keep-network/keep-core \
go-build-env \
gotestsum -- -tags=integration ./...
gotestsum -- -timeout 20m -tags=integration ./...
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.18.3-alpine3.16 AS build-sources
FROM golang:1.18.10-alpine3.16 AS build-sources

ENV GOPATH=/go \
GOBIN=/go/bin \
Expand Down
38 changes: 0 additions & 38 deletions config/electrum_integration_test.go

This file was deleted.

32 changes: 32 additions & 0 deletions internal/testdata/bitcoin/block.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package bitcoin

import "github.com/keep-network/keep-core/pkg/bitcoin"

// Blocks holds details of block header data used as test vectors.
var Blocks = map[bitcoin.Network]struct {
BlockHeight uint
BlockHeader *bitcoin.BlockHeader
}{
bitcoin.Testnet: {
BlockHeight: 2135502,
BlockHeader: &bitcoin.BlockHeader{
Version: 536870916,
PreviousBlockHeaderHash: hashFromString("000000000066450030efdf72f233ed2495547a32295deea1e2f3a16b1e50a3a5"),
MerkleRootHash: hashFromString("1251774996b446f85462d5433f7a3e384ac1569072e617ab31e86da31c247de2"),
Time: 1641914003,
Bits: 436256810,
Nonce: 778087099,
},
},
bitcoin.Mainnet: {
BlockHeight: 792379,
BlockHeader: &bitcoin.BlockHeader{
Version: 547356672,
PreviousBlockHeaderHash: hashFromString("000000000000000000035d7345203315d8c73c37da256eebbe58a683331b60f5"),
MerkleRootHash: hashFromString("a406a1495c4c4bed2d458f06f393cb841a545cbf7cc04b1ee3d9ae9e6eccb402"),
Time: 1685622977,
Bits: 386236009,
Nonce: 2812580720,
},
},
}
56 changes: 56 additions & 0 deletions internal/testdata/bitcoin/merkleproof.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package bitcoin

import "github.com/keep-network/keep-core/pkg/bitcoin"

// TxMerkleProofs holds details of transaction merkle proof data used as test vectors.
var TxMerkleProofs = map[bitcoin.Network]struct {
TxHash bitcoin.Hash
BlockHeight uint
MerkleProof *bitcoin.TransactionMerkleProof
}{
bitcoin.Testnet: {
TxHash: hashFromString(
"72e7fd57c2adb1ed2305c4247486ff79aec363296f02ec65be141904f80d214e",
),
BlockHeight: 1569342,
MerkleProof: &bitcoin.TransactionMerkleProof{
BlockHeight: 1569342,
MerkleNodes: []string{
"8b5bbb5bdf6727bf70fad4f46fe4eaab04c98119ffbd2d95c29adf32d26f8452",
"53637bacb07965e4a8220836861d1b16c6da29f10ea9ab53fc4eca73074f98b9",
"0267e738108d094ceb05217e2942e9c2a4c6389ac47f476f572c9a319ce4dfbc",
"34e00deec50c48d99678ca2b52b82d6d5432326159c69e7233d0dde0924874b4",
"7a53435e6c86a3620cdbae510901f17958f0540314214379197874ed8ed7a913",
"6315dbb7ce350ceaa16cd4c35c5a147005e8b38ca1e9531bd7320629e8d17f5b",
"40380cdadc0206646208871e952af9dcfdff2f104305ce463aed5eeaf7725d2f",
"5d74bae6a71fd1cff2416865460583319a40343650bd4bb89de0a6ae82097037",
"296ddccfc659e0009aad117c8ed15fb6ff81c2bade73fbc89666a22708d233f9",
},
Position: 176,
},
},
bitcoin.Mainnet: {
TxHash: hashFromString(
"c11feea0f8b9e256e0a70ad58f88c7e3800d8ffbfb85edf7169629584a97a7ab",
),
BlockHeight: 793508,
MerkleProof: &bitcoin.TransactionMerkleProof{
BlockHeight: 793508,
MerkleNodes: []string{
"557900a6e94e751da2de3cc4c322a12d682b0285996187b4276c8c1936940efe",
"910ae74a83dda3faa97dff964eac4d4102119161f8c850c578afff33a5e43c33",
"0d3648b1fba7f375b54a268644e0f6f7f739a490156752916312dc945b3c5a5d",
"8d19e661f8b3bfdb1d4228a5f8aa855808ef5a0a5ffa65e32551c8f3599ff01b",
"ea1bbd7e974a8455f38bb4c047b2324fa62df49dc486018f3604c02a71473261",
"b315a3bb6dfc35e53eaf8756214a521ece6b7c5323d7ed616e6e828de6d024e2",
"d7272801d3f9d8dd459451cdf066cf4fab03cc2198391213e22f49b5a5563c2e",
"baf373eb68aa0fece7e680d09183d7b441073a5b0745bbad92345fdd0447badb",
"016c2eb0e2be1cdbed723690e6de31030a03bece34edf6944ba5d55ab64fa305",
"dc74dc3b4b84293cce52b9d739ca29501e612ceb566ea391a5fde1341d46c950",
"9c941fd7c44fc29403865d57b78941664a236f8506b7a8676d1a833eeea16ff3",
"6ad9f32a66f3d376ea4bcc48d807f565e8b5228cf5b45eefb42879c270263d2d",
},
Position: 227,
},
},
}
Loading