onflow / onflow/cadence

Checking Smart Contract Versions before Execution

Open
#263 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Feature Feedback
Dominant language
Go
Stars
548
Forks
152
Avg merge
1h 15m
Merged PRs (30d)
1

Description

Issue To Be Solved

Scenario: I'm a user that has signed a transaction to do something involving a smart contract. But, between the time that I sign the tx and the time that the tx is executed, that smart contract gets updated. There is a very good chance that I'd actually want my transaction to automatically abort, so that I can see what has changed about that smart contract, and then either re-authorize (or not!) based on my findings.

Possible Solution

It should be the case that a tx (or script) can include a list of smart contracts with some kind of "version identifier" (possibly a version number, possibly the content hash of the contract code) that the tx expects to see. If any of the listed smart contracts have versions differing from the given version numbers at the time that the tx is executed, the tx is aborted before it even starts (still paying the inclusion fee, of course).

On the client side, it would be ideal if we could provide a mechanism in the SDK to do some basic static analysis of the smart contract to automatically create this list for all smart contracts that are referenced by the contract. This would be impossible to do for references that go "through" an interface, but I think that this should be fine. If you are calling through a polymorphic interface, you are explicitly allowing the interaction to be mediated by the interface definition, and not the static type of the object. (Although, if the interface definition changed versions, you'd probably still want to abort...)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files, tests, or entry points are identified. Start by reviewing how transactions and scripts reference smart contracts, then examine the SDK discussion in the issue. Done would require an agreed version-identifier design and defined abort behavior when a referenced contract changes before execution.

Written by the indexing model from the issue text.

Assessment

Tech stack
blockchain
Domain
blockchain
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.