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

@@ -6,23 +6,11 @@ import (
arkv1 "github.com/ark-network/ark/api-spec/protobuf/gen/ark/v1"
"github.com/ark-network/ark/common"
"github.com/ark-network/ark/server/internal/core/application"
"github.com/ark-network/ark/server/internal/core/domain"
"github.com/decred/dcrd/dcrec/secp256k1/v4"
)
func parseTxs(txs []string) ([]string, error) {
if len(txs) <= 0 {
return nil, fmt.Errorf("missing list of forfeit txs")
}
// TODO abstract this ?
// for _, tx := range txs {
// if _, err := psetv2.NewPsetFromBase64(tx); err != nil {
// return nil, fmt.Errorf("invalid tx format")
// }
// }
return txs, nil
}
func parseAddress(addr string) (string, *secp256k1.PublicKey, *secp256k1.PublicKey, error) {
if len(addr) <= 0 {
return "", nil, nil, fmt.Errorf("missing address")
@@ -30,19 +18,31 @@ func parseAddress(addr string) (string, *secp256k1.PublicKey, *secp256k1.PublicK
return common.DecodeAddress(addr)
}
func parseInputs(ins []*arkv1.Input) ([]domain.VtxoKey, error) {
func parseInputs(ins []*arkv1.Input) ([]application.Input, error) {
if len(ins) <= 0 {
return nil, fmt.Errorf("missing inputs")
}
vtxos := make([]domain.VtxoKey, 0, len(ins))
inputs := make([]application.Input, 0, len(ins))
for _, input := range ins {
vtxos = append(vtxos, domain.VtxoKey{
Txid: input.GetTxid(),
VOut: input.GetVout(),
if input.GetBoardingInput() != nil {
desc := input.GetBoardingInput().GetDescriptor_()
inputs = append(inputs, application.Input{
Txid: input.GetBoardingInput().GetTxid(),
Index: input.GetBoardingInput().GetVout(),
Descriptor: desc,
})
continue
}
inputs = append(inputs, application.Input{
Txid: input.GetVtxoInput().GetTxid(),
Index: input.GetVtxoInput().GetVout(),
})
}
return vtxos, nil
return inputs, nil
}
func parseReceivers(outs []*arkv1.Output) ([]domain.Receiver, error) {