relayer icon indicating copy to clipboard operation
relayer copied to clipboard

[ISSUE] Update HistoryStore key

Open salman01zp opened this issue 3 years ago • 1 comments

Overview

HistoryStoreKey contains keys used to store the history of events and all the event watcher use ResourceID as a key. The problem with substrate ResourceId is it uses PalletId which can be changed if a new pallet is added.

#[derive(Eq, PartialEq, Hash)]
pub enum HistoryStoreKey {
    /// Block Queue Key
    Block { chain_id: u32 },
    /// ResourceId Key
    ResourceId {
        resource_id: webb_proposals::ResourceId,
    },
}

// Substrate target system
pub struct SubstrateTargetSystem {
    pub pallet_index: u8,
    pub tree_id: u32,
}

There are two options we can use to solve this

  • We hard code and use the pallet Index as zero to store and retrieve event data
  • We have fixed pallet Ids

salman01zp avatar Nov 07 '22 14:11 salman01zp

One solution that we could take, is by fetching the pallet index during the runtime, it will be costly, but that's an option we could consider.

shekohex avatar Nov 07 '22 14:11 shekohex

closing this. We don't hardcode PalletId anymore and fetch it during runtime.

salman01zp avatar Feb 27 '23 13:02 salman01zp