MCPcopy Create free account
hub / github.com/SeismicSystems/summit / ssz_append

Method ssz_append

types/src/header.rs:115–179  ·  view source on GitHub ↗
(&self, buf: &mut Vec<u8>)

Source from the content-addressed store, hash-verified

113 timestamp,
114 epoch,
115 view,
116 payload_hash: payload_hash.into(),
117 execution_request_hash: execution_request_hash.into(),
118 checkpoint_hash: checkpoint_hash.into(),
119 prev_epoch_header_hash: prev_epoch_header_hash.into(),
120 added_validators,
121 removed_validators: removed_validators.into_iter().map(|x| x.into()).collect(),
122 parent_beacon_block_root,
123 digest: OnceLock::new(),
124 }
125 }
126
127 /// Builds a header with an externally-supplied digest instead of deriving it
128 /// from the canonical encoding. This is intentionally `pub(crate)` and exists
129 /// only for `Block::genesis`, which uses the eth genesis hash as the block
130 /// identity rather than `SHA256(ssz(header))`.
131 #[allow(clippy::too_many_arguments)]
132 pub(crate) fn new_with_digest(
133 parent: Digest,
134 height: u64,
135 timestamp: u64,
136 epoch: u64,
137 view: u64,
138 payload_hash: Digest,
139 execution_request_hash: Digest,
140 checkpoint_hash: Digest,
141 prev_epoch_header_hash: Digest,
142 added_validators: Vec<AddedValidator>,
143 removed_validators: Vec<PublicKey>,
144 parent_beacon_block_root: [u8; 32],
145 digest: Digest,
146 ) -> Self {
147 Self {
148 parent: parent.into(),
149 height,
150 timestamp,
151 epoch,
152 view,
153 payload_hash: payload_hash.into(),
154 execution_request_hash: execution_request_hash.into(),
155 checkpoint_hash: checkpoint_hash.into(),
156 prev_epoch_header_hash: prev_epoch_header_hash.into(),
157 added_validators,
158 removed_validators: removed_validators.into_iter().map(|x| x.into()).collect(),
159 parent_beacon_block_root,
160 digest: OnceLock::from(digest),
161 }
162 }
163
164 /// Returns the (cached) digest of this header.
165 ///
166 /// The value is memoized in `self.digest`, and may have been *seeded* via
167 /// [`Header::new_with_digest`] (genesis seeds it with the genesis hash,
168 /// which is intentionally not the hash of the fields). This is correct for
169 /// block identity, but it means the cached value cannot be trusted to
170 /// reflect the current fields. Trust boundaries that authenticate a header
171 /// against a signed payload must use [`Header::computed_digest`] instead.
172 pub fn get_digest(&self) -> Digest {

Callers

nothing calls this directly

Calls 2

lenMethod · 0.80
writeMethod · 0.45

Tested by

no test coverage detected