confio / poe-contracts

Tgrade PoE smart contracts
Apache License 2.0
25 stars 8 forks source link

[tg4-engagement] Half-life process does not update members #203

Closed maurolacy closed 1 year ago

maurolacy commented 1 year ago

The half-life points halving works as expected, but does not send UpdateMember messages to the hooked contracts(!).

As a result, the tg4-mixer contract does not get the point updates, and it's effectively like no half-life has happened for it. Moreover: if some member then gets an EP increase through AddPoints, UpdateMember is dispatched, and that member, if it's a validator, now has a lower relative score in comparison to their not-yet-updated counterparts.

To fix this, a way could be to follow the same sequence of events add_points follows. That is, to copy or generalise the sequence of steps from add_points, so that it can be used / adapted to end_block's half-life processing. And also, make sure points updates sent through UpdateMember can work with reduced points, instead of just point increases.

An associated issue would be, to force the pending UpdateMember events to happen, using the migration handler. For simplicity, we can just send an UpdateMember for each member in the group (after checking contract versions). Also, it would be good to confirm first UpdateMember works fine with zero points differences, as some members already had their UpdateMember messages delivered to the hooks, because of AddPoints.