Closed timolegros closed 1 year ago
Blocked by #3228 -> contains quite a few changes to the structure of the subscriber therefore I will wait until it is merged before I make additional changes to the subscriber for this issue.
After reviewing the changes that would be required CE app-side to query the new chain-events format it seems to me that simply redefining chain
to be ChainNode.name
and then optionally including a contract address in the event may be a better approach. This is because a separate contract_address
column that can be indexed in the database is better for querying than having the name
+ contract_address
combined in a single column. Thus on the backend the chain + address will be stored separately but we can of course still combine both into an origin
for logging/display purposes if needed.
Since chain
is updated to community
by Ian CW side there should be no conflicts with CE. Most of the logic above holds it simply won't be renamed to origin and there will be an extra contract_address
column. @jnaviask thoughts?
has_chain_events_listener = true
change then #3963 may become a blocker.ChainEntities
on the chain-events side are no longer related to any specific community while ChainEntityMeta
inherently are since they are titles set by community members/authors on existing proposals. Since this is the case we have the option of either refactoring ChainEntityMeta to make them work within a community-agnostic CE or completely delete the table and the title setting functionality that it supports.Given that #3991 will be merged soon and #3542 was already merged we now have no more use for the ChainEntityMeta table and we can completely remove it without any loss of functionality (considering that only Substrate supported title setting and the feature has been broken since the Listeners have been broken as well).
To be clear, #3991 #4020 and #3806 need to merged/completed before this ticket will be unblocked.
Still blocked by #3991 and #4020. Once those 2 are merged I can work on resolving merge conflicts and splitting the existing PR into 3 separate PRs to avoid app downtime during deployment (aka ensure backward compatibility between CE/CW and then PR to remove the backward compatibility).
Also, this is not a 3-point ticket. This ticket has been ongoing with lots of testing + preliminary changes required. This is a 5-point ticket.
If chain-events is removed, this issue can be closed.
CE will be removed per #4696
The Problem
Currently ALL events and entities are directly linked to a chain from the
Chains
model (being renamed toCommunities
). This is restrictive since it means an event cannot be consumed by more than 1 community. If we want a system that is truly a general indexer we need to be able to determine the origin of an event or entity without referencing any CW-specific data.The Solution
Thus we should introduce a new data point called
origin
.Directory structure refactor
src/chains
toBases
or something agnostic to chainEVM
and move all EVM chain-event listener modules to that directorysrc/bases/
:Chain-Events Library Refactor
chain
inprocessor.ts
,storageFetcher.ts
,subscriberFunc.ts
,subscriber.ts
, and/filters
withorigin
[Substrate:Stafi] some log info here
the appearance of the log will remain the same for event-feeds that don’t contain a contract address but sinceorigin
contains contract addresses the new log prefixes for say Aave will be[Aave:Ethereum:Aave:0x1234] some log info here
. While it might look strange to have Aave precede Ethereum in the prefix, this is intentional.Aave
in this case is meant to describe whichnetwork
orbase
chain-events is using (info that would be unavailable to us while debugging unless we go to the contract address on Ethereum and see that it is an Aave contract).[SupportedNetwork:chain-name:protocol:module]
chain
withorigin
inListener.ts
Chain-Events Services Refactor
ChainSubscriber
origin
value and create event-feedsname
in ChainNodes table for the ChainNode associated with each Substrate chain/community from the Chains tablehas-chain-events-listener = true
type = 'chain'
base = 'substrate'
name
in ChainNodes table with theaddress
from theContracts
tablehas-chain-events-listener = true
base = 'ethereum'
name
in the ChainNodes table for the ChainNode associated with each Cosmos chain/community from the Chains tablehas-chain-events-listener = true
type = 'chain'
base = 'cosmos'
CE Database
chain
column withorigin
inChainEntities
andChainEvents
tables (requires cross-database migration).Acceptance Criteria
chain
anywhere in thechain-events
package (onlyorigin
).