Skip to content

Commit

Permalink
Use fvm_shared identity hash definition
Browse files Browse the repository at this point in the history
  • Loading branch information
elmattic committed Jan 9, 2025
1 parent 4bb15ab commit d111d3d
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/rpc/methods/eth/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
use super::types::{EthAddress, EthBytes};
use crate::rpc::state::{MessageTrace, ReturnTrace};
use crate::shim::address::Address as FilecoinAddress;
use crate::shim::fvm_shared_latest::IDENTITY_HASH;
use crate::shim::state_tree::StateTree;

use anyhow::{bail, Result};
Expand All @@ -13,9 +14,6 @@ use fvm_ipld_blockstore::Blockstore;
use fvm_ipld_encoding::{RawBytes, CBOR, DAG_CBOR, IPLD_RAW};
use serde::de;

/// The Identity multicodec code.
pub const IDENTITY: u64 = 0x0;

pub fn lookup_eth_address<DB: Blockstore>(
addr: &FilecoinAddress,
state: &StateTree<DB>,
Expand Down Expand Up @@ -60,7 +58,7 @@ pub fn lookup_eth_address<DB: Blockstore>(
/// Decodes the payload using the given codec.
pub fn decode_payload(payload: &RawBytes, codec: u64) -> Result<EthBytes> {
match codec {
IDENTITY => Ok(EthBytes::default()),
IDENTITY_HASH => Ok(EthBytes::default()),
DAG_CBOR | CBOR => {
let mut reader = cbor4ii::core::utils::SliceReader::new(payload.bytes());
match Value::decode(&mut reader) {
Expand Down Expand Up @@ -159,7 +157,7 @@ mod test {
);

// identity
let result = decode_payload(&RawBytes::new(vec![1]), IDENTITY);
let result = decode_payload(&RawBytes::new(vec![1]), IDENTITY_HASH);
assert!(result.unwrap().0.is_empty());
}
}

0 comments on commit d111d3d

Please sign in to comment.