Skip to content

Commit

Permalink
Serialize Keccak256 as array, not slice.
Browse files Browse the repository at this point in the history
  • Loading branch information
deuszx committed Jan 16, 2025
1 parent 49a6746 commit 7fade4e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions linera-base/src/crypto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ impl Serialize for CryptoHash {
if serializer.is_human_readable() {
serializer.serialize_str(&self.to_string())
} else {
serializer.serialize_newtype_struct("CryptoHash", &self.0)
serializer.serialize_newtype_struct("CryptoHash", &self.0 .0)
}
}
}
Expand All @@ -183,10 +183,10 @@ impl<'de> Deserialize<'de> for CryptoHash {
} else {
#[derive(Deserialize)]
#[serde(rename = "CryptoHash")]
struct Foo(B256);
struct Foo([u8; 32]);

let value = Foo::deserialize(deserializer)?;
Ok(Self(value.0))
Ok(Self(value.0.into()))
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion linera-chain/src/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ static STATE_HASH_COMPUTATION_LATENCY: LazyLock<HistogramVec> = LazyLock::new(||
});

/// The BCS-serialized size of an empty `ExecutedBlock`.
const EMPTY_EXECUTED_BLOCK_SIZE: usize = 93;
const EMPTY_EXECUTED_BLOCK_SIZE: usize = 91;

/// An origin, cursor and timestamp of a unskippable bundle in our inbox.
#[derive(Debug, Clone, Serialize, Deserialize, async_graphql::SimpleObject)]
Expand Down
2 changes: 1 addition & 1 deletion linera-chain/src/unit_tests/chain_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ async fn test_block_size_limit() {
let mut chain = ChainStateView::new(chain_id).await;

// The size of the executed valid block below.
let maximum_executed_block_size = 713;
let maximum_executed_block_size = 707;

// Initialize the chain.
let mut config = make_open_chain_config();
Expand Down

0 comments on commit 7fade4e

Please sign in to comment.