Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
069e46e
store the fvm events in blockstore and fetch from blockstore if not a…
akaladarshi Dec 3, 2025
d1990da
add unit test and update the exisitng event API snapshot test
akaladarshi Dec 5, 2025
b15c1bf
add empty check while fetching events and small fixes
akaladarshi Dec 5, 2025
af90795
refactor get events method and udpdate the snapshot tests
akaladarshi Dec 9, 2025
0cf17fd
remove the indices store
akaladarshi Dec 9, 2025
b7328eb
address comments
akaladarshi Dec 10, 2025
d3f0c50
add DB migration and bump the forest version
akaladarshi Jan 12, 2026
6fb70ec
fix linter issue
akaladarshi Jan 12, 2026
51f61bf
Merge branch 'main' into akaladarshi/fix-get-events-api
akaladarshi Jan 12, 2026
d7775e7
Merge branch 'main' into akaladarshi/fix-get-events-api
akaladarshi Jan 12, 2026
2acca34
Merge branch 'main' into akaladarshi/fix-get-events-api
akaladarshi Jan 12, 2026
49f17a6
add change log entry
akaladarshi Jan 13, 2026
10e21f8
remove the ChainGetEvents API from the filter list
akaladarshi Jan 13, 2026
488e5c3
add comment for the API
akaladarshi Jan 13, 2026
a3fa8f1
Merge branch 'main' into akaladarshi/fix-get-events-api
akaladarshi Jan 13, 2026
de08a14
Merge branch 'main' into akaladarshi/fix-get-events-api
akaladarshi Jan 15, 2026
c78de22
Merge branch 'main' into akaladarshi/fix-get-events-api
akaladarshi Jan 16, 2026
39bd1e6
Merge branch 'main' into akaladarshi/fix-get-events-api
akaladarshi Jan 19, 2026
eec093f
address migration comments
akaladarshi Jan 19, 2026
93edf96
address remaining comments
akaladarshi Jan 20, 2026
b8976c3
Merge branch 'main' into akaladarshi/fix-get-events-api
akaladarshi Jan 20, 2026
8aea806
Merge branch 'main' into akaladarshi/fix-get-events-api
akaladarshi Jan 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,22 @@

- [#6368](https://github.com/ChainSafe/forest/pull/6368): Migrated build and development tooling from Makefile to `mise`. Contributors should install `mise` and use `mise run` commands instead of `make` commands.

- [#6286](https://github.com/ChainSafe/forest/pull/6286) `Filecoin.ChainGetEvents` now returns an error if the events are not present in the db.

### Removed

### Fixed

- [#6409](https://github.com/ChainSafe/forest/pull/6409) Fixed backfill issue when null tipsets are present.

- [#6327](https://github.com/ChainSafe/forest/pull/6327) Fixed: Forest returns 404 for all invalid api paths.

- [#6354](https://github.com/ChainSafe/forest/pull/6354) Fixed: Correctly calculate the epoch range instead of directly using the look back limit value while searching for messages.

- [#6400](https://github.com/ChainSafe/forest/issues/6400) Fixed `eth_subscribe` `newHeads` to return Ethereum block format instead of Filecoin block headers array.

- [#6286](https://github.com/ChainSafe/forest/pull/6286) Fixed: `Filecoin.ChainGetEvents` API returns correct events.

- [#6430](https://github.com/ChainSafe/forest/issues/6430) Fixed a panic when syncing from genesis on the calibration network.

## Forest v0.30.5 "Dulce de Leche"
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "forest-filecoin"
version = "0.30.5"
version = "0.31.0"
authors = ["ChainSafe Systems <[email protected]>"]
repository = "https://github.com/ChainSafe/forest"
edition = "2024"
Expand Down
4 changes: 0 additions & 4 deletions scripts/tests/api_compare/filter-list
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
# This list contains potentially broken methods (or tests) that are ignored.
# They should be considered bugged, and not used until the root cause is resolved.

# Ignoring ChainGetEvents for now, as we are not sure if we should get duplicated events or not.
# TODO(forest): https://github.com/ChainSafe/forest/issues/6271.
!Filecoin.ChainGetEvents
3 changes: 0 additions & 3 deletions scripts/tests/api_compare/filter-list-offline
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,3 @@
!Filecoin.EthGetBlockByNumber
!eth_getBlockByNumber
!Filecoin.ChainSetHead
# Ignoring ChainGetEvents for now, as we are not sure if we should get duplicated events or not.
# TODO(forest): https://github.com/ChainSafe/forest/issues/6271.
!Filecoin.ChainGetEvents
37 changes: 4 additions & 33 deletions src/chain/store/chain_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use super::{
index::{ChainIndex, ResolveNullTipset},
tipset_tracker::TipsetTracker,
};
use crate::db::{EthMappingsStore, EthMappingsStoreExt, IndicesStore, IndicesStoreExt};
use crate::db::{EthMappingsStore, EthMappingsStoreExt};
use crate::interpreter::{BlockMessages, VMTrace};
use crate::libp2p_bitswap::{BitswapStoreRead, BitswapStoreReadWrite};
use crate::message::{ChainMessage, Message as MessageTrait, SignedMessage};
Expand Down Expand Up @@ -82,9 +82,6 @@ pub struct ChainStore<DB> {
/// Ethereum mappings store
eth_mappings: Arc<dyn EthMappingsStore + Sync + Send>,

/// Indices store
indices: Arc<dyn IndicesStore + Sync + Send>,

/// Needed by the Ethereum mapping.
chain_config: Arc<ChainConfig>,
}
Expand Down Expand Up @@ -121,7 +118,6 @@ where
db: Arc<DB>,
heaviest_tipset_key_provider: Arc<dyn HeaviestTipsetKeyProvider + Sync + Send>,
eth_mappings: Arc<dyn EthMappingsStore + Sync + Send>,
indices: Arc<dyn IndicesStore + Sync + Send>,
chain_config: Arc<ChainConfig>,
genesis_block_header: CachingBlockHeader,
) -> anyhow::Result<Self> {
Expand All @@ -139,7 +135,6 @@ where
genesis_block_header,
validated_blocks,
eth_mappings,
indices,
chain_config,
};

Expand Down Expand Up @@ -204,15 +199,6 @@ where
.map(|(cid, _)| cid))
}

pub fn put_index<V: Serialize>(&self, key: &Cid, value: &V) -> Result<(), Error> {
self.indices.write_obj(key, value)?;
Ok(())
}

pub fn get_tipset_key(&self, key: &Cid) -> Result<Option<TipsetKey>, Error> {
Ok(self.indices.read_obj(key)?)
}

/// Expands tipset to tipset with all other headers in the same epoch using
/// the tipset tracker.
fn expand_tipset(&self, header: CachingBlockHeader) -> Result<Tipset, Error> {
Expand Down Expand Up @@ -754,15 +740,8 @@ mod tests {
message_receipts: Cid::new_v1(DAG_CBOR, MultihashCode::Identity.digest(&[])),
..Default::default()
});
let cs = ChainStore::new(
db.clone(),
db.clone(),
db.clone(),
db,
chain_config,
gen_block.clone(),
)
.unwrap();
let cs =
ChainStore::new(db.clone(), db.clone(), db, chain_config, gen_block.clone()).unwrap();

assert_eq!(cs.genesis_block_header(), &gen_block);
}
Expand All @@ -776,15 +755,7 @@ mod tests {
..Default::default()
});

let cs = ChainStore::new(
db.clone(),
db.clone(),
db.clone(),
db,
chain_config,
gen_block,
)
.unwrap();
let cs = ChainStore::new(db.clone(), db.clone(), db, chain_config, gen_block).unwrap();

let cid = Cid::new_v1(DAG_CBOR, MultihashCode::Blake2b256.digest(&[1, 2, 3]));
assert!(!cs.is_block_validated(&cid));
Expand Down
1 change: 0 additions & 1 deletion src/chain_sync/chain_follower.rs
Original file line number Diff line number Diff line change
Expand Up @@ -923,7 +923,6 @@ mod tests {
db.clone(),
db.clone(),
db.clone(),
db.clone(),
Default::default(),
genesis_header.clone().into(),
)
Expand Down
1 change: 0 additions & 1 deletion src/daemon/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,6 @@ async fn create_state_manager(
Arc::clone(db),
Arc::new(db.clone()),
eth_mappings,
db.writer().clone(),
chain_config.clone(),
genesis_header.clone(),
)?);
Expand Down
7 changes: 1 addition & 6 deletions src/daemon/db_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,14 +339,9 @@ where
let epoch = ts.epoch();
let tsk = ts.key().clone();

let state_output = state_manager
state_manager
.compute_tipset_state(ts.clone(), NO_CALLBACK, VMTrace::NotTraced)
.await?;
for events_root in state_output.events_roots.iter().flatten() {
tracing::trace!("Indexing events root @{epoch}: {events_root}");

state_manager.chain_store().put_index(events_root, &tsk)?;
}

delegated_messages.append(
&mut state_manager
Expand Down
18 changes: 2 additions & 16 deletions src/db/car/many.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
use super::{AnyCar, ZstdFrameCache};
use crate::blocks::TipsetKey;
use crate::db::{
BlockstoreWriteOpsSubscribable, EthMappingsStore, IndicesStore, MemoryDB, PersistentStore,
SettingsStore, SettingsStoreExt,
BlockstoreWriteOpsSubscribable, EthMappingsStore, MemoryDB, PersistentStore, SettingsStore,
SettingsStoreExt,
};
use crate::libp2p_bitswap::BitswapStoreReadWrite;
use crate::rpc::eth::types::EthHash;
Expand Down Expand Up @@ -251,20 +251,6 @@ impl<WriterT: EthMappingsStore> EthMappingsStore for ManyCar<WriterT> {
}
}

impl<WriterT: IndicesStore> IndicesStore for ManyCar<WriterT> {
fn read_bin(&self, key: &Cid) -> anyhow::Result<Option<Vec<u8>>> {
IndicesStore::read_bin(self.writer(), key)
}

fn write_bin(&self, key: &Cid, value: &[u8]) -> anyhow::Result<()> {
IndicesStore::write_bin(self.writer(), key, value)
}

fn exists(&self, key: &Cid) -> anyhow::Result<bool> {
IndicesStore::exists(self.writer(), key)
}
}

impl<T: Blockstore + SettingsStore> super::super::HeaviestTipsetKeyProvider for ManyCar<T> {
fn heaviest_tipset_key(&self) -> anyhow::Result<TipsetKey> {
match SettingsStoreExt::read_obj::<TipsetKey>(self, crate::db::setting_keys::HEAD_KEY)? {
Expand Down
20 changes: 1 addition & 19 deletions src/db/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

use super::{EthMappingsStore, SettingsStore, SettingsStoreExt};
use crate::blocks::TipsetKey;
use crate::db::{IndicesStore, PersistentStore};
use crate::db::PersistentStore;
use crate::libp2p_bitswap::{BitswapStoreRead, BitswapStoreReadWrite};
use crate::rpc::eth::types::EthHash;
use crate::utils::db::car_stream::CarBlock;
Expand All @@ -21,7 +21,6 @@ pub struct MemoryDB {
blockchain_persistent_db: RwLock<HashMap<Cid, Vec<u8>>>,
settings_db: RwLock<HashMap<String, Vec<u8>>>,
pub eth_mappings_db: RwLock<HashMap<EthHash, Vec<u8>>>,
pub indices_db: RwLock<HashMap<Cid, Vec<u8>>>,
}

impl MemoryDB {
Expand Down Expand Up @@ -110,23 +109,6 @@ impl EthMappingsStore for MemoryDB {
}
}

impl IndicesStore for MemoryDB {
fn read_bin(&self, key: &Cid) -> anyhow::Result<Option<Vec<u8>>> {
Ok(self.indices_db.read().get(key).cloned())
}

fn write_bin(&self, key: &Cid, value: &[u8]) -> anyhow::Result<()> {
self.indices_db
.write()
.insert(key.to_owned(), value.to_vec());
Ok(())
}

fn exists(&self, key: &Cid) -> anyhow::Result<bool> {
Ok(self.indices_db.read().contains_key(key))
}
}

impl Blockstore for MemoryDB {
fn get(&self, k: &Cid) -> anyhow::Result<Option<Vec<u8>>> {
Ok(self.blockchain_db.read().get(k).cloned().or(self
Expand Down
2 changes: 2 additions & 0 deletions src/db/migration/migration_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use std::{
use crate::Config;
use crate::db::migration::v0_22_1::Migration0_22_0_0_22_1;
use crate::db::migration::v0_26_0::Migration0_25_3_0_26_0;
use crate::db::migration::v0_31_0::Migration0_30_5_0_31_0;
use anyhow::Context as _;
use anyhow::bail;
use itertools::Itertools;
Expand Down Expand Up @@ -155,6 +156,7 @@ pub(super) static MIGRATIONS: LazyLock<MigrationsMap> = LazyLock::new(|| {
create_migrations!(
"0.22.0" -> "0.22.1" @ Migration0_22_0_0_22_1,
"0.25.3" -> "0.26.0" @ Migration0_25_3_0_26_0,
"0.30.5" -> "0.31.0" @ Migration0_30_5_0_31_0,
);

/// Creates a migration chain from `start` to `goal`. The chain is chosen to be the shortest
Expand Down
1 change: 1 addition & 0 deletions src/db/migration/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ mod db_migration;
mod migration_map;
mod v0_22_1;
mod v0_26_0;
mod v0_31_0;
mod void_migration;

pub use db_migration::DbMigration;
Loading
Loading