-
Notifications
You must be signed in to change notification settings - Fork 208
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
Migration to v1.3.0 can cause missed events when contract listeners are listening from latest #1531
Comments
Concrete proposal - which has other benefits:
|
The listener endpoint on FFTM already has the checkpoint information embedded, so it doesn't look like changes would be needed to the FFTM or EVMConnect codebases for Core to be able to query the checkpoint information: |
This code confirms existence of custom listeners. Per the comment it's not specific to the migration scenario: firefly/internal/contracts/manager.go Lines 156 to 161 in 16aec0b
This calls down to firefly/internal/blockchain/ethereum/ethereum.go Lines 909 to 913 in 16aec0b
So from this I believe that the code for migration is rather leaning on simply the recreation code that was introduced (during the 1.2->1.3 development) for a different reason - the recreation of listeners in EVMConnect if they had been deleted. Need to dig into what happens to the old listeners that were at a global level 👁️ |
Reading through #1388 and the code, it seems like the original event streams are just left and ignored. However, they are not referred to in any way currently. So implementing a read of their checkpoint would be complicated. So I'm going to investigate locating/decoding/passing the last-event information. |
For MultiParty networks (where used) the FireFly batch pin contract follows the same pattern, and there's even less code change as the namespace was included in the listener name already in 1.2: firefly/internal/blockchain/ethereum/ethereum.go Lines 285 to 289 in 16aec0b
|
The thing that distinguishes multi-party |
For Tokens, there is a strong leaning to using either So I am not going to work on addressing that, as it would mean a change to the I will look to discuss this a little further with @awrichar |
@EnriqueL8 @awrichar - I have submitted PR #1534 Open conversations I'd like your view on this week:
|
Thanks for all the thinking!
|
So just thinking about the implications, it will simply be that the I think that's justifiable for the benefit you get - should roll up to the release notes for 1.3.1 for sure, and maybe we need a tweak to the reference section that talks about the event bus, to cover this. Happy to take both those items on. |
I've updated the PR to handle the |
Just added the documentation tag to make sure we document this new behaviour and add it to the release notes |
Agreed, we should just document that as part of upgrade your listeners will get recreated and as part of this it will take the new "latest" block so it does not loose events. We query the checkpoint information from the connector when retrieving a listener so users will see it straight away |
This has been merged! |
As part of the v1.3.0 release, we rearchitected the way event streams from the transaction managers are configured against the namespaces in FireFly. FireFly core will now create one event stream per namespace and as such we wrote code to migrate the existing contract listeners on the previous event stream to the corresponding namespace event stream.
Contract listeners have an option of where to listen from where the choices are accepted:
oldest
which defaults to the first blocklatest
which will be start listen from the creation of the listener.As such when the listeners get recreated as part of the migration, the ones set to
latest
will now listen from a new latest and in the time where the chain has advance and FireFly is starting up some event could get lost! This can get worse with another bug where if FireFly cannot communicate with the Transaction Manager to create the listener it will give up and never listen to those events!A way to solve this would be:
This was we do not lose events.
Looking at the code, this change is tricker than it sounds because the original change simply at startup creates an event stream and apply the listeners created for the namespace. There is no notion of "migration" so this code will need to introduce some code to get the existing listeners on the "global" event stream and hopefully be able to using some identifier correlate them to the new ones that need to be created.
The text was updated successfully, but these errors were encountered: