Skip to content

Commit

Permalink
Add mock blame to report completed exits handler in oracle service
Browse files Browse the repository at this point in the history
  • Loading branch information
shanejearley committed Jun 12, 2023
1 parent ac37349 commit a6f4d36
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions services/oracle/src/providers/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ export async function reportCompletedExitsHandler(input: HandlerInput) {
* In production, we get the completed exit order from the Beacon API (sorting by withdrawn epoch)
* We check all validators using:
* const stakedPublicKeys = await views.getStakedPublicKeys(startIndex, endIndex)
* Here, we're just grabbing a random active pool for each forced exit
* Here, we're just grabbing the next exiting pool for each completed exit
*/
const stakedPoolIds = await manager.getStakedPoolIds()
let remaining = count
Expand All @@ -181,10 +181,20 @@ export async function reportCompletedExitsHandler(input: HandlerInput) {
const poolDetails = await views.getPoolDetails(poolId)
if (poolDetails.status === 2 || poolDetails.status === 3) {
remaining--

/**
* In production, we use the SSV performance data to determine blame
* We check all validators using:
* const stakedPublicKeys = await views.getStakedPublicKeys(startIndex, endIndex)
* Here, we're just hardcoding blame to the first operator if less than 32 ETH
*/
const operatorIds = poolDetails.operatorIds.map((operatorId) => operatorId.toNumber())
const blamePercents = [0, 0, 0, 0]
let blamePercents = [0, 0, 0, 0]
if (poolDetails.balance.lt(ethers.utils.parseEther('32'))) {
blamePercents = [100, 0, 0, 0]
}
const clusterDetails = await getClusterDetails({
provider: provider,
provider,
ownerAddress: manager.address,
operatorIds
})
Expand Down

0 comments on commit a6f4d36

Please sign in to comment.