Try โ€‚โ€‰HackMD

EPF Cohort 3 Dev Update 8 (pavignol)

This week's update will be relatively short since there are not many endpoints to implement on my end, and some of the endpoints that I have implemented are blocked on PRs that haven't been merged yet.

Added Capella support to the ProposeBeaconBlock and GetBeaconBlock REST API implementations

Originally, when I added ProposeBeaconBlock and GetBeaconBlock, I wasn't able to add support for Capella since the functionality wasn't ready yet on the beacon node side, and therefore there wasn't even a gRPC implementation on the validator side either. But since the Prysm team has been working hard on implementating withdrawals, it was time to revisit those 2 endpoints and add the missing functionality.

Adding Capella support was pretty easy since I have already written all of the boilerplate code, heavylifting and tests a few weeks ago for Bellatrix, so all I needed to do was code the conversion of the withdrawals array between the gRPC and the REST API JSON structs, which looks like this:

func jsonifyWithdrawals(withdrawals []*enginev1.Withdrawal) []*apimiddleware.WithdrawalJson {
	jsonWithdrawals := make([]*apimiddleware.WithdrawalJson, len(withdrawals))
	for index, withdrawal := range withdrawals {
		jsonWithdrawals[index] = &apimiddleware.WithdrawalJson{
			WithdrawalIndex:  strconv.FormatUint(withdrawal.Index, 10),
			ValidatorIndex:   strconv.FormatUint(uint64(withdrawal.ValidatorIndex), 10),
			ExecutionAddress: hexutil.Encode(withdrawal.Address),
			Amount:           strconv.FormatUint(withdrawal.Amount, 10),
		}
	}
	return jsonWithdrawals
}

func convertWithdrawalsToProto(jsonWithdrawals []*apimiddleware.WithdrawalJson) ([]*enginev1.Withdrawal, error) {
	withdrawals := make([]*enginev1.Withdrawal, len(jsonWithdrawals))

	for index, jsonWithdrawal := range jsonWithdrawals {
		if jsonWithdrawal == nil {
			return nil, errors.Errorf("withdrawal at index `%d` is nil", index)
		}

		withdrawalIndex, err := strconv.ParseUint(jsonWithdrawal.WithdrawalIndex, 10, 64)
		if err != nil {
			return nil, errors.Wrapf(err, "failed to parse withdrawal index `%s`", jsonWithdrawal.WithdrawalIndex)
		}

		validatorIndex, err := strconv.ParseUint(jsonWithdrawal.ValidatorIndex, 10, 64)
		if err != nil {
			return nil, errors.Wrapf(err, "failed to parse validator index `%s`", jsonWithdrawal.ValidatorIndex)
		}

		executionAddress, err := hexutil.Decode(jsonWithdrawal.ExecutionAddress)
		if err != nil {
			return nil, errors.Wrapf(err, "failed to decode execution address `%s`", jsonWithdrawal.ExecutionAddress)
		}

		amount, err := strconv.ParseUint(jsonWithdrawal.Amount, 10, 64)
		if err != nil {
			return nil, errors.Wrapf(err, "failed to parse withdrawal amount `%s`", jsonWithdrawal.Amount)
		}

		withdrawals[index] = &enginev1.Withdrawal{
			Index:          withdrawalIndex,
			ValidatorIndex: types.ValidatorIndex(validatorIndex),
			Address:        executionAddress,
			Amount:         amount,
		}
	}

	return withdrawals, nil
}

Update on the PRs

Last week I started publishing updates on the state of the endpoints, so I thought I would keep doing it until the end of the project. Not many PRs were merged this week since our mentor was still on vacation, but other members of the Prysm team pitched in so we were able to merged a few PRs (the ones in bold):

Legend:

Symbol State
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 โ†’
Not ready for PR
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 โ†’
PR opened
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 โ†’
Merged into develop
Done Owner Endpoint
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 โ†’
pavignol GetDuties
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 โ†’
pavignol GetBeaconBlock
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 โ†’
pavignol ProposeBeaconBlock
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 โ†’
pavignol PrepareBeaconProposer
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 โ†’
pavignol GetAttestationData
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 โ†’
dhruv ProposeAttestation
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 โ†’
dhruv SubmitAggregateSelectionProof
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 โ†’
dhruv SubmitSignedAggregateSelectionProof
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 โ†’
pavignol ProposeExit
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 โ†’
pavignol SubscribeCommitteeSubnets
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 โ†’
manu SubmitValidatorRegistrations
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 โ†’
manu ValidatorIndex
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 โ†’
manu ValidatorStatus
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 โ†’
manu MultipleValidatorStatus
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 โ†’
pavignol SubmitSignedContributionAndProof
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 โ†’
manu SubmitSyncMessage
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 โ†’
dhruv GetSyncSubcommitteeIndex
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 โ†’
dhruv GetSyncMessageBlockRoot
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 โ†’
pavignol StreamDuties
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 โ†’
pavignol WaitForChainStart
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 โ†’
manu WaitForActivation
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 โ†’
pavignol StreamBlocksAltair
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 โ†’
pavignol DomainData
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 โ†’
manu GetFeeRecipientByPubKey
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 โ†’
manu CheckDoppelGanger
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 โ†’
dhruv GetSyncCommitteeContribution