Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

schedule presync stf events to the first sync block #339

Merged
merged 2 commits into from
Apr 17, 2024

Conversation

ecioppettini
Copy link
Contributor

I think the change to the scheduled behavior in #314 may have been a mistake. I thought that presync data was being scheduled with the original block which didn't make sense and was useless, but that only happened because of the Math.max usage and the block heights in the parallel chain being bigger (in particular, with emulated blocks this is always the case since SM_START_BLOCKHEIGHT is 0) . Also, that PR didn't fix the issue for the carp/cardano primitives.

So this restores the behavior to the way it worked before that PR for the scheduled data, but also fixes the original issue for the parallel evm and carp funnels.

If we actually don't want to schedule data during the presync like we are doing currently, we still should do it in the carp primitives. But I imagine it's actually more practical to schedule everything in the first stf? The only potential issue is that the first state transition could take a while if there is a lot of presync data.

@ecioppettini ecioppettini self-assigned this Apr 5, 2024
@SebastienGllmt
Copy link
Contributor

SebastienGllmt commented Apr 5, 2024

It could be useful to add any detail you think is missing about presync handling to the docs (https://docs.paimastudios.com/home/react-to-events/funnel-types/intro) that way everybody on the team has a document to refer to on how presync handling works

then we can review all the primitives and make sure they follow the same behavior we specify in the docs, since for example:

Primitives that don't schedule during the presync:

  • cde-erc721-mint
  • cde-cardano-pool
  • cde-cardano-projected-nft
  • cde-generic
  • cde-erc20-deposit

Primitives that schedule during the presync:

  • cde-cardano-mint-burn
  • cde-cardano-transfer

@SebastienGllmt SebastienGllmt merged commit 9e11c04 into master Apr 17, 2024
@SebastienGllmt SebastienGllmt deleted the enzo/restore-presync-scheduled-data-behavior branch April 17, 2024 03:50
SpaceManiac added a commit that referenced this pull request Apr 17, 2024
SebastienGllmt pushed a commit that referenced this pull request Apr 19, 2024
* Add ERC1155Contract artifacts extracted from hardhat build

* Add IInverseAppProjected1155 artifacts extracted from hardhat build

* Import 1155 contract into paima-utils/contracts.ts

* Add configuration and data types for 'erc1155-app'

* Fix 1055 typo

* Add ERC-1155 stuff to paima-sm

* Add ERC-1155 stuff to paima-funnel

* Read ERC-1155 TransferSingle and TransferBatch events into Transfer datums

* Add value to mint event

* npm run prettier

* Remove leftover base ERC1155Contract files

* Rename InverseAppProjected1155Transfer -> Erc1155Transfer, 'erc1155-app' to 'erc1155'

* Add IERC1155Contract.json & .ts

* Add Erc1155 base contract types

* Make logic inside isPaimaErc721 reusable

* Expose just ERC-1155 transfer datums, expand rather than flatten them

* JSON-encode ids and values lists in scheduled data

* Remove contractAddress from ERC-1155 transfer scheduled data

* Add cde_erc1155_data and cde_erc1155_burn tables and queries

* Actually update data + burn tables

* Revert "Make logic inside isPaimaErc721 reusable"

This reverts commit 471a81e.

* Remove mint leftover from cdeTransitionFunction

* Apply presync change from #339

* Remove remaining InverseAppProjected1155 types in favor of stock Erc1155

* Pre-lowercase addresses in ERC-1155 transfer scheduled event

* Improve cde-config error logging

* Remove unintended depositAddress config field

* npm run prettier

* Add query functions for ERC-1155 support

* Make 'erc-1155' scheduledPrefix optional, add optional burnScheduledPrefix

* Fix stale filename in contract-types import

* Added get erc1155 token by id

* Fixed return type

* Fix /src import

* Update loadAbi docs

* Remove sketchy getERC1155TotalBalanceAllTokens helper

---------

Co-authored-by: Edward Alvarado <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants