diff --git a/testing/integration/src/builtin.rs b/testing/integration/src/builtin.rs index db2264f89..6d6010601 100644 --- a/testing/integration/src/builtin.rs +++ b/testing/integration/src/builtin.rs @@ -2,11 +2,12 @@ // SPDX-License-Identifier: Apache-2.0, MIT use anyhow::{Context, Result}; use cid::Cid; -use fvm::machine::Manifest; +use fvm::machine::{Manifest, BURNT_FUNDS_ACTOR_ID}; use fvm::state_tree::{ActorState, StateTree}; use fvm::{init_actor, system_actor}; use fvm_ipld_blockstore::Blockstore; use fvm_ipld_encoding::CborStore; +use fvm_shared::address::Address; use fvm_shared::ActorID; use multihash::Code; @@ -90,3 +91,28 @@ pub fn set_eam_actor(state_tree: &mut StateTree, eam_code_cid: state_tree.set_actor(EAM_ACTOR_ID, eam_actor_state); Ok(()) } + +pub fn set_burnt_funds_account( + state_tree: &mut StateTree, + account_code_cid: Cid, +) -> Result<()> { + let state = fvm::account_actor::State { + address: Address::new_id(BURNT_FUNDS_ACTOR_ID), + }; + + let account_state_cid = state_tree + .store() + .put_cbor(&state, Code::Blake2b256) + .context(FailedToSetState("burnt funds account actor".to_owned()))?; + + let actor_state = ActorState { + code: account_code_cid, + state: account_state_cid, + sequence: 0, + balance: Default::default(), + delegated_address: None, + }; + + state_tree.set_actor(BURNT_FUNDS_ACTOR_ID, actor_state); + Ok(()) +} diff --git a/testing/integration/src/tester.rs b/testing/integration/src/tester.rs index 584e3e249..a613598b6 100644 --- a/testing/integration/src/tester.rs +++ b/testing/integration/src/tester.rs @@ -20,7 +20,9 @@ use lazy_static::lazy_static; use libsecp256k1::{PublicKey, SecretKey}; use multihash::Code; -use crate::builtin::{fetch_builtin_code_cid, set_eam_actor, set_init_actor, set_sys_actor}; +use crate::builtin::{ + fetch_builtin_code_cid, set_burnt_funds_account, set_eam_actor, set_init_actor, set_sys_actor, +}; use crate::dummy::DummyExterns; use crate::error::Error::{FailedToFlushTree, NoManifestInformation}; @@ -96,10 +98,11 @@ where let init_state = init_actor::State::new_test(&blockstore); let mut state_tree = StateTree::new(blockstore, stv).map_err(anyhow::Error::from)?; - // Deploy init, sys, and eam actors + // Deploy init, sys, burn, and eam actors let sys_state = system_actor::State { builtin_actors }; set_sys_actor(&mut state_tree, sys_state, sys_code_cid)?; set_init_actor(&mut state_tree, init_code_cid, init_state)?; + set_burnt_funds_account(&mut state_tree, accounts_code_cid)?; set_eam_actor(&mut state_tree, eam_code_cid)?; Ok(Tester {