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

Allow storage access in fallback only contracts #6031

Merged
merged 2 commits into from
May 21, 2024
Merged

Conversation

IGI-111
Copy link
Contributor

@IGI-111 IGI-111 commented May 19, 2024

Description

Contract that do not implement any ABI (and therefore have no methods) do not always properly set the storage annotations of the entry function because the fallback function's storage annotations are not taken into account. This changes makes sure that the storage function's storage permissions are also considered.

We also change the code generation for the method selector to make selection optional, such as for full passthrough proxies.

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).
  • 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.
  • I have requested a review from the relevant team or maintainers.

@IGI-111 IGI-111 force-pushed the IGI-111/fallback-only branch 2 times, most recently from 370e348 to e115645 Compare May 19, 2024 16:09
@IGI-111 IGI-111 added the breaking May cause existing user code to break. Requires a minor or major release. label May 19, 2024
Copy link

Benchmark for a0f806f

Click to view benchmark
Test Base PR %
code_action 5.2±0.03ms 5.2±0.10ms 0.00%
code_lens 282.2±6.50ns 283.1±12.56ns +0.32%
compile 2.9±0.03s 2.9±0.05s 0.00%
completion 4.5±0.08ms 4.5±0.09ms 0.00%
did_change_with_caching 2.8±0.03s 2.8±0.03s 0.00%
document_symbol 980.0±11.39µs 953.0±16.08µs -2.76%
format 73.8±0.75ms 73.7±1.27ms -0.14%
goto_definition 364.0±8.94µs 368.2±6.56µs +1.15%
highlight 8.7±0.15ms 8.7±0.15ms 0.00%
hover 483.0±3.84µs 484.6±6.64µs +0.33%
idents_at_position 122.8±0.39µs 122.3±0.60µs -0.41%
inlay_hints 652.7±10.06µs 660.0±34.51µs +1.12%
on_enter 466.3±7.22ns 454.3±12.73ns -2.57%
parent_decl_at_position 3.6±0.04ms 3.6±0.02ms 0.00%
prepare_rename 367.3±10.60µs 368.4±7.03µs +0.30%
rename 9.2±0.15ms 9.2±0.16ms 0.00%
semantic_tokens 991.0±8.85µs 996.7±19.51µs +0.58%
token_at_position 356.3±1.40µs 365.9±2.70µs +2.69%
tokens_at_position 3.6±0.02ms 3.6±0.07ms 0.00%
tokens_for_file 413.3±2.41µs 421.0±2.19µs +1.86%
traverse 39.3±1.22ms 39.7±1.05ms +1.02%

Copy link

Benchmark for c9fcce9

Click to view benchmark
Test Base PR %
code_action 5.2±0.11ms 5.2±0.01ms 0.00%
code_lens 282.9±7.55ns 285.1±20.48ns +0.78%
compile 2.9±0.04s 2.9±0.03s 0.00%
completion 4.6±0.09ms 4.6±0.15ms 0.00%
did_change_with_caching 2.8±0.05s 2.8±0.02s 0.00%
document_symbol 956.0±14.76µs 1011.8±36.81µs +5.84%
format 73.7±0.71ms 73.5±1.00ms -0.27%
goto_definition 365.3±4.77µs 367.0±9.13µs +0.47%
highlight 8.7±0.12ms 8.7±0.05ms 0.00%
hover 482.2±7.96µs 490.2±4.11µs +1.66%
idents_at_position 121.8±0.39µs 122.1±0.75µs +0.25%
inlay_hints 652.9±9.94µs 655.4±25.26µs +0.38%
on_enter 465.6±8.22ns 458.6±20.25ns -1.50%
parent_decl_at_position 3.6±0.03ms 3.6±0.06ms 0.00%
prepare_rename 364.6±2.43µs 364.0±5.73µs -0.16%
rename 9.3±0.50ms 9.2±0.14ms -1.08%
semantic_tokens 969.4±21.46µs 975.0±17.43µs +0.58%
token_at_position 362.5±2.18µs 360.3±3.30µs -0.61%
tokens_at_position 3.6±0.02ms 3.6±0.03ms 0.00%
tokens_for_file 416.7±1.89µs 420.5±3.81µs +0.91%
traverse 40.4±1.20ms 40.3±1.14ms -0.25%

Copy link

Benchmark for 9250810

Click to view benchmark
Test Base PR %
code_action 5.2±0.05ms 5.2±0.03ms 0.00%
code_lens 283.4±7.17ns 281.3±4.91ns -0.74%
compile 3.0±0.06s 3.0±0.03s 0.00%
completion 4.6±0.10ms 4.6±0.10ms 0.00%
did_change_with_caching 2.9±0.04s 2.8±0.07s -3.45%
document_symbol 966.2±22.51µs 956.7±11.87µs -0.98%
format 74.8±2.40ms 74.3±0.94ms -0.67%
goto_definition 426.9±8.16µs 368.6±6.82µs -13.66%
highlight 8.8±0.20ms 8.7±0.14ms -1.14%
hover 549.4±7.39µs 486.7±9.07µs -11.41%
idents_at_position 122.8±0.45µs 122.5±1.47µs -0.24%
inlay_hints 661.7±28.28µs 657.3±23.18µs -0.66%
on_enter 472.9±10.93ns 477.1±16.73ns +0.89%
parent_decl_at_position 3.6±0.06ms 3.6±0.05ms 0.00%
prepare_rename 426.0±4.83µs 368.8±6.33µs -13.43%
rename 9.3±0.12ms 9.2±0.21ms -1.08%
semantic_tokens 988.1±22.62µs 971.0±19.50µs -1.73%
token_at_position 365.4±2.10µs 369.1±3.24µs +1.01%
tokens_at_position 3.6±0.05ms 3.6±0.05ms 0.00%
tokens_for_file 418.5±1.83µs 460.0±3.07µs +9.92%
traverse 41.0±1.26ms 41.0±0.78ms 0.00%

Copy link

Benchmark for 6025ae0

Click to view benchmark
Test Base PR %
code_action 5.2±0.11ms 5.2±0.13ms 0.00%
code_lens 284.4±7.85ns 284.2±7.56ns -0.07%
compile 3.0±0.04s 3.0±0.04s 0.00%
completion 4.6±0.10ms 4.6±0.03ms 0.00%
did_change_with_caching 2.8±0.03s 2.8±0.06s 0.00%
document_symbol 1027.8±35.32µs 972.0±10.45µs -5.43%
format 74.0±0.66ms 75.2±1.49ms +1.62%
goto_definition 371.5±9.63µs 380.7±6.69µs +2.48%
highlight 8.7±0.06ms 8.7±0.03ms 0.00%
hover 481.7±5.82µs 505.8±6.99µs +5.00%
idents_at_position 122.5±0.62µs 124.0±1.70µs +1.22%
inlay_hints 656.0±26.07µs 664.4±33.17µs +1.28%
on_enter 488.7±12.11ns 462.6±16.69ns -5.34%
parent_decl_at_position 3.6±0.03ms 3.6±0.02ms 0.00%
prepare_rename 362.4±5.69µs 378.4±4.22µs +4.42%
rename 9.2±0.43ms 9.2±0.05ms 0.00%
semantic_tokens 977.6±16.93µs 994.5±35.45µs +1.73%
token_at_position 358.5±2.30µs 366.8±3.01µs +2.32%
tokens_at_position 3.6±0.02ms 3.6±0.04ms 0.00%
tokens_for_file 419.3±1.88µs 425.8±2.53µs +1.55%
traverse 41.4±1.59ms 41.1±0.84ms -0.72%

Contract that do not implement any ABI (and therefore have no methods)
do not always properly set the storage annotations of the entry function
because the fallback function's storage annotations are not taken into
account. This changes makes sure that the storage function's storage
permissions are also considered.
Copy link

Benchmark for 261b494

Click to view benchmark
Test Base PR %
code_action 5.2±0.02ms 5.2±0.12ms 0.00%
code_lens 284.2±11.23ns 283.9±8.81ns -0.11%
compile 2.9±0.03s 2.9±0.03s 0.00%
completion 4.5±0.01ms 4.5±0.06ms 0.00%
did_change_with_caching 2.8±0.06s 2.8±0.03s 0.00%
document_symbol 1042.9±17.61µs 993.5±21.31µs -4.74%
format 73.9±1.07ms 74.4±1.12ms +0.68%
goto_definition 368.3±4.24µs 366.7±10.37µs -0.43%
highlight 8.7±0.13ms 8.8±0.41ms +1.15%
hover 491.1±4.53µs 489.6±6.59µs -0.31%
idents_at_position 122.7±0.42µs 122.8±1.36µs +0.08%
inlay_hints 657.4±36.08µs 657.9±22.85µs +0.08%
on_enter 474.0±23.59ns 466.5±7.20ns -1.58%
parent_decl_at_position 3.6±0.03ms 3.6±0.04ms 0.00%
prepare_rename 369.3±4.50µs 367.0±5.45µs -0.62%
rename 9.2±0.01ms 9.3±0.40ms +1.09%
semantic_tokens 966.8±16.49µs 989.7±20.58µs +2.37%
token_at_position 363.0±1.32µs 360.2±4.19µs -0.77%
tokens_at_position 3.6±0.04ms 3.6±0.08ms 0.00%
tokens_for_file 422.7±6.35µs 422.3±3.67µs -0.09%
traverse 40.6±1.18ms 40.1±0.94ms -1.23%

@IGI-111 IGI-111 requested a review from a team May 20, 2024 09:17
@IGI-111 IGI-111 self-assigned this May 20, 2024
@IGI-111 IGI-111 marked this pull request as ready for review May 20, 2024 09:18
Copy link

Benchmark for 0c91717

Click to view benchmark
Test Base PR %
code_action 5.4±0.02ms 5.2±0.02ms -3.70%
code_lens 286.8±8.03ns 283.6±8.04ns -1.12%
compile 3.1±0.05s 3.0±0.05s -3.23%
completion 4.8±0.13ms 4.5±0.07ms -6.25%
did_change_with_caching 2.9±0.06s 2.9±0.04s 0.00%
document_symbol 963.1±14.80µs 1010.4±47.55µs +4.91%
format 74.7±0.76ms 73.8±0.76ms -1.20%
goto_definition 372.0±3.96µs 363.9±5.59µs -2.18%
highlight 9.1±0.18ms 8.7±0.04ms -4.40%
hover 489.2±4.73µs 480.6±8.97µs -1.76%
idents_at_position 123.4±0.38µs 124.8±1.67µs +1.13%
inlay_hints 668.9±21.43µs 656.6±24.93µs -1.84%
on_enter 461.3±15.08ns 449.2±11.89ns -2.62%
parent_decl_at_position 3.7±0.05ms 3.6±0.05ms -2.70%
prepare_rename 368.7±6.54µs 362.9±18.68µs -1.57%
rename 9.7±0.17ms 9.3±0.13ms -4.12%
semantic_tokens 985.7±19.89µs 985.8±31.68µs +0.01%
token_at_position 363.7±4.09µs 356.3±1.96µs -2.03%
tokens_at_position 3.7±0.05ms 3.6±0.03ms -2.70%
tokens_for_file 422.6±2.01µs 416.4±1.62µs -1.47%
traverse 41.2±1.32ms 41.0±1.01ms -0.49%

@IGI-111 IGI-111 merged commit ea97c34 into master May 21, 2024
38 checks passed
@IGI-111 IGI-111 deleted the IGI-111/fallback-only branch May 21, 2024 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking May cause existing user code to break. Requires a minor or major release.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants