vikiival / mimick

Indexer for ink! based NFTs
GNU General Public License v3.0
1 stars 3 forks source link

Time warp to register smart contract #3

Closed vikiival closed 1 year ago

vikiival commented 1 year ago

Why?

Let's say that we create a marketplace contract in block 1_000_000 before that (block 900_000) a few smart contracts that want to list on KodaDot were created

sequenceDiagram
    participant user
    participant marketplace
    participant blockchain
    participant squid
    user->>marketplace: call register(contract)
    marketplace->>blockchain: make transaction
    blockchain->> blockchain: emit "register event"
    squid->> blockchain: get "register" event
    squid->>squid: spawn processor that handles all historical data about smart contract

Idea

When processor sees a "register" event it should spun a new process that will from zero would sync the state of the registered SC

Questions

1. is that possible?

The closest thing is thing is Talismans Squid

2. is there a better solution?

For example ask archive directly, sync the state of NFTs at current point and then continue?

vikiival commented 1 year ago

Regading to time-warping

So I tried the Talisman squid but looks unstable.

Why?

1. blockUpdate does not work as anticipated

Failed to fetch currentBlock for phala: QueryFailedError: relation "phala.status" does not exist
Failed to fetch currentBlock for quartz: QueryFailedError: relation "quartz.status" does not exist
Failed to fetch currentBlock for kintsugi: QueryFailedError: relation "kintsugi.status" does not exist
Failed to fetch currentBlock for bajun: QueryFailedError: relation "bajun.status" does not exist
Failed to fetch currentBlock for invarch-tinkernet: QueryFailedError: relation "invarch-tinkernet.status" does not exist
Failed to fetch currentBlock for aleph-zero-testnet: QueryFailedError: relation "aleph-zero-testnet.status" does not exist
Failed to fetch currentBlock for khala: QueryFailedError: relation "khala.status" does not exist
Failed to fetch currentBlock for crust: QueryFailedError: relation "crust.status" does not exist
Failed to fetch currentBlock for peaq: QueryFailedError: relation "peaq.status" does not exist
Failed to fetch currentBlock for reef-testnet: QueryFailedError: relation "reef-testnet.status" does not exist
Failed to fetch currentBlock for shiden: QueryFailedError: relation "shiden.status" does not exist
Failed to fetch currentBlock for subsocial-parachain: QueryFailedError: relation "subsocial-parachain.status" does not exist

2. It fails a lot

Chain processor for chain kusama exited with an error.
Restarting chain processor for chain kusama

3. Many deadlocks

19:04:23 FATAL sqd:processor QueryFailedError: deadlock detected

Maybe @alecdwm could give me some knowledge about that.

So far I am abandoning this approach. Sorry @maar-io

vikiival commented 1 year ago

Possible solution

@belopash suggested an alternative sub-processor approach when only a single sub-processor is active at a time, and the parent processor waits for it to catch up and then kills.

Closing as not planned. Will find different way