rooch-network / rooch

VApp Container with Move Language
https://rooch.network
Apache License 2.0
140 stars 64 forks source link

[Framework] Store Move packages meta on-chain #704

Open pause125 opened 10 months ago

pause125 commented 10 months ago

There may have some meta infomations of Move packages to be stored on-chain.

For example, the upgrading policy. There are two basic policies: compatible, immutable. We need to store the configurations on-chain and check every time publish modules.

jolestar commented 10 months ago

Should we also store the source on-chain?

pause125 commented 10 months ago

Should we also store the source on-chain?

I think this should be optional? Maybe some projects don't want to open source.

pause125 commented 1 month ago

The designed fields of package meta:

/// Metadata for a package.
struct PackageMetadata has store, drop {
    /// The upgrade policy.
    upgrade_policy: UpgradePolicy,
    /// The upgrade version.
    version: u64,
    /// The module bytes in this package.
    modules: vector<vector<u8>>,
}

Any other ideas? Do we need consider adding new fields of this struct? @jolestar

jolestar commented 1 month ago

Add struct field will break the compatibility.

Add PackageMetadata to the Package's dynamic field?

Keep all modules in PackageMetada is not a good idea. We can continue to keep the modules as package dynamic fields.

pause125 commented 1 month ago
  1. So we'd better think about what other fields we can put in PackageMetadata
  2. I think it's suitable to add PackageMetadata to the Package's dynamic field.
  3. modules here means the module source code.
pause125 commented 1 month ago

Maybe there's no need to define a new PackageMetadata struct. We can add each meta as Package's dynamic field. In this way, it will be easy to add more meta field in the future if needed.

jolestar commented 1 month ago

The source code can use the module_name.move as the key of the dynamic field.