Skip to main content

Questions tagged [chain-extension]

The tag has no usage guidance.

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

Ink e2e tests with custom environment

I have an ink! contract that uses a custom environment that contains custom chain extensions. I am trying to write e2e tests for this contract however there is a problem. Instantiate the contract how ...
Szegoo's user avatar
  • 657
1 vote
1 answer
35 views

Pallet extrinsic event not triggering when called through chain extension

When I call the pallet extrinsic bond_and_stake, the Event BondAndStake gets triggered. But when I call it through the chain extension method from my ink smart contract message, the event does not ...
Snowmead's user avatar
  • 625
1 vote
1 answer
53 views

In the runtime chain extension, should we be charging weight if we are reading a `StorageMap`?

If we have the storage map DummyStorageMap in pallet-example And we read its value under the key key by calling DummyStorageMap::<T>::get(key) in the runtime chain extension (https://paritytech....
aang114's user avatar
  • 43
3 votes
1 answer
78 views

Charge weight and weight Info in chain-extension

I am writing a chain-extension that is a 1 to 1 map of a pallet. Based on this: [...] charging the appropriate amount of weight. In order to do so benchmarks must be written and the charge_weight ...
P.Ossun's user avatar
  • 1,219
0 votes
1 answer
75 views

Is it possible to integrate a third-party library into a smart contract using ink!

I want to integrate a third party library into my ink! smart contract and I am not sure if this is possible. I did notice that ink! has something called Chain Extensions which can allow a smart ...
chomprrr's user avatar
  • 113
2 votes
1 answer
71 views

Reading arguments in chain extension

I have a question about reading data in a chain extension. To be precise, I'm concerned about methods Environment<_,_,_,S: BufIn>::read*. Do I understand correctly, that every such function ...
pmikolajczyk41's user avatar
0 votes
1 answer
93 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 ...
Nimish Agrawal's user avatar
3 votes
1 answer
177 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 ...
Hector Bulgarini's user avatar
2 votes
2 answers
160 views

Access to chain extension method from another module in ink!

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 ...
Castor19's user avatar
1 vote
1 answer
147 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 ...
Shunsuke's user avatar
  • 432
4 votes
1 answer
211 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 ...
Ankan's user avatar
  • 335
3 votes
1 answer
400 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/...
HCastano's user avatar
  • 1,071
2 votes
2 answers
99 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 ...
莫海江's user avatar
1 vote
2 answers
132 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 ...
Petar Ivanov's user avatar
1 vote
1 answer
107 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 ...
Tony's user avatar
  • 527
1 vote
1 answer
38 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>...
IronMan's user avatar
  • 41
3 votes
1 answer
95 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 ...
IronMan's user avatar
  • 41
5 votes
1 answer
104 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.
ExplodingJay's user avatar
4 votes
2 answers
135 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 ...
Gabe's user avatar
  • 115
6 votes
2 answers
204 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 ...
ExplodingJay's user avatar
3 votes
1 answer
81 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 ...
Tony's user avatar
  • 527