Questions tagged [events]
Questions that relate to pallets and disptachables that emit specific events, including decoding events.
62
questions
7
votes
2
answers
110
views
Should events only be emitted in extrinsics?
Suppose my pallet implements a trait MyTrait so that it can be loosely coupled with another pallet. Suppose also that MyTrait::my_function() makes storage modifications, which I would like to notify ...
7
votes
2
answers
340
views
How to decode ink smart contract call and event data?
I want to decode the contract call data and event data saved in a block. How can I do that?
7
votes
2
answers
105
views
How to verify upward teleport on Relay Chain?
I performed an upward teleport from Encointer-Parachain to Kusama- Relay Chain.
The parachain confirmed the XCM extrinsic polkadotXcm.limitedTeleportAssets and an Event was disposed: polkadotXcm....
7
votes
1
answer
163
views
Filter Events with subxt over multiple threads
I'm working on a project that uses Substrate in the backend. The System I am working on is written with Elixir and so I have a rustler NIF (Erlang/Elixir Native Function interface) for interacting ...
6
votes
2
answers
110
views
Are there any event patterns for pallets to communicate within the runtime?
Could I have one pallet emit an event that other pallets are aware of?
For example:
assets-pallet emits an AssetCreated event
market-pallet listens for the AssetCreated event
So the assets-pallet is ...
6
votes
2
answers
117
views
How to parse/match a specific frame_system event?
From the following function I can read the frame_system events:
let events = frame_system::Pallet::<T>::read_events_no_consensus();
the above provides me the following example array:
...
5
votes
1
answer
59
views
Which data to put in a Pallet Event?
In other blockchains I practiced extreme frugality with event data, since it is expensive.
For example only putting an ID into an event which can then be looked up with lookup(ID) -> ...
5
votes
2
answers
119
views
Large event payloads unsafe?
Premise
Substrate will, by default, store every event in a block in a storage value Event of type Vec<EventRecord> in the system module, which involves reading & writing this full vector ...
5
votes
1
answer
117
views
How to identify received contract event?
My contract emits several [ink(event)] events. My application subscribes to the events and receives Contracts_ContractEmitted data (from centrifuge go-substrate-rpc-client). How may I understand which ...
4
votes
2
answers
106
views
error[E0599]: no function or associated item named `events` found for struct `frame_system::Pallet` in the current scope [closed]
When writing:
let events = frame_system::Pallet::<T>::events();
I get the error:
error[E0599]: no function or associated item named `events` found for struct `frame_system::Pallet` in the ...
4
votes
2
answers
42
views
DispatchError::Other(_) always being mapped to DispatchError::Other("")
I'm trying to pass some custom error messages to the frame_system::note_applied_extrinsic() but it seems to be ignoring my message and always using an empty string "".
Adding this test to ...
4
votes
2
answers
254
views
Events in Polkadot.js/api
I am trying to call api.events.staking.Withdrawn.is in polkadot.js/api.
Docs: https://polkadot.js.org/docs/substrate/events#withdrawnaccountid32-u128
Code sandbox: https://codesandbox.io/s/hardcore-...
4
votes
2
answers
210
views
How to build prefixed key for rocksdb
I would like to know how can the key for the state System Events storage can be built for a given block hash/height
4
votes
1
answer
138
views
Correlate events with extrinsics in a utility.batch call in Polkadot
In Polkadot and Kusama emitted module events has the phase property so we can correlate them with the extrinsic that triggered that event but I can not do the same when the extrinsic is included in a ...
4
votes
1
answer
432
views
Decoding events with Rust
If I make a request to get events in a particular block using web UI, I get a nice human-readable response:
I've made an RPC call to get the same data
{
"id": 1,
"jsonrpc":...
3
votes
1
answer
242
views
Browse events in Polkadot.js/api
I want to get events list by using polkadot.js/api.
I can see api.query.system.events() in docs.
Docs: https://polkadot.js.org/docs/substrate/storage#eventcount-u32
However, this api lists events for ...
3
votes
1
answer
100
views
Event type & Call type
I am doing Substrate-tutorial and I just have a question about template-node.
Inside impl 'frame_system::Config for Runtime {} code, there are type Event = Event and type Call = Call, but I don't see ...
3
votes
1
answer
165
views
Emiting events does not work with cross contract calling
When using cross contract calling on another contract which also emits
events the events of the original contract do not work anymore.
I get the following error.
error[E0283]: type annotations needed
...
3
votes
1
answer
132
views
Problem running assert_last_event in tests.rs
As the title suggests, I've been trying to call assert_last_event on the tests.rs class without success. The problem first happened when developing the kitties tutorial and after several toolchain ...
3
votes
1
answer
67
views
Should events be taken into account if their extrinsic fails?
If the System.ExtrinsicFailed event was emitted within a given extrinsic, does it mean that all other events that were also emitted within it can be considered invalid and should not be taken into ...
3
votes
1
answer
80
views
How to filter the subscribed contracts events with their topics?
I need to subscribe to my smart-contract events (#[ink(event)]). So I state_subscribeStorage to "System.Events" storage key. But then I get all system events of all smart contracts in my ...
3
votes
1
answer
228
views
How to subscribe to contract events using RPC?
I'm looking to subscribe to events emitted from a contract.
I am currently creating a storage key for System Events, subscribing to it and filtering the events to get the one emitted by the contract I ...
3
votes
1
answer
50
views
nextAuthorities() output clarification from Babe storage event
Good evening,
I am trying to parse the output hash of nextAuthorities details retrieved by storage function.
I would like to know how to parse the output sent per validator, is it an hashproof ...
3
votes
1
answer
93
views
How to emit events from inner contracts
let's say we have a contract which calls other contract's function that emits an event. What is the approach to emit the event coming from the inner contract's message?
Currently, there is only an ...
2
votes
2
answers
128
views
How to save decoded events using polkadot.js?
I am monitoring the events when calling a method from my contract and want to
save the output of one of my custom events, to display it.
The call of my method looks like this:
contract.tx
.method({ ...
2
votes
1
answer
137
views
Filter events for specific account in Polkadot.js/api
I am trying to get list events by filter for specific account(validator, nominator).
I can get list of events using api.query.system.events(). However, if I get events for a day, there
will be much ...
2
votes
2
answers
205
views
Why are events stored?
The documentation around emitting events states that events are written to storage, and then cleared next block.
This has considerable costs
You add extra db write/read overhead to practically every ...
2
votes
1
answer
58
views
How can a recoverable account get notified when someone is initiated a recovery for it?
One of the interesting features of (social) account recovery in Kusama is that "If some one tries to initiate recovery for your recoverable account, you can close the process and kind of punish ...
2
votes
1
answer
90
views
How can I access custom pallet Event data in a test?
I have an Event (ThingStored) that is deposited in a public function in my custom pallet.
#[derive(Encode, Decode, PartialEq, Clone, RuntimeDebugNoBound, TypeInfo, MaxEncodedLen)]
#[scale_info(...
2
votes
1
answer
151
views
Need Help Understanding ink! Contract Storage And Data Access
There are some aspects of ink! contract storage and data access that I cannot find the answers to in the documentation or by experimentation. Here are my questions...
Is it true that there can be ...
2
votes
1
answer
115
views
What does the Staking.EraPaid event mean?
According to Polkadot's events description page, the Staking.EraPaid event means the following:
The era payout has been set; the first balance is the validator-payout; the second is the remainder ...
2
votes
2
answers
43
views
How to ensure a call is the first to execute in a block?
As the title mention, I would like to know what would be the best way to ensure that an extrinsic can be executed only if it's the first call in the block (ignoring timestamp).
It also need to work ...
2
votes
1
answer
40
views
How use Metadata deocde Vec::<EventRecord<Event, H256>>
first get the system eventData state_getStorage api
now i need to decode the system eventData by metadata
is there some example how to decode it ?
for some reaseon ,only rust worker it ,thanks
2
votes
1
answer
135
views
Emit Events from hooks like on_initialize()
Is it okay to emit event from hooks like on_initialize()?
For example, I have ~1000 items in storage and in a loop in on_initialize() I want to emit an event if certain process is completed, then is ...
2
votes
1
answer
38
views
How to recognise user behaviour data on substrate chains? (Events + Extrinsics)
Context: Specifically trying to measure user behaviour data on substrate chains.
Questions:
Is there any specific data that indicates whether a user triggered an extrinsic or an event?
Do only ...
1
vote
1
answer
80
views
Event encoding in substrate pallet
Can two pallets have exactly same event name and event parameters. If yes then is there a way to distinguish the event came from which pallet in golang.
1
vote
2
answers
443
views
How to query events?
I need to get a list of all events of a specific custom type. In the documentation, it said that I can query the System pallet's storage for events. I am looking for an example (in Rust) of how to ...
1
vote
1
answer
68
views
Querying events from storage migration
I'm currently attempting to perform a migration process that involves querying events emitted from a specific pallet. The objective of this migration is to extract relevant data from these events and ...
1
vote
1
answer
46
views
Ink Contracts: What Data Structures/Situations Are Best Suited To Contract Storage vs Events?
Using events to write data to the chain is great for registering information to the chain, especially information that you want a permanent record of. So my question is: under what circumstances ...
1
vote
1
answer
64
views
What's the Substrate's equivalent of receipts in Ethereum?
I want to check if a given extrinsic is executed successfully or not from a light client inside the enclave (aka Intel SGX). I am importing new blocks, iterating over the extrinsics I am interested in,...
1
vote
1
answer
28
views
Why do are some events in a block missing an extrinsic_idx?
Using py-substrate-interface to parse block data, we noticed that some events return None for the extrinsic_idx parameter.
Would someone please be so kind to explain why an event wouldn't have an ...
1
vote
1
answer
130
views
How to assert deposited event in pallet call?
In testing my pallet, I have some function that stores something and deposits an event.
#[pallet::event]
#[pallet::generate_deposit(pub(super) fn deposit_event)]
pub enum Event<T: ...
1
vote
1
answer
52
views
List all balance changes of an account on a Substrate-based chain
My goal is to list all balance changes for an account on a Substrate-based chain like Acala.
I assumed that on Substrate-based chains all incoming and outgoing values to and from an account would be ...
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
158
views
the trait `std::clone::Clone` is not implemented for `Nominations<T>`
I was making a new event in the function nominate of Staking pallet which is going to show when the nominator is going to be added. But i facing one issue
#[pallet::call_index(5)]
#[pallet::weight(...
1
vote
1
answer
52
views
polkadot.js | SignAndSend SuccessResponse does NOT contain all events emitted in tx
SignAndSend SuccessResponse that is a result of a contract call does NOT contain all events that are emitted during tx execution. The Object contains only events emitted from the contract that is ...
1
vote
1
answer
52
views
How to get the contract address for a events
I am using
github.com/centrifuge/go-substrate-rpc-client
And able to get list of events from each block and also able to filter it out but is there a way to identify which contract triggered the event....
1
vote
1
answer
73
views
Is there a JSON-RPC method similar to `eth_getLogs`?
I was wondering if there is a JSON-RPC method similar to eth_getLogs.
What I would like to accomplish is to query all the events that meet a certain criteria, and that happened after a certain block. ...
1
vote
1
answer
298
views
How do I get the block hash of an event?
I am subscribing system events using the events api. After I got the specific event I am looking for, how should get the block hash of this event?
Thanks
api.query.system.events((events) => {
...
1
vote
1
answer
15
views
Will the event pairs `NewMultisig` <> `Reserved` and `MultisigExecuted` <> `Unreserved` always be emitted during a multisig transaction?
I would like to correctly monitor the events that are related to multisig transactions and I was wondering if I should always expect the following event pairs :
NewMultisig <> Reserved
...