Replace custom read/write impls in router with borsh

This commit is contained in:
Luke Parker
2025-01-21 03:49:29 -05:00
parent f690bf831f
commit c8f3a32fdf
9 changed files with 81 additions and 217 deletions

View File

@@ -2,12 +2,27 @@
#![doc = include_str!("../README.md")]
#![deny(missing_docs)]
use ::borsh::{BorshSerialize, BorshDeserialize};
use group::ff::PrimeField;
use k256::Scalar;
use alloy_primitives::PrimitiveSignature;
use alloy_consensus::{SignableTransaction, Signed, TxLegacy};
mod borsh;
pub use borsh::*;
/// An index of a log within a block.
#[derive(Clone, Copy, PartialEq, Eq, Debug, BorshSerialize, BorshDeserialize)]
#[borsh(crate = "::borsh")]
pub struct LogIndex {
/// The hash of the block which produced this log.
pub block_hash: [u8; 32],
/// The index of this log within the execution of the block.
pub index_within_block: u64,
}
/// The Keccak256 hash function.
pub fn keccak256(data: impl AsRef<[u8]>) -> [u8; 32] {
alloy_primitives::keccak256(data.as_ref()).into()