near / nearcore

Reference client for NEAR Protocol
https://near.org
GNU General Public License v3.0
2.31k stars 618 forks source link

refactor: replace some references with owned structures in VMLogic #11615

Closed nagisa closed 3 months ago

nagisa commented 3 months ago

VMLogic containing a lifetime makes it difficult to have it live for any longer than a short sequence of instantiate-link-run and is one of the reasons why we're forced to have some unsafe code in our linking code.

This refactor replaces some of the reference fields with Arcs, Boxes, etc. This is not a complete refactor, I intend to do the remainder as a follow-up.

Based on #11614 Part of #11319

codecov[bot] commented 3 months ago

Codecov Report

Attention: Patch coverage is 79.09605% with 37 lines in your changes missing coverage. Please review.

Project coverage is 71.45%. Comparing base (8189888) to head (4851fce).

Files Patch % Lines
...ntime/runtime-params-estimator/src/gas_metering.rs 55.55% 16 Missing :warning:
runtime/near-vm-runner/src/wasmer_runner.rs 27.27% 0 Missing and 8 partials :warning:
...time/runtime-params-estimator/src/function_call.rs 52.94% 8 Missing :warning:
...me-params-estimator/src/costs_to_runtime_config.rs 0.00% 4 Missing :warning:
runtime/runtime/src/lib.rs 85.71% 0 Missing and 1 partial :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #11615 +/- ## ========================================== - Coverage 71.48% 71.45% -0.03% ========================================== Files 788 788 Lines 160835 160921 +86 Branches 160835 160921 +86 ========================================== + Hits 114968 114993 +25 - Misses 40850 40901 +51 - Partials 5017 5027 +10 ``` | [Flag](https://app.codecov.io/gh/near/nearcore/pull/11615/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | Coverage Δ | | |---|---|---| | [backward-compatibility](https://app.codecov.io/gh/near/nearcore/pull/11615/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | `0.23% <0.00%> (-0.01%)` | :arrow_down: | | [db-migration](https://app.codecov.io/gh/near/nearcore/pull/11615/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | `0.23% <0.00%> (-0.01%)` | :arrow_down: | | [genesis-check](https://app.codecov.io/gh/near/nearcore/pull/11615/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | `1.35% <0.00%> (-0.01%)` | :arrow_down: | | [integration-tests](https://app.codecov.io/gh/near/nearcore/pull/11615/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | `37.66% <37.85%> (-0.02%)` | :arrow_down: | | [linux](https://app.codecov.io/gh/near/nearcore/pull/11615/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | `68.89% <78.53%> (+0.01%)` | :arrow_up: | | [linux-nightly](https://app.codecov.io/gh/near/nearcore/pull/11615/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | `70.94% <79.09%> (-0.04%)` | :arrow_down: | | [macos](https://app.codecov.io/gh/near/nearcore/pull/11615/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | `52.29% <67.14%> (-0.28%)` | :arrow_down: | | [pytests](https://app.codecov.io/gh/near/nearcore/pull/11615/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | `1.58% <0.00%> (-0.01%)` | :arrow_down: | | [sanity-checks](https://app.codecov.io/gh/near/nearcore/pull/11615/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | `1.38% <0.00%> (-0.01%)` | :arrow_down: | | [unittests](https://app.codecov.io/gh/near/nearcore/pull/11615/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | `66.12% <74.57%> (-0.03%)` | :arrow_down: | | [upgradability](https://app.codecov.io/gh/near/nearcore/pull/11615/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | `0.28% <0.00%> (-0.01%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.