You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Background
The
ContractsInfo
type is current the tuple(Salt, Bytes32)
where theSalt
records the salt used to create the contract, and theBytes32
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 onContractInfo
duringCROO
and other on-chain operations. We can then remove the Merkle root from theContractsInfo
type and store only the salt, allowingContractsInfo
to be anoff-chain
only data type.With the simplified
ContractsInfo
type, we can apply the versioned enum idiom to allow simple upgrades.Criteria
ContractsInfo
table infuel-vm
(feat: Remove ContractsInfo FuelLabs/fuel-vm#673)CROO
, the contract's root is recalculated reading the contract data from storage and applying the root calculation (feat: Remove ContractsInfo FuelLabs/fuel-vm#673)ContractsInfo
type is versioned using an enum (feat: Remove ContractsInfo FuelLabs/fuel-vm#673)fuel-core
is updated to use the versioned type of theContractsInfo
table (feat: AddContractInfo
table and versionableContractInfoType
to on-chain storage FuelLabs/fuel-core#1657)最初由 @bvrooman 在 FuelLabs/fuel-core#1654 发布
The text was updated successfully, but these errors were encountered: