Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@

### Added

- [#6913](https://github.com/ChainSafe/forest/issues/6913): Added support for NV28 for devnets. Use `FOREST_FIREHORSE_HEIGHT` environment variable to set the upgrade height. Note that `FIP-0115` is not yet automatically activated with this change.
- [#6913](https://github.com/ChainSafe/forest/issues/6913): Added support for NV28 for devnets. Use `FOREST_FIREHORSE_HEIGHT` environment variable to set the upgrade height.

### Changed

### Removed

- [#6948](https://github.com/ChainSafe/forest/pull/6948): Removed the `FOREST_FEES_FIP0115HEIGHT` environment variable. The `FIP-0115` will be automatically activated at `FireHorse` network upgrade.

### Fixed

## Forest v0.33.0 "Patroclus"
Expand Down
2 changes: 1 addition & 1 deletion scripts/devnet/.env
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
LOTUS_IMAGE=ghcr.io/chainsafe/lotus-devnet:2026-04-20-4f7bde5
LOTUS_IMAGE=ghcr.io/chainsafe/lotus-devnet:2026-04-21-adb50d9
FOREST_DATA_DIR=/forest_data
LOTUS_DATA_DIR=/lotus_data
FIL_PROOFS_PARAMETER_CACHE=/var/tmp/filecoin-proof-parameters
Expand Down
2 changes: 1 addition & 1 deletion scripts/devnet/lotus.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --no-modify-path --profile mini

ENV PATH="/root/.cargo/bin:${PATH}"

RUN git clone https://github.com/filecoin-project/lotus.git . && git reset --hard d036ad9521d6621b5393d3d1b707a9994e94feed
RUN git clone https://github.com/filecoin-project/lotus.git . && git reset --hard 7db670848518732139425d36f8baaad7518e569a

# https://github.com/Filecoin-project/filecoin-ffi?tab=readme-ov-file#building-from-source
RUN CGO_CFLAGS_ALLOW="-D__BLST_PORTABLE__" \
Expand Down
23 changes: 6 additions & 17 deletions src/chain/store/base_fee.rs
Original file line number Diff line number Diff line change
@@ -1,25 +1,15 @@
// Copyright 2019-2026 ChainSafe Systems
// SPDX-License-Identifier: Apache-2.0, MIT

use std::sync::LazyLock;

use crate::blocks::Tipset;
use crate::message::MessageReadWrite;
use crate::shim::clock::ChainEpoch;
use crate::shim::econ::{BLOCK_GAS_LIMIT, TokenAmount};
use crate::utils::misc::env::env_or_default;
use ahash::{HashSet, HashSetExt};
use fvm_ipld_blockstore::Blockstore;

use super::weighted_quick_select::weighted_quick_select;

/// FIP-0115 base fee activation epoch, controlled via `FOREST_FEES_FIP0115HEIGHT`.
/// Defaults to `-1` (disabled). Setting to a non-negative value activates premium-based
/// base fee computation at that epoch.
/// WARNING: This is a consensus-breaking change and should only be used for testing.
static FIP0115_HEIGHT: LazyLock<ChainEpoch> =
LazyLock::new(|| env_or_default("FOREST_FEES_FIP0115HEIGHT", -1));

pub const BLOCK_GAS_TARGET_INDEX: u64 = BLOCK_GAS_LIMIT * 80 / 100 - 1;

/// Used in calculating the base fee change.
Expand Down Expand Up @@ -64,17 +54,15 @@ pub fn compute_base_fee<DB>(
db: &DB,
ts: &Tipset,
smoke_height: ChainEpoch,
firehorse_height: ChainEpoch,
) -> Result<TokenAmount, crate::chain::Error>
where
DB: Blockstore,
{
// FIP-0115: https://github.com/filecoin-project/FIPs/blob/master/FIPS/fip-0115.md
let fip0115_height = *FIP0115_HEIGHT;
if fip0115_height >= 0 && ts.epoch() >= fip0115_height {
return compute_next_base_fee_from_premiums(db, ts);
if ts.epoch() < firehorse_height {
return compute_next_base_fee_from_utlilization(db, ts, smoke_height);
}

compute_next_base_fee_from_utlilization(db, ts, smoke_height)
compute_next_base_fee_from_premiums(db, ts)
}

fn compute_next_base_fee_from_premiums<DB>(
Expand Down Expand Up @@ -229,7 +217,8 @@ mod tests {
});
let ts = Tipset::from(h0);
let smoke_height = ChainConfig::default().epoch(Height::Smoke);
assert!(compute_base_fee(&blockstore, &ts, smoke_height).is_err());
let firehorse_height = ChainConfig::default().epoch(Height::FireHorse);
assert!(compute_base_fee(&blockstore, &ts, smoke_height, firehorse_height).is_err());
}

#[test]
Expand Down
14 changes: 10 additions & 4 deletions src/chain_sync/tipset_syncer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,14 +240,20 @@ async fn validate_block<DB: Blockstore + Sync + Send + 'static>(
// Base fee check
validations.spawn_blocking({
let smoke_height = state_manager.chain_config().epoch(Height::Smoke);
let firehorse_height = state_manager.chain_config().epoch(Height::FireHorse);
let base_tipset = base_tipset.shallow_clone();
let block_store = state_manager.blockstore_owned();
let block = block.shallow_clone();
move || {
let base_fee = crate::chain::compute_base_fee(&block_store, &base_tipset, smoke_height)
.map_err(|e| {
TipsetSyncerError::Validation(format!("Could not compute base fee: {e}"))
})?;
let base_fee = crate::chain::compute_base_fee(
&block_store,
&base_tipset,
smoke_height,
firehorse_height,
)
.map_err(|e| {
TipsetSyncerError::Validation(format!("Could not compute base fee: {e}"))
})?;
let parent_base_fee = &block.header.parent_base_fee;
if &base_fee != parent_base_fee {
return Err(TipsetSyncerError::Validation(format!(
Expand Down
3 changes: 2 additions & 1 deletion src/message_pool/msgpool/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ impl<DB: Blockstore> Provider for ChainStore<DB> {

fn chain_compute_base_fee(&self, ts: &Tipset) -> Result<TokenAmount, Error> {
let smoke_height = self.chain_config().epoch(Height::Smoke);
crate::chain::compute_base_fee(self.blockstore(), ts, smoke_height)
let firehorse_height = self.chain_config().epoch(Height::FireHorse);
crate::chain::compute_base_fee(self.blockstore(), ts, smoke_height, firehorse_height)
.map_err(|err| err.into())
}

Expand Down
9 changes: 6 additions & 3 deletions src/rpc/methods/miner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,15 +133,18 @@ impl RpcMethod<1> for MinerCreateBlock {
.get_miner_work_addr(*lookback_state, &block_template.miner)?;

let parent_weight = weight(store, &parent_tipset)?;
//let parent_weight = parent_tipset.weight().to_owned();
let heights = &ctx.chain_config().height_infos;
let parent_base_fee = compute_base_fee(
store,
&parent_tipset,
ctx.chain_config()
.height_infos
heights
.get(&Height::Smoke)
.context("Missing Smoke height")?
.epoch,
heights
.get(&Height::FireHorse)
.context("Missing FireHorse height")?
.epoch,
)?;
let ExecutedTipset {
state_root,
Expand Down
Loading