Skip to content

Commit c1f11fd

Browse files
Bump covenant signer to latest (#20)
* Bump signer * Use v26 bitcoin and psbt signer
1 parent e1cc64a commit c1f11fd

File tree

5 files changed

+40
-30
lines changed

5 files changed

+40
-30
lines changed

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,10 @@ require (
4747
)
4848

4949
require (
50-
github.com/babylonchain/covenant-signer v0.0.0-20240426115954-38daee94636c
50+
github.com/babylonchain/covenant-signer v0.0.0-20240507155851-64756e393be2
5151
github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0
5252
github.com/btcsuite/btcwallet/wallet/txauthor v1.3.4
53+
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0
5354
)
5455

5556
require (
@@ -131,7 +132,6 @@ require (
131132
github.com/danieljoos/wincred v1.1.2 // indirect
132133
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
133134
github.com/decred/dcrd/crypto/blake256 v1.0.1 // indirect
134-
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
135135
github.com/decred/dcrd/lru v1.0.0 // indirect
136136
github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect
137137
github.com/dgraph-io/badger/v2 v2.2007.4 // indirect

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,8 @@ github.com/aws/aws-sdk-go v1.44.312/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8
279279
github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g=
280280
github.com/babylonchain/babylon v0.8.6-0.20240426101001-7778c798e236 h1:Ydna4VcP56xu1+zdgygqHdSCeMduZjuznVhr4exO5do=
281281
github.com/babylonchain/babylon v0.8.6-0.20240426101001-7778c798e236/go.mod h1:lfeASLNJgcUsX7LEns3HRUv0k+MjzcB2q2AMasfz38M=
282-
github.com/babylonchain/covenant-signer v0.0.0-20240426115954-38daee94636c h1:xiuGSRFVBv8Mf9svkl8evoV0trjkHe3k+NMdSh3nogo=
283-
github.com/babylonchain/covenant-signer v0.0.0-20240426115954-38daee94636c/go.mod h1:AD3XKyPFa4ZWOm3Zi4vx8rLp0gtuOMiSgPoiiAkaJtU=
282+
github.com/babylonchain/covenant-signer v0.0.0-20240507155851-64756e393be2 h1:v5h+81bOlENEw/cyXv/6+/5laUs/EOvxAfZTdWbOW5A=
283+
github.com/babylonchain/covenant-signer v0.0.0-20240507155851-64756e393be2/go.mod h1:alX7NoDE2m7gW4O17hLAsluU30P0XaP5RlThAco8Y9Q=
284284
github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
285285
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
286286
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=

itest/bitcoind_node_setup.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ func (h *BitcoindTestHandler) CreateWallet(walletName string, passphrase string)
8181
// last false on the list will create legacy wallet. This is needed, as currently
8282
// we are signing all taproot transactions by dumping the private key and signing it
8383
// on app level. Descriptor wallets do not allow dumping private keys.
84-
buff, _, err := h.m.ExecBitcoindCliCmd(h.t, []string{"createwallet", walletName, "false", "false", passphrase, "false", "false"})
84+
buff, _, err := h.m.ExecBitcoindCliCmd(h.t, []string{"createwallet", walletName, "false", "false", passphrase})
8585
require.NoError(h.t, err)
8686

8787
var response CreateWalletResponse

itest/containers/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ type ImageConfig struct {
1010
//nolint:deadcode
1111
const (
1212
dockerBitcoindRepository = "lncm/bitcoind"
13-
dockerBitcoindVersionTag = "v24.0.1"
13+
dockerBitcoindVersionTag = "v26.0"
1414
)
1515

1616
// NewImageConfig returns ImageConfig needed for running e2e test.

itest/e2e_test.go

Lines changed: 34 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"context"
88
"encoding/hex"
99
"fmt"
10+
"math"
1011
"testing"
1112
"time"
1213

@@ -74,8 +75,9 @@ func defaultStakingData() *stakingData {
7475
stakingAmount: btcutil.Amount(100000),
7576
stakingTime: 10000,
7677
stakingFeeRate: btcutil.Amount(5000), // feeRatePerKb
77-
unbondingTime: 100,
78-
unbondingFee: btcutil.Amount(10000),
78+
// TODO: Move those to global params
79+
unbondingTime: 100,
80+
unbondingFee: btcutil.Amount(10000),
7981
}
8082
}
8183

@@ -130,9 +132,7 @@ func StartManager(
130132
appConfig.Btc.Network = netParams.Name
131133

132134
magicBytes := []byte{0x0, 0x1, 0x2, 0x3}
133-
signerCfg, quorum, signingServer := startSigningServer(t, magicBytes)
134-
parsedSignerCfg, err := signerCfg.Parse()
135-
require.NoError(t, err)
135+
signerCfg, signerGlobalParams, signingServer := startSigningServer(t, magicBytes)
136136

137137
appConfig.Signer = *signerCfg
138138
appConfig.Db.Address = fmt.Sprintf("mongodb://%s", m.MongoHost())
@@ -141,8 +141,8 @@ func StartManager(
141141

142142
ver := services.ParsedVersionedGlobalParams{
143143
Version: 0,
144-
CovenantPks: parsedSignerCfg.PublicKeys,
145-
CovenantQuorum: quorum,
144+
CovenantPks: signerGlobalParams.Versions[0].CovenantPks,
145+
CovenantQuorum: signerGlobalParams.Versions[0].CovenantQuorum,
146146
Tag: magicBytes,
147147
}
148148

@@ -164,7 +164,7 @@ func StartManager(
164164

165165
err = client.UnlockWallet(60*60*60, passphrase)
166166
require.NoError(t, err)
167-
stakerPrivKey, err := client.DumpPrivateKey(walletAddress)
167+
stakerPrivKey, err := btcec.NewPrivateKey()
168168
require.NoError(t, err)
169169

170170
fpKey, err := btcec.NewPrivateKey()
@@ -187,8 +187,8 @@ func StartManager(
187187
bitcoindHandler: h,
188188
walletPass: passphrase,
189189
btcClient: client,
190-
covenantPublicKeys: parsedSignerCfg.PublicKeys,
191-
covenantQuorum: quorum,
190+
covenantPublicKeys: signerGlobalParams.Versions[0].CovenantPks,
191+
covenantQuorum: signerGlobalParams.Versions[0].CovenantQuorum,
192192
finalityProviderKey: fpKey,
193193
stakerAddress: walletAddress,
194194
stakerPrivKey: stakerPrivKey,
@@ -205,9 +205,8 @@ func StartManager(
205205
func startSigningServer(
206206
t *testing.T,
207207
magicBytes []byte,
208-
) (*config.RemoteSignerConfig, uint32, *signerservice.SigningServer) {
208+
) (*config.RemoteSignerConfig, *signerapp.ParsedGlobalParams, *signerservice.SigningServer) {
209209
appConfig := signercfg.DefaultConfig()
210-
logger := logger.DefaultLogger()
211210
appConfig.BtcNodeConfig.Host = "127.0.0.1:18443"
212211
appConfig.BtcNodeConfig.User = "user"
213212
appConfig.BtcNodeConfig.Pass = "pass"
@@ -263,31 +262,42 @@ func startSigningServer(
263262

264263
appConfig.Server.Host = host
265264
appConfig.Server.Port = port
266-
appConfig.Params.CovenantQuorum = quorum
267-
appConfig.Params.MagicBytes = hex.EncodeToString(magicBytes)
268-
appConfig.Params.W = 1
269-
appConfig.Params.CovenantPublicKeys = covenantPksStr
270-
271265
parsedconfig, err := appConfig.Parse()
272266
require.NoError(t, err)
273267

274268
// In e2e test we are using the same node for signing as for indexing functionalities
275269
chainInfo := signerapp.NewBitcoindChainInfo(client)
276-
// TODO: Use signer with psbt, this require some changes in tests
277-
signer := signerapp.NewPrivKeySigner(client)
278-
paramsGetter := signerapp.NewConfigParamsRetriever(parsedconfig.ParamsConfig)
270+
signer := signerapp.NewPsbtSigner(client)
271+
272+
signerGlobalParams := signerapp.ParsedGlobalParams{
273+
Versions: []*signerapp.ParsedVersionedGlobalParams{
274+
{
275+
Version: 0,
276+
ActivationHeight: 0,
277+
StakingCap: btcutil.Amount(100000000000),
278+
Tag: magicBytes,
279+
CovenantQuorum: quorum,
280+
CovenantPks: []*btcec.PublicKey{localCovenantKey1, localCovenantKey2},
281+
ConfirmationDepth: 1,
282+
UnbondingTime: 100,
283+
UnbondingFee: btcutil.Amount(10000),
284+
MinStakingTime: 1,
285+
MaxStakingTime: math.MaxUint16,
286+
MinStakingAmount: btcutil.Amount(1),
287+
MaxStakingAmount: btcutil.Amount(100000000000),
288+
},
289+
},
290+
}
279291

280292
app := signerapp.NewSignerApp(
281-
logger,
282293
signer,
283294
chainInfo,
284-
paramsGetter,
295+
&signerGlobalParams,
285296
netParams,
286297
)
287298

288299
server, err := signerservice.New(
289300
context.Background(),
290-
logger,
291301
parsedconfig,
292302
app,
293303
)
@@ -305,7 +315,7 @@ func startSigningServer(
305315
_ = server.Stop(context.TODO())
306316
})
307317

308-
return signerCfg, quorum, server
318+
return signerCfg, &signerGlobalParams, server
309319
}
310320

311321
type stakingTxSigInfo struct {

0 commit comments

Comments
 (0)