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

[refactor] Extracted near-vm-runner from near-primitives #11578

Merged

Conversation

akorchyn
Copy link
Contributor

@akorchyn akorchyn commented Jun 14, 2024

Description

This pull request tries to de-couple the near-vm-runner from the dependency list of near-primitives

Motivation

Near-vm-runner is not a proper dependency for something primitive, but now it's a part of many near dependencies.
Also, near-vm-runner uses rustix::fs, a blocker for any release on Windows.

  • here you can see that Windows built is broken.
  • here you can see an example patch so build pass

How is it done?

Well, I have proceeded next way:

  • Moved ViewApplyState to node-runtime
  • Copied ProfileV3 to near-primitives and created conversion in node-runtime

TODO:

  • Windows CI for public libraries :)
  • Fix tests compilation

For reviewers

  • Please take a look at a patch that I have created here. Do you think we could rollout 0.22.2 release, so I could continue rolling out 0.22, but go with this more proper implementation for future 0.23/0.24 release?

@akorchyn akorchyn force-pushed the extracted-near-vm-runner-from-near-primitives branch from 95b64e5 to 585db43 Compare June 14, 2024 12:20
@akorchyn akorchyn marked this pull request as ready for review June 14, 2024 12:27
@akorchyn akorchyn requested a review from a team as a code owner June 14, 2024 12:27
@akorchyn akorchyn requested a review from wacban June 14, 2024 12:27
Copy link

codecov bot commented Jun 14, 2024

Codecov Report

Attention: Patch coverage is 94.49275% with 19 lines in your changes missing coverage. Please review.

Project coverage is 71.49%. Comparing base (7414c3b) to head (8a56afc).

Files Patch % Lines
core/primitives/src/profile_data_v3.rs 94.61% 4 Missing and 14 partials ⚠️
chain/chain/src/runtime/mod.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #11578      +/-   ##
==========================================
+ Coverage   71.44%   71.49%   +0.04%     
==========================================
  Files         786      787       +1     
  Lines      160355   160698     +343     
  Branches   160355   160698     +343     
==========================================
+ Hits       114573   114898     +325     
  Misses      40793    40793              
- Partials     4989     5007      +18     
Flag Coverage Δ
backward-compatibility 0.23% <0.00%> (-0.01%) ⬇️
db-migration 0.23% <0.00%> (-0.01%) ⬇️
genesis-check 1.36% <0.00%> (-0.01%) ⬇️
integration-tests 37.72% <19.42%> (-0.06%) ⬇️
linux 68.92% <94.49%> (+0.06%) ⬆️
linux-nightly 70.96% <86.11%> (-0.02%) ⬇️
macos 52.54% <94.49%> (+0.15%) ⬆️
pytests 1.59% <0.00%> (-0.01%) ⬇️
sanity-checks 1.39% <0.00%> (-0.01%) ⬇️
unittests 66.20% <94.49%> (+0.04%) ⬆️
upgradability 0.28% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@akorchyn akorchyn force-pushed the extracted-near-vm-runner-from-near-primitives branch 2 times, most recently from 89c8009 to 7a17ee6 Compare June 14, 2024 21:29
@akorchyn akorchyn force-pushed the extracted-near-vm-runner-from-near-primitives branch from 7a17ee6 to 6a23b9b Compare June 14, 2024 21:31
Copy link
Collaborator

@nagisa nagisa left a comment

Choose a reason for hiding this comment

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

This looks quite a bit more reasonable! The copies of profile_data_v3 can be simplified and made smaller in a follow-up(s) by anybody who cares.

I did a brief look-around for ecosystem uses of ViewApplyState and it does appear that near-sdk-rs/near-sdk-sim is using this structure (alongside the whole contract cache thing...) and is the only public user that I was able to find.

This crate however also pulls in the whole transaction runtime, so it shouldn't be a big deal for it to reference that struct from there. Will there be other users of this struct? I don't know! And I don't think we'll find out without breaking those users ^^

(The approval is conditional on the fixes to GHA workflows)

.github/workflows/ci.yml Outdated Show resolved Hide resolved
@nagisa nagisa added this pull request to the merge queue Jun 17, 2024
Merged via the queue into near:master with commit aaa924f Jun 17, 2024
30 checks passed
posvyatokum pushed a commit that referenced this pull request Jun 17, 2024
This pull request tries to de-couple the near-vm-runner from the
dependency list of near-primitives

Near-vm-runner is not a proper dependency for something primitive, but
now it's a part of many near dependencies.
Also, near-vm-runner uses rustix::fs, a blocker for any release on
Windows.

* [here](near/near-cli-rs#350) you can see that
Windows built is broken.
*
[here](https://github.com/near/nearcore/compare/1.39.2...akorchyn:nearcore:patch-defaults?expand=1)
you can see an example patch so build pass

Well, I have proceeded next way:
* Moved ViewApplyState to node-runtime
* Copied ProfileV3 to near-primitives and created conversion in
node-runtime

* [x] Windows CI for public libraries :)
* [x] Fix tests compilation

* Please take a look at a patch that I have created
[here](https://github.com/near/nearcore/compare/1.39.2...akorchyn:nearcore:patch-defaults?expand=1).
Do you think we could rollout 0.22.2 release, so I could continue
rolling out 0.22, but go with this more proper implementation for future
0.23/0.24 release?
@VanBarbascu VanBarbascu added the pick-2.0.0 Changes that need to be cherry-picked in 2.0 release label Aug 9, 2024
marcelo-gonzalez pushed a commit that referenced this pull request Aug 13, 2024
### Description

This pull request tries to de-couple the near-vm-runner from the
dependency list of near-primitives

### Motivation
Near-vm-runner is not a proper dependency for something primitive, but
now it's a part of many near dependencies.
Also, near-vm-runner uses rustix::fs, a blocker for any release on
Windows.

* [here](near/near-cli-rs#350) you can see that
Windows built is broken.
*
[here](https://github.com/near/nearcore/compare/1.39.2...akorchyn:nearcore:patch-defaults?expand=1)
you can see an example patch so build pass

### How is it done?
Well, I have proceeded next way:
* Moved ViewApplyState to node-runtime
* Copied ProfileV3 to near-primitives and created conversion in
node-runtime

#### TODO:
* [x] Windows CI for public libraries :)
* [x] Fix tests compilation


## For reviewers
* Please take a look at a patch that I have created
[here](https://github.com/near/nearcore/compare/1.39.2...akorchyn:nearcore:patch-defaults?expand=1).
Do you think we could rollout 0.22.2 release, so I could continue
rolling out 0.22, but go with this more proper implementation for future
0.23/0.24 release?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pick-2.0.0 Changes that need to be cherry-picked in 2.0 release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants