-
Notifications
You must be signed in to change notification settings - Fork 81
Conversation
Preview is available here: |
This is still incomplete: - The examples tag should be bumped - The CLI should be updated, so that there is some way to install the contract WASM
Preview is available here: |
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.
Few requests, most minor, the one at the end might be tricky.
docs/examples/deployer.mdx
Outdated
Open the `deployer/deployer/src/src.rs` file to follow along. | ||
Open the `deployer/deployer/src/lib.rs` file to follow along. | ||
|
||
### Contract code installation |
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.
Title needs capitalizing for consistency, and I suggest we shorten it, since it is easier to create a concept stories around single word names like "installation" and "deployment".
### Contract code installation | |
### Contract Installation |
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.
Capitalized. I think we need to keep 'code' around though, as we are not installing the contract yet (IMO 'contract deploy' and 'contract install' aren't really distinguishable and both concern 'contracts', while the code is not a contract).
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.
It's not really "code" either, it's compiled into some form of code, but not "code" the way developers think of code normally. And it is a contract. It's literally the contract. Deployment creates a contract instance, one of the paragraphs in the doc use that language of "contract instance". So I think we already have dual usage of the term. But that's fine, lets keep code as that's what is in the env and XDR too I realize.
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.
WASM is binary code and that's the way I think about that personally. But I'm fine with updating the terminology to make it less ambiguous. I agree that the code is a contract in some sense, but OTOH saying 'contract instance' every time we refer to the thing you can invoke (and the thing that you'd use 99% of the time) is kind of redundant. Maybe they can be used interchangeably, but then we need something to disambiguate WASM in docs like this one.
docs/examples/deployer.mdx
Outdated
|
||
Before deploying the new contract instances, the WASM code needs to be installed | ||
on-chain. Then it can be reused to deploy an arbitrary number of contract | ||
instances. The installation typically should happen outside of the deployer |
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.
instances. The installation typically should happen outside of the deployer | |
instances. The installation should typically happen outside of the deployer |
docs/examples/deployer.mdx
Outdated
[Below](#tests) is the example of installing the contract code in tests. For the actual | ||
installation see the general deployment [tutorial](https://soroban.stellar.org/docs/tutorials/deploy-to-futurenet). |
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.
[Below](#tests) is the example of installing the contract code in tests. For the actual | |
installation see the general deployment [tutorial](https://soroban.stellar.org/docs/tutorials/deploy-to-futurenet). | |
See the [tests](#tests) for an example of installing the contract in tests. For the actual | |
installation see the deployment [tutorial](https://soroban.stellar.org/docs/tutorials/deploy-to-futurenet). |
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.
Updated.
docs/examples/deployer.mdx
Outdated
|
||
### Deployer | ||
|
||
The `deployer` contract deploys other contracts. It accepts a salt that will be | ||
used to derive a contract ID, and a WASM bytes to deploy. It also accepts an | ||
initialization function and arguments to pass to that function. | ||
used to derive a contract ID, and a hash-based identifier of the installed WASM |
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.
used to derive a contract ID, and a hash-based identifier of the installed WASM | |
used to derive a contract ID, and a hash of the installed WASM |
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.
Not sure about removing this... Maybe we should really only hash the code (initially the install entries had more fields), but that would need to happen in the next release. Added an additional comment to make that clear.
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.
Is the wasm hash only a hash of the code or something else? Because If it is of something else I think the SDK is misleading.
docs/examples/deployer.mdx
Outdated
|
||
```rust | ||
env.register_contract(&deployer_id, Deployer); | ||
``` | ||
|
||
...and created a client for it: |
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.
...and created a client for it: | |
Create a client that will be used to invoke the contract. |
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.
Rephrased.
docs/examples/deployer.mdx
Outdated
The deployer contract is registered with the environment. | ||
Register the deployer contract with the environment: |
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.
Can you keep these as sentences with trailing .
for consistency with the other other examples. I don't mind changing it, but if we're going to change it, can you go over every page in the doc and update them all? The docs try and be as consistent as possible.
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.
Updated.
docs/examples/deployer.mdx
Outdated
TODO: the CLI currently doesn't support the install operation. Before running | ||
the `invoke` below, the contract has to be installed. | ||
|
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.
There's no plan to add an install command to the CLI in this iteration, so we need to remove this todo and come up with a way for them to "install" it.
docs/examples/deployer.mdx
Outdated
```sh | ||
soroban invoke \ | ||
--wasm target/wasm32-unknown-unknown/release/soroban_deployer_contract.wasm \ | ||
--id 0 \ | ||
--fn deploy \ | ||
--arg 0000000000000000000000000000000000000000000000000000000000000000 \ | ||
--arg $(xxd -p -c- target/wasm32-unknown-unknown/release/soroban_deployer_test_contract.wasm) \ | ||
--arg <installed WASM hash> \ |
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.
We need to tell people how to get this hash. Can you add that?
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.
Updated the phrasing according to comments. I'll come back to the CLI-related part when we have some changes for CLI merged.
docs/examples/deployer.mdx
Outdated
Open the `deployer/deployer/src/src.rs` file to follow along. | ||
Open the `deployer/deployer/src/lib.rs` file to follow along. | ||
|
||
### Contract code installation |
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.
Capitalized. I think we need to keep 'code' around though, as we are not installing the contract yet (IMO 'contract deploy' and 'contract install' aren't really distinguishable and both concern 'contracts', while the code is not a contract).
docs/examples/deployer.mdx
Outdated
[Below](#tests) is the example of installing the contract code in tests. For the actual | ||
installation see the general deployment [tutorial](https://soroban.stellar.org/docs/tutorials/deploy-to-futurenet). |
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.
Updated.
docs/examples/deployer.mdx
Outdated
|
||
### Deployer | ||
|
||
The `deployer` contract deploys other contracts. It accepts a salt that will be | ||
used to derive a contract ID, and a WASM bytes to deploy. It also accepts an | ||
initialization function and arguments to pass to that function. | ||
used to derive a contract ID, and a hash-based identifier of the installed WASM |
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.
Not sure about removing this... Maybe we should really only hash the code (initially the install entries had more fields), but that would need to happen in the next release. Added an additional comment to make that clear.
docs/examples/deployer.mdx
Outdated
used to derive a contract ID, and a WASM bytes to deploy. It also accepts an | ||
initialization function and arguments to pass to that function. | ||
used to derive a contract ID, and a hash-based identifier of the installed WASM | ||
code to deploy. It also accepts an initialization function and arguments to pass |
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.
Rephrased.
docs/examples/deployer.mdx
Outdated
WASM bytes. The WASM bytes will be deployed and the contract ID for that new | ||
contract is returned. The contract ID is deterministic and is derived from the | ||
deploying contract and the salt. | ||
WASM hash. The contract that with the code corresponding to the `wasm_hash` will |
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.
Rephrased and added more context regarding properties/benefits of hash-based deployment.
docs/examples/deployer.mdx
Outdated
let client = DeployerClient::new(&env, &deployer_id); | ||
let client = DeployerClient::new(&env, &env.register_contract(None, Deployer)); | ||
|
||
// Install the WASM code to be deployed from the deployer contract. |
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.
Updated.
docs/examples/deployer.mdx
Outdated
The deployer contract is registered with the environment. | ||
Register the deployer contract with the environment: |
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.
Updated.
docs/examples/deployer.mdx
Outdated
|
||
```rust | ||
env.register_contract(&deployer_id, Deployer); | ||
``` | ||
|
||
...and created a client for it: |
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.
Rephrased.
Preview is available here: |
This commit should be reverted if the respective CLI PR doesn't get into release.
Preview is available here: |
Preview is available here: |
This is still incomplete:
I'm sending this for a preliminary review as the updates above are trivial.