Questions tagged [chain-extension]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
19 views

Cannot upgrade contract using chain extension

I am trying to update the code of a smart contract using the chain-extension functionality instead of using the ink_env::set_code_hash method. The contract pallet successfully emits the ...
1 vote
0 answers
30 views

Error when compiling a contract using the XCM chain extension

I'm trying to implement this xcm chain extension mvp to send a XCM call from a simple contract. The problem i'm facing is when i try to compile the contract with the given Cargo.toml, i get the ...
2 votes
1 answer
73 views

Update: Access to chain extension method from another module

Summary I am using an Ink! smart contract (implemented in contract.rs) code calling a chain extension method. This works well. However, I want to split my code and call the extension method in a new ...
1 vote
1 answer
100 views

How ink! handles DispatchError from ChainExtension

ChainExtension will return Result<RetVal, DispatchError>. (As you can see in the bottom pircutre) When ChainExtension implementation returns Ok(RetVal::Converging(1)) and handle that status ...
  • 101
4 votes
1 answer
134 views

How can I pass a Vec<u8> via chain extension to pallet?

I am working on chain extension to call rmrk pallet methods. One of the methods needs a BoundedVec that I need to pass via ink smart contract. What data type can I use to do this on smart contract ...
  • 105
3 votes
1 answer
126 views

Using Scheduler Pallet to schedule Contract pallet call

I'm trying to use the Scheduler pallet to schedule a call to the Contracts pallet as part of a chain extension implementation. I've managed to get the following to compile and execute: // In `runtime/...
  • 680
2 votes
2 answers
57 views

How to receive multiple parameters of different types in chain extension

As ink chain-extension example https://github.com/paritytech/ink/blob/master/examples/rand-extension/runtime/chain-extension-example.rs#L32 . It show how to receive one param. But if I want receive ...
1 vote
1 answer
76 views

How can I increase contract memory in pallet-contracts + chain-extension?

I am exposing some external functions to ink! contracts via a chain-extension in pallet-contracts. I am essentially passing a vector of bytes as a parameter to a contract method and directly ...
1 vote
1 answer
48 views

Contract CodeRejected when using chain extension

I've recently upgraded my chain to the latest substrate master, however, I'm unable to deploy contracts that use a chain extension. When I try to use a chain extension, the contract fails to deploy ...
1 vote
1 answer
32 views

How to retrieve dynamic type size data from chain extension in ink? [duplicate]

my example looks like this : #[ink(extension = 1111] fn asset_name(asset_id: u32) -> Result<[u8], PalletAssetErr> or this fn asset_name(asset_id: u32) -> Result<[u8], PalletAssetErr>...
  • 41
3 votes
1 answer
56 views

How to return error from chain extension?

I saw how to handle error from chain extension on smart contract side https://paritytech.github.io/ink-docs/macros-attributes/chain-extension#error-code But I can't find example and can't understand ...
  • 41
4 votes
1 answer
61 views

How to benchmark a chain extension?

I would like to know the recommended way to benchmark a chain extension, and then how to charge the calculated weight. According to this document, we need to write benchmarks.
4 votes
2 answers
89 views

Correct way to use dynamic sized types in chain extension

I'm writing chain extensions for my pallets and I have a few functions that require dynamic sized types, for example Vec<u8> for metadata and Vec<u64> for a list of asset ids. The way I am ...
5 votes
2 answers
119 views

How do I test a chain extension used in the runtime?

I am aware of this example that shows how to create a mock chain extension and test that. However, I do not know how to test the chain extension that is used by the runtime and calling functions from ...
2 votes
1 answer
56 views

Chain Extension func_id enumeration is resulting in ContractTrapped for func ids greater than 1

I'm encountering an issue where a contract is only able to called functions in my chain extension if they are enumerated with function ids 0 and 1. My chain extension has four functions, lets say ...