witnet / witnet-rust

Open source Rust implementation of the Witnet decentralized oracle protocol, including full node and wallet backend 👁️🦀
https://docs.witnet.io
GNU General Public License v3.0
180 stars 56 forks source link

Stakes data structure does not correctly track multiple validators with the same withdrawer #2467

Closed drcpu-github closed 1 month ago

drcpu-github commented 3 months ago

Staking onto two validators with the same external withdraw address results in the by_withdrawer data stucture only tracking the latest one. However, this is actually a valid move and it is just the by_withdrawer map which cannot index that properly because it only has one SyncStake entry per withdrawer address and each of those entries is tied to a <validator, withdrawer> key.

It's basically the same bug as the one I already shared for by_validator, but more serious because the former is technically invalid if we implement all WIP validation rules.

aesedepece commented 1 month ago

Solved a while ago.