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

feature: add outbound-liquidity auction market, bidder pays for channel acceptance #390

Merged
merged 7 commits into from
Oct 27, 2022

Conversation

positiveblue
Copy link
Contributor

@positiveblue positiveblue commented Sep 22, 2022

Allow the submission of orders for different auction markets. Expand the current auctions, bidder pays for inbound liquidity, with another market where the bidder pays for channel acceptor, outbound liquidity.

To be able to participate in the new auctions:
The asker needs to:

  • Set auction type to BTCOutboundLiquidity
  • Set order amt to 100K (BaseSupply)
  • Set min_chan_size to 100k or more. This will take into account the bidders funding supply.

The bidder needs to:

  • Set auction type to BTCOutboundLiquidity
  • Set order amt to 100K (BaseSupply)
  • Set self_chan_balance to 100k or more.

Sidecar tickets are not supported yet for this new market.

NOTE: Only the last 5 commits need to be reviewed in this PR

Copy link
Member

@guggero guggero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did a quick pass, looks almost ready. Nice go get this with such a small diff.

order/interfaces.go Outdated Show resolved Hide resolved
order/interfaces.go Outdated Show resolved Hide resolved
order/interfaces.go Outdated Show resolved Hide resolved
order/batch_verifier.go Outdated Show resolved Hide resolved
@guggero guggero changed the title feature: new auciton markets (outbound liquidity) feature: new auction markets (outbound liquidity) Sep 23, 2022
@dstadulis
Copy link
Contributor

after we get ZC and unannounced channels merged, we'll need 2x review on this with Roas to cap it out

@guggero
Copy link
Member

guggero commented Sep 28, 2022

Should be rebased on the compressed/combined ZC PR.

@lightninglabs-deploy
Copy link
Collaborator

@positiveblue, remember to re-request review from reviewers when ready

@positiveblue positiveblue force-pushed the new-auction-type branch 3 times, most recently from dd2a017 to 695bdfb Compare October 6, 2022 14:48
@positiveblue positiveblue requested a review from guggero October 6, 2022 14:51
Copy link
Member

@guggero guggero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got a few more comments, but we're very close!

order/interfaces.go Outdated Show resolved Hide resolved
cmd/pool/order.go Show resolved Hide resolved
cmd/pool/order.go Outdated Show resolved Hide resolved
order/interfaces.go Show resolved Hide resolved
cmd/pool/order.go Show resolved Hide resolved
cmd/pool/order.go Show resolved Hide resolved
@positiveblue positiveblue force-pushed the new-auction-type branch 3 times, most recently from 7222d26 to 0a8ef8d Compare October 7, 2022 15:07
@positiveblue positiveblue requested a review from guggero October 7, 2022 15:07
Copy link
Member

@guggero guggero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, great work 🎉

docs/orders.md Outdated Show resolved Hide resolved
@positiveblue positiveblue force-pushed the new-auction-type branch 2 times, most recently from c42a99a to 0afb46c Compare October 10, 2022 13:15
@dstadulis dstadulis changed the title feature: new auction markets (outbound liquidity) feature: add outbound-liquidity auction market, bidder pays for channel acceptance Oct 10, 2022
@positiveblue positiveblue requested a review from Roasbeef October 11, 2022 16:41
positiveblue pushed a commit to positiveblue/pool that referenced this pull request Oct 11, 2022
…-status

status: add `update status` endpoint
Copy link
Member

@Roasbeef Roasbeef left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did an initial pass, but tbh I'm still working to get an accurate mental model in my head of: the way the new feee accounting works, and scenarios in which a buyer/seller would want to enter into this new engagement.

Would be it be accurate to say that (assuming a fixed number of connection slots), this lets a party sell/auction off an inbound (from their PoV) connection/channel slot?

clientdb/order_test.go Show resolved Hide resolved
order/interfaces.go Outdated Show resolved Hide resolved
rpcserver.go Show resolved Hide resolved
rpcserver.go Show resolved Hide resolved
rpcserver.go Show resolved Hide resolved
auctionType := ourOrder.Details().AuctionType
if auctionType == order.BTCOutboundLiquidity {
premiumAmt += btcutil.Amount(
selfChanBalance,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In most cases though, we expect the channel amount to be nothing, and the actual value being the self channel balance right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly, for the BTCOutboundLiquiditythe chan amount needs to be always 100k (1 unit). This way we can roll it out and check the demand for this feature without having to make big refactor

order/batch_verifier_test.go Show resolved Hide resolved
order/tradingfees.go Outdated Show resolved Hide resolved
Comment on lines +1406 to +1407
return fmt.Errorf("to participate in the outbound liquidity " +
"market the order amt should be exactly 100k sats")
Copy link
Contributor

@ffranr ffranr Oct 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This error message talks about amount whereas the if conditional examines units. I expected something like:

if o.Details().AuctionType == order.BTCOutboundLiquidity &&
	o.Details().Amt != order.BaseSupplyUnit {
        return fmt.Errorf("to participate in the outbound liquidity " +
			"market the order amt should be exactly the base supply amount (%v sats)", order.BaseSupplyUnit)
}

Does that seem reasonable?

EDIT: FYI, I've just noticed that testing on amt would mirror this change:
https://github.com/lightninglabs/pool/pull/390/files#diff-60f9a53c1dcbdd7baee29e9e4ae17725d00da191f07abcc50f9e3c035c87c247R509

cmd/pool/order.go Outdated Show resolved Hide resolved
cmd/pool/order.go Outdated Show resolved Hide resolved
Comment on lines +206 to +209
case ourOrder.Details().AuctionType != BTCOutboundLiquidity &&
unitsFilled < ourOrder.Details().MinUnitsMatch:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these lines are correct. I suppose that if the bid is for oubound liquidity only a single unit will be filled. I wound consider adding a comment.

Further, I wander whether a third case is necessary:

		case ourOrder.Details().AuctionType == BTCOutboundLiquidity &&
			unitsFilled == 1

order/interfaces.go Outdated Show resolved Hide resolved
Copy link
Contributor

@ffranr ffranr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've left a few comments around the parts which I'm uncertain about.

Copy link
Member

@Roasbeef Roasbeef left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🐞

defaultAuctionType = auctionTypeInboundLiquidity

submitOrderDescription = `
Submit a new order in the given market. Currently, Pool supports two
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great description 👍

@positiveblue positiveblue requested a review from ffranr October 27, 2022 14:51
@positiveblue positiveblue merged commit 45faa2f into master Oct 27, 2022
@guggero guggero deleted the new-auction-type branch October 27, 2022 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants