Skip to content

Commit

Permalink
feat:add decode v1 test
Browse files Browse the repository at this point in the history
Signed-off-by: Chen Kai <[email protected]>
  • Loading branch information
GrapeBaBa committed Sep 2, 2024
1 parent 811d469 commit 650fe28
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
7 changes: 7 additions & 0 deletions crates/net/src/types/envelope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,13 @@ mod tests {
use super::*;
use alloy::hex;

#[test]
fn decode_v1() {
let data = hex::decode("0xbd04f043128457c6ccf35128497167442bcc0f8cce78cda8b366e6a12e526d938d1e4c1046acffffbfc542a7e212bb7d80d3a4b2f84f7b196d935398a24eb84c519789b401000000fe0300fe0300fe0300fe0300fe0300fe0300a203000c4a8fd56621ad04fc0101067601008ce60be0005b220117c32c0f3b394b346c2aa42cfa8157cd41f891aa0bec485a62fc010000").unwrap();
let payload_envelop = ExecutionPayloadEnvelope::decode_v1(&data).unwrap();
assert_eq!(1725271882, payload_envelop.payload.timestamp);
}

#[test]
fn decode_v2() {
let data = hex::decode("0xc104f0433805080eb36c0b130a7cc1dc74c3f721af4e249aa6f61bb89d1557143e971bb738a3f3b98df7c457e74048e9d2d7e5cd82bb45e3760467e2270e9db86d1271a700000000fe0300fe0300fe0300fe0300fe0300fe0300a203000c6b89d46525ad000205067201009cda69cb5b9b73fc4eb2458b37d37f04ff507fe6c9cd2ab704a05ea9dae3cd61760002000000020000").unwrap();
Expand Down
3 changes: 2 additions & 1 deletion crates/net/src/types/payload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ impl PayloadHash {

#[cfg(test)]
mod tests {
use super::*;
use alloy::primitives::b256;

use super::*;

#[test]
fn test_signature_message() {
let inner = b256!("9999999999999999999999999999999999999999999999999999999999999999");
Expand Down

0 comments on commit 650fe28

Please sign in to comment.