Skip to content

Commit

Permalink
fix: block validation error at epoch 2281645
Browse files Browse the repository at this point in the history
  • Loading branch information
hanabi1224 committed Jan 6, 2025
1 parent 90df4ec commit 57eb7c7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 25 deletions.
17 changes: 6 additions & 11 deletions .config/lychee.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,15 @@

verbose = "debug"
no_progress = true
exclude_path = [
"./node_modules",
"./docs/node_modules",
"./documentation",
"./target"
]
exclude_path = ["./node_modules", "./docs/node_modules", "./documentation", "./target"]
exclude = [
# Avoid Github rate limits
"github.com/ChainSafe/forest",
# Requires CAPTCHA verification
"faucet.calibnet.chainsafe-fil.io/funds.html"
# Avoid Github rate limits
"github.com/ChainSafe/forest",
# Requires CAPTCHA verification
"faucet.calibnet.chainsafe-fil.io/funds.html",
]
timeout = 30
max_retries = 6
retry_wait_time = 10

output = "lychee-report.md"
output = "lychee-report.md"
17 changes: 3 additions & 14 deletions src/interpreter/fvm4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use crate::chain::{
ChainStore,
};
use crate::interpreter::errors::Error;
use crate::interpreter::resolve_to_key_addr;
use crate::networks::{ChainConfig, Height, NetworkChain};
use crate::shim::actors::miner;
use crate::shim::actors::MinerActorStateLoad as _;
Expand All @@ -32,9 +33,6 @@ use fvm_shared4::{
clock::ChainEpoch,
consensus::{ConsensusFault, ConsensusFaultType},
};
use tracing::error;

use crate::interpreter::resolve_to_key_addr;

pub struct ForestExterns<DB> {
rand: Box<dyn Rand>,
Expand Down Expand Up @@ -83,9 +81,8 @@ impl<DB: Blockstore + Send + Sync + 'static> ForestExterns<DB> {
) -> anyhow::Result<(Address, i64)> {
if height < self.epoch - self.chain_config.policy.chain_finality {
bail!(
"cannot get worker key (current epoch: {}, height: {})",
"cannot get worker key (current epoch: {}, height: {height}, miner address: {miner_addr})",
self.epoch,
height
);
}

Expand Down Expand Up @@ -271,14 +268,6 @@ impl<DB: Blockstore + Send + Sync + 'static> Consensus for ForestExterns<DB> {
Some(fault_type) => {
// (4) expensive final checks

let bail = |err| {
// When a lookup error occurs we should just bail terminating all the
// computations.
error!("database lookup error: {err}");
self.bail.store(true, Ordering::Relaxed);
Err(err)
};

// check blocks are properly signed by their respective miner
// note we do not need to check extra's: it is a parent to block b
// which itself is signed, so it was willingly included by the miner
Expand All @@ -287,7 +276,7 @@ impl<DB: Blockstore + Send + Sync + 'static> Consensus for ForestExterns<DB> {
match res {
// invalid consensus fault: cannot verify block header signature
Err(Error::Signature(_)) => return Ok((None, total_gas)),
Err(Error::Lookup(err)) => return bail(err),
Err(Error::Lookup(_)) => return Ok((None, total_gas)),
Ok(gas_used) => total_gas += gas_used,
}
}
Expand Down

0 comments on commit 57eb7c7

Please sign in to comment.