Skip to content
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

Prevent overwriting of Mixnodes if the mixnode is already bonded #912

Closed
tommyv1987 opened this issue Nov 22, 2021 · 1 comment · Fixed by #917
Closed

Prevent overwriting of Mixnodes if the mixnode is already bonded #912

tommyv1987 opened this issue Nov 22, 2021 · 1 comment · Fixed by #917
Assignees
Labels
bug Something isn't working

Comments

@tommyv1987
Copy link
Contributor

tommyv1987 commented Nov 22, 2021

Given I (the end user) have a fresh mixnode and I bond such mixnode with the relevant information

  • Sphinx key
  • Host
  • Identity Key
  • Additional Options

Then after successfully bonding the node. I attempt to bond another node with the same identity, I can overwrite the keys when using the nymd client.

Then, in the same fashion as using the Nym Wallet, I should be prevented from attempting to bond another mixnode until I unbond the existing one.

An example of a result from bonding another mixnode whilst supplying the same identity_keys.

ExecuteResult { logs: [Log { msg_index: 0, events: [Event { kind: "message", attributes: [Attribute { key: "action", value: "execute" }, Attribute { key: "module", value: "wasm" }, Attribute { key: "signer", value: "punk..." }, Attribute { key: "contract_address", value: "punk..." }] }, Event { kind: "transfer", attributes: [Attribute { key: "recipient", value: "punk..." }, Attribute { key: "sender", value: "punk..." }, Attribute { key: "amount", value: "1500000000upunk" }] }, Event { kind: "wasm", attributes: [Attribute { key: "contract_address", value: "punkaddress" }, Attribute { key: "overwritten", value: "true" }] }] }], transaction_hash: transaction::Hash(HASH) }

We should prevent this from happening because it may have the ability to lose bonding amounts.

@tommyv1987 tommyv1987 added the bug Something isn't working label Nov 22, 2021
@jstuczyn jstuczyn self-assigned this Nov 24, 2021
@tommyv1987
Copy link
Contributor Author

Steps to test:

  • Build the latest mixnet contract off develop (where the code currently resides)
  • Run a validator instance
  • Upload the contract and instantiate the contract against the validator
  • Take note off all the relevant contract details
  • Create a test user (mnemonic - and punk address)
  • Make sure this user has available tokens to broadcast and perform the transaction (send tokens to this account from a respective wallet)
  • Have a mixnode ready to bond
    • Bond the mixnode on the first attempt - a successful log, and transaction is now on the chain
    • Now try with the same user to bond another node
      image

The contract fails, and the user is not allowed to bond another node.

Attempting then to bond a gateway also fails in the contract execution:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants