go-perun
go-perun copied to clipboard
☂️ Beauty fixes
List of oddities that we noticed in go-perun will be collected here for triage:
- [ ] 1.
channel.Nonceis modelled as a*big.Intbut describes a[]bytewhich can cause issues with negative number encoding. - [ ] 2.
NewFundingReqreturns a*FundingReq(per convention) butFunder.Fundaccepts aFundingReq. - [ ] 3. eth/Backend.VerifySignature contains a superfluous
if - [x] 4.
wallet.Addressneeds only to be anEncoder, notSerializer. Decoding is handled by the backend anyway. (Done in #194) - [x] 5.
channel/backend.Verifygets passed inParamsbut expects the implementation to ignore them (Done in #196). - [ ] 6.
Params.IDshould be calculated on the fly to avoid inconsistencies. Members of Params are exported, but should be read only (TBD #188). - [ ] 7.
AdjudicatorReq.AccandAdjudicatorReq.Idxare not needed forAdjudicator.Register. We could createtype RegisterReqspecifically for registering. - [ ] 9.
Adjudicator.Withdrawcould take the beneficiary as a parameter. (Currently, the beneficiary is a property of the adjudicator.) - [ ] 10. Add custom errors to the wallet interface: eg.
ErrAccountNotFoundorErrWrongAddrType. - [ ] 11. Add
NewAssetFundingErrorsince we also haveNewFundingTimeoutErrorand they need each other. - [ ] 12. Add
NewAdjudicatorReq. - [ ]
WithCommitTxis missing a comment. - [ ]
local/watcher.gocontains two wrong usages ofDebugf
Please extend this list.
:point_right: Related issues will be moved to Milestone Beautification.
Params.IDshould be calculated on the fly to avoid inconsistencies. Members ofParamsare exported, but should be read only.AdjudicatorReq.AccandAdjudicatorReq.Idxare not needed forAdjudicator.Register. We could createtype RegisterReqspecifically for registering.Adjudicator.Withdrawcould take the beneficiary as a parameter. (Currently, the beneficiary is a property of the adjudicator.)
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.
* `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.
I added the entries to the issue. Feel free to edit the issue next time.