Skip to content
Draft
Show file tree
Hide file tree
Changes from 5 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
2 changes: 1 addition & 1 deletion src/chain/store/chain_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ where

for message in unsigned_box.chain(signed_box) {
let from_address = &message.from();
if applied.contains_key(from_address) {
if !applied.contains_key(from_address) {
let actor_state = state
.get_actor(from_address)?
.ok_or_else(|| Error::Other("Actor state not found".to_string()))?;
Expand Down
24 changes: 22 additions & 2 deletions src/cli_shared/cli/config.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
// Copyright 2019-2025 ChainSafe Systems
// SPDX-License-Identifier: Apache-2.0, MIT

use super::client::Client;
use crate::db::db_engine::DbConfig;
use crate::libp2p::Libp2pConfig;
use crate::shim::clock::ChainEpoch;
use crate::shim::econ::TokenAmount;
use crate::utils::misc::env::is_env_set_and_truthy;
use crate::{chain_sync::SyncConfig, networks::NetworkChain};
use serde::{Deserialize, Serialize};
use std::path::PathBuf;

use super::client::Client;
use std::str::FromStr;

const FOREST_CHAIN_INDEXER_ENABLED: &str = "FOREST_CHAIN_INDEXER_ENABLED";

Expand Down Expand Up @@ -92,6 +93,24 @@ impl Default for ChainIndexerConfig {
}
}

#[derive(Deserialize, Serialize, PartialEq, Eq, Debug, Clone)]
#[cfg_attr(test, derive(derive_quickcheck_arbitrary::Arbitrary))]
pub struct FeeConfig {
pub max_fee: TokenAmount,
}

impl Default for FeeConfig {
fn default() -> Self {
// This indicates the default max fee for a message,
// The code is taken from https://github.com/filecoin-project/lotus/blob/release/v1.34.1/node/config/def.go#L39
Self {
max_fee: TokenAmount::from_atto(
num_bigint::BigInt::from_str("70000000000000000").unwrap(),
), // 0.07 FIL
}
}
}

#[derive(Serialize, Deserialize, PartialEq, Default, Debug, Clone)]
#[cfg_attr(test, derive(derive_quickcheck_arbitrary::Arbitrary))]
#[serde(default)]
Expand All @@ -104,6 +123,7 @@ pub struct Config {
pub daemon: DaemonConfig,
pub events: EventsConfig,
pub fevm: FevmConfig,
pub fee: FeeConfig,
pub chain_indexer: ChainIndexerConfig,
}

Expand Down
1 change: 1 addition & 0 deletions src/daemon/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ fn get_chain_config_and_set_network(config: &Config) -> Arc<ChainConfig> {
Arc::new(ChainConfig {
enable_indexer: config.chain_indexer.enable_indexer,
enable_receipt_event_caching: config.client.enable_rpc,
default_max_fee: Some(config.fee.max_fee.clone()),
..chain_config
})
}
Expand Down
11 changes: 11 additions & 0 deletions src/lotus_json/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ pub struct MessageLotusJson {
default
)]
params: Option<RawBytes>,
#[schemars(with = "LotusJson<Option<::cid::Cid>>")]
#[serde(
with = "crate::lotus_json",
rename = "CID",
skip_serializing_if = "Option::is_none",
default
)]
cid: Option<::cid::Cid>,
}

impl HasLotusJson for Message {
Expand All @@ -65,6 +73,7 @@ impl HasLotusJson for Message {
}

fn into_lotus_json(self) -> Self::LotusJson {
let cid = Some(self.cid());
let Self {
version,
from,
Expand All @@ -88,6 +97,7 @@ impl HasLotusJson for Message {
gas_premium,
method: method_num,
params: Some(params),
cid,
}
}

Expand All @@ -103,6 +113,7 @@ impl HasLotusJson for Message {
gas_premium,
method,
params,
cid: _ignored, // CID is computed from the message content
} = lotus_json;
Self {
version,
Expand Down
5 changes: 5 additions & 0 deletions src/networks/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ pub struct ChainConfig {
pub f3_initial_power_table: Option<Cid>,
pub enable_indexer: bool,
pub enable_receipt_event_caching: bool,
pub default_max_fee: Option<TokenAmount>,
}

impl ChainConfig {
Expand Down Expand Up @@ -304,6 +305,7 @@ impl ChainConfig {
),
enable_indexer: false,
enable_receipt_event_caching: true,
default_max_fee: None,
}
}

Expand Down Expand Up @@ -340,6 +342,7 @@ impl ChainConfig {
),
enable_indexer: false,
enable_receipt_event_caching: true,
default_max_fee: None,
}
}

Expand All @@ -366,6 +369,7 @@ impl ChainConfig {
f3_initial_power_table: None,
enable_indexer: false,
enable_receipt_event_caching: true,
default_max_fee: None,
}
}

Expand Down Expand Up @@ -398,6 +402,7 @@ impl ChainConfig {
f3_initial_power_table: None,
enable_indexer: false,
enable_receipt_event_caching: true,
default_max_fee: None,
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/rpc/methods/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,7 @@ impl RpcMethod<0> for EthGasPrice {
let ts = ctx.chain_store().heaviest_tipset();
let block0 = ts.block_headers().first();
let base_fee = block0.parent_base_fee.atto();
let tip = crate::rpc::gas::estimate_gas_premium(&ctx, 0)
let tip = crate::rpc::gas::estimate_gas_premium(&ctx, 0, &ApiTipsetKey(None))
.await
.map(|gas_premium| gas_premium.atto().to_owned())
.unwrap_or_default();
Expand Down Expand Up @@ -2286,7 +2286,7 @@ impl RpcMethod<0> for EthMaxPriorityFeePerGas {
ctx: Ctx<impl Blockstore + Send + Sync + 'static>,
(): Self::Params,
) -> Result<Self::Ok, ServerError> {
match crate::rpc::gas::estimate_gas_premium(&ctx, 0).await {
match crate::rpc::gas::estimate_gas_premium(&ctx, 0, &ApiTipsetKey(None)).await {
Ok(gas_premium) => Ok(EthBigInt(gas_premium.atto().clone())),
Err(_) => Ok(EthBigInt(num_bigint::BigInt::zero())),
}
Expand Down
Loading
Loading