Support private contracts (with unknown src) under `[contract-dependencies]`
- Dominant language
- Rust
- Stars
- 0
- Forks
- 0
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 3
Description
*This is a follow-up to (and motivated by) FuelLabs/sway#3571.*
Currently `[contract-dependencies]` only support depending on contracts whose source code is publicly available and accessible via either `path` or `git`.
In practise, many projects will choose *not* to publish their source code and prefer to remain private, however developers will likely still want to be able to communicate with these contracts from their own contracts or scripts.
This is a problem when attempting to support multi-contract calls in unit testing (#3571), as contract dependencies that aren't declared to forc explicitly cannot be deployed in the local test node, as forc has no way to know about them.
### Specify `[contract-dependencies]` via ID?
One way to support testing private contracts (with unknown src or salt) might be to allow for specifying them solely via their contract ID, allowing us to download their bytecode directly from one of the fuel networks declared within their project's manifest. E.g.
```toml
[contract-dependencies]
foo = { git = "https://domain.com/owner/repo", salt = "0x15534F..." } # Contract dependencies as we have today.
bar = { id = "0x81249105AB4515DF..." } # A potentially private contract with unknown src.
```
A failure to fetch the bytecode would result in a failure to build the project, in the same way that fetching src might fail. Upon successful fetch, the bytecode would be hashed for its entry within the `Forc.lock` file and cached. Note that we cannot use the contract ID for the lock file or cache validity directly as it may be salted - we *must* hash the fetched bytecode.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.