Skip to content

Conversation

@twoeths
Copy link
Contributor

@twoeths twoeths commented Nov 18, 2020

resolves #1761

  • Keep initiateValidatorExit for backward reference, it's the same to the spec
  • Implement initiateMultipleValidatorExits which loop through validator array inside state only 1 time
  • Spec test goes through initiateMultipleValidatorExits

@twoeths twoeths marked this pull request as ready for review November 18, 2020 01:59
processOp(epochCtx, state, op, verifySignatures);
});
});
const indexes = readOnlyMap(body.voluntaryExits, (voluntaryExit) => voluntaryExit.message.validatorIndex);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about using

processVoluntaryExits(body.voluntaryExits, epochCtx, state)

to not spread the logic in multiple files

[body.attestations, processAttestation],
[body.deposits, processDeposit],
[body.voluntaryExits, processVoluntaryExit],
[body.voluntaryExits, verifyVoluntaryExit],
Copy link
Contributor

@dapplion dapplion Nov 18, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we can modify this entire statement to

processAttesterSlashings(...)
processAttestations(...)
processDeposits(...)

And look for similar optimizations in the other opts

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the initiateValidatorExit() was called in slashValidator.ts also but we couldn't optimize the same way to this because it's required to process one by one there in order to use validator withdrawableEpoch correctly

other than that I don't see any similar improvement can be made so I keep other functions as is.

@twoeths twoeths force-pushed the tuyen/improve-initiate-validator-exit branch from 9091847 to c8f061d Compare November 19, 2020 09:55
@twoeths
Copy link
Contributor Author

twoeths commented Dec 5, 2020

closing this in favor of #1816 as I think the bigger issue is we loop through validators array in other flows too

@twoeths twoeths closed this Dec 5, 2020
@dapplion dapplion deleted the tuyen/improve-initiate-validator-exit branch August 6, 2022 08:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve validator exit process

4 participants