New boarding protocol (#279)

* [domain] add reverse boarding inputs in Payment struct

* [tx-builder] support reverse boarding script

* [wallet] add GetTransaction

* [api-spec][application] add reverse boarding support in covenantless

* [config] add reverse boarding config

* [api-spec] add ReverseBoardingAddress RPC

* [domain][application] support empty forfeits txs in EndFinalization events

* [tx-builder] optional connector output in round tx

* [btc-embedded] fix getTx and taproot finalizer

* whitelist ReverseBoardingAddress RPC

* [test] add reverse boarding integration test

* [client] support reverse boarding

* [sdk] support reverse boarding

* [e2e] add sleep time after faucet

* [test] run using bitcoin-core RPC

* [tx-builder] fix GetSweepInput

* [application][tx-builder] support reverse onboarding in covenant

* [cli] support reverse onboarding in covenant CLI

* [test] rework integration tests

* [sdk] remove onchain wallet, replace by onboarding address

* remove old onboarding protocols

* [sdk] Fix RegisterPayment

* [e2e] add more funds to covenant ASP

* [e2e] add sleeping time

* several fixes

* descriptor boarding

* remove boarding delay from info

* [sdk] implement descriptor boarding

* go mod tidy

* fixes and revert error msgs

* move descriptor pkg to common

* add replace in go.mod

* [sdk] fix unit tests

* rename DescriptorInput --> BoardingInput

* genrest in SDK

* remove boarding input from domain

* remove all "reverse boarding"

* rename "onboarding" ==> "boarding"

* remove outdate payment unit test

* use tmpfs docker volument for compose testing files

* several fixes
This commit is contained in:
Louis Singer
2024-09-04 19:21:26 +02:00
committed by GitHub
parent 8cba9c9d42
commit 4da76ec88b
113 changed files with 5627 additions and 4430 deletions

View File

@@ -21,14 +21,15 @@ const (
)
type storeData struct {
AspUrl string `json:"asp_url"`
AspPubkey string `json:"asp_pubkey"`
WalletType string `json:"wallet_type"`
ClientType string `json:"client_type"`
Network string `json:"network"`
RoundLifetime string `json:"round_lifetime"`
UnilateralExitDelay string `json:"unilateral_exit_delay"`
MinRelayFee string `json:"min_relay_fee"`
AspUrl string `json:"asp_url"`
AspPubkey string `json:"asp_pubkey"`
WalletType string `json:"wallet_type"`
ClientType string `json:"client_type"`
Network string `json:"network"`
RoundLifetime string `json:"round_lifetime"`
UnilateralExitDelay string `json:"unilateral_exit_delay"`
MinRelayFee string `json:"min_relay_fee"`
BoardingDescriptorTemplate string `json:"boarding_descriptor_template"`
}
func (d storeData) isEmpty() bool {
@@ -43,27 +44,29 @@ func (d storeData) decode() store.StoreData {
buf, _ := hex.DecodeString(d.AspPubkey)
aspPubkey, _ := secp256k1.ParsePubKey(buf)
return store.StoreData{
AspUrl: d.AspUrl,
AspPubkey: aspPubkey,
WalletType: d.WalletType,
ClientType: d.ClientType,
Network: network,
RoundLifetime: int64(roundLifetime),
UnilateralExitDelay: int64(unilateralExitDelay),
MinRelayFee: uint64(minRelayFee),
AspUrl: d.AspUrl,
AspPubkey: aspPubkey,
WalletType: d.WalletType,
ClientType: d.ClientType,
Network: network,
RoundLifetime: int64(roundLifetime),
UnilateralExitDelay: int64(unilateralExitDelay),
MinRelayFee: uint64(minRelayFee),
BoardingDescriptorTemplate: d.BoardingDescriptorTemplate,
}
}
func (d storeData) asMap() map[string]string {
return map[string]string{
"asp_url": d.AspUrl,
"asp_pubkey": d.AspPubkey,
"wallet_type": d.WalletType,
"client_type": d.ClientType,
"network": d.Network,
"round_lifetime": d.RoundLifetime,
"unilateral_exit_delay": d.UnilateralExitDelay,
"min_relay_fee": d.MinRelayFee,
"asp_url": d.AspUrl,
"asp_pubkey": d.AspPubkey,
"wallet_type": d.WalletType,
"client_type": d.ClientType,
"network": d.Network,
"round_lifetime": d.RoundLifetime,
"unilateral_exit_delay": d.UnilateralExitDelay,
"min_relay_fee": d.MinRelayFee,
"boarding_descriptor_template": d.BoardingDescriptorTemplate,
}
}
@@ -100,14 +103,15 @@ func (s *Store) GetDatadir() string {
func (s *Store) AddData(ctx context.Context, data store.StoreData) error {
sd := &storeData{
AspUrl: data.AspUrl,
AspPubkey: hex.EncodeToString(data.AspPubkey.SerializeCompressed()),
WalletType: data.WalletType,
ClientType: data.ClientType,
Network: data.Network.Name,
RoundLifetime: fmt.Sprintf("%d", data.RoundLifetime),
UnilateralExitDelay: fmt.Sprintf("%d", data.UnilateralExitDelay),
MinRelayFee: fmt.Sprintf("%d", data.MinRelayFee),
AspUrl: data.AspUrl,
AspPubkey: hex.EncodeToString(data.AspPubkey.SerializeCompressed()),
WalletType: data.WalletType,
ClientType: data.ClientType,
Network: data.Network.Name,
RoundLifetime: fmt.Sprintf("%d", data.RoundLifetime),
UnilateralExitDelay: fmt.Sprintf("%d", data.UnilateralExitDelay),
MinRelayFee: fmt.Sprintf("%d", data.MinRelayFee),
BoardingDescriptorTemplate: data.BoardingDescriptorTemplate,
}
if err := s.write(sd); err != nil {

View File

@@ -13,14 +13,15 @@ const (
)
type StoreData struct {
AspUrl string
AspPubkey *secp256k1.PublicKey
WalletType string
ClientType string
Network common.Network
RoundLifetime int64
UnilateralExitDelay int64
MinRelayFee uint64
AspUrl string
AspPubkey *secp256k1.PublicKey
WalletType string
ClientType string
Network common.Network
RoundLifetime int64
UnilateralExitDelay int64
MinRelayFee uint64
BoardingDescriptorTemplate string
}
type ConfigStore interface {

View File

@@ -18,14 +18,15 @@ func TestStore(t *testing.T) {
key, _ := btcec.NewPrivateKey()
ctx := context.Background()
testStoreData := store.StoreData{
AspUrl: "localhost:7070",
AspPubkey: key.PubKey(),
WalletType: wallet.SingleKeyWallet,
ClientType: client.GrpcClient,
Network: common.LiquidRegTest,
RoundLifetime: 512,
UnilateralExitDelay: 512,
MinRelayFee: 300,
AspUrl: "localhost:7070",
AspPubkey: key.PubKey(),
WalletType: wallet.SingleKeyWallet,
ClientType: client.GrpcClient,
Network: common.LiquidRegTest,
RoundLifetime: 512,
UnilateralExitDelay: 512,
MinRelayFee: 300,
BoardingDescriptorTemplate: "tr(0250929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0,{ and(pk(873079a0091c9b16abd1f8c508320b07f0d50144d09ccd792ce9c915dac60465), pk(USER)), and(older(604672), pk(USER)) })",
}
tests := []struct {