Say you want to implement vote delegation on top of the current DAO DAO voting module interface.
Let
When queried at time
This means that if any delegator's voting power has changed in
Assuming that future delegations can not be predicted,
As we are attempting this without modifying the voting module interface, there are two external queries available, VotingPowerAtHeight
and TotalPowerAtHeight
. Total power is not granular enough for updating delegated voting powers, so we must use VotingPowerAtHeight
to learn of voting power changes of delegators. This requires
The gas cost of determining voting power growing with the number of delegators means that an attacker can sybil and split their delegation over many addresses to DOS queries for an addresses' voting power.
Footnotes
-
Contracts can only update their state when a message is executed on them. The maximum possible amount of state a contract can know is the entire state of the chain. Thus, when queried the maximum amount of state known to the contract without performing a query is the entire state of the chain when it last had a message executed on it. ↩