Open turbocrime opened 2 weeks ago
this is a great idea and would be a big ux boost. we'd need to figure out what data is necessary to store -- one thing that comes to mind is the SCT state, which would ideally be initialized with a bare root (as if the user had synced and then forgotten all internal nodes). maybe @plaidfinch would know if there's a way to initialize an SCT with just the root like that.
Theoretically, it is even possible not to scan with skip trial decryption, but to use a snapshot of view service data for the last epoch (if there will be a service that will provide these snapshots)
some relevant helper functions:
querying the latest block height
const latestHeight = await this.querier.tendermint.latestBlockHeight();
fetching merkle root associated with the latest height
let root = await this.querier.cnidarium.fetchRemoteRoot(latestHeight!);
fetching epoch index from compact block associated with latest height
let epochIndex = this.querier.compactBlock.compactBlockRange(latestHeight).epochIndex
The TCT cannot be initialized just as a bare root, or else no updates could be performed to it. It always needs to have a frontier. The smallest TCT is the one when an epoch has just ended, which contains only a path down from the root to an epoch root.
If a user onboards prax with a passphrase, they may have existing activity on chain.
But if a user generates a new wallet in onboarding, there will be no activity on the chain, so the block processor can skip trial decryption until the present height.
This would greatly accelerate initial sync for many new users.