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

delegate_dependency api calls #2076

Merged
merged 33 commits into from
Feb 23, 2024
Merged

delegate_dependency api calls #2076

merged 33 commits into from
Feb 23, 2024

Conversation

ascjones
Copy link
Collaborator

@ascjones ascjones commented Jan 26, 2024

Adds support for two new host functions

  • lock_delegate_dependency: prevents the code at the given code hash for being removed.
  • unlock_delegate_dependency: releases the lock on the code being removed from the current contract.

Having a delegate dependency allows contracts to safely delegate to another code_hash with the guarantee that it cannot be deleted. See paritytech/substrate#14079.

I have modified the upgradeable-contracts/delegator integration test to demonstrate these new calls. For that purpose I have also added remove_code extrinsic to the e2e client.

🟡 Requires version of pallet_contracts including paritytech/polkadot-sdk@d250a6e

@ascjones ascjones changed the title *WIP* add delegate_dependency env api calls delegate_dependency api calls Feb 9, 2024
@ascjones ascjones marked this pull request as ready for review February 9, 2024 15:25
@ascjones ascjones requested a review from pgherveou February 9, 2024 15:26
@codecov-commenter
Copy link

codecov-commenter commented Feb 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 53.67%. Comparing base (1e46971) to head (d20cd52).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2076      +/-   ##
==========================================
+ Coverage   53.64%   53.67%   +0.02%     
==========================================
  Files         224      224              
  Lines        7046     7046              
  Branches     3118     3118              
==========================================
+ Hits         3780     3782       +2     
+ Misses       3266     3264       -2     

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

Copy link

github-actions bot commented Feb 19, 2024

🦑 📈 ink! Example Contracts ‒ Changes Report 📉 🦑

These are the results when building the integration-tests/* contracts from this branch with cargo-contract and comparing them to ink! master:

Contract Upstream Size (kB) PR Size (kB) Diff (kB) Diff (%) Change
call-builder-return-value 9.237 9.237 0 0
call-runtime 2.061 2.061 0 0
combined-extension 2.12 2.12 0 0
conditional-compilation 1.49 1.49 0 0
contract-storage 7.568 7.568 0 0
contract-terminate 1.329 1.329 0 0
contract-transfer 1.689 1.689 0 0
cross-contract-calls 5.835 5.835 0 0
cross-contract-calls/other-contract 1.583 1.583 0 0
custom-allocator 7.775 7.775 0 0
custom-environment 2.146 2.146 0 0
dns 7.318 7.318 0 0
e2e-call-runtime 1.296 1.296 0 0
e2e-runtime-only-backend 1.881 1.881 0 0
erc1155 14.308 14.308 0 0
erc20 6.918 6.918 0 0
erc721 10.007 10.007 0 0
events 5.258 5.258 0 0
flipper 1.639 1.639 0 0
incrementer 1.504 1.504 0 0
lang-err-integration-tests/call-builder-delegate 2.638 2.638 0 0
lang-err-integration-tests/call-builder 5.354 5.354 0 0
lang-err-integration-tests/constructors-return-value 1.985 1.985 0 0
lang-err-integration-tests/contract-ref 4.753 4.753 0 0
lang-err-integration-tests/integration-flipper 1.815 1.815 0 0
lazyvec-integration-test 4.616 4.616 0 0
mapping-integration-tests 7.999 7.999 0 0
mother 12.741 12.741 0 0
multi-contract-caller 6.313 6.313 0 0
multi-contract-caller/accumulator 1.378 1.378 0 0
multi-contract-caller/adder 1.912 1.912 0 0
multi-contract-caller/subber 1.932 1.932 0 0
multisig 21.821 21.821 0 0
payment-channel 5.659 5.659 0 0
psp22-extension 7.071 7.071 0 0
rand-extension 2.965 2.965 0 0
sr25519-verification 1.142 1.142 0 0
static-buffer 1.654 1.654 0 0
trait-dyn-cross-contract-calls 2.887 2.887 0 0
trait-dyn-cross-contract-calls/contracts/incrementer 1.545 1.545 0 0
trait-erc20 7.294 7.294 0 0
trait-flipper 1.49 1.49 0 0
trait-incrementer 1.614 1.614 0 0
upgradeable-contracts/delegator 3.928 3.928 0 0
upgradeable-contracts/delegator/delegatee 1.609 1.609 0 0
upgradeable-contracts/delegator/delegatee2 1.609 1.609 0 0
upgradeable-contracts/set-code-hash-migration 1.743 1.743 0 0
upgradeable-contracts/set-code-hash-migration/migration 1.45 1.45 0 0
upgradeable-contracts/set-code-hash-migration/updated-incrementer 1.897 1.897 0 0
upgradeable-contracts/set-code-hash 1.743 1.743 0 0
upgradeable-contracts/set-code-hash/updated-incrementer 1.721 1.721 0 0
wildcard-selector 2.846 2.846 0 0

Link to the run | Last update: Fri Feb 23 19:33:22 CET 2024

crates/env/src/api.rs Outdated Show resolved Hide resolved
github-merge-queue bot pushed a commit to paritytech/polkadot-sdk that referenced this pull request Feb 20, 2024
Remove `#[unstable]` on `call_v2`, `instantiate_v2`,
`lock_delegate_dependency` and `unlock_delegate_dependency`.
See ink! integrations: 
- call_v2: use-ink/ink#2077
- instantiate_v2: <TODO>
- lock/unlock dependency: use-ink/ink#2076
github-merge-queue bot pushed a commit to paritytech/polkadot-sdk that referenced this pull request Feb 20, 2024
Remove `#[unstable]` on `call_v2`, `instantiate_v2`,
`lock_delegate_dependency` and `unlock_delegate_dependency`.
See ink! integrations: 
- call_v2: use-ink/ink#2077
- instantiate_v2: <TODO>
- lock/unlock dependency: use-ink/ink#2076
paritytech-ci pushed a commit to paritytech/polkadot-sdk that referenced this pull request Feb 20, 2024
Remove `#[unstable]` on `call_v2`, `instantiate_v2`,
`lock_delegate_dependency` and `unlock_delegate_dependency`.
See ink! integrations: 
- call_v2: use-ink/ink#2077
- instantiate_v2: <TODO>
- lock/unlock dependency: use-ink/ink#2076
Copy link
Contributor

@pgherveou pgherveou left a comment

Choose a reason for hiding this comment

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

lgtm

crates/env/src/api.rs Outdated Show resolved Hide resolved
franciscoaguirre pushed a commit to paritytech/polkadot-sdk that referenced this pull request Feb 22, 2024
Remove `#[unstable]` on `call_v2`, `instantiate_v2`,
`lock_delegate_dependency` and `unlock_delegate_dependency`.
See ink! integrations: 
- call_v2: use-ink/ink#2077
- instantiate_v2: <TODO>
- lock/unlock dependency: use-ink/ink#2076
crates/e2e/src/backend.rs Outdated Show resolved Hide resolved
crates/e2e/src/backend.rs Show resolved Hide resolved
crates/env/src/api.rs Outdated Show resolved Hide resolved
crates/env/src/backend.rs Outdated Show resolved Hide resolved
@@ -0,0 +1,20 @@
[package]
name = "delegatee2"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done 👍

Copy link
Collaborator Author

@ascjones ascjones Feb 26, 2024

Choose a reason for hiding this comment

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

Copy link
Collaborator

@cmichi cmichi left a comment

Choose a reason for hiding this comment

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

Thanks, Andrew!

@ascjones ascjones enabled auto-merge (squash) February 23, 2024 17:12
@ascjones ascjones disabled auto-merge February 23, 2024 17:12
ascjones and others added 4 commits February 23, 2024 17:12
Co-authored-by: Michael Müller <[email protected]>
Co-authored-by: Michael Müller <[email protected]>
Co-authored-by: Michael Müller <[email protected]>
Co-authored-by: Michael Müller <[email protected]>
@ascjones ascjones enabled auto-merge (squash) February 23, 2024 17:37
@ascjones ascjones merged commit bc92b61 into master Feb 23, 2024
22 checks passed
@ascjones ascjones deleted the aj/delegate-dependency branch February 23, 2024 18:05
@SkymanOne SkymanOne mentioned this pull request Mar 4, 2024
bgallois pushed a commit to duniter/duniter-polkadot-sdk that referenced this pull request Mar 25, 2024
Remove `#[unstable]` on `call_v2`, `instantiate_v2`,
`lock_delegate_dependency` and `unlock_delegate_dependency`.
See ink! integrations: 
- call_v2: use-ink/ink#2077
- instantiate_v2: <TODO>
- lock/unlock dependency: use-ink/ink#2076
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.

5 participants