go-perun icon indicating copy to clipboard operation
go-perun copied to clipboard

☂️ Beauty fixes

Open ggwpez opened this issue 4 years ago • 4 comments

List of oddities that we noticed in go-perun will be collected here for triage:

  • [ ] 1. channel.Nonce is modelled as a *big.Int but describes a []byte which can cause issues with negative number encoding.
  • [ ] 2. NewFundingReq returns a *FundingReq (per convention) but Funder.Fund accepts a FundingReq.
  • [ ] 3. eth/Backend.VerifySignature contains a superfluous if
  • [x] 4. wallet.Address needs only to be an Encoder, not Serializer. Decoding is handled by the backend anyway. (Done in #194)
  • [x] 5. channel/backend.Verify gets passed in Params but expects the implementation to ignore them (Done in #196).
  • [ ] 6. Params.ID should be calculated on the fly to avoid inconsistencies. Members of Params are exported, but should be read only (TBD #188).
  • [ ] 7. AdjudicatorReq.Acc and AdjudicatorReq.Idx are not needed for Adjudicator.Register. We could create type RegisterReq specifically for registering.
  • [ ] 9. Adjudicator.Withdraw could take the beneficiary as a parameter. (Currently, the beneficiary is a property of the adjudicator.)
  • [ ] 10. Add custom errors to the wallet interface: eg. ErrAccountNotFound or ErrWrongAddrType.
  • [ ] 11. Add NewAssetFundingError since we also have NewFundingTimeoutError and they need each other.
  • [ ] 12. Add NewAdjudicatorReq.
  • [ ] WithCommitTx is missing a comment.
  • [ ] local/watcher.go contains two wrong usages of Debugf

Please extend this list.
:point_right: Related issues will be moved to Milestone Beautification.

ggwpez avatar Sep 06 '21 09:09 ggwpez

  • Params.ID should be calculated on the fly to avoid inconsistencies. Members of Params are exported, but should be read only.
  • AdjudicatorReq.Acc and AdjudicatorReq.Idx are not needed for Adjudicator.Register. We could create type RegisterReq specifically for registering.
  • Adjudicator.Withdraw could take the beneficiary as a parameter. (Currently, the beneficiary is a property of the adjudicator.)

matthiasgeihs avatar Sep 06 '21 12:09 matthiasgeihs

Do you think we should rename AdjudicatgorSubscription to AdjudicatorSub ? This would make it more concise and also in line with the name of other type AdjudicatorReq.

manoranjith avatar Sep 13 '21 07:09 manoranjith

* `Params.ID` should be calculated on the fly to avoid inconsistencies. Members of `Params` are exported, but should be read only.

* `AdjudicatorReq.Acc` and `AdjudicatorReq.Idx` are not needed for `Adjudicator.Register`. We could create `type RegisterReq` specifically for registering.

* `channel.MakeStateMap` could accept parameter `states ...*State`.

* `Adjudicator.Withdraw` could take the beneficiary as a parameter. (Currently, the beneficiary is a property of the adjudicator.)

+1 Especially on ReqisterReq and beneficiary parameter for Withdraw.

In the watcher task, I currently fill dummy values for Acc and Idx, because I figured out this fields are not used. Doing otherwise meant, I will have to provide this data to the watcher via a the StartWatching API. Which was unnecessary.

manoranjith avatar Sep 13 '21 07:09 manoranjith

I added the entries to the issue. Feel free to edit the issue next time.

ggwpez avatar Sep 13 '21 07:09 ggwpez