Post EPF regular update no.1
eODS (enshrined Operator-Delegator Separation) - modelling the logic with a toy Python project
Introduction
After EPF cohort-five ended, I hacked an eODS toy project, based on the beacon-chain-accounting model I worked on during EPF.
The aim is to explore and test (locally) one possible functional model for implementing delegations in Ethereum, at protocol level, with the minimal possible disruption to the current protocol.
The logic
The logic is built on top of Electra upgrade logic, and is based on the eODS design notes.
The minimal requirements of functionality that were proven by the project:
- Deposit from outside the system (via something like
DEPOSIT_TO_DELEGATE_CONTRACT
), to a delegator’s balance. Initiate delegators, in the delegators registry, and store their balances inside a list.
- A delegated validator class serves as a wrapper around the Validator data object mocked from the protocol. It adds functionality specific to eODS, to the Validator.
- Transfer capital from a delegator's balance to a specific delegated validator's active balance. Validator's effective balance is not implemented in the current project's logic, being outside of its scope at this point.
- Store delegators’ quotas, as lists, across all delegated validators
- Adjusting delegators’ balances, according to their quota in the delegated validator’s balance, when their balance increases or decreases, due to rewards, penalties or slashing.
- Delegator initiated withdrawals from a certain delegated validator’s balance.
- Withdrawals from a certain delegator’s balance to an execution address.
Implementation
Class diagram
The project is composed of the following modules:
- edos
This is the core module of the project, holding the basics of the logic behind eODS. It contains vital sub-modules like the registry of validators, the registry of delegators, or the delegated validator and delegator classes.
- main
This module is designed to test, validate, and refine the foundational concepts that will serve as the cornerstone for eODS.
- protocol
This module mocks some of the existing functionalities in the protocol, and offers a base on which the rest of the code builds on.
- simulator_constants
This module defines the constants used by the project's simulator, to generate data.
- simulator
This module simulates an ecosystem in which we can test delegations. It generates new delegations, applies rewards, penalties, and slashings, and processes withdrawals.
- tester
This module contains functions used to test the generated data.
This is the project's class diagram:
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
More in depth information on how the project's logic is implemented can be found in the project's documentation.
Next weeks
Write an ethresear.ch post about the prospect of enshrining delegations in Ethereum, using the following resources as a basis:
Resources