firefly icon indicating copy to clipboard operation
firefly copied to clipboard

Migration Issue with ERC-1155 Token Pools

Open nguyer opened this issue 1 year ago • 4 comments

While testing upgrading from v1.2.2 to the current code in main I discovered that token events can get "stuck" in a certain situation.

Steps to reproduce:

  • Create a FireFly stack on v1.2.2 (default, using no release or manifest options) with an ERC-1155 token connector
    • ff init dev -t erc1155
  • Create a token pool
  • Deploy the current Batch Pin contract from main
  • ff stop dev
  • Update your FireFly Core config file by adding a new entry under contracts with the contract address and block number you deployed the contract in the step above
  • Add entries in your docker-compose.override.yml to use builds from main for FireFly Core and the Token Connector
  • ff start dev - You should now be running on main and with a new batch pin contract
  • docker stop dev_firefly_core_0
  • docker stop dev_tokens_0_0
  • Delete the tokens event stream
  • docker start dev_firefly_core_0
  • docker start dev_tokens_0_0
  • curl -X POST "http://127.0.0.1:5108/api/v1/init" to re-create the event stream
  • FireFly begins throwing an error on the duplicate token pool forever

NOTE: This also blocks any future token pools from being created and I think any transfers from being indexed as well

nguyer avatar Jan 29 '24 21:01 nguyer

Would like to work on this @nguyer

Philip-21 avatar Feb 02 '24 21:02 Philip-21

Upon more investigation this is due to the fact that the format of the token pool locator changed between v1.2.2 and now. I discussed this with @awrichar and we decided that adding an alternateLocators: []string to the token pool creation event which the connector sends back to FireFly will allow the token connector to inform FireFly of any previous locators by which this pool may have been referenced. On the token pool creation event (and only that one) if FireFly sees a new locator but has a record for a token pool with a matching alternateLocator it will update its database to use the new locator.

nguyer avatar Feb 02 '24 21:02 nguyer

@Philip-21

Would like to work on this @nguyer

I have fixed this in https://github.com/hyperledger/firefly/pull/1388 and https://github.com/hyperledger/firefly-tokens-erc1155/pull/135

nguyer avatar Feb 02 '24 21:02 nguyer

@Philip-21

Would like to work on this @nguyer

I have fixed this in #1388 and hyperledger/firefly-tokens-erc1155#135

Alright

Philip-21 avatar Feb 05 '24 17:02 Philip-21

@nguyer I think we can close this?

EnriqueL8 avatar Apr 25 '24 12:04 EnriqueL8