telos.contracts icon indicating copy to clipboard operation
telos.contracts copied to clipboard

BP Vote aggregation

Open pmjanus opened this issue 10 months ago • 0 comments

[Feature] Implement EVM Vote Weight Synchronization for Block Producers

🔄 Description Create a new action in the system contract that synchronizes block producer vote weights between EVM and native chains, ensuring consistent voting power across both environments.

📋 Key Features

  • Read vote aggregates from EVM state for specific block producers
  • Compare with locally tracked vote weights on native side
  • Calculate and apply vote weight differences when detected
  • Maintain a persistent record of EVM vote weights in a dedicated table

🧠 Tasks

  • [ ] Create new action in system contract to fetch EVM vote weights for a specific BP
  • [ ] Implement table structure to store EVM vote weights on native side
  • [ ] Develop logic to compare EVM vs native vote weights and apply differences
  • [ ] Ensure only significant changes trigger state updates (optimization)
  • [ ] Add support for off-chain script to periodically call this action
  • [ ] Implement security measures to ensure only eosio account can modify EVM contract state
  • [ ] Configure zero gas price for all system contract to EVM transactions
  • [ ] Add comprehensive documentation for the new feature

🔐 Security Considerations

  • Native-to-EVM communications for BP registration/unregistration and decay multiplier updates must only be executable by the eosio account
  • The EVM contract should have the system contract address hardcoded for verification
  • All transactions from system contract to EVM should have 0 gas price
  • Add thorough testing
  • Consider audit.

🔄 Flow Example

  • Action called for BP with 0 previous EVM votes
  • System reads current EVM state showing 10^6 votes after decay
  • System adds these votes to the BP's total stake
  • System updates the EVM vote weights table with new value
  • No action taken if values remain unchanged between calls

pmjanus avatar Feb 26 '25 17:02 pmjanus