Questions tagged [chain-extension]
The chain-extension tag has no usage guidance.
20
questions
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 ...
1
vote
1
answer
51
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....
3
votes
1
answer
75
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 ...
0
votes
1
answer
57
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 ...
2
votes
1
answer
69
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 ...
0
votes
1
answer
92
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 ...
3
votes
1
answer
153
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
2
answers
155
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 ...
1
vote
1
answer
137
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 ...
4
votes
1
answer
200
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 ...
3
votes
1
answer
323
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/...
2
votes
2
answers
97
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
2
answers
125
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
99
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
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>...
3
votes
1
answer
89
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 ...
5
votes
1
answer
99
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
125
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 ...
6
votes
2
answers
192
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 ...
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 ...