Skip to content
This repository has been archived by the owner on Aug 2, 2021. It is now read-only.

Bytecode / contract verification #1641

Closed
Eknir opened this issue Aug 2, 2019 · 2 comments · Fixed by #1803
Closed

Bytecode / contract verification #1641

Eknir opened this issue Aug 2, 2019 · 2 comments · Fixed by #1803

Comments

@Eknir
Copy link
Contributor

Eknir commented Aug 2, 2019

Dependent on: ethersphere/swap-swear-and-swindle#71

This is related to the chequebook payment module implementation:
After we connect and decide to use the chequebook as a payment module implementation, we should verify whether the bytecode at the counterparty's cheqeubook address matches with the expected bytecode of the chequebook implementation.
Checking only the bytecode is not enough: we should verify the content of relevant state variables, as these can be set during deployment to a value which prevents us from cashing out our cheques.

Example: if cheque.paidOut is set to MAX_UINT, no cheque can ever be cashed out.

Possible solutions are:

  • Reading the value of relevant state variables at handshake and make sure they are as expected.
  • Making an on-chain factory which deploys smart-contracts and keeps track of deployed smart-contracts. Hard-code the address of the factory in the code and at handShake verify whether the chequebook contract is deployed by the factory.
@ralph-pichler
Copy link
Member

same as #1583?

@Eknir
Copy link
Contributor Author

Eknir commented Aug 2, 2019

Quoting a conversation from: https://github.com/ethersphere/swarm/pull/1637/files

I don't really object, but if you remove a TODO it must be clear that it will be done later and not be forgot. So if for you it is clear that this is part of #1641, I am fine removing it. Otherwise make an additional note in the issue.

BTW. It's not necessarily a bad practice to leave a couple of TODOs in the code.

This one should actually be changed: it is already a package level function, it's the SimpleSwapBin argument which is missing.

Related to the TODO which was deleted: // TODO: have this as a package level function and pass the SimpleSwapBin as argument

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants