-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
feat: create and deploy a reference proxy contract for contracts with [proxy]
enabled
#6069
Conversation
Benchmark for 946beecClick to view benchmark
|
Benchmark for 52d495eClick to view benchmark
|
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.
Looking good! Left a few initial comments/questions
Benchmark for 6828faaClick to view benchmark
|
07910ec
to
7d3613e
Compare
Benchmark for 82fee6fClick to view benchmark
|
Benchmark for 1101331Click to view benchmark
|
Benchmark for c157f2bClick to view benchmark
|
Benchmark for 126ba37Click to view benchmark
|
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 suggestions for the docs, but this is a great feature. The auto updating of the proxy address in the manifest is great
Benchmark for 5318cffClick to view benchmark
|
Benchmark for 0fb629aClick to view benchmark
|
Benchmark for 09d598fClick to view benchmark
|
Benchmark for d89ec7fClick to view benchmark
|
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.
Minor nits 1 min too late
|
||
To create a wallet you can use `forc wallet new`. It will ask you to choose a password to encrypt your wallet. After the initialization is done you will have your mnemonic phrase. | ||
The easiest and recommended way to interact with deployed networks such as our testnets is option 1, using `forc-client` to sign your transactions which reads your default `forc-wallet` vault. For interacting with local node, we recommend using the second option, which leads `forc-client` to sign transactions with the a private key that comes pre-funded in local environments. |
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 easiest and recommended way to interact with deployed networks such as our testnets is option 1, using `forc-client` to sign your transactions which reads your default `forc-wallet` vault. For interacting with local node, we recommend using the second option, which leads `forc-client` to sign transactions with the a private key that comes pre-funded in local environments. | |
The easiest and recommended way to interact with deployed networks such as our testnets is option 1, using `forc-client` to sign your transactions which reads your default `forc-wallet` vault. For interacting with local node, we recommend using the second option, which leads `forc-client` to sign transactions with the private key that comes pre-funded in local environments. |
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.
Oh looks like it got auto merged, I'll address these with the follow-up, thanks!
@@ -1,26 +1,62 @@ | |||
# `forc-client` | |||
|
|||
Forc plugin for interacting with a Fuel node. | |||
Forc plugin for interacting with a Fuel node. Since transactions are going to require some gas, you need to sign them with an account that has enough tokens to pay for them. |
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.
Forc plugin for interacting with a Fuel node. Since transactions are going to require some gas, you need to sign them with an account that has enough tokens to pay for them. | |
The forc plugin for interacting with a Fuel node. | |
Since transactions are going to require some gas, you need to sign them with an account that has enough coins to pay for them. |
Should be assets or coins as there are no tokens on Fuel 🙂
https://docs.fuel.network/docs/sway/blockchain-development/native_assets/#asset-vs-coin-vs-token
|
||
To install `forc-wallet` please refer to `forc-wallet`'s [GitHub repo](https://github.com/FuelLabs/forc-wallet#forc-wallet). | ||
If you are not interacting with a deployed network, such as testnets, your local `fuel-core` environment can be structured such that it funds an account by default. Using `--default-signer` flag with `forc-client` binaries (run, deploy) will instruct `forc-client` to sign transactions with this pre-funded account. Which makes it a useful command while working against a local node. |
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.
If you are not interacting with a deployed network, such as testnets, your local `fuel-core` environment can be structured such that it funds an account by default. Using `--default-signer` flag with `forc-client` binaries (run, deploy) will instruct `forc-client` to sign transactions with this pre-funded account. Which makes it a useful command while working against a local node. | |
If you are not interacting with a deployed network, such as testnets, your local `fuel-core` environment can be structured such that it funds an account by default. Using `--default-signer` flag with `forc-client` binaries (run, deploy) will instruct `forc-client` to sign transactions with this pre-funded account. This makes it a useful command while working against a local node. |
|
||
## Option 3: Manually signing through forc-wallet (Deprecated) | ||
|
||
This option is for creating the transaction first, signing it manually and supplying the signed transaction back to forc-client. Since it requires multiple steps, it is more error-prone and not recommended for general use case. Also this will be deprecated soon. |
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.
This option is for creating the transaction first, signing it manually and supplying the signed transaction back to forc-client. Since it requires multiple steps, it is more error-prone and not recommended for general use case. Also this will be deprecated soon. | |
This option is for creating the transaction first, signing it manually, and supplying the signed transaction back to forc-client. Since it requires multiple steps, it is more error-prone and not recommended for general use cases. Also this will be deprecated soon. |
enabled = true | ||
``` | ||
|
||
If there is no `address` field present under the proxy table, like the example above, `forc` will automatically create a proxy contract based on the [SRC-14](https://github.com/FuelLabs/sway-standards/blob/master/docs/src/src-14-simple-upgradeable-proxies.md) implementation from [sway-standards](https://github.com/FuelLabs/sway-standards). After generating and deploying the proxy contract, the target is set to the current contract, and owner of the proxy is set to the account that is signing the transaction for deployment. |
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.
If there is no `address` field present under the proxy table, like the example above, `forc` will automatically create a proxy contract based on the [SRC-14](https://github.com/FuelLabs/sway-standards/blob/master/docs/src/src-14-simple-upgradeable-proxies.md) implementation from [sway-standards](https://github.com/FuelLabs/sway-standards). After generating and deploying the proxy contract, the target is set to the current contract, and owner of the proxy is set to the account that is signing the transaction for deployment. | |
If there is no `address` field present under the proxy table, like the example above, `forc` will automatically create a proxy contract based on the [SRC-14](https://github.com/FuelLabs/sway-standards/blob/master/docs/src/src-14-simple-upgradeable-proxies.md) implementation from [sway-standards](https://github.com/FuelLabs/sway-standards). After generating and deploying the proxy contract, the target is set to the current contract, and the owner of the proxy is set to the account that is signing the transaction for deployment. |
|
||
If there is no `address` field present under the proxy table, like the example above, `forc` will automatically create a proxy contract based on the [SRC-14](https://github.com/FuelLabs/sway-standards/blob/master/docs/src/src-14-simple-upgradeable-proxies.md) implementation from [sway-standards](https://github.com/FuelLabs/sway-standards). After generating and deploying the proxy contract, the target is set to the current contract, and owner of the proxy is set to the account that is signing the transaction for deployment. | ||
|
||
This means that if you simply enable proxy in the `Forc.toml`, forc will automatically deploy a proxy contract for you and you do not need to do anything manually aside from signing the deployment transactions for the proxy contract. After deploying the proxy contract, the its address is added into the `address` field of the proxy table. |
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.
This means that if you simply enable proxy in the `Forc.toml`, forc will automatically deploy a proxy contract for you and you do not need to do anything manually aside from signing the deployment transactions for the proxy contract. After deploying the proxy contract, the its address is added into the `address` field of the proxy table. | |
This means that if you simply enable proxy in the `Forc.toml`, forc will automatically deploy a proxy contract for you and you do not need to do anything manually aside from signing the deployment transactions for the proxy contract. After deploying the proxy contract, the address is added into the `address` field of the proxy table. |
Benchmark for 887d855Click to view benchmark
|
|
## Description Apply @bitzoic 's comments from #6069 ## Checklist - [ ] I have linked to any relevant issues. - [ ] I have commented my code, particularly in hard-to-understand areas. - [ ] I have updated the documentation where relevant (API docs, the reference, and the Sway book). - [ ] If my change requires substantial documentation changes, I have [requested support from the DevRel team](https://github.com/FuelLabs/devrel-requests/issues/new/choose) - [ ] I have added tests that prove my fix is effective or that my feature works. - [ ] I have added (or requested a maintainer to add) the necessary `Breaking*` or `New Feature` labels where relevant. - [ ] I have done my best to ensure that my PR adheres to [the Fuel Labs Code Review Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md). - [ ] I have requested a review from the relevant team or maintainers.
… `[proxy]` enabled (#6069) Part of #6068. This PR adds couple of things: 1. A default proxy contract implementation taken from [sway standards](https://github.com/FuelLabs/sway-standards/blob/master/standards/src/src14.sw). 2. Infra for creating, building and deploying the reference implementation for proxy contracts. 3. Deployment procedure such that proxy contract is deployed while working on a contract which enables the `[proxy]` in its forc.toml. In a way that it is owned by the deployer and the target initially points to implementation contract. 4. Infra for making a contract call into the already deployed proxy contracts to update their targets. 5. Adds a `Building` text to the all forc build invocations to better inform the user about what forc is doing behind the scenes. 6. Removes duplicate forc-wallet password prompts which was very frustrating for the users. Now forc-wallet deployment path only asks for password once. 7. Refactors around how secret_key is selected based on user input 8. Updated docs around forc-client 9. Docs around how to use the proxy feature If the user does not have a proxy table in their forc.toml, nothing changes, same old deployment procedure is followed. Only difference is that this PR improves the ux by removing the need of providing the password multiple times. If the user has a contract with a proxy table but without an address like: ```TOML [project] authors = ["kaya"] entry = "main.sw" license = "Apache-2.0" name = "impl-contract" [dependencies] [proxy] enabled = true ``` Forc automatically creates a proxy contract based on the reference implementation at [SRC14](https://github.com/FuelLabs/sway-standard-implementations/tree/61fd4ad8f69d21cec0d5cd8135bdc4495e0c125c). Sets its target to the implementation contract, whichever contract enabled the proxy and the owner to the deployer (signing account of the transaction). If the user has a contract with a proxy table and an address specified like: ```TOML [project] authors = ["kaya"] entry = "main.sw" license = "Apache-2.0" name = "impl-contract" [dependencies] [proxy] enabled = true address = "........." ``` Forc automatically makes a set target conract call to update the proxy contract's target. Pointing it to the newly deployed impl contract which defines the proxy table. Generated proxy contract abi and bins are stored at `~/.forc/.generated_proxy_contracts/project_name` for housekeeping.
## Description Apply @bitzoic 's comments from #6069 ## Checklist - [ ] I have linked to any relevant issues. - [ ] I have commented my code, particularly in hard-to-understand areas. - [ ] I have updated the documentation where relevant (API docs, the reference, and the Sway book). - [ ] If my change requires substantial documentation changes, I have [requested support from the DevRel team](https://github.com/FuelLabs/devrel-requests/issues/new/choose) - [ ] I have added tests that prove my fix is effective or that my feature works. - [ ] I have added (or requested a maintainer to add) the necessary `Breaking*` or `New Feature` labels where relevant. - [ ] I have done my best to ensure that my PR adheres to [the Fuel Labs Code Review Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md). - [ ] I have requested a review from the relevant team or maintainers.
… `[proxy]` enabled (#6069) Part of #6068. This PR adds couple of things: 1. A default proxy contract implementation taken from [sway standards](https://github.com/FuelLabs/sway-standards/blob/master/standards/src/src14.sw). 2. Infra for creating, building and deploying the reference implementation for proxy contracts. 3. Deployment procedure such that proxy contract is deployed while working on a contract which enables the `[proxy]` in its forc.toml. In a way that it is owned by the deployer and the target initially points to implementation contract. 4. Infra for making a contract call into the already deployed proxy contracts to update their targets. 5. Adds a `Building` text to the all forc build invocations to better inform the user about what forc is doing behind the scenes. 6. Removes duplicate forc-wallet password prompts which was very frustrating for the users. Now forc-wallet deployment path only asks for password once. 7. Refactors around how secret_key is selected based on user input 8. Updated docs around forc-client 9. Docs around how to use the proxy feature If the user does not have a proxy table in their forc.toml, nothing changes, same old deployment procedure is followed. Only difference is that this PR improves the ux by removing the need of providing the password multiple times. If the user has a contract with a proxy table but without an address like: ```TOML [project] authors = ["kaya"] entry = "main.sw" license = "Apache-2.0" name = "impl-contract" [dependencies] [proxy] enabled = true ``` Forc automatically creates a proxy contract based on the reference implementation at [SRC14](https://github.com/FuelLabs/sway-standard-implementations/tree/61fd4ad8f69d21cec0d5cd8135bdc4495e0c125c). Sets its target to the implementation contract, whichever contract enabled the proxy and the owner to the deployer (signing account of the transaction). If the user has a contract with a proxy table and an address specified like: ```TOML [project] authors = ["kaya"] entry = "main.sw" license = "Apache-2.0" name = "impl-contract" [dependencies] [proxy] enabled = true address = "........." ``` Forc automatically makes a set target conract call to update the proxy contract's target. Pointing it to the newly deployed impl contract which defines the proxy table. Generated proxy contract abi and bins are stored at `~/.forc/.generated_proxy_contracts/project_name` for housekeeping.
… and loader generation (#6250) ## Description This PR adds chunk deployment based on LDC. Contracts larger than 100 kb size, is split into chunks and chunks are deployed as `blobs`. Out of these blobs we create a loader contract, which loads all the blobs using `LDC` opcode. One important thing is that this feature works nicely with the proxy feature introduced in #6069, so a large contract, with proxy can be deployed directly. Large contract will be split into chunks, chunks will get deployed, loader will get get generated and deployed, after all these a proxy contract is deployed and pointed to the loader contract deployed. Simple chunked deploy, chunked deployment re routing the call, chunked deployment behind a proxy re routes the call is tested. --------- Co-authored-by: Sophie Dankel <47993817+sdankel@users.noreply.github.com>
Description
Part of #6068.
This PR adds couple of things:
[proxy]
in its forc.toml. In a way that it is owned by the deployer and the target initially points to implementation contract.Building
text to the all forc build invocations to better inform the user about what forc is doing behind the scenes.How this works
If the user does not have a proxy table in their forc.toml, nothing changes, same old deployment procedure is followed. Only difference is that this PR improves the ux by removing the need of providing the password multiple times.
If the user has a contract with a proxy table but without an address like:
Forc automatically creates a proxy contract based on the reference implementation at SRC14. Sets its target to the implementation contract, whichever contract enabled the proxy and the owner to the deployer (signing account of the transaction).
If the user has a contract with a proxy table and an address specified like:
Forc automatically makes a set target conract call to update the proxy contract's target. Pointing it to the newly deployed impl contract which defines the proxy table.
Generated proxy contracts are stored at
~/.forc/.generated_proxy_contracts/project_name
for housekeeping.