feat: create and deploy a reference proxy contract for contracts with `[proxy]` enabled
Description
Part of #6068.
This PR adds couple of things:
- A default proxy contract implementation taken from sway standards.
- Infra for creating, building and deploying the reference implementation for proxy contracts.
- 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. - Infra for making a contract call into the already deployed proxy contracts to update their targets.
- Adds a
Buildingtext to the all forc build invocations to better inform the user about what forc is doing behind the scenes. - Removes duplicate forc-wallet password prompts which was very frustrating for the users. Now forc-wallet deployment path only asks for password once.
- Refactors around how secret_key is selected based on user input
- Updated docs around forc-client
- Docs around how to use the proxy feature
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:
[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. 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:
[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 contracts are stored at ~/.forc/.generated_proxy_contracts/project_name for housekeeping.
Benchmark for 946beec
Click to view benchmark
| Test | Base | PR | % |
|---|---|---|---|
| code_action | 5.4±0.08ms | 5.6±0.09ms | +3.70% |
| code_lens | 293.0±13.95ns | 293.8±7.41ns | +0.27% |
| compile | 3.1±0.06s | 3.2±0.04s | +3.23% |
| completion | 4.9±0.16ms | 4.8±0.08ms | -2.04% |
| did_change_with_caching | 3.0±0.04s | 3.0±0.07s | 0.00% |
| document_symbol | 958.8±26.32µs | 971.8±20.63µs | +1.36% |
| format | 76.0±0.96ms | 74.6±1.08ms | -1.84% |
| goto_definition | 368.0±6.55µs | 373.1±7.31µs | +1.39% |
| highlight | 9.1±0.05ms | 9.2±0.11ms | +1.10% |
| hover | 493.4±8.98µs | 500.5±8.27µs | +1.44% |
| idents_at_position | 122.6±0.49µs | 123.1±1.51µs | +0.41% |
| inlay_hints | 667.5±19.60µs | 668.1±8.53µs | +0.09% |
| on_enter | 465.3±9.95ns | 467.2±20.48ns | +0.41% |
| parent_decl_at_position | 3.8±0.05ms | 3.8±0.03ms | 0.00% |
| prepare_rename | 368.3±5.98µs | 371.7±8.25µs | +0.92% |
| rename | 9.8±0.17ms | 9.8±0.15ms | 0.00% |
| semantic_tokens | 977.9±43.61µs | 955.9±21.75µs | -2.25% |
| token_at_position | 359.7±3.69µs | 359.9±2.89µs | +0.06% |
| tokens_at_position | 3.8±0.04ms | 3.8±0.08ms | 0.00% |
| tokens_for_file | 417.7±2.07µs | 434.2±4.37µs | +3.95% |
| traverse | 42.4±1.16ms | 41.5±1.31ms | -2.12% |
Benchmark for 52d495e
Click to view benchmark
| Test | Base | PR | % |
|---|---|---|---|
| code_action | 5.9±0.09ms | 5.2±0.09ms | -11.86% |
| code_lens | 288.2±7.07ns | 336.9±20.68ns | +16.90% |
| compile | 3.3±0.07s | 3.1±0.06s | -6.06% |
| completion | 5.2±0.13ms | 4.6±0.11ms | -11.54% |
| did_change_with_caching | 3.2±0.07s | 3.2±0.04s | 0.00% |
| document_symbol | 979.3±20.40µs | 1016.6±39.59µs | +3.81% |
| format | 75.6±0.68ms | 73.9±1.17ms | -2.25% |
| goto_definition | 365.5±6.80µs | 362.6±5.96µs | -0.79% |
| highlight | 9.5±0.16ms | 8.7±0.05ms | -8.42% |
| hover | 491.9±8.59µs | 487.2±6.58µs | -0.96% |
| idents_at_position | 122.0±0.50µs | 124.3±0.61µs | +1.89% |
| inlay_hints | 656.9±38.17µs | 649.2±23.86µs | -1.17% |
| on_enter | 487.8±15.12ns | 461.1±15.57ns | -5.47% |
| parent_decl_at_position | 4.0±0.09ms | 3.6±0.06ms | -10.00% |
| prepare_rename | 366.2±10.83µs | 362.3±6.63µs | -1.06% |
| rename | 10.1±0.26ms | 9.3±0.16ms | -7.92% |
| semantic_tokens | 973.5±11.84µs | 987.9±31.67µs | +1.48% |
| token_at_position | 354.5±1.86µs | 356.1±2.36µs | +0.45% |
| tokens_at_position | 4.0±0.13ms | 3.6±0.04ms | -10.00% |
| tokens_for_file | 416.3±1.88µs | 418.4±2.03µs | +0.50% |
| traverse | 43.3±1.39ms | 44.0±1.51ms | +1.62% |
Benchmark for 6828faa
Click to view benchmark
| Test | Base | PR | % |
|---|---|---|---|
| code_action | 5.2±0.10ms | 5.2±0.09ms | 0.00% |
| code_lens | 289.6±10.50ns | 333.3±9.93ns | +15.09% |
| compile | 3.1±0.04s | 3.0±0.05s | -3.23% |
| completion | 4.6±0.10ms | 4.6±0.08ms | 0.00% |
| did_change_with_caching | 2.9±0.02s | 2.9±0.05s | 0.00% |
| document_symbol | 1031.5±18.02µs | 997.1±33.27µs | -3.33% |
| format | 73.7±1.29ms | 74.5±0.94ms | +1.09% |
| goto_definition | 364.5±6.44µs | 361.7±8.55µs | -0.77% |
| highlight | 8.8±0.13ms | 8.7±0.05ms | -1.14% |
| hover | 485.8±7.68µs | 483.7±5.30µs | -0.43% |
| idents_at_position | 124.4±0.20µs | 123.9±1.14µs | -0.40% |
| inlay_hints | 638.8±18.70µs | 651.2±31.08µs | +1.94% |
| on_enter | 489.6±33.45ns | 464.2±20.28ns | -5.19% |
| parent_decl_at_position | 3.6±0.03ms | 3.6±0.02ms | 0.00% |
| prepare_rename | 359.0±7.57µs | 360.2±3.56µs | +0.33% |
| rename | 9.4±0.18ms | 9.3±0.17ms | -1.06% |
| semantic_tokens | 969.0±11.77µs | 977.7±10.31µs | +0.90% |
| token_at_position | 358.0±2.02µs | 358.9±1.97µs | +0.25% |
| tokens_at_position | 3.6±0.03ms | 3.6±0.03ms | 0.00% |
| tokens_for_file | 419.8±2.06µs | 423.8±1.52µs | +0.95% |
| traverse | 41.9±1.31ms | 41.3±0.79ms | -1.43% |
Benchmark for 82fee6f
Click to view benchmark
| Test | Base | PR | % |
|---|---|---|---|
| code_action | 5.2±0.06ms | 5.3±0.03ms | +1.92% |
| code_lens | 288.2±9.93ns | 335.7±9.82ns | +16.48% |
| compile | 3.0±0.02s | 3.0±0.05s | 0.00% |
| completion | 4.5±0.02ms | 4.6±0.02ms | +2.22% |
| did_change_with_caching | 2.9±0.04s | 2.9±0.04s | 0.00% |
| document_symbol | 948.7±22.76µs | 950.3±13.68µs | +0.17% |
| format | 73.7±1.23ms | 73.4±1.16ms | -0.41% |
| goto_definition | 363.8±7.73µs | 364.9±8.75µs | +0.30% |
| highlight | 8.8±0.18ms | 8.8±0.09ms | 0.00% |
| hover | 488.2±8.73µs | 489.5±8.05µs | +0.27% |
| idents_at_position | 123.9±0.41µs | 123.9±2.55µs | 0.00% |
| inlay_hints | 651.6±29.84µs | 657.4±26.93µs | +0.89% |
| on_enter | 483.4±8.19ns | 461.6±17.51ns | -4.51% |
| parent_decl_at_position | 3.6±0.04ms | 3.6±0.05ms | 0.00% |
| prepare_rename | 357.1±5.05µs | 365.0±4.40µs | +2.21% |
| rename | 9.3±0.18ms | 9.3±0.18ms | 0.00% |
| semantic_tokens | 971.9±15.01µs | 992.1±18.33µs | +2.08% |
| token_at_position | 353.1±3.44µs | 362.3±7.73µs | +2.61% |
| tokens_at_position | 3.6±0.07ms | 3.6±0.02ms | 0.00% |
| tokens_for_file | 419.0±2.26µs | 421.0±2.66µs | +0.48% |
| traverse | 41.2±0.54ms | 42.1±0.84ms | +2.18% |
Benchmark for 1101331
Click to view benchmark
| Test | Base | PR | % |
|---|---|---|---|
| code_action | 5.3±0.12ms | 5.3±0.12ms | 0.00% |
| code_lens | 287.3±4.49ns | 333.9±14.18ns | +16.22% |
| compile | 3.1±0.06s | 3.0±0.06s | -3.23% |
| completion | 4.6±0.39ms | 4.6±0.09ms | 0.00% |
| did_change_with_caching | 3.0±0.06s | 2.9±0.02s | -3.33% |
| document_symbol | 951.8±30.65µs | 989.7±41.43µs | +3.98% |
| format | 74.6±0.69ms | 73.7±0.77ms | -1.21% |
| goto_definition | 361.6±4.20µs | 367.2±4.25µs | +1.55% |
| highlight | 8.7±0.03ms | 8.8±0.19ms | +1.15% |
| hover | 489.3±4.76µs | 486.9±6.76µs | -0.49% |
| idents_at_position | 124.6±0.78µs | 124.3±1.16µs | -0.24% |
| inlay_hints | 708.3±16.99µs | 685.6±28.42µs | -3.20% |
| on_enter | 483.6±14.57ns | 467.5±16.97ns | -3.33% |
| parent_decl_at_position | 3.6±0.05ms | 3.6±0.07ms | 0.00% |
| prepare_rename | 359.4±5.69µs | 364.5±9.30µs | +1.42% |
| rename | 9.4±0.10ms | 9.3±0.17ms | -1.06% |
| semantic_tokens | 975.5±20.21µs | 961.2±21.32µs | -1.47% |
| token_at_position | 363.5±3.07µs | 357.2±2.08µs | -1.73% |
| tokens_at_position | 3.6±0.01ms | 3.6±0.05ms | 0.00% |
| tokens_for_file | 429.3±5.69µs | 422.0±2.56µs | -1.70% |
| traverse | 42.5±1.01ms | 42.5±0.86ms | 0.00% |
Benchmark for c157f2b
Click to view benchmark
| Test | Base | PR | % |
|---|---|---|---|
| code_action | 5.6±0.18ms | 5.3±0.10ms | -5.36% |
| code_lens | 335.5±9.43ns | 284.7±8.11ns | -15.14% |
| compile | 3.2±0.06s | 3.2±0.05s | 0.00% |
| completion | 4.6±0.13ms | 4.7±0.13ms | +2.17% |
| did_change_with_caching | 3.1±0.04s | 3.0±0.04s | -3.23% |
| document_symbol | 1005.0±49.17µs | 956.5±22.53µs | -4.83% |
| format | 75.0±0.77ms | 73.7±0.90ms | -1.73% |
| goto_definition | 494.9±3.76µs | 361.6±7.21µs | -26.93% |
| highlight | 9.0±0.27ms | 8.8±0.06ms | -2.22% |
| hover | 511.8±11.43µs | 489.9±15.58µs | -4.28% |
| idents_at_position | 123.4±0.37µs | 124.5±1.08µs | +0.89% |
| inlay_hints | 650.2±8.69µs | 649.9±23.67µs | -0.05% |
| on_enter | 478.7±11.97ns | 478.4±16.64ns | -0.06% |
| parent_decl_at_position | 3.6±0.02ms | 3.6±0.04ms | 0.00% |
| prepare_rename | 357.0±3.45µs | 359.4±6.67µs | +0.67% |
| rename | 9.4±0.19ms | 9.5±0.25ms | +1.06% |
| semantic_tokens | 995.8±20.54µs | 988.1±17.90µs | -0.77% |
| token_at_position | 353.1±3.42µs | 355.9±2.95µs | +0.79% |
| tokens_at_position | 3.6±0.03ms | 3.6±0.08ms | 0.00% |
| tokens_for_file | 425.6±2.75µs | 424.5±4.89µs | -0.26% |
| traverse | 43.5±1.13ms | 42.9±0.92ms | -1.38% |
Benchmark for 126ba37
Click to view benchmark
| Test | Base | PR | % |
|---|---|---|---|
| code_action | 5.5±0.21ms | 5.4±0.07ms | -1.82% |
| code_lens | 339.9±26.93ns | 291.1±16.71ns | -14.36% |
| compile | 3.2±0.07s | 3.2±0.06s | 0.00% |
| completion | 4.7±0.15ms | 4.8±0.10ms | +2.13% |
| did_change_with_caching | 3.1±0.06s | 3.1±0.05s | 0.00% |
| document_symbol | 1014.9±40.47µs | 980.3±18.46µs | -3.41% |
| format | 75.9±0.98ms | 75.1±1.53ms | -1.05% |
| goto_definition | 368.9±3.50µs | 369.1±10.14µs | +0.05% |
| highlight | 8.9±0.20ms | 8.9±0.07ms | 0.00% |
| hover | 497.4±9.43µs | 497.6±7.45µs | +0.04% |
| idents_at_position | 123.5±1.08µs | 123.5±1.06µs | 0.00% |
| inlay_hints | 724.3±16.14µs | 665.8±36.54µs | -8.08% |
| on_enter | 484.2±11.49ns | 480.1±15.19ns | -0.85% |
| parent_decl_at_position | 3.6±0.04ms | 3.6±0.05ms | 0.00% |
| prepare_rename | 370.4±9.60µs | 368.6±9.76µs | -0.49% |
| rename | 9.6±0.22ms | 9.8±0.24ms | +2.08% |
| semantic_tokens | 1001.1±23.12µs | 986.6±20.43µs | -1.45% |
| token_at_position | 363.8±2.08µs | 362.2±9.01µs | -0.44% |
| tokens_at_position | 3.6±0.03ms | 3.6±0.08ms | 0.00% |
| tokens_for_file | 430.8±3.03µs | 428.5±4.93µs | -0.53% |
| traverse | 43.7±0.71ms | 43.1±1.04ms | -1.37% |
Benchmark for 7d4734a
Click to view benchmark
| Test | Base | PR | % |
|---|---|---|---|
| code_action | 5.5±0.02ms | 5.6±0.12ms | +1.82% |
| code_lens | 335.1±9.07ns | 291.2±6.53ns | -13.10% |
| compile | 4.0±0.08s | 4.0±0.06s | 0.00% |
| completion | 4.8±0.08ms | 4.8±0.10ms | 0.00% |
| did_change_with_caching | 3.7±0.05s | 3.7±0.07s | 0.00% |
| document_symbol | 991.1±45.34µs | 1072.6±40.27µs | +8.22% |
| format | 74.4±1.02ms | 74.1±1.40ms | -0.40% |
| goto_definition | 373.1±7.65µs | 362.7±5.87µs | -2.79% |
| highlight | 9.1±0.16ms | 9.1±0.02ms | 0.00% |
| hover | 543.9±6.97µs | 539.1±6.47µs | -0.88% |
| idents_at_position | 125.6±0.26µs | 122.0±1.31µs | -2.87% |
| inlay_hints | 661.6±28.09µs | 663.1±21.25µs | +0.23% |
| on_enter | 451.3±10.16ns | 476.1±11.42ns | +5.50% |
| parent_decl_at_position | 3.7±0.02ms | 3.7±0.02ms | 0.00% |
| prepare_rename | 375.5±30.69µs | 363.9±6.58µs | -3.09% |
| rename | 9.7±0.21ms | 9.7±0.19ms | 0.00% |
| semantic_tokens | 1018.8±15.49µs | 971.6±21.01µs | -4.63% |
| token_at_position | 370.7±2.37µs | 354.1±2.87µs | -4.48% |
| tokens_at_position | 3.7±0.04ms | 3.7±0.03ms | 0.00% |
| tokens_for_file | 424.6±2.83µs | 418.1±6.30µs | -1.53% |
| traverse | 39.1±1.45ms | 38.9±1.15ms | -0.51% |
I had to rebase as there were conflicts.
Benchmark for 0a46d9b
Click to view benchmark
| Test | Base | PR | % |
|---|---|---|---|
| code_action | 5.3±0.10ms | 5.3±0.11ms | 0.00% |
| code_lens | 292.3±5.21ns | 283.2±8.29ns | -3.11% |
| compile | 4.1±0.10s | 4.1±0.07s | 0.00% |
| completion | 4.7±0.13ms | 4.7±0.12ms | 0.00% |
| did_change_with_caching | 3.7±0.08s | 3.7±0.09s | 0.00% |
| document_symbol | 948.6±10.73µs | 956.1±19.90µs | +0.79% |
| format | 72.9±2.50ms | 71.6±2.44ms | -1.78% |
| goto_definition | 375.5±14.54µs | 394.4±7.68µs | +5.03% |
| highlight | 8.8±0.31ms | 8.8±0.26ms | 0.00% |
| hover | 549.7±23.01µs | 574.9±6.79µs | +4.58% |
| idents_at_position | 123.2±0.39µs | 123.1±1.14µs | -0.08% |
| inlay_hints | 717.8±23.84µs | 702.3±23.16µs | -2.16% |
| on_enter | 461.6±6.69ns | 510.7±13.83ns | +10.64% |
| parent_decl_at_position | 3.6±0.03ms | 3.6±0.04ms | 0.00% |
| prepare_rename | 363.4±7.05µs | 394.2±9.92µs | +8.48% |
| rename | 9.6±0.20ms | 9.6±0.28ms | 0.00% |
| semantic_tokens | 1001.0±62.50µs | 969.6±24.62µs | -3.14% |
| token_at_position | 360.5±2.21µs | 353.7±2.80µs | -1.89% |
| tokens_at_position | 3.6±0.05ms | 3.6±0.11ms | 0.00% |
| tokens_for_file | 424.5±6.20µs | 428.4±2.24µs | +0.92% |
| traverse | 40.6±1.64ms | 40.0±0.68ms | -1.48% |
Benchmark for b441f2e
Click to view benchmark
| Test | Base | PR | % |
|---|---|---|---|
| code_action | 5.3±0.10ms | 5.3±0.12ms | 0.00% |
| code_lens | 285.7±7.49ns | 288.7±20.50ns | +1.05% |
| compile | 4.1±0.06s | 4.0±0.07s | -2.44% |
| completion | 4.6±0.09ms | 4.6±0.13ms | 0.00% |
| did_change_with_caching | 3.7±0.08s | 3.7±0.11s | 0.00% |
| document_symbol | 1003.8±50.30µs | 997.0±43.02µs | -0.68% |
| format | 71.2±1.26ms | 71.2±1.36ms | 0.00% |
| goto_definition | 366.3±8.61µs | 360.7±7.13µs | -1.53% |
| highlight | 8.7±0.02ms | 8.8±0.95ms | +1.15% |
| hover | 543.0±8.36µs | 539.6±18.20µs | -0.63% |
| idents_at_position | 124.1±0.18µs | 124.9±1.50µs | +0.64% |
| inlay_hints | 650.6±28.26µs | 653.5±20.46µs | +0.45% |
| on_enter | 459.4±9.38ns | 472.7±14.16ns | +2.90% |
| parent_decl_at_position | 3.6±0.04ms | 3.6±0.05ms | 0.00% |
| prepare_rename | 365.4±4.87µs | 358.1±5.96µs | -2.00% |
| rename | 9.4±0.31ms | 9.3±0.18ms | -1.06% |
| semantic_tokens | 968.6±42.38µs | 981.9±31.09µs | +1.37% |
| token_at_position | 362.4±3.13µs | 357.1±2.36µs | -1.46% |
| tokens_at_position | 3.6±0.04ms | 3.6±0.03ms | 0.00% |
| tokens_for_file | 424.3±2.12µs | 420.6±2.34µs | -0.87% |
| traverse | 39.9±0.92ms | 40.3±0.77ms | +1.00% |
Benchmark for 4fab154
Click to view benchmark
| Test | Base | PR | % |
|---|---|---|---|
| code_action | 5.1±0.14ms | 5.1±0.05ms | 0.00% |
| code_lens | 346.2±10.49ns | 339.7±13.37ns | -1.88% |
| compile | 3.6±0.14s | 3.7±0.08s | +2.78% |
| completion | 4.7±0.05ms | 4.9±0.14ms | +4.26% |
| did_change_with_caching | 3.5±0.06s | 3.4±0.10s | -2.86% |
| document_symbol | 1010.3±48.37µs | 1028.2±28.40µs | +1.77% |
| format | 90.3±1.37ms | 90.3±1.72ms | 0.00% |
| goto_definition | 353.6±7.21µs | 354.5±10.82µs | +0.25% |
| highlight | 8.7±0.26ms | 8.7±0.10ms | 0.00% |
| hover | 576.8±6.73µs | 580.0±7.62µs | +0.55% |
| idents_at_position | 120.2±0.41µs | 119.5±1.66µs | -0.58% |
| inlay_hints | 644.8±25.71µs | 642.3±29.03µs | -0.39% |
| on_enter | 457.3±25.42ns | 462.8±14.84ns | +1.20% |
| parent_decl_at_position | 3.6±0.06ms | 3.6±0.06ms | 0.00% |
| prepare_rename | 353.6±8.76µs | 352.8±6.30µs | -0.23% |
| rename | 9.0±0.17ms | 9.3±0.15ms | +3.33% |
| semantic_tokens | 989.9±16.94µs | 972.6±18.22µs | -1.75% |
| token_at_position | 431.4±12.64µs | 349.8±3.14µs | -18.92% |
| tokens_at_position | 3.6±0.05ms | 3.7±0.12ms | +2.78% |
| tokens_for_file | 413.8±5.44µs | 411.1±5.33µs | -0.65% |
| traverse | 38.6±0.92ms | 38.1±0.94ms | -1.30% |
Benchmark for 7c5e50c
Click to view benchmark
| Test | Base | PR | % |
|---|---|---|---|
| code_action | 5.1±0.20ms | 5.1±0.12ms | 0.00% |
| code_lens | 340.2±5.23ns | 339.4±10.37ns | -0.24% |
| compile | 3.4±0.08s | 3.6±0.09s | +5.88% |
| completion | 4.6±0.01ms | 4.7±0.07ms | +2.17% |
| did_change_with_caching | 3.2±0.09s | 3.3±0.10s | +3.12% |
| document_symbol | 991.1±19.46µs | 948.8±34.93µs | -4.27% |
| format | 87.8±1.26ms | 89.2±0.99ms | +1.59% |
| goto_definition | 354.6±6.85µs | 360.5±6.36µs | +1.66% |
| highlight | 8.7±0.16ms | 8.7±0.05ms | 0.00% |
| hover | 581.2±5.48µs | 581.3±4.90µs | +0.02% |
| idents_at_position | 120.5±0.53µs | 120.7±1.02µs | +0.17% |
| inlay_hints | 653.5±26.11µs | 640.3±30.50µs | -2.02% |
| on_enter | 467.4±11.02ns | 449.1±13.35ns | -3.92% |
| parent_decl_at_position | 3.6±0.02ms | 3.6±0.09ms | 0.00% |
| prepare_rename | 357.6±15.88µs | 358.1±10.71µs | +0.14% |
| rename | 9.0±0.16ms | 8.9±0.10ms | -1.11% |
| semantic_tokens | 975.1±27.51µs | 978.4±22.46µs | +0.34% |
| token_at_position | 344.3±1.82µs | 357.1±4.07µs | +3.72% |
| tokens_at_position | 3.6±0.04ms | 3.6±0.06ms | 0.00% |
| tokens_for_file | 411.6±1.45µs | 412.2±3.14µs | +0.15% |
| traverse | 36.1±0.38ms | 37.5±0.64ms | +3.88% |
I tried this out on test/src/e2e_vm_tests/test_programs/should_pass/forc/contract_dependencies/contract_c/Forc.toml
The first deployment was successful, and the Forc.toml was updated correctly.
The second time I tried deploying, I got this error:
error: provider: io error: Response errors; InsufficientMaxFee { max_fee_from_policies: 0, max_fee_from_gas_price: 326087 }
However, there are sufficient funds in the account. Blocked by https://github.com/FuelLabs/fuels-rs/pull/1396
The other issue is that, for the second request, it's not clear to the user what they are signing. There should be a message like Updating proxy_contract before the user is asked to sign the transaction.
Benchmark for 783259b
Click to view benchmark
| Test | Base | PR | % |
|---|---|---|---|
| code_action | 5.2±0.08ms | 5.2±0.02ms | 0.00% |
| code_lens | 339.4±12.61ns | 337.3±8.89ns | -0.62% |
| compile | 3.5±0.10s | 3.5±0.09s | 0.00% |
| completion | 4.8±0.10ms | 4.8±0.32ms | 0.00% |
| did_change_with_caching | 3.3±0.07s | 3.3±0.09s | 0.00% |
| document_symbol | 990.3±39.60µs | 997.8±39.81µs | +0.76% |
| format | 89.2±1.41ms | 88.8±0.57ms | -0.45% |
| goto_definition | 355.1±7.71µs | 355.8±7.63µs | +0.20% |
| highlight | 9.0±0.18ms | 9.0±0.10ms | 0.00% |
| hover | 579.6±6.91µs | 581.8±5.42µs | +0.38% |
| idents_at_position | 119.2±0.40µs | 119.9±0.58µs | +0.59% |
| inlay_hints | 659.4±20.94µs | 651.7±21.31µs | -1.17% |
| on_enter | 460.5±9.41ns | 451.9±14.45ns | -1.87% |
| parent_decl_at_position | 3.7±0.04ms | 3.7±0.05ms | 0.00% |
| prepare_rename | 354.6±5.68µs | 357.9±9.17µs | +0.93% |
| rename | 9.2±0.20ms | 9.2±0.20ms | 0.00% |
| semantic_tokens | 951.9±20.84µs | 979.6±20.15µs | +2.91% |
| token_at_position | 347.9±1.93µs | 345.1±3.35µs | -0.80% |
| tokens_at_position | 3.7±0.02ms | 3.7±0.04ms | 0.00% |
| tokens_for_file | 413.6±1.24µs | 407.2±4.39µs | -1.55% |
| traverse | 36.9±1.04ms | 37.1±0.30ms | +0.54% |
SDK issues are solved should be able to update now. I also opened #6199 and will open a follow-up to this one to further clean forc-client.
Benchmark for 67b762f
Click to view benchmark
| Test | Base | PR | % |
|---|---|---|---|
| code_action | 5.0±0.09ms | 5.1±0.18ms | +2.00% |
| code_lens | 280.1±5.32ns | 300.9±13.85ns | +7.43% |
| compile | 2.5±0.02s | 2.5±0.02s | 0.00% |
| completion | 4.5±0.07ms | 4.5±0.10ms | 0.00% |
| did_change_with_caching | 2.4±0.02s | 2.4±0.02s | 0.00% |
| document_symbol | 914.4±54.88µs | 864.0±12.57µs | -5.51% |
| format | 74.1±1.13ms | 73.2±1.00ms | -1.21% |
| goto_definition | 337.6±7.13µs | 334.5±4.99µs | -0.92% |
| highlight | 8.7±0.17ms | 8.7±0.20ms | 0.00% |
| hover | 486.2±5.52µs | 482.7±6.41µs | -0.72% |
| idents_at_position | 120.8±1.64µs | 119.2±0.46µs | -1.32% |
| inlay_hints | 633.0±22.46µs | 630.3±14.18µs | -0.43% |
| on_enter | 464.2±6.60ns | 487.4±13.41ns | +5.00% |
| parent_decl_at_position | 3.6±0.03ms | 3.5±0.02ms | -2.78% |
| prepare_rename | 336.9±6.47µs | 335.8±8.65µs | -0.33% |
| rename | 8.9±0.12ms | 8.9±0.01ms | 0.00% |
| semantic_tokens | 1249.4±11.22µs | 1237.0±15.93µs | -0.99% |
| token_at_position | 335.1±2.48µs | 335.7±2.61µs | +0.18% |
| tokens_at_position | 3.6±0.03ms | 3.5±0.02ms | -2.78% |
| tokens_for_file | 395.5±2.81µs | 401.1±3.24µs | +1.42% |
| traverse | 36.2±0.78ms | 36.5±0.90ms | +0.83% |
Benchmark for 87f5da9
Click to view benchmark
| Test | Base | PR | % |
|---|---|---|---|
| code_action | 5.3±0.12ms | 5.3±0.09ms | 0.00% |
| code_lens | 281.3±5.17ns | 302.1±11.45ns | +7.39% |
| compile | 2.6±0.03s | 2.6±0.05s | 0.00% |
| completion | 4.7±0.10ms | 4.7±0.10ms | 0.00% |
| did_change_with_caching | 2.5±0.03s | 2.5±0.02s | 0.00% |
| document_symbol | 898.9±27.36µs | 926.0±36.82µs | +3.01% |
| format | 74.8±0.62ms | 74.4±0.90ms | -0.53% |
| goto_definition | 338.5±20.61µs | 338.7±12.06µs | +0.06% |
| highlight | 9.1±0.13ms | 9.1±0.06ms | 0.00% |
| hover | 490.3±13.29µs | 488.6±8.71µs | -0.35% |
| idents_at_position | 120.2±0.22µs | 118.3±1.18µs | -1.58% |
| inlay_hints | 643.4±18.88µs | 646.1±8.96µs | +0.42% |
| on_enter | 473.1±25.19ns | 477.8±15.27ns | +0.99% |
| parent_decl_at_position | 3.7±0.05ms | 3.8±0.05ms | +2.70% |
| prepare_rename | 337.7±10.62µs | 336.6±7.17µs | -0.33% |
| rename | 9.3±0.13ms | 9.4±0.13ms | +1.08% |
| semantic_tokens | 1268.3±16.18µs | 1279.2±14.56µs | +0.86% |
| token_at_position | 328.6±2.10µs | 334.3±3.03µs | +1.73% |
| tokens_at_position | 3.7±0.03ms | 3.7±0.07ms | 0.00% |
| tokens_for_file | 400.1±4.28µs | 399.2±4.27µs | -0.22% |
| traverse | 37.1±1.03ms | 37.2±1.02ms | +0.27% |
The output after updating the proxy contract needs some tweaking:
0xshould be at the beginning of the address, not the line- "Updated" should be bold to match the style of
Updating
Benchmark for fd6c8ee
Click to view benchmark
| Test | Base | PR | % |
|---|---|---|---|
| code_action | 5.2±0.04ms | 5.2±0.05ms | 0.00% |
| code_lens | 281.5±8.54ns | 309.7±14.38ns | +10.02% |
| compile | 2.5±0.03s | 2.5±0.03s | 0.00% |
| completion | 4.7±0.06ms | 4.7±0.05ms | 0.00% |
| did_change_with_caching | 2.5±0.03s | 2.5±0.02s | 0.00% |
| document_symbol | 925.6±33.95µs | 906.4±42.75µs | -2.07% |
| format | 74.3±0.99ms | 73.5±2.03ms | -1.08% |
| goto_definition | 338.8±3.07µs | 337.1±7.73µs | -0.50% |
| highlight | 9.0±0.02ms | 9.2±0.50ms | +2.22% |
| hover | 485.5±6.18µs | 491.9±6.21µs | +1.32% |
| idents_at_position | 119.4±2.34µs | 118.2±1.72µs | -1.01% |
| inlay_hints | 628.8±22.89µs | 644.9±20.75µs | +2.56% |
| on_enter | 467.4±13.30ns | 470.5±42.38ns | +0.66% |
| parent_decl_at_position | 3.7±0.03ms | 3.7±0.04ms | 0.00% |
| prepare_rename | 352.7±51.07µs | 336.4±8.04µs | -4.62% |
| rename | 9.4±0.40ms | 9.3±0.12ms | -1.06% |
| semantic_tokens | 1156.9±10.88µs | 1243.5±12.30µs | +7.49% |
| token_at_position | 333.5±2.62µs | 331.6±1.89µs | -0.57% |
| tokens_at_position | 3.7±0.01ms | 3.7±0.02ms | 0.00% |
| tokens_for_file | 398.2±1.48µs | 401.7±7.40µs | +0.88% |
| traverse | 37.3±0.61ms | 37.9±0.66ms | +1.61% |
Thanks Kaya, this is great. Appreciate the thoughtful documentation updates. I think adding more tests might be useful before merging this though. Here's a few suggestions:
- Add an integration test simulating the full workflow of enabling, deploying, and updating proxy contracts.
- Include error case testing to ensure proper handling of failure scenarios (e.g., invalid addresses, updating non-existent proxies).
- Test the interaction between proxy and implementation contracts to verify correct function forwarding.
- Verify the proxy contract's ownership controls, ensuring only the owner can update the target.
Benchmark for e99094d
Click to view benchmark
| Test | Base | PR | % |
|---|---|---|---|
| code_action | 5.2±0.12ms | 5.2±0.09ms | 0.00% |
| code_lens | 292.4±13.45ns | 316.0±22.39ns | +8.07% |
| compile | 2.5±0.03s | 2.5±0.03s | 0.00% |
| completion | 4.7±0.07ms | 4.7±0.05ms | 0.00% |
| did_change_with_caching | 2.5±0.02s | 2.5±0.03s | 0.00% |
| document_symbol | 888.8±32.23µs | 853.7±20.79µs | -3.95% |
| format | 73.5±0.97ms | 74.5±3.08ms | +1.36% |
| goto_definition | 343.4±5.91µs | 346.1±5.46µs | +0.79% |
| highlight | 9.0±0.05ms | 9.0±0.09ms | 0.00% |
| hover | 497.1±3.08µs | 492.5±5.64µs | -0.93% |
| idents_at_position | 122.4±1.24µs | 120.8±0.37µs | -1.31% |
| inlay_hints | 658.1±16.41µs | 646.4±24.40µs | -1.78% |
| on_enter | 460.8±14.08ns | 464.1±10.54ns | +0.72% |
| parent_decl_at_position | 3.7±0.09ms | 3.7±0.04ms | 0.00% |
| prepare_rename | 348.9±4.55µs | 348.0±8.87µs | -0.26% |
| rename | 9.3±0.01ms | 9.3±0.16ms | 0.00% |
| semantic_tokens | 1306.8±15.81µs | 1272.9±11.11µs | -2.59% |
| token_at_position | 341.0±5.38µs | 335.5±2.29µs | -1.61% |
| tokens_at_position | 3.7±0.04ms | 3.7±0.03ms | 0.00% |
| tokens_for_file | 399.5±6.47µs | 402.0±3.59µs | +0.63% |
| traverse | 37.9±0.91ms | 37.4±1.10ms | -1.32% |
Currently, we ask for user input for both the proxy and the main contract deployment transactions. We should be able to just ask for the password, account to use, and user agreement only once.
Currently, we ask for user input for both the proxy and the main contract deployment transactions. We should be able to just ask for the password, account to use, and user agreement only once.
I agree that this is more seamless but with current way it is possible to use a different account for paying for the update transaction. If the first deployment depletes the first account, a user would have the ability still continue with the transaction. That being said we can do this tradeoff
Currently, we ask for user input for both the proxy and the main contract deployment transactions. We should be able to just ask for the password, account to use, and user agreement only once.
I agree that this is more seamless but with current way it is possible to use a different account for paying for the update transaction. If the first deployment depletes the first account, a user would have the ability still continue with the transaction. That being said we can do this tradeoff
For these multi-tx deployments, I think we should also build in a mechanism where if an account runs out of gas after the first deployment, forc-deploy is suspended and gives the user a chance to fund the account before continuing, at which point forc-deploy will try that transaction again.
We could also give the user the option to choose a different account before retrying.
Even if the user can choose multiple accounts, they still could run into an issue where they run out of gas and don't want to have to redo the tx's that were already successful.
I think it would also be good to show an estimate of the total amount of gas for all transactions before they agree to sign the first one, so that they can ensure they'll have enough. If we are able to estimate it, we could also display information about which accounts have enough gas for the full deployment. This could be done as a follow up issue.
Benchmark for 55c80da
Click to view benchmark
| Test | Base | PR | % |
|---|---|---|---|
| code_action | 5.2±0.09ms | 5.2±0.05ms | 0.00% |
| code_lens | 294.6±5.99ns | 288.1±7.65ns | -2.21% |
| compile | 2.5±0.04s | 2.5±0.03s | 0.00% |
| completion | 4.8±0.02ms | 4.7±0.01ms | -2.08% |
| did_change_with_caching | 2.5±0.03s | 2.5±0.05s | 0.00% |
| document_symbol | 841.6±19.03µs | 857.0±7.82µs | +1.83% |
| format | 82.1±0.98ms | 81.8±0.44ms | -0.37% |
| goto_definition | 335.7±7.29µs | 345.0±6.35µs | +2.77% |
| highlight | 9.0±0.01ms | 9.1±0.03ms | +1.11% |
| hover | 489.2±2.81µs | 492.1±6.14µs | +0.59% |
| idents_at_position | 117.1±0.29µs | 118.2±0.24µs | +0.94% |
| inlay_hints | 643.4±22.53µs | 645.3±23.47µs | +0.30% |
| on_enter | 458.6±10.44ns | 464.7±13.35ns | +1.33% |
| parent_decl_at_position | 3.7±0.04ms | 3.7±0.03ms | 0.00% |
| prepare_rename | 336.0±4.26µs | 342.5±10.35µs | +1.93% |
| rename | 9.3±0.09ms | 9.3±0.02ms | 0.00% |
| semantic_tokens | 1245.6±8.88µs | 1227.2±7.83µs | -1.48% |
| token_at_position | 326.4±1.81µs | 343.5±2.60µs | +5.24% |
| tokens_at_position | 3.7±0.01ms | 3.7±0.01ms | 0.00% |
| tokens_for_file | 395.4±1.85µs | 401.8±3.37µs | +1.62% |
| traverse | 36.7±0.87ms | 37.6±0.64ms | +2.45% |
This will need some more love, to be more specific needs two more integration tests:
- Try and fail to obtain ownership of a proxy with different account
- Deploy with proxy, make a call, update proxy's target and confirm that the re-routing routes to the updated contract and the call result changes.
I am currently querying how to check the result of a proxy contract call using the sdk.
Benchmark for ab0a0de
Click to view benchmark
| Test | Base | PR | % |
|---|---|---|---|
| code_action | 5.0±0.12ms | 5.0±0.08ms | 0.00% |
| code_lens | 327.4±10.13ns | 282.2±15.70ns | -13.81% |
| compile | 2.6±0.03s | 2.5±0.03s | -3.85% |
| completion | 4.5±0.09ms | 4.6±0.08ms | +2.22% |
| did_change_with_caching | 2.5±0.03s | 2.5±0.03s | 0.00% |
| document_symbol | 880.6±25.78µs | 910.7±46.30µs | +3.42% |
| format | 81.6±1.09ms | 82.2±0.56ms | +0.74% |
| goto_definition | 336.3±3.92µs | 342.2±6.08µs | +1.75% |
| highlight | 8.7±0.18ms | 8.7±0.06ms | 0.00% |
| hover | 487.6±10.70µs | 494.3±8.12µs | +1.37% |
| idents_at_position | 118.2±0.36µs | 117.4±1.20µs | -0.68% |
| inlay_hints | 634.9±28.85µs | 632.9±11.34µs | -0.32% |
| on_enter | 453.6±12.33ns | 460.7±12.82ns | +1.57% |
| parent_decl_at_position | 3.6±0.04ms | 3.6±0.02ms | 0.00% |
| prepare_rename | 337.5±6.59µs | 340.5±5.60µs | +0.89% |
| rename | 8.9±0.03ms | 8.9±0.12ms | 0.00% |
| semantic_tokens | 1220.5±12.77µs | 1284.2±9.74µs | +5.22% |
| token_at_position | 415.4±2.10µs | 341.8±2.93µs | -17.72% |
| tokens_at_position | 3.6±0.04ms | 3.6±0.04ms | 0.00% |
| tokens_for_file | 452.7±2.98µs | 462.1±18.76µs | +2.08% |
| traverse | 38.6±0.89ms | 38.1±1.06ms | -1.30% |
Benchmark for 48d1c73
Click to view benchmark
| Test | Base | PR | % |
|---|---|---|---|
| code_action | 5.0±0.07ms | 5.1±0.01ms | +2.00% |
| code_lens | 282.6±8.65ns | 308.1±9.68ns | +9.02% |
| compile | 2.6±0.04s | 2.5±0.03s | -3.85% |
| completion | 4.5±0.03ms | 4.6±0.04ms | +2.22% |
| did_change_with_caching | 2.5±0.02s | 2.5±0.02s | 0.00% |
| document_symbol | 942.5±25.24µs | 902.1±42.80µs | -4.29% |
| format | 69.9±1.95ms | 70.0±0.75ms | +0.14% |
| goto_definition | 339.1±3.69µs | 343.4±5.91µs | +1.27% |
| highlight | 8.7±0.12ms | 8.8±0.14ms | +1.15% |
| hover | 497.2±6.53µs | 496.5±5.48µs | -0.14% |
| idents_at_position | 117.5±0.35µs | 118.7±0.41µs | +1.02% |
| inlay_hints | 627.6±14.00µs | 633.7±29.73µs | +0.97% |
| on_enter | 483.3±13.80ns | 474.5±15.89ns | -1.82% |
| parent_decl_at_position | 3.6±0.03ms | 3.6±0.07ms | 0.00% |
| prepare_rename | 341.5±7.49µs | 341.0±7.70µs | -0.15% |
| rename | 9.0±0.05ms | 9.0±0.07ms | 0.00% |
| semantic_tokens | 1267.3±9.96µs | 1297.1±15.71µs | +2.35% |
| token_at_position | 332.8±1.19µs | 336.2±2.51µs | +1.02% |
| tokens_at_position | 3.6±0.13ms | 3.6±0.04ms | 0.00% |
| tokens_for_file | 424.8±2.23µs | 405.0±3.47µs | -4.66% |
| traverse | 37.1±0.90ms | 37.1±0.83ms | 0.00% |
Benchmark for 0b832ca
Click to view benchmark
| Test | Base | PR | % |
|---|---|---|---|
| code_action | 5.3±0.11ms | 5.2±0.04ms | -1.89% |
| code_lens | 289.7±12.55ns | 277.5±9.42ns | -4.21% |
| compile | 2.6±0.03s | 2.6±0.06s | 0.00% |
| completion | 4.8±0.06ms | 4.8±0.13ms | 0.00% |
| did_change_with_caching | 2.5±0.04s | 2.5±0.02s | 0.00% |
| document_symbol | 885.9±19.12µs | 896.1±54.82µs | +1.15% |
| format | 71.7±0.77ms | 72.5±0.88ms | +1.12% |
| goto_definition | 344.1±7.53µs | 344.8±6.53µs | +0.20% |
| highlight | 9.0±0.03ms | 9.0±0.02ms | 0.00% |
| hover | 510.3±5.93µs | 498.9±3.29µs | -2.23% |
| idents_at_position | 121.5±0.41µs | 120.0±0.95µs | -1.23% |
| inlay_hints | 647.4±17.20µs | 642.8±32.83µs | -0.71% |
| on_enter | 460.3±12.73ns | 463.4±14.77ns | +0.67% |
| parent_decl_at_position | 3.7±0.03ms | 3.7±0.02ms | 0.00% |
| prepare_rename | 346.5±5.30µs | 342.2±17.63µs | -1.24% |
| rename | 9.3±0.07ms | 9.3±0.08ms | 0.00% |
| semantic_tokens | 1208.0±9.30µs | 1255.9±13.55µs | +3.97% |
| token_at_position | 348.2±11.80µs | 330.8±8.88µs | -5.00% |
| tokens_at_position | 3.7±0.18ms | 3.7±0.04ms | 0.00% |
| tokens_for_file | 399.4±2.55µs | 406.5±6.24µs | +1.78% |
| traverse | 37.7±1.39ms | 37.2±0.70ms | -1.33% |