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

Upgradable ContractsInfo type #1654

Closed
3 tasks done
bvrooman opened this issue Feb 10, 2024 · 1 comment
Closed
3 tasks done

Upgradable ContractsInfo type #1654

bvrooman opened this issue Feb 10, 2024 · 1 comment
Assignees

Comments

@bvrooman
Copy link
Contributor

bvrooman commented Feb 10, 2024

Background

The ContractsInfo type is current the tuple (Salt, Bytes32) where the Salt records the salt used to create the contract, and the Bytes32 is the Merkle root of the given contract. The salt is non-protocol level data, while the Merkle root is protocol level data. This coupling of non-protocol and protocol level data is unnecessary, and we can decouple these data points.

Solution

One solution stems from recognizing that we do not need to store the Merkle root in on-chain storage. During CROO execution, we can instead recalculate the contract's Merkle root from the contract data loaded from storage. This removes the dependency on ContractInfo during CROO and other on-chain operations. We can then remove the Merkle root from the ContractsInfo type and store only the salt, allowing ContractsInfo to be an off-chain only data type.

With the simplified ContractsInfo type, we can apply the versioned enum idiom to allow simple upgrades.

Criteria

@xgreenx
Copy link
Collaborator

xgreenx commented Mar 4, 2024

I'm closing this issue as fixed. The last sub-task will be done in a separate issue #1721

@xgreenx xgreenx closed this as completed Mar 4, 2024
crypto523 added a commit to crypto523/fuel-core that referenced this issue Oct 7, 2024
…on-chain storage (#1657)

Related issues:
- FuelLabs/fuel-core#1654

---------

Co-authored-by: xgreenx <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants