-
Notifications
You must be signed in to change notification settings - Fork 112
Conversation
swap/cheque.go
Outdated
@@ -131,7 +131,7 @@ func (cheque *Cheque) verifyChequeProperties(p *Peer, expectedBeneficiary common | |||
return fmt.Errorf("wrong cheque parameters: expected contract: %x, was: %x", p.contractAddress, cheque.Contract) | |||
} | |||
|
|||
// the beneficiary is the owner of the counterparty swap contract | |||
// the beneficiary is the issuer of the counterparty swap contract |
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.
since a contract is not issued (unlike a cheque) i don't think the terminology change should be applied in this case
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 contract does not use the owner
terminology anymore. But you are correct that the contract is not issued (the "issuer" is the party allowed to issue cheques but not the "issuer" of the contract). allowed issuer
or issuing party
might be some option, but I think outside the context of a cheque we can also keep it as owner
on the go side.
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.
We can also consider cheque issuer
. I would not use the terminology owner
anymore, to avoid confusion.
Apart from that, I think this comment is somewhat confusing whatever naming we use, as in SWAP a beneficiary can at one point also be issuer (as is the case here). I would propose:
p.beneficiary
(to emphasize that this peer is not the beneficiary of the cheque) is the issuer of cheques of the counterparty swap contract.
Ideally, I would like peer.beneficiary
to be peer.counterpary
, as a counterparty can be both a beneficiary and an issuer. Right now, it looks as if a beneficiary becomes an issuer and that it is very confusing.
If we do that, the comment can just be the counterparty must have signed
.
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 will commit the changed comment, the beneficiary is the issuer of cheques of the counterparty swap contract
.
I replaced all instances just to be on the safe side, but I agree it depends on the context.
I agree that it's a bit confusing.
// the owner of this swap is the beneficiaryAddress | ||
// hence the owner of this swap would sign cheques with beneficiaryKey and receive cheques from ownerKey (or another party) which is NOT the owner of this swap | ||
// the issuer of this swap is the beneficiaryAddress | ||
// hence the issuer of this swap would sign cheques with beneficiaryKey and receive cheques from issuerKey (or another party) which is NOT the issuer of this swap |
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.
same as above: not convinced swap
or contract
can use the terminology of issued
like cheques can
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 confusion here has in my opinion not so much to do with renaming owner
to issuer
.
It underlines, IMO, that we have created somewhat of confusin situation due to naming:
Here we see again that an issuer can be also a beneficiary and vice versa. What makes it extra confusing here, is that in the Swarm source code (protocol.go:124
and peer.go:34
), we speak about the peer.beneficiary
as the counterparty and we set our own address and contract in the swap
struct. Whereas here, we are just doing it the other way around, saving the issuer
in the peer struct and the beneficiary in the swap
struct.
We have 4 parties to name properly:
- Counterparty Externally Owned account,
Currentlypeer.beneficiary
- Counterparty chequebook address,
Currentlypeer.contractAddress
- Our own Externally Owned account,
Currentlyswap.issuer.address
- Our own chequebook address
Currentlyswap.issuer.Contract
What do you think: is it worth spending time on attempting to find perfect names for those, or shall we just leave as it is, and accept that there can be ambiguity and that we risk making mistakes as in the function newTestSwapAndPeer
?
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 understand the cause of confusion, should I leave alone for now?.
Or should I refactor the comments?, I'm a bit confused.
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 would leave this one for now. I will bring it up as a point on the agenda for our next sync meeting!
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 am leaving a general comment here in order not to spam, but my overall impression is that we shouldn't use the term issuer
when talking about either the Swap
structure or making direct references to contracts (instead of cheques).
i am aware that issue #1553 does not state this, but i am objecting to it; to me, owner
still feels better suited to these cases.
tagging @Eknir as well as @ralph-pichler since they are the ones most familiar with the terminology used in the SCs. do they use the term owner
at all?
i will approve the PR if we are not in agreement on this and a case can be made for the opposing view 👍
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.
"Simplest" Swap has landed on master. Please rebase.
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.
Good first PR and sorry for the long comments!
I generally have the feeling, as expressed in the comments, that our naming is not always spot on and that this might create confusion. I remember though the wise words from @mortelli (ask him about this) and perhaps we should just move on and don't attempt to make the naming better.
Nevertheless, I think it is an improvement to rename issuer
to owner
, as owner
is not used anymore on the smart-contract side.
I approve the PR, as I think it is good, as is. We could perhaps make it better, but then I would like to assess the whole issue with regards to naming and not only talk about renaming owner
to issuer
.
swap/cheque.go
Outdated
@@ -131,7 +131,7 @@ func (cheque *Cheque) verifyChequeProperties(p *Peer, expectedBeneficiary common | |||
return fmt.Errorf("wrong cheque parameters: expected contract: %x, was: %x", p.contractAddress, cheque.Contract) | |||
} | |||
|
|||
// the beneficiary is the owner of the counterparty swap contract | |||
// the beneficiary is the issuer of the counterparty swap contract |
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.
We can also consider cheque issuer
. I would not use the terminology owner
anymore, to avoid confusion.
Apart from that, I think this comment is somewhat confusing whatever naming we use, as in SWAP a beneficiary can at one point also be issuer (as is the case here). I would propose:
p.beneficiary
(to emphasize that this peer is not the beneficiary of the cheque) is the issuer of cheques of the counterparty swap contract.
Ideally, I would like peer.beneficiary
to be peer.counterpary
, as a counterparty can be both a beneficiary and an issuer. Right now, it looks as if a beneficiary becomes an issuer and that it is very confusing.
If we do that, the comment can just be the counterparty must have signed
.
swap/swap.go
Outdated
// getContractOwner retrieve the owner of the chequebook at address from the blockchain | ||
func (s *Swap) getContractOwner(ctx context.Context, address common.Address) (common.Address, error) { | ||
// getContractIssuer retrieve the issuer of the chequebook at address from the blockchain | ||
func (s *Swap) getContractIssuer(ctx context.Context, address common.Address) (common.Address, error) { |
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.
You could make it: getIssuerAtContract
, or decide that we can cope with some ambiguity 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.
It makes more sense this way.
// the owner of this swap is the beneficiaryAddress | ||
// hence the owner of this swap would sign cheques with beneficiaryKey and receive cheques from ownerKey (or another party) which is NOT the owner of this swap | ||
// the issuer of this swap is the beneficiaryAddress | ||
// hence the issuer of this swap would sign cheques with beneficiaryKey and receive cheques from issuerKey (or another party) which is NOT the issuer of this swap |
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 confusion here has in my opinion not so much to do with renaming owner
to issuer
.
It underlines, IMO, that we have created somewhat of confusin situation due to naming:
Here we see again that an issuer can be also a beneficiary and vice versa. What makes it extra confusing here, is that in the Swarm source code (protocol.go:124
and peer.go:34
), we speak about the peer.beneficiary
as the counterparty and we set our own address and contract in the swap
struct. Whereas here, we are just doing it the other way around, saving the issuer
in the peer struct and the beneficiary in the swap
struct.
We have 4 parties to name properly:
- Counterparty Externally Owned account,
Currentlypeer.beneficiary
- Counterparty chequebook address,
Currentlypeer.contractAddress
- Our own Externally Owned account,
Currentlyswap.issuer.address
- Our own chequebook address
Currentlyswap.issuer.Contract
What do you think: is it worth spending time on attempting to find perfect names for those, or shall we just leave as it is, and accept that there can be ambiguity and that we risk making mistakes as in the function newTestSwapAndPeer
?
@@ -105,7 +105,7 @@ func (s *Swap) run(p *p2p.Peer, rw p2p.MsgReadWriter) error { | |||
protoPeer := protocols.NewPeer(p, rw, Spec) | |||
|
|||
handshake, err := protoPeer.Handshake(context.Background(), &HandshakeMsg{ | |||
ContractAddress: s.owner.Contract, | |||
ContractAddress: s.issuer.Contract, |
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 is exactly what I meant this morning in the call.
This is the handshake. At this point, two nodes are just exchanging contract addresses. We don't even know what balances there are (they might be 0 on both sides at this point!). Thus, I see it as incorrect to change this to issuer
. No cheques may have been issued at this point, thus no issuer exists. Furthermore, at this point both nodes could be the issuer of cheques! I think it does not make sense to introduce this change 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.
i agree.
if we don't want to use owner
for reasons of consistency with the smart contracts, we can find another word.
in any case, the golang context is different from the SC context, so it wouldn't bother me if we were to use additional terms on either side that the other side doesn't.
i'd just insist on using the same terms when referring to the same entities, specially in variables or fields.
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 have to say that at this point, i am not sure of how to move forward here.
i cannot approve this PR, nor request changes, since it seems many of us have different opinions on what each thing should be named.
i am officially requesting commentary/thoughts on how to proceed in this case: from @holisticode due to being the track lead, and/or @vojtechsimetka due to being the issue creator.
@@ -116,7 +116,7 @@ func (cheque *Cheque) verifyChequeProperties(p *Peer, expectedBeneficiary common | |||
return fmt.Errorf("wrong cheque parameters: expected contract: %x, was: %x", p.contractAddress, cheque.Contract) | |||
} | |||
|
|||
// the beneficiary is the owner of the counterparty swap contract | |||
// the beneficiary is the issuer of cheques of the counterparty swap contract. | |||
if err := cheque.VerifySig(p.beneficiary); err != nil { |
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 if i understand this correctly, the mentioned counterparty
here would be the peer p
, right?
i find it confusing to call this beneficiary
, as it could be interpreted as the address this peer writes cheques to or the address this peer wants its cheques written to just as well.
also: remove .
from this comment
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.
Agree about beneficiary
being confusing. I would change it to p.counterparty
@@ -105,7 +105,7 @@ func (s *Swap) run(p *p2p.Peer, rw p2p.MsgReadWriter) error { | |||
protoPeer := protocols.NewPeer(p, rw, Spec) | |||
|
|||
handshake, err := protoPeer.Handshake(context.Background(), &HandshakeMsg{ | |||
ContractAddress: s.owner.Contract, | |||
ContractAddress: s.issuer.Contract, |
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.
if we don't want to use owner
for reasons of consistency with the smart contracts, we can find another word.
in any case, the golang context is different from the SC context, so it wouldn't bother me if we were to use additional terms on either side that the other side doesn't.
i'd just insist on using the same terms when referring to the same entities, specially in variables or fields.
@@ -47,7 +47,7 @@ func TestHandshake(t *testing.T) { | |||
t.Fatal(err) | |||
} | |||
// setup the protocolTester, which will allow protocol testing by sending messages | |||
protocolTester := p2ptest.NewProtocolTester(swap.owner.privateKey, 2, swap.run) |
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.
same here, as commented above (i will refrain from repeating it from here onwards)
Owner to Issuer is not agreed on by consensus. |
Can we close this PR and address the proposed changes here in the upcoming rename PR? |
This PR was closed due to the outdated changes between this code and the latest additions of ERC20 and Swap Factory. It makes more sense to branch of master, and then include the comments that were provided in this PR. |
Resolves Issue #1553
Changes Owner for Issuer, So the terminology is the same as the Smart Contract.