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: move NightshadeRuntime to chain #10675

Merged
merged 1 commit into from Feb 28, 2024

Conversation

pugachAG
Copy link
Contributor

@pugachAG pugachAG commented Feb 27, 2024

This PR is a part of getting rid of KeyValueRuntime (#10678) and MockEpochManager (#10634).

Currently NightshadeRuntime is part of nearcore which makes it impossible to use it in chain since chain depends on nearcore. We need to use NightshadeRuntime as a replacement for KeyValueRuntime in chain tests. Ideally it would be great to move it to node-runtime crate, but currently it has a lot of dependencies from near_chain which makes it very challenging, so as the first step let's move it to chain.

This PR includes:

  • move nearcore::runtime to near_chain::runtime
  • introduce NightshadeRuntimeExt to expose NightshadeRuntime::from_config separately since NearConfig is part of nearcore
  • move GenesisExt test methods directly to Genesis, also duplicate some constants for now (will be refactored separately to reduce size of this PR).
  • move the necessary migrations code to chain

@pugachAG pugachAG force-pushed the move-nightshade-runtime-chain branch from d0cf8aa to 8169346 Compare February 27, 2024 21:02
Copy link

codecov bot commented Feb 27, 2024

Codecov Report

Attention: Patch coverage is 95.84775% with 12 lines in your changes are missing coverage. Please review.

Project coverage is 72.26%. Comparing base (7bad46a) to head (731ff7c).

Files Patch % Lines
chain/chain/src/runtime/mod.rs 47.82% 11 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #10675      +/-   ##
==========================================
- Coverage   72.28%   72.26%   -0.02%     
==========================================
  Files         732      734       +2     
  Lines      150408   150457      +49     
  Branches   150408   150457      +49     
==========================================
+ Hits       108716   108732      +16     
- Misses      36753    36781      +28     
- Partials     4939     4944       +5     
Flag Coverage Δ
backward-compatibility 0.24% <0.00%> (-0.01%) ⬇️
db-migration 0.24% <0.00%> (-0.01%) ⬇️
genesis-check 1.40% <0.00%> (-0.01%) ⬇️
integration-tests 36.88% <86.15%> (+<0.01%) ⬆️
linux 71.09% <95.84%> (-0.03%) ⬇️
linux-nightly 71.70% <95.84%> (-0.01%) ⬇️
macos 55.29% <93.42%> (-0.07%) ⬇️
pytests 1.66% <36.39%> (+0.03%) ⬆️
sanity-checks 1.41% <36.39%> (-0.01%) ⬇️
unittests 68.11% <93.42%> (-0.02%) ⬇️
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.

@pugachAG pugachAG force-pushed the move-nightshade-runtime-chain branch from 8169346 to 731ff7c Compare February 27, 2024 21:45
@pugachAG pugachAG marked this pull request as ready for review February 27, 2024 21:46
@pugachAG pugachAG requested a review from a team as a code owner February 27, 2024 21:46
@nagisa
Copy link
Collaborator

nagisa commented Feb 28, 2024

Currently NightshadeRuntime is part of nearcore which makes it impossible to use it in chain since chain depends on nearcore.

Could you please expand on this part? Why is it necessary to make it possible to use it in a chain? There's a leap in the reasoning between this and the goal to get rid of the Mock thingy.

@robin-near
Copy link
Contributor

Wow this is a big refactor. I can't really get through it today because unfortunately a lot of these changes are hard to review because they are moved around, but am I right that the only changes are to move code around and not to do anything else at all?

@pugachAG
Copy link
Contributor Author

@robin-near yes, this change is purely about moving the code around, nothing else is changed.

@pugachAG pugachAG added this pull request to the merge queue Feb 28, 2024
Merged via the queue into master with commit 1ab5d1b Feb 28, 2024
28 checks passed
@pugachAG pugachAG deleted the move-nightshade-runtime-chain branch February 28, 2024 18:15
github-merge-queue bot pushed a commit that referenced this pull request Feb 29, 2024
In #10675 some of the constants and testing-related methods from
`nearcore::config` were copied to `near_chain_configs::test_utils`. This
PR removes it from `nearcore::configs` and replaces all the usages to
take it from `near_chain_configs`. Also some of the constants are used
not only for testing, so those are moved directly to
`near_chain_configs`.

Also wrap tests inside `nearcore::config` into `mod tests` because that
is how it should be.

This change doesn't introduce any functional changes to the codebase, it
only moves code around.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants