Skip to content
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: Implement ldc based automatic contract chunking #6250

Merged
merged 24 commits into from
Aug 17, 2024

Conversation

kayagokalp
Copy link
Member

@kayagokalp kayagokalp commented Jul 9, 2024

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.

@kayagokalp kayagokalp changed the base branch from master to kayagokalp/deploy-default-proxy July 9, 2024 22:06
@kayagokalp
Copy link
Member Author

based on #6069

Copy link

github-actions bot commented Jul 9, 2024

Benchmark for 5e70df3

Click to view benchmark
Test Base PR %
code_action 5.3±0.07ms 5.2±0.13ms -1.89%
code_lens 283.6±4.33ns 326.2±12.12ns +15.02%
compile 2.7±0.04s 2.8±0.03s +3.70%
completion 4.9±0.09ms 4.6±0.09ms -6.12%
did_change_with_caching 2.7±0.02s 2.7±0.02s 0.00%
document_symbol 875.4±27.08µs 933.7±32.03µs +6.66%
format 72.0±1.18ms 71.8±1.25ms -0.28%
goto_definition 337.4±6.62µs 352.4±7.76µs +4.45%
highlight 9.1±0.10ms 8.8±0.25ms -3.30%
hover 490.4±6.71µs 506.5±5.76µs +3.28%
idents_at_position 118.7±0.48µs 124.0±1.08µs +4.47%
inlay_hints 639.3±22.90µs 636.9±26.05µs -0.38%
on_enter 448.5±17.66ns 463.2±11.29ns +3.28%
parent_decl_at_position 3.7±0.04ms 3.6±0.04ms -2.70%
prepare_rename 342.7±8.20µs 354.1±6.70µs +3.33%
rename 9.6±0.10ms 9.3±0.07ms -3.12%
semantic_tokens 1239.0±28.04µs 1255.6±15.00µs +1.34%
token_at_position 332.8±2.73µs 348.6±17.00µs +4.75%
tokens_at_position 3.7±0.05ms 3.6±0.08ms -2.70%
tokens_for_file 398.7±2.71µs 408.2±2.48µs +2.38%
traverse 38.4±1.26ms 39.7±0.62ms +3.39%

@kayagokalp kayagokalp self-assigned this Jul 10, 2024
Base automatically changed from kayagokalp/deploy-default-proxy to master August 7, 2024 10:41
@kayagokalp kayagokalp marked this pull request as ready for review August 8, 2024 22:13
@kayagokalp kayagokalp requested a review from a team as a code owner August 8, 2024 22:13
@kayagokalp kayagokalp added enhancement New feature or request forc P: critical Should be looked at before anything else forc-deploy Everything to do with forc-deploy labels Aug 8, 2024
@kayagokalp kayagokalp requested a review from a team as a code owner August 8, 2024 22:46
@kayagokalp kayagokalp enabled auto-merge (squash) August 8, 2024 23:05
Copy link
Member

@sdankel sdankel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome work 👍

forc-plugins/forc-client/tests/deploy.rs Outdated Show resolved Hide resolved
forc-plugins/forc-client/src/util/pkg.rs Outdated Show resolved Hide resolved
forc-plugins/forc-client/src/util/pkg.rs Outdated Show resolved Hide resolved
forc-plugins/forc-client/src/util/pkg.rs Outdated Show resolved Hide resolved
forc-plugins/forc-client/src/util/pkg.rs Outdated Show resolved Hide resolved
forc-plugins/forc-client/src/util/pkg.rs Outdated Show resolved Hide resolved
forc-plugins/forc-client/tests/deploy.rs Show resolved Hide resolved
forc-plugins/forc-client/src/op/deploy.rs Show resolved Hide resolved
forc-plugins/forc-client/src/util/pkg.rs Outdated Show resolved Hide resolved
@kayagokalp kayagokalp enabled auto-merge (squash) August 16, 2024 01:41
@kayagokalp kayagokalp changed the title feat: Implement ldc based automatic contract chunking with auto split and loader generation feat: Implement ldc based automatic contract chunking Aug 16, 2024
Co-authored-by: Joshua Batty <joshpbatty@gmail.com>
Copy link
Member

@JoshuaBatty JoshuaBatty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work Kaya looks great. Just wondering if we can add a small section to the forc client documentation explaining that this process is going on automatically behind the scenes for large contracts. This then can help explain why they might see different outputs from forc during deployment.

alfiedotwtf
alfiedotwtf previously approved these changes Aug 16, 2024
forc-plugins/forc-client/src/op/deploy.rs Show resolved Hide resolved
forc-plugins/forc-client/src/op/deploy.rs Show resolved Hide resolved
forc-plugins/forc-client/src/op/deploy.rs Show resolved Hide resolved
## Description

Test should all pass once FuelLabs/fuels-rs#1483
is released

## 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.
@sdankel sdankel requested review from a team as code owners August 17, 2024 00:08
@kayagokalp kayagokalp merged commit d003a5f into master Aug 17, 2024
42 checks passed
@kayagokalp kayagokalp deleted the kayagokalp/proxy-with-chunks branch August 17, 2024 06:47
IGI-111 added a commit that referenced this pull request Aug 19, 2024
## Description

To be merged after #6250

## 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.

---------

Co-authored-by: Brandon Kite <brandonkite92@gmail.com>
Co-authored-by: IGI-111 <igi-111@protonmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request forc forc-deploy Everything to do with forc-deploy P: critical Should be looked at before anything else
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants