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

feat: global contract usage #12886

Open
wants to merge 51 commits into
base: master
Choose a base branch
from
Open

feat: global contract usage #12886

wants to merge 51 commits into from

Conversation

stedfn
Copy link
Contributor

@stedfn stedfn commented Feb 7, 2025

The PR adds testing and support for the UseGlobalContract action. Part of #12716

Copy link

codecov bot commented Feb 7, 2025

Codecov Report

Attention: Patch coverage is 78.19149% with 41 lines in your changes missing coverage. Please review.

Project coverage is 70.48%. Comparing base (e8bbcfb) to head (0d07078).
Report is 7 commits behind head on master.

Files with missing lines Patch % Lines
runtime/runtime/src/actions.rs 54.54% 13 Missing and 2 partials ⚠️
runtime/runtime/src/lib.rs 68.96% 5 Missing and 4 partials ⚠️
core/primitives/src/action/mod.rs 0.00% 7 Missing ⚠️
core/primitives/src/errors.rs 0.00% 5 Missing ⚠️
core/primitives/src/trie_key.rs 71.42% 2 Missing ⚠️
chain/chain-primitives/src/error.rs 0.00% 1 Missing ⚠️
chain/chain/src/runtime/mod.rs 0.00% 1 Missing ⚠️
integration-tests/src/user/runtime_user.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #12886      +/-   ##
==========================================
- Coverage   70.53%   70.48%   -0.05%     
==========================================
  Files         851      854       +3     
  Lines      174921   175594     +673     
  Branches   174921   175594     +673     
==========================================
+ Hits       123374   123765     +391     
- Misses      46420    46686     +266     
- Partials     5127     5143      +16     
Flag Coverage Δ
backward-compatibility 0.36% <0.00%> (-0.01%) ⬇️
db-migration 0.36% <0.00%> (-0.01%) ⬇️
genesis-check 1.42% <0.00%> (-0.01%) ⬇️
linux 70.12% <7.44%> (-0.27%) ⬇️
linux-nightly 70.12% <78.19%> (-0.04%) ⬇️
pytests 1.73% <0.00%> (-0.01%) ⬇️
sanity-checks 1.53% <0.00%> (-0.01%) ⬇️
unittests 70.31% <78.19%> (-0.05%) ⬇️
upgradability 0.36% <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.

@stedfn stedfn force-pushed the stefan/global_contract_usage branch from ac40cd9 to b4c4c2f Compare February 11, 2025 12:11
@stedfn stedfn changed the title [wip] feat: global contract usage feat: global contract usage Feb 13, 2025
@stedfn stedfn requested a review from pugachAG February 13, 2025 12:28
@stedfn stedfn marked this pull request as ready for review February 13, 2025 12:28
@stedfn stedfn requested a review from a team as a code owner February 13, 2025 12:28
runtime/runtime/src/actions.rs Show resolved Hide resolved
runtime/runtime/src/balance_checker.rs Outdated Show resolved Hide resolved
runtime/runtime/src/lib.rs Outdated Show resolved Hide resolved
core/store/src/trie/update.rs Outdated Show resolved Hide resolved
integration-tests/src/test_loop/utils/transactions.rs Outdated Show resolved Hide resolved
integration-tests/src/test_loop/utils/transactions.rs Outdated Show resolved Hide resolved
integration-tests/src/test_loop/utils/transactions.rs Outdated Show resolved Hide resolved
runtime/runtime/src/actions.rs Outdated Show resolved Hide resolved
runtime/runtime/src/balance_checker.rs Outdated Show resolved Hide resolved
runtime/runtime/src/lib.rs Outdated Show resolved Hide resolved
runtime/runtime/src/actions.rs Outdated Show resolved Hide resolved
runtime/runtime/src/balance_checker.rs Outdated Show resolved Hide resolved
// TODO(#12716): implement global contract usage
let key = TrieKey::GlobalContractCode { identifier: action.contract_identifier.clone().into() };
if !state_update.contains_key(&key)? {
return Err(RuntimeError::GlobalContractError(GlobalContractError::IdentifierNotFound(
Copy link
Contributor

Choose a reason for hiding this comment

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

almost missed that: returning Err here indicates internal error, so this will fail the whole chunk application. instead you should set error result for this action, like we do that for action_deploy_global_contract:

        result.result = Err(ActionErrorKind::GlobalContractIdentifierNotFound {...}).into());
        return Ok(());

note that we need to add ActionErrorKind instead of new RuntimeError

core/primitives/src/test_utils.rs Outdated Show resolved Hide resolved
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.

2 participants