Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Remove contracts RPCs #12358

Merged
merged 6 commits into from
Oct 2, 2022
Merged

Remove contracts RPCs #12358

merged 6 commits into from
Oct 2, 2022

Conversation

athei
Copy link
Member

@athei athei commented Sep 27, 2022

Those RPCs are redundant and should be called via state_call. Polkadot.js and cargo contract both already migrated. This means all our tooling should not break after this change.

This will greatly reduce boilerplate and maintenance burden for those APIs.

@statictype ContractsUI is the last user dependent on those RPCs (instantiation dry-run). We will wait with merging until it migrated away.

cumulus companion: paritytech/cumulus#1685

Porting Guide

The high level contracts API in polkadot.js already uses state_call so upgrading to the latest version here is enough. If you are using api.rpc.contracts directly you need to switch to api.call.contractsApi.

@athei athei added A0-please_review Pull request needs code review. B5-clientnoteworthy C1-low PR touches the given topic and has a low impact on builders. D2-notlive 💤 PR contains changes in a runtime directory that is not deployed to a chain that requires an audit. labels Sep 27, 2022
Copy link
Contributor

@ascjones ascjones left a comment

Choose a reason for hiding this comment

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

🙌

@athei athei added A1-onice and removed A0-please_review Pull request needs code review. labels Sep 27, 2022
@athei
Copy link
Member Author

athei commented Sep 27, 2022

Blocked until ContractsUI no longer uses the instantiate RPC (ETA end of week).

@athei
Copy link
Member Author

athei commented Oct 2, 2022

bot merge

@paritytech-processbot paritytech-processbot bot merged commit 37664fe into master Oct 2, 2022
@paritytech-processbot paritytech-processbot bot deleted the at/remove-contract-rpc branch October 2, 2022 15:16
@ggwpez
Copy link
Member

ggwpez commented Oct 3, 2022

The companion is hanging and blocking the CI.

ordian added a commit that referenced this pull request Oct 5, 2022
* master: (42 commits)
  Adapt `pallet-contracts` to WeightV2 (#12421)
  Improved election pallet testing (#12327)
  Bump prost to 0.11+ (#12419)
  Use saturating add for alliance::disband witness data (#12418)
  [Fix] Rename VoterBagsList -> VoterList to match pdot (#12416)
  client/beefy: small code improvements (#12414)
  BEEFY: Simplify hashing for pallet-beefy-mmr (#12393)
  Add @koute to `docs/CODEOWNERS` and update stale paths (#12408)
  docs/CODEOWNERS: add @acatangiu as MMR owner (#12406)
  Remove unnecessary Clone trait bounds on CountedStorageMap (#12402)
  Fix `Weight::is_zero` (#12396)
  Beefy on-demand justifications as a custom RequestResponse protocol (#12124)
  Remove contracts RPCs (#12358)
  pallet-mmr: generate historical proofs (#12324)
  unsafe_pruning flag removed (#12385)
  Carry over where clauses defined in Config to Call and Hook (#12388)
  Properly set the max proof size weight on defaults and tests (#12383)
  BEEFY: impl TypeInfo for SignedCommitment (#12382)
  bounding staking: `BoundedElectionProvider` trait (#12362)
  New Pallet: Root offences (#11943)
  ...
kayabaNerve added a commit to serai-dex/serai that referenced this pull request Oct 20, 2022
Also removes the patch for zip since a new release was issued.

Closes #81.

Contracts RPC purged as according to 
paritytech/substrate#12358.
@eggachecat
Copy link

Now the tutorial is broken due to this change I think
see
https://docs.substrate.io/tutorials/work-with-pallets/contracts-pallet/
section [Expose the Contracts API]

What can I do?

@athei
Copy link
Member Author

athei commented Nov 7, 2022

You no longer need to add the RPCs. Have a look at this as an example.

@donkey-donkey
Copy link

You no longer need to add the RPCs. Have a look at this as an example.

thank you for this.
would you mind explaining what this line about calculating the gas limit means.

let gas_limit = gas_limit.unwrap_or(RuntimeBlockWeights::get().max_block);

thanks again

@athei
Copy link
Member Author

athei commented Dec 8, 2022

If the caller of the runtime API does not supply a gas_limit we just set it to the maximum weight of a block. Usually, a caller of the API does not know the limit because finding out that limit is the main purpose of using the API (dry run).

@donkey-donkey
Copy link

If the caller of the runtime API does not supply a gas_limit we just set it to the maximum weight of a block. Usually, a caller of the API does not know the limit because finding out that limit is the main purpose of using the API (dry run).

Very Nice.!
thanks

slmagus added a commit to slmagus/ink-docs that referenced this pull request Dec 16, 2022
Use a more recent version that doesn't have strange rpc dependancies as noted here paritytech/substrate#12358
cmichi pushed a commit to use-ink/ink-docs that referenced this pull request Jan 18, 2023
Use a more recent version that doesn't have strange rpc dependancies as noted here paritytech/substrate#12358
AlexD10S added a commit to AlexD10S/ink-docs that referenced this pull request Jan 24, 2023
* Use custom home icon (use-ink#102)

Swizzled the home icon via:

	yarn swizzle @docusaurus/theme-classic Icon/Home --danger

Generated the SVG for the code via:

	npx @svgr/cli <  Breadcrumb.svg

* Added Solidity -> ink! guide (use-ink#97)

* Added Solidity -> ink! guide

* replaced broken links

* Removed no-longer necessary text. Improved some sentence structures.

* Add monthly update for October (use-ink#105)

* Tune text

* Execute `yarn upgrade` (use-ink#106)

* Add link to blog post

* Less text on landing page

* --dev flag implies --tmp (use-ink#107)

* Execute `yarn upgrade`

* Upgrade to docusaurus v2.2.0 (use-ink#108)

* Bump loader-utils from 2.0.3 to 2.0.4 (use-ink#111)

Bumps [loader-utils](https://github.com/webpack/loader-utils) from 2.0.3 to 2.0.4.
- [Release notes](https://github.com/webpack/loader-utils/releases)
- [Changelog](https://github.com/webpack/loader-utils/blob/v2.0.4/CHANGELOG.md)
- [Commits](webpack/loader-utils@v2.0.3...v2.0.4)

---
updated-dependencies:
- dependency-name: loader-utils
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Add November 2022 Monthly Update (use-ink#113)

* Add November monthly update

* Add Sardinia team photo

* Fill out Sub0 section

* Add photo of fireside chat

* Small fixes for November update (use-ink#114)

* Add Novermber update to sidebar

* Add cropped fireside chat image

* Re-order dependency installation steps (use-ink#117)

* Use openbrush (use-ink#120)

* use openbrush

* add info how to add openbrush to project

* Update openbrush.md

* Improve landingpage (use-ink#123)

* Add and update monthly updates (use-ink#124)

* Add and update monthlies

* Fix broken links

* Adding the structure for support for spanish Documentation (use-ink#104) (use-ink#125)

* config docs in spanish + overview translation

* added support for translating versioning docs

Co-authored-by: Santi Balaguer <santibalaguer@Santis-MacBook-Pro.local>

Co-authored-by: Santi Balaguer <santiago.balaguer@gmail.com>
Co-authored-by: Santi Balaguer <santibalaguer@Santis-MacBook-Pro.local>

* Improve 4.0 landingpage (use-ink#126)

* Update setup.md (use-ink#118)

Use a more recent version that doesn't have strange rpc dependancies as noted here paritytech/substrate#12358

* Update `contracts-node` version everywhere

* Added usage of Enum in basics-storing values page  (use-ink#119)

* add example of string, hash and Enum

* add example of string, hash and Enum

* Update docs/basics/storing-values.md

* Update docs/basics/storing-values.md

Co-authored-by: Michael Müller <mich@elmueller.net>

* Add info about enum storage to versioned page and i18n pages

* Execute `yarn upgrade`

* Support icons in page title

* Improve structure

* Add content for ink! 4.0 + Add ToDo's (use-ink#127)

* Update information on Rococo testnet (use-ink#128)

* Add layout improvements (use-ink#129)

* Use custom info icon

Generated via

	yarn swizzle @docusaurus/theme-classic Admonition -- --wrap

* Update schemas with illustrations

* Add icon for FAQ

* Add FAQ icon

* Make code consistent

* Update ink! vs. Solidity docs

* Fix JSON

* Add more ToDo's for 4.0

* Add more ToDo's for 4.0

* Add documentation of `Environment` trait

* Highlight ToDo annotations

* Explain the `cargo contract new` template (use-ink#131)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Michael Müller <mich@elmueller.net>
Co-authored-by: Peter White <23270067+peterwht@users.noreply.github.com>
Co-authored-by: Squirrel <giles@parity.io>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>
Co-authored-by: Dan Quirk <danieljquirk@gmail.com>
Co-authored-by: Dominik | 727 <43150707+coreggon11@users.noreply.github.com>
Co-authored-by: Santi Balaguer <santiago.balaguer@gmail.com>
Co-authored-by: Santi Balaguer <santibalaguer@Santis-MacBook-Pro.local>
Co-authored-by: slmagus <vida.zach@gmail.com>
Co-authored-by: kirti purohit <58950467+Irene-123@users.noreply.github.com>
Hounsette pushed a commit to NodleCode/chain that referenced this pull request Jan 31, 2023
ark0f pushed a commit to gear-tech/substrate that referenced this pull request Feb 27, 2023
* Remove contracts RPCs

* Remove serde as RPC serialization is no longer needed

* Rename folder to match crate name

* Compile fix

* Remove Byte wrapper
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
C1-low PR touches the given topic and has a low impact on builders. D2-notlive 💤 PR contains changes in a runtime directory that is not deployed to a chain that requires an audit.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

6 participants