quorum icon indicating copy to clipboard operation
quorum copied to clipboard

Private contract extension: allow extension without extending storage

Open nmvalera opened this issue 3 years ago • 0 comments

Currently when extending a private smart contract to a new node, all smart contract account state is being pushed to the new node including address, balance, nonce, code, codeHash and storage.

This is a proposal to allow a user to possibly extend without extending the storage (only pushing address, balance, nonce, code and codeHash). This could be implemented as a 2nd option for the user when extending a contract.

The typical use case for this is

  • Node A and Node B have been sharing private transactions
  • At some point they want to send private transactions to Node C using the same smart contract code and address but do not want to share any data that was private between A & B

To achieve something similar with the current implementation, it requires to

  1. redeploy a new private instance of the contract between A, B & C
  2. have Node A & B implementing some off-chain logic to properly manage both instances

This can become a significant overhead when not 2 but several smart contract instances have to be deployed.

Acceptance Criteria

  • [ ] Update JSON-RPC Extension API to add a new argument to flag if it should share or not the storage
  • [ ] This should be taken into account in the Smart Contract extension implementation.
  • [ ] Investigate a way to handle in progress extension using the old contract (without flag) when upgrading to the new goQuorum version with new extension contract (maybe be able to capture both events, old and new with flag).
  • [ ] The node requesting the extension should not send the storage to Tessera and the extended node should be able to handle the extension without storage (when receiving the event that the extension is approved).
  • [ ] Backwards compatibility: check if we can re-use the same JSON-RPC and add a new optional argument; or create a new method that instead of arguments, receive an object for the extension arguments and other for tx arguments. Same should be applied for console (geth attach).

nmvalera avatar Dec 08 '20 16:12 nmvalera