-
Notifications
You must be signed in to change notification settings - Fork 34
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
Add tools/foundry subchapter #1151
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for oasisprotocol-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also mention the forge verify
command they can use after the contract is deployed. Details are on the Contract verification page.
d082058
to
af86c0a
Compare
docs/build/tools/foundry.mdx
Outdated
package using Foundry package manager [soldeer]: | ||
|
||
```shell | ||
forge soldeer install @oasisprotocol-sapphire-contracts~0.2.11 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The version could be omitted right?
forge soldeer install @oasisprotocol-sapphire-contracts~0.2.11 | |
forge soldeer install @oasisprotocol-sapphire-contracts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't find a way to make it work without specifying version. The suggested change returns an error, and in soldeer/foundry docs, version is always mentioned.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, Soldeer needs a version, there is nothing similar like @latest
To omit the version in the cmd line, the foundry.toml would to be updated first with the dependencies, then you could use forge soldeer install
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since these are step-by-step instructions I think it's better to leave it as is. forge soldeer install
shortcut and foundry.toml are already mentioned in the later section.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few more suggestions.
docs/build/tools/foundry.mdx
Outdated
|
||
```toml | ||
[profile.default] | ||
src = "src" | ||
out = "out" | ||
libs = ["lib", "dependencies"] | ||
ffi = true | ||
|
||
[dependencies] | ||
"@oasisprotocol-sapphire-contracts" = "0.2.11" | ||
"@oasisprotocol-sapphire-foundry" = "0.1.0" | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
```toml | |
[profile.default] | |
src = "src" | |
out = "out" | |
libs = ["lib", "dependencies"] | |
ffi = true | |
[dependencies] | |
"@oasisprotocol-sapphire-contracts" = "0.2.11" | |
"@oasisprotocol-sapphire-foundry" = "0.1.0" | |
``` | |
```toml title="foundry.toml" | |
[profile.default] | |
src = "src" | |
out = "out" | |
libs = ["lib", "dependencies"] | |
// highlight-start | |
ffi = true | |
[dependencies] | |
"@oasisprotocol-sapphire-contracts" = "0.2.11" | |
"@oasisprotocol-sapphire-foundry" = "0.1.0" | |
// highlight-end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added highlighting.
docs/build/tools/foundry.mdx
Outdated
- `ffi = true` enables `vm.ffi()` ([foreign function interface]) which is used to call rust bindings | ||
which contain the precompile and decryption logic. | ||
|
||
- `"dependencies"` is a list of dependencies that are required for the project. | ||
We use Foundry package manager [soldeer] to install these dependencies. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- `ffi = true` enables `vm.ffi()` ([foreign function interface]) which is used to call rust bindings | |
which contain the precompile and decryption logic. | |
- `"dependencies"` is a list of dependencies that are required for the project. | |
We use Foundry package manager [soldeer] to install these dependencies. | |
- `ffi = true` enables `vm.ffi()` ([foreign function interface]) which is used to call rust bindings | |
which contain the precompile and decryption logic. | |
- `"dependencies"` is a list of dependencies that are required for the project. | |
We use Foundry package manager [soldeer] to install these dependencies. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added indentation.
docs/build/tools/foundry.mdx
Outdated
package using Foundry package manager [soldeer]: | ||
|
||
```shell | ||
forge soldeer install @oasisprotocol-sapphire-contracts~0.2.11 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, Soldeer needs a version, there is nothing similar like @latest
To omit the version in the cmd line, the foundry.toml would to be updated first with the dependencies, then you could use forge soldeer install
.
docs/build/tools/foundry.mdx
Outdated
helper solidity contracts and libraries that enable convenient access to | ||
on-chain data and precompiles (rng, signatures, on-chain encryption, etc.). | ||
After intializing the project, we can install the **Sapphire Contracts** | ||
package using Foundry package manager [soldeer]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
package using Foundry package manager [soldeer]: | |
package using Foundry package manager [Soldeer]: |
nitpick - lets keep product names capitalized
docs/build/tools/foundry.mdx
Outdated
available in the default revm. | ||
When using `forge script` on an external RPC node or a fork, | ||
precompiles are available through the `vm.rpcUrl()` cheatcode. | ||
To disable simulation on integrated revm make sure to disable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit confused, does simulation make sense with Sapphire?
At what point you wouldn't use --no-simulation?
If you use forge script without an external RPC, how do you use the precompiles?
## Verification with Foundry | ||
|
||
After contracts are deployed, you can verify them with Sourcify. | ||
Check out the [verification with foundry] section for more details. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check out the [verification with foundry] section for more details. | |
Check out the [Verification with Foundry] section for more details. |
nitpick - keep capitalization like in the header
docs/build/tools/foundry.mdx
Outdated
[gasless transactions]: ../sapphire/develop/gasless | ||
[key]: ../sapphire/develop/concept | ||
[examples/foundry]: https://github.com/oasisprotocol/sapphire-paratime/tree/main/examples/foundry | ||
[verification with foundry]: ./verification/#verification-with-foundry |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[verification with foundry]: ./verification/#verification-with-foundry | |
[Verification with Foundry]: ./verification/#verification-with-foundry |
docs/build/tools/foundry.mdx
Outdated
[examples/foundry]: https://github.com/oasisprotocol/sapphire-paratime/tree/main/examples/foundry | ||
[verification with foundry]: ./verification/#verification-with-foundry | ||
[foreign function interface]: https://book.getfoundry.sh/cheatcodes/ffi | ||
[soldeer]: https://book.getfoundry.sh/projects/soldeer?highlight=soldeer#soldeer-as-a-package-manager |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[soldeer]: https://book.getfoundry.sh/projects/soldeer?highlight=soldeer#soldeer-as-a-package-manager | |
[Soldeer]: https://book.getfoundry.sh/projects/soldeer?highlight=soldeer#soldeer-as-a-package-manager |
docs/build/tools/foundry.mdx
Outdated
[foreign function interface]: https://book.getfoundry.sh/cheatcodes/ffi | ||
[soldeer]: https://book.getfoundry.sh/projects/soldeer?highlight=soldeer#soldeer-as-a-package-manager | ||
[Oasis Web3 gateway]: ../../node/web3.mdx | ||
[revm]: https://github.com/bluealloy/revm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[revm]: https://github.com/bluealloy/revm | |
[Revm]: https://github.com/bluealloy/revm |
This PR adds foundry subchapter to tools.