hyperledger-firefly / hyperledger-firefly/firefly

Advanced Object Deletion

Open
#1,220 7 comments 0 reactions 1 assignee Claimed by @awrichar View on GitHub
enhancement
Dominant language
Go
Stars
602
Forks
246
Avg merge
18h 47m
Merged PRs (30d)
6

Description

## Background

While doing some testing locally, I ended up stuck in a less than ideal state. Here's a summary of what I did:

- Created a "gateway mode" stack connected to a public testnet
- Deployed an ERC-721 token contract that I created with the OpenZeppelin contract wizard
- Created a token pool for that contract
- Attempted to mint a token with a URI
- FireFly told me (based on the response from the token connector) that setting a URI is not supported with my contract
- This was due to the fact that I did not specify the contract interface when creating the token pool
- I went back and created the interface
- I then went to create a new token pool with a new name, while specifying the interface ID
- The FireFly transaction for creating the token pool becomes stuck "Pending", while the Token Create Pool Operation is successful
- Upon inspecting the logs I found a `200` response from the token connector to create the pool, then FireFly core logs: ```[2023-03-15T16:53:11.943Z] DEBUG Token pool ID=79a6bb2f-11bd-45e6-99a7-f3045ec911ac Locator='address=0xfd403b063ecf959867973a4cf383c48b9a06e19e&schema=ERC721NoData&type=nonfungible' already confirmed ns=default pid=1 role=event-manager```

This now leaves me stuck state. I have no way of deleting the token pool, but because I created it incorrectly, I also have no way of using it. My options at this point are to:

- Deploy a new contract - not viable if this was a pre-existing contract that already has transactions that need to be index
- Completely delete my stack and start over - not viable if I have other production data in my DB
- Worse, I don't think this would even work if I was in a multi party system, because as soon as my FireFly node comes back online it would see the token pool broadcast in the chain as it re-indexes everything

In reality, this problem extends to more than just token pools, but this situation was exceptionally painful, so it got me thinking about the problem. The same situation could occur with contact interfaces, contract APIs, etc, though those things have versions so it may not be as big of a deal there.

## What needs to change

- We need a way to delete things which have not been broadcasted, which should be a simple curd operation.
- We also need a way to delete a token pool which _has_ been broadcasted

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.