Question
We have created a smart contract which contains dependencies from other contracts which fully compiles and all of our logic passes our tests (we never call the dependency during tests)... now, we'd like to deploy to testnet/mainnet, and so we use sui client publish, however this then will try to compile our dependencies. this leads to a very large amount of unbound module alias errors when it tries to compile the dependencies... is there any way to circumvent this? I've tried the flags --with-unpublished-dependencies and --skip-dependency-verification
Discussion
- TL:DR - Questions are primarily around publishing flow, toml configs, and how to create shared object, data model of third-party public functions, and PTBs. Request for a open repository with examples.
- Support an intermediate contract to a third party. When compiling this contract ran into hundreds of dependency error messages. Contract simply collect any fees and then call the third party where dependency issues happened. Never properly tested the third party because a lot of setup is needed to make that happen. When publishing on Testnet, calling sui client publish.
- 3 different toml files is required today which Sui intends to address. This is also needed today also due to the third party contract’s structure. Will try to abstract away numerical addresses from developers. There is a full on 3rd party client. Try to perform sui publish have to specify the tunnel in a particular way.
- The dependency error is that there is no specification on where it should be published. When one does package upgrade, the address to publish to will change with new versions, but the address to call it will be the same. The additional field is needed when there are new versions.
- The Unbound module error indicates that somewhere in the source code there is a governance address, but the toml file does not know the numeric value of the address. Third party’s example there is a governance message. Third party recommended looking at what version the 3rd party contract is deployed so may not be able to depend on a particular branch. Third party has a module called governance_message.
- Remove multiple dev_address lines in Move.toml. Why is 0x0 used for publishing address and publishing flow is different from Aptos? Do not have an account model but have an object model. Sui’s publish flow set the address to 0x0 initially, and once publish is submitted to validators the validators will return the published address and that is what xxxx_bridge will be set to.
- How to pass mutable references? Just pass in the ID at the entry point. Can only get mutable reference if it is a shared object. Owned object can be passed by address by ID or by mutable reference, only txn signed by owned address can access that object. Shared object can be accessed by anyone, cannot take a shared object by value.
- But anyone acquire a field but only the module that defines the type can freely mute its fields. If there is a privileged operation in the package should be protected with auth check. Clock object is a special ID at address 0x6. At the Move level gas coin is provided at the time of txn building. Provide a list of coins to use for gas, txn will smash them into one coin, will take off what it needs for the transaction, then the rest are free to be used - can be split off to other parameters for other Move calls. Can also use splitCoin. There is a limit of 256 gas coins, and can shove them into a transaction block to merge them into 1 big coin. The TS SDK will pick these gas coins, SDK will do a dry-run to estimate gas cost and pick the right coins.
- Having an example repository file where a lot of these things are done would be very helpful. SuiFrens is open sourced as contract only and does not have the scripts.
Noted Areas of Improvement
- Improve package management flow
- Open repository with e2e examples