-
Notifications
You must be signed in to change notification settings - Fork 35
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
Peer Protocol for Contract Negotiation Specification #59
Conversation
* `contract_info`: ??? | ||
* `oracle_info`: ??? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can probably port over the way we do these in bitcoin-s?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it might depend on the discussion on oracle specifications. It could end up just being a URI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to think about multi-oracle support here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I'm thinking that will be the version 0 of them but I actually want these to be true TLV types that can very between number of oracles, kinds of oracles (multi-R values for example) etc. Same with contract info and others
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tracked here if I'm not mistaken: #61
- MUST reject the contract. | ||
- MUST NOT broadcast the funding transaction before receipt of a valid `sign_dlc`. | ||
- on receipt of a valid `sign_dlc`: | ||
- SHOULD broadcast the funding transaction. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add something about if the Initiator doesn't see the funding tx in a timely manner, they can exit the DLC by self-spending one of their funding inputs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that should be specified but I believe it belongs in its own doc similar to BOLT 5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should also include fee-bumping and such in that doc
Ichiro Kuwahara | ||
Thibaut Le Guilly | ||
Nadav Kohen | ||
[ FIXME: Add Authors ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still need the FIXME?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, all the BOLTs have this so I figured in this case I would put it here as unlike the tx doc others have worked on this pretty extensively previously
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks nice! Put quite some comments but maybe many things are just me being confused so sorry in advance if that's the case.
* `contract_info`: ??? | ||
* `oracle_info`: ??? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it might depend on the discussion on oracle specifications. It could end up just being a URI.
* [`u16`:`num_funding_inputs`] | ||
* [`num_funding_inputs*funding_input`:`funding_inputs`] | ||
* [`spk`:`change_spk`] | ||
* [`cet_signatures`:`cet_signatures`] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
again I feel here the type should be nb_cets*signature
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But we need a label on each signature to point it to what outcome it signs for no? Or I guess we could use ordering explicitly (like copying the structure of the contract info) but this would need to be added to the specification if this were the case. I'll probably hold off judgement until the PR where cet_signatures
as a TLV is defined.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I was assuming that the order of signatures and outcomes was corresponding, but I feel this is an acceptable assumption, as I can't think of a reason not to do that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to decide something on this. One reason I can think of to follow your approach is that we might have to split them in several messages in which case having the index can be practical.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* [`chain_hash`:`chain_hash`] | ||
* [`contract_info`:`contract_info`] | ||
* [`oracle_info`:`oracle_info`] | ||
* [`point`:`funding_pubkey`] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm guessing offer_dlc
assumes counterparty has already been established (whether off-chain or through an orderbook) since counterparty pubkey is required to derive funding_pubkey
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what you mean by
counterparty pubkey is required to derive
funding_pubkey
as I don't believe this is true.
Regardless though, yes this entire document assumes the existence of some kind of communication layer as is stated at the top of the Messaging doc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
funding_pubkey
is a 2-of-2 multisig Script right? So don't you need pubkey of both alice and bob to derive funding_pubkey
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
funding_pubkey
is just one party's public key (which is one of the two that goes into the funding script public key)
Note to self: This was just updated: niftynei/lightning-rfc#1 |
|
||
Various fundamental types are referred to in the message specifications: | ||
|
||
* `byte`: an 8-bit byte |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
signed or unsigned?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this question doesn't apply to byte
, it isn't a number, just 8 bits.
2. data: | ||
* [`byte`:`contract_flags`] | ||
* [`chain_hash`:`chain_hash`] | ||
* [`contract_info`:`contract_info`] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So how/where is "contract_info" specified? There is an assumption here that peers know how to parse/interpret contract_info? Do we need a similar spec for this just like we are talking about oracles in #55 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see #59 (comment)
Protocol.md
Outdated
* [`u32`:`contract_maturity_cltv`] | ||
* [`u32`:`contract_timeout_cltv`] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, Matt does have a good point. It might be nice to invalidate refund transactions when contract terms are updated. Perhaps we can use the Lightning penalty mechanism?
- the `chain_hash` value is set to a hash of a chain that is unknown to the receiver. | ||
- the `contract_info` refers to events unknown to the receiver. | ||
- the `oracle_info` refers to an oracle unknown to the receiver. | ||
- it considers `feerate_per_vb` too small for timely processing or unreasonably large. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this is implied here, but if the number of funding_inputs
is something ridiculous you should reject as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only time this would lead to a rejection is if the resulting funding transaction would not be valid so I'm not sure I need to say this? Will double check against Lisa's spec.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should have been more specific about what I meant by "valid". In this case I meant valid in terms of relay policy on the bitcoin p2p network. If you want more background on this you look at the AcceptToMemoryPool
(ATMP) logic in bitcoin core.
and you should definitely checkout this excellent discussion from @ariard about relay policies on the bitcoin network in the future
Protocol.md
Outdated
|
||
## Validation | ||
This message gives all of the initiator's the signatures, which allows the receiver |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit,: initiator
-> offerer
/maker
etc
* B fund amount: confirm that the fund amount matches what was agreed upon. | ||
- if any `signature` is incorrect: | ||
- MUST reject the contract. | ||
- MUST NOT broadcast the funding transaction before receipt of a valid `sign_dlc`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what happens if this is not followed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A free option
|
||
#### CET CSV Delay | ||
The number to use as input to the CSV in the [CETs](Transactions.md#outputs-1). | ||
- set undefined bits in `contract_flags` to 0. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Above you say they should be ignored, here you say they should be set to 0. Maybe change above to say that it should expect 0 and fail otherwise?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that in the current state it is easiest to implement this way but it should change before we have an official v0.1: #74
cf7e49e
to
e25275b
Compare
Re-wrote the Transactions specification to match the new adaptor signature based DLCs and to match the BOLT style.
It is not in its final state but it should be a good starting point to get merged in!
Related to #46
TODO: