We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 276eaef commit 0697db6Copy full SHA for 0697db6
shasta/src/l2/tools.rs
@@ -10,6 +10,14 @@ pub fn encode_extra_data(basefee_sharing_pctg: u8, proposal_id: u64) -> Bytes {
10
Bytes::from(data.to_vec())
11
}
12
13
+/// Decode the extra data field of a Shasta block header.
14
+///
15
+/// The expected format of `extra_data` is exactly 7 bytes:
16
+/// - byte 0: `basefee_sharing_pctg` (the base fee sharing percentage)
17
+/// - bytes 1..7: the most significant 6 bytes of the big-endian `proposal_id`
18
19
+/// On success, returns a tuple `(basefee_sharing_pctg, proposal_id)`.
20
+/// Returns an error if `extra_data` is not exactly 7 bytes long.
21
pub fn decode_extra_data(extra_data: &[u8]) -> Result<(u8, u64), Error> {
22
if extra_data.len() != 7 {
23
return Err(anyhow::anyhow!(
0 commit comments