keep-network / keep-core

The smart contracts and reference client behind the Keep network
https://keep.network
MIT License
118 stars 73 forks source link

RFC 12 Implementation: Coordination result processing #3750

Closed lukasz-zimnoch closed 8 months ago

lukasz-zimnoch commented 9 months ago

Refs: https://github.com/keep-network/tbtc-v2/issues/737 Depends on: https://github.com/keep-network/keep-core/pull/3747

Here we present the fourth part of the changes meant to implement RFC 12: Decentralized wallet coordination in the tBTC wallet client. This pull request focuses on the coordination result processing.

Result processor

Here we implement the processCoordinationResult function that receives coordination results, detects the proposal type, and triggers the appropriate proposal handler exposed by the node component. This function also sets up the proposal processing start block (i.e. coordination window end block) and the proposal expiry block.

Detach WalletCoordinator event handlers

Due to the above changes, from now on, the node component fires wallet actions based on incoming coordination results. The node component no longer listens for events coming from the WalletCoordinator contract. We are taking the opportunity and remove those handlers along with the auxiliary code (e.g. events deduplication).

Next steps

The next steps on the way towards RFC 12 implementation are: