Skip to content

Commit

Permalink
Merge branch 'main' into akaladarshi/add-delegated-address
Browse files Browse the repository at this point in the history
  • Loading branch information
akaladarshi authored Feb 4, 2025
2 parents d09b3ca + edc2312 commit 3c2b69c
Show file tree
Hide file tree
Showing 8 changed files with 215 additions and 97 deletions.
237 changes: 148 additions & 89 deletions Cargo.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ daemonize-me = "2"
data-encoding = "2"
data-encoding-macro = "0.1"
derive_builder = "0.20"
derive_more = { version = "1", features = ["from", "into"] }
derive_more = { version = "2", features = ["from", "into"] }
dialoguer = "0.11"
digest = "0.10"
directories = "6"
Expand Down Expand Up @@ -88,7 +88,7 @@ fvm_ipld_encoding = "0.5"
fvm_shared2 = { package = "fvm_shared", version = "~2.10" }
fvm_shared3 = { package = "fvm_shared", version = "~3.12", features = ["arb", "proofs"] }
fvm_shared4 = { package = "fvm_shared", version = "~4.5.3", features = ["arb", "proofs"] }
gethostname = "0.5"
gethostname = "1"
git-version = "0.3"
group = "0.13"
hex = { version = "0.4", features = ["serde"] }
Expand Down Expand Up @@ -132,7 +132,7 @@ libp2p = { workspace = true, features = [
'secp256k1',
] }
libsecp256k1 = "0.7"
lru = "0.12"
lru = "0.13"
memmap2 = "0.9"
memory-stats = "1"
multiaddr = "0.18"
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:2025-01-23-1dde2fe
LOTUS_IMAGE=ghcr.io/chainsafe/lotus-devnet:2025-02-03-3b303d7
FOREST_DATA_DIR=/forest_data
LOTUS_DATA_DIR=/lotus_data
FIL_PROOFS_PARAMETER_CACHE=/var/tmp/filecoin-proof-parameters
Expand Down
3 changes: 2 additions & 1 deletion scripts/devnet/lotus.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --no-modify-path --profile mini

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

RUN git clone --depth 1 --branch phi/bubble-up-dev https://github.com/filecoin-project/lotus.git .
# FIP-0097 support
RUN git clone --depth 1 https://github.com/filecoin-project/lotus.git . && git reset --hard a526c48

# https://github.com/Filecoin-project/filecoin-ffi?tab=readme-ov-file#building-from-source
RUN CGO_CFLAGS_ALLOW="-D__BLST_PORTABLE__" \
Expand Down
2 changes: 0 additions & 2 deletions scripts/tests/api_compare/filter-list
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,5 @@
# They should be considered bugged, and not used until the root cause is resolved.
# Internal Server Error on Lotus: https://github.com/ChainSafe/forest/actions/runs/8619017774/job/23623141130?pr=4170
!Filecoin.MpoolGetNonce
# CustomCheckFailed in Forest: https://github.com/ChainSafe/forest/actions/runs/9593268587/job/26453560366
!Filecoin.StateReplay
# CustomCheckFailed in Forest: https://github.com/ChainSafe/forest/issues/5213
!Filecoin.EthGetLogs
51 changes: 51 additions & 0 deletions src/state_migration/nv25/evm.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// Copyright 2019-2025 ChainSafe Systems
// SPDX-License-Identifier: Apache-2.0, MIT

//! This module contains the logic for adding transient storage (EIP-1153).
//! actor. See the [FIP-0097](https://github.com/filecoin-project/FIPs/blob/b258e36e5e085afd48525cb6442f2301553df528/FIPS/fip-0097.md) for more details.
use crate::state_migration::common::{ActorMigration, ActorMigrationInput, ActorMigrationOutput};
use crate::utils::db::CborStoreExt as _;
use anyhow::Context as _;
use cid::Cid;
use fil_actor_evm_state::v15::State as EvmStateOld;
use fil_actor_evm_state::v16::State as EvmStateNew;
use fil_actor_evm_state::v16::Tombstone as TombstoneNew;
use fvm_ipld_blockstore::Blockstore;

pub struct EvmMigrator {
pub new_code_cid: Cid,
}

impl<BS: Blockstore> ActorMigration<BS> for EvmMigrator {
fn migrate_state(
&self,
store: &BS,
input: ActorMigrationInput,
) -> anyhow::Result<Option<ActorMigrationOutput>> {
let in_state: EvmStateOld = store.get_cbor_required(&input.head)?;

let out_state = EvmStateNew {
bytecode: in_state.bytecode,
bytecode_hash: in_state
.bytecode_hash
.as_slice()
.try_into()
.context("bytecode hash conversion failed")?,
contract_state: in_state.contract_state,
nonce: in_state.nonce,
tombstone: in_state.tombstone.map(|tombstone| TombstoneNew {
origin: tombstone.origin,
nonce: tombstone.nonce,
}),
transient_data: None,
};

let new_head = store.put_cbor_default(&out_state)?;

Ok(Some(ActorMigrationOutput {
new_code_cid: self.new_code_cid,
new_head,
}))
}
}
10 changes: 9 additions & 1 deletion src/state_migration/nv25/migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use crate::networks::{ChainConfig, Height};
use crate::shim::{
address::Address,
clock::ChainEpoch,
machine::BuiltinActorManifest,
machine::{BuiltinActor, BuiltinActorManifest},
state_tree::{StateTree, StateTreeVersion},
};
use crate::utils::db::CborStoreExt as _;
Expand All @@ -18,6 +18,7 @@ use cid::Cid;

use fvm_ipld_blockstore::Blockstore;

use super::evm::EvmMigrator;
use super::{system, verifier::Verifier, SystemStateOld};
use crate::state_migration::common::{migrators::nil_migrator, StateMigration};

Expand Down Expand Up @@ -47,6 +48,13 @@ impl<BS: Blockstore> StateMigration<BS> {
system::system_migrator(new_manifest),
);

self.add_migrator(
current_manifest.get(BuiltinActor::EVM)?,
Arc::new(EvmMigrator {
new_code_cid: new_manifest.get(BuiltinActor::EVM)?,
}),
);

Ok(())
}
}
Expand Down
1 change: 1 addition & 0 deletions src/state_migration/nv25/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// SPDX-License-Identifier: Apache-2.0, MIT

//! This module contains the migration logic for the `NV25` upgrade.
mod evm;
mod migration;

/// Run migration for `NV25`. This should be the only exported method in this
Expand Down

0 comments on commit 3c2b69c

Please sign in to comment.