mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-14 18:32:42 +00:00
## Proposed Changes Split out several crates which now exist in separate repos under `sigp`. - [`ssz` and `ssz_derive`](https://github.com/sigp/ethereum_ssz) - [`tree_hash` and `tree_hash_derive`](https://github.com/sigp/tree_hash) - [`ethereum_hashing`](https://github.com/sigp/ethereum_hashing) - [`ethereum_serde_utils`](https://github.com/sigp/ethereum_serde_utils) - [`ssz_types`](https://github.com/sigp/ssz_types) For the published crates see: https://crates.io/teams/github:sigp:crates-io?sort=recent-updates. ## Additional Info - [x] Need to work out how to handle versioning. I was hoping to do 1.0 versions of several crates, but if they depend on `ethereum-types 0.x` that is not going to work. EDIT: decided to go with 0.5.x versions. - [x] Need to port several changes from `tree-states`, `capella`, `eip4844` branches to the external repos.
15 lines
433 B
Rust
15 lines
433 B
Rust
use crate::PublicKey;
|
|
use ethereum_hashing::hash;
|
|
use ssz::Encode;
|
|
|
|
/// Returns the withdrawal credentials for a given public key.
|
|
///
|
|
/// Used for submitting deposits to the Eth1 deposit contract.
|
|
pub fn get_withdrawal_credentials(pubkey: &PublicKey, prefix_byte: u8) -> Vec<u8> {
|
|
let hashed = hash(&pubkey.as_ssz_bytes());
|
|
let mut prefixed = vec![prefix_byte];
|
|
prefixed.extend_from_slice(&hashed[1..]);
|
|
|
|
prefixed
|
|
}
|