kleros-v2
kleros-v2 copied to clipboard
fix(Governor): remove CappedMath and tx order
CappedMath is removed because for the most part it's not needed as it was initially used to prevent underflows/overflows which isn't relevant for 0.8.0. In a couple of cases it was relevant still and I implemented a manual check there.
Requirement for tx ordering is removed since it becomes an issue where the txs in the list must be executed in a particular order (e.g. during minStake
changes in courts). On the other hand, removing it now makes possible to submit lists with the same txs but in different order with an attempt "to steal" the list in cases where order of execution doesn't matter. In this case the list that was submitted the first should be chosen.
There is no way to automate this process within the contract, since it's not possible to determine automatically whether the order of the list matters or not, thus the process of choosing the list should be done by the jurors, which might require some policy changes to address the cases of duplication.
PR-Codex overview
This PR refactors the KlerosGovernor
contract by removing the CappedMath
library and optimizing transaction list handling.
Detailed summary
- Removed
CappedMath
library import and usage - Optimized transaction list creation and submission logic
- Improved deposit handling and fund calculations
✨ Ask PR-Codex anything about this PR by commenting with
/codex {your question}