Skip to content

Provider Pool

gjgd edited this page Jul 24, 2018 · 3 revisions

The Provider Pool is a structure that stores Providers, and keep them sorted by the amount Delegators bonded to them (a.k.a totalBondedAmount). The sorted aspect is important because at the end of each round, the top numberOfActiveProviders Providers are selected from the pool to execute jobs on the network.

It is implemented using two contracts:

  • SortedDoublyLL.sol, a library taken from the LivePeer project that contains the data structure and sorting mechanisms
  • ProviderPool.sol is an interface between the main contract TransmuteDPOS.sol and the library and allows for future flexibility in the choice of data structure being used. Indeed all tests are written for that interface, and not the library.

ProviderPool.sol offers several methods to:

  • interact with the pool
function addProvider(address _provider, uint _bondedAmount) internal;
function updateProvider(address _provider, uint _newBondedAmount) internal;
function removeProvider(address _provider) internal;
  • view the current state of the pool
function getProvider(address _provider) external view returns (uint, address, address);
function containsProvider(address _provider) external view returns (bool);
  • set parameters
function setMaxNumberOfProviders(uint _maxNumber) external onlyOwner;

To see how we wrote tests for internal methods of ProviderPool.sol, read Testing internal methods

Clone this wiki locally