3. Key Provisioning in vFactory
This process is gas intensive and a Merkle Tree based solution is currently being worked on that would only require an update + approval of the tree root, drastically reducing the gas cost to add keys.
Now that we have the exact address of the vPool and its vWithdrawalRecipient, we can start creating validation keys for its withdrawal credentials and upload them to the vFactory.
Withdrawal Channels
The vFactory stores keys in separated Withdrawal Channels. Only two types of Withdrawal Channels exist:
Withdrawal Channel != 0: The withdrawal channel value is the actual withdrawal credential of the keys inside the channel. In the case of the vPool, keys are added on a withdrawal channel that is equal to the withdrawal credential of the vWithdrawalRecipient
Withdrawal Channel == 0: This special withdrawal channel holds keys with each its own withdrawal recipient, handled by the vFactory. This means that the generation of these keys is a bit different as the address of the withdrawal recipient is deterministic and based on the validator public. We won't use this channel for the vPool.
Retrieving the withdrawal credential of the vPool
We will need both the withdrawal credential and the vWithdrawalRecipient address for the next step
Generating 10 keys
For our example, we'll use the official deposit cli to generate 10 keys for the pool.
deposit new-mnemonic \
--eth1_withdrawal_address $WITHDRAWAL_RECIPIENT_ADDRESS \
--num_validators 10
And once done, you can check the generated deposit_data
file to make sure that all keys:
have the same withdrawal credential
the value is the proper one
Verifying our 10 keys before submission
We can now verify our deposit data to make sure it's valid. The tool we're going to use ensures that the key has no duplicates inside the vFactory and ensures that the signature associated with the public key is valid.
You should retrieve the vsuite-utils
repository, and have golang
installed for the next step.
Clone vsuite-utils
and run:
go run main.go factory verify-deposit-data \
--deposit-data-file $DEPOSIT_DATA_FILE_PATH \
--eth-rpc-url $ETH_RPC_URL \
--factory-address $FACTORY_ADDRESS \
--network prater \
--withdrawal-channel $WITHDRAWAL_CHANNEL
It should directly tell you if there is any error in the deposit_data
, otherwise we're clear to advance to the next step: submitting the keys
Adding 10 keys to the vFactory
We can now convert the generated deposit_data
into calldata for the submit transaction.
Approving the newly added keys
When keys are approved, authorized depositors on the withdrawal channel will be able to fund them. This means that it is a very critical action, that only the ADMIN
of the vFactory can perform. We suggest using a multisig where a quorum of members will be able to run the verification script on their end to ensure that the current keys of the channel are valid.
function approve(bytes32[] calldata withdrawalChannels, uint256[] calldata limits, uint256[] calldata snapshots) external;
The approve
method of the vFactory is able to change the staking limit of several withdrawal channels at once.
The parameters are the following ones:
withdrawalChannels
: The list of withdrawal channels that we will approvelimits
: The staking limits of the withdrawal channels, at the same indexessnapshots
: This parameter will ensure that the approval only passes if there has been no modification to the channel since the provided snapshot block number. When perform the off-chain verifications, quorum members should use the same snapshot block number to perform their verifications.
Once we know all the keys are valid, we can approve them ! In the following example we use cast but only as illustration for testnet, we strongly recommend using a strong multisig on mainnet for this purpose.
The vFactory is now ready for the vPool to purchase up to 10 validators !
Last updated
Was this helpful?