8000 fix: build backward compatible test contract by pugachAG · Pull Request #13576 · near/nearcore · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: build backward compatible test contract #13576

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

Merged
merged 5 commits into from
May 22, 2025

Conversation

pugachAG
Copy link
Contributor
@pugachAG pugachAG commented May 20, 2025

Currently we copy backwards_compatible_rs_contract.wasm from res directory. This is no longer necessary since we no longer support old protocol versions.
This PR changes that to make it compiled from test-contract-rs without latest_protocol feature enabled. This way we can make changes test contract in backward compatible way using #[cfg(feature = "latest_protocol")].
backwards_compatible_rs_contract.wasm is renamed to legacy_backwards_compatible_rs_contract.wasm, we keep it for the test_near_vm_artifact_output_stability test.

We also change resharding_v3 tests to use backwards_compatible_rs_contract instead of rs_contract because that test suite uses non-latest protocol version. So it imports host functions that might not yet be exposed in that protocol version which breaks it (#13565 is one example). Backward compatible contract should be used in such cases.

@pugachAG pugachAG requested review from nagisa and wacban May 20, 2025 19:21
@pugachAG pugachAG requested a review from a team as a code owner May 20, 2025 19:21
@pugachAG pugachAG changed the title fix: build backward compatible contract fix: build backward compatible test contract May 20, 2025
@pugachAG pugachAG force-pushed the build-backwards-compatible-contract branch 5 times, most recently from 59b193f to 2a20c83 Compare May 20, 2025 20:03
@pugachAG
Copy link
Contributor Author

@nagisa could you please suggest how test_near_vm_artifact_output_stability failure should be addressed? It relies on backward compatible contract not changing as part of near_test_contracts::arbitrary_contract

@pugachAG pugachAG force-pushed the build-backwards-compatible-contract branch from 2a20c83 to f738125 Compare May 21, 2025 06:36
@pugachAG pugachAG force-pushed the build-backwards-compatible-contract branch from f738125 to fcfba31 Compare May 21, 2025 07:09
@pugachAG pugachAG requested review from Trisfald and removed request for wacban May 21, 2025 08:35
@nagisa
Copy link
Collaborator
nagisa commented May 21, 2025

arbitrary_contract is a red herring to some extent – arbitrary contract uses the backwards compatible contract to determine the available functions to import and nothing else. All that is necessary that the contract used by the output stability test does not change for other reasons such as the compiler version changes. I suppose that since arbitrary_contract only inspects the imports from the backwards compatible contract this property continues to hold. The only instances where the hashes would change without a reason are upgrades to wasm-smith (preexisting failure mode) and now whenever somebody modifies the list of imported functions (which is a reasonable enough new failure mode to add.)

Given that all that's changing here is the list of imported functions IMO its perfectly fine to just update hashes without taking any other action.

@pugachAG pugachAG force-pushed the build-backwards-compatible-contract branch from 31cbf2a to a5515d6 Compare May 21, 2025 16:22
@pugachAG
Copy link
Contributor Author

@nagisa unfortunately prepare::prepare_contract failed with the new contract code with Deserialize error and I don't want to spend any more time debugging that. So I decided to keep the old version as legacy_backwards_compatible_rs_contract.wasm to be used in that test, can be removed later.
Could you please take a final look and stamp this PR 🙏

Copy link
codecov bot commented May 21, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 69.47%. Comparing base (760df75) to head (9a869d5).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #13576   +/-   ##
=======================================
  Coverage   69.47%   69.47%           
=======================================
  Files         856      856           
  Lines      168134   168137    +3     
  Branches   168134   168137    +3     
=======================================
+ Hits       116805   116808    +3     
- Misses      46544    46548    +4     
+ Partials     4785     4781    -4     
Flag Coverage Δ
pytests 1.52% <50.00%> (-0.01%) ⬇️
pytests-nightly 1.62% <0.00%> (-0.01%) ⬇️
unittests 69.11% <100.00%> (+<0.01%) ⬆️
unittests-nightly 69.01% <100.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.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

Choose a reason for hiding this comment

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

👍

About the rest of the changes, they look alright to me. I'll let someone from CRT have the final say though

Co-authored-by: Simonas Kazlauskas <git@kazlauskas.me>
@pugachAG pugachAG enabled auto-merge May 22, 2025 11:31
@pugachAG pugachAG added this pull request to the merge queue May 22, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 22, 2025
@pugachAG pugachAG added this pull request to the merge queue May 22, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 22, 2025
@pugachAG pugachAG enabled auto-merge May 22, 2025 18:13
@pugachAG pugachAG added this pull request to the merge queue May 22, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 22, 2025
@pugachAG pugachAG added this pull request to the merge queue May 22, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 22, 2025
@pugachAG pugachAG enabled auto-merge May 22, 2025 19:40
@pugachAG pugachAG added this pull request to the merge queue May 22, 2025
Merged via the queue into master with commit 43b4c9c May 22, 2025
28 checks passed
@pugachAG pugachAG deleted the build-backwards-compatible-contract branch May 22, 2025 20:12
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.

3 participants
0