Skip to content

Commit

Permalink
fix: incorrect params serialisation for EthGetBlockReceipts (#5131)
Browse files Browse the repository at this point in the history
  • Loading branch information
LesnyRumcajs authored Jan 13, 2025
1 parent 99c877d commit 67ff65d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 32 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@

- [#5122](https://github.com/ChainSafe/forest/issues/5122) Fix a bug in database garbage collection flow.

- [#5131](https://github.com/ChainSafe/forest/pull/5131) Fix incorrect data deserialization in the `Filecoin.EthGetBlockReceipts` RPC method. This caused the method to return an error on some blocks.

## Forest v.0.23.3 "Plumber"

Mandatory release for calibnet node operators. It fixes a sync error at epoch 2281645.
Expand Down
2 changes: 1 addition & 1 deletion src/rpc/methods/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1094,7 +1094,7 @@ async fn new_eth_tx_receipt<DB: Blockstore + Send + Sync + 'static>(
let ret: eam::CreateExternalReturn =
from_slice_with_fallback(message_lookup.receipt.return_data().bytes())?;

receipt.contract_address = Some(ret.eth_address.into());
receipt.contract_address = Some(ret.eth_address.0.into());
}

let mut events = vec![];
Expand Down
32 changes: 1 addition & 31 deletions src/shim/actors/builtin/eam.rs
Original file line number Diff line number Diff line change
@@ -1,34 +1,4 @@
// Copyright 2019-2025 ChainSafe Systems
// SPDX-License-Identifier: Apache-2.0, MIT

use crate::shim::address::Address;

use serde::{Deserialize, Serialize};

#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
pub struct CreateExternalReturn {
pub actor_id: u64,
pub robust_address: Address,
pub eth_address: [u8; 20],
}

#[cfg(test)]
mod tests {
use super::*;
use crate::utils::encoding::from_slice_with_fallback;
use fvm_ipld_encoding::to_vec;

#[test]
fn test_create_external_return_roundtrip() {
let ret_struct = CreateExternalReturn {
actor_id: 666,
robust_address: Address::new_id(2),
eth_address: [0; 20],
};
let struct_encoded = to_vec(&ret_struct).unwrap();

let struct_decoded: CreateExternalReturn =
from_slice_with_fallback(&struct_encoded).unwrap();
assert_eq!(struct_decoded, ret_struct);
}
}
pub type CreateExternalReturn = fil_actor_eam_state::v16::CreateExternalReturn;

0 comments on commit 67ff65d

Please sign in to comment.