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

call_v2 cross-contract calls with additional limit parameters #2077

Merged
merged 51 commits into from
Feb 8, 2024

Conversation

ascjones
Copy link
Collaborator

@ascjones ascjones commented Jan 29, 2024

Requires version of pallet-contracts including call_v2 host function. Introduced in this commit

There is a new host function call_v2 which allows passing both Weight parts: ref_time_limit and proof_time_limit and the storage_deposit_limit. The legacy call function only provides the single gas_limit parameter, which is used as the value for ref_time_limit.

The call extrinsic already requires these, so this just brings the cross-contract call API into line with the extrinsic.

These parameters can be set on a call builder instance, e.g.

call_builder
  .ref_time_limit(ref_time_limit)
  .proof_time_limit(proof_time_limit)
  .storage_deposit_limit(storage_deposit_limit)
  .invoke();

Calling invoke will cause the host function ext::call_v2 to be invoked, with the supplied parameters.

To call the original call host function with just the gas_limit parameter, call the call_v1 method on the call builder:

call_builder
  .call_v1()
  .gas_limit(ref_time_limit)
  .invoke();

Calling invoke will cause the host function ext::call to be invoked, with the supplied parameters.

@ascjones ascjones changed the title *WIP* support v2 contract invocation with proof_size_limit parameter *WIP* v2 contract invocation with proof_size_limit parameter Jan 29, 2024
ascjones and others added 16 commits January 30, 2024 16:40
* WIP

* Update versions

* WIP

* WIP migration

* WIP

* Make test pass

* Move e2e tests mod to own file

* Update comment

* Update example for new e2e API

* Update integration-tests/upgradeable-contracts/set-code-hash-migration/lib.rs

Co-authored-by: Michael Müller <michi@parity.io>

* Top level gitignore

* Fix tests update comments

* Update upgradeable contracts README.md

* spelling

---------

Co-authored-by: Michael Müller <michi@parity.io>
* add e2e tests to basic-contract-caller example

* Fix basic-contract-caller e2e tests

* Remove `call_builder` change

* Remove `basic_contract_caller` integration test, moved to #1909

* Revert "Remove `basic_contract_caller` integration test, moved to #1909"

This reverts commit 8f3ab31.

* fmt
@ascjones ascjones changed the title *WIP* v2 contract invocation with proof_size_limit parameter call_v2 cross-contract calls with additional limit parameters Feb 2, 2024
Copy link
Contributor

@SkymanOne SkymanOne left a comment

Choose a reason for hiding this comment

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

LGTM. Need also to add migration notice in ink-docs

@ascjones ascjones enabled auto-merge (squash) February 6, 2024 17:26
@ascjones
Copy link
Collaborator Author

ascjones commented Feb 7, 2024

One unrelated test currently failing, should be fixed in #2101

@ascjones ascjones merged commit dfcfd85 into master Feb 8, 2024
22 of 23 checks passed
@ascjones ascjones deleted the aj/call-v2 branch February 8, 2024 12:32
@SkymanOne SkymanOne mentioned this pull request Feb 8, 2024
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
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
@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.

4 participants