Skip to content
Open
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
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ fvm_ipld_encoding = { git = "https://github.com/consensus-shipyard/ref-fvm.git"
fvm_ipld_hamt = { git = "https://github.com/consensus-shipyard/ref-fvm.git" }
fvm_ipld_amt = { git = "https://github.com/consensus-shipyard/ref-fvm.git" }

[profile.wasm]
[profile.wasm-actor]
inherits = "release"
panic = "abort"
overflow-checks = false
Expand Down
1 change: 1 addition & 0 deletions fendermint/actors-custom-car/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ ignore = "0.4"
tracing = "0.1"
build-rs-utils = { path = "../../build-rs-utils" }
which = "7"
indexmap = "2"
25 changes: 17 additions & 8 deletions fendermint/actors-custom-car/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ use cargo_metadata::{DependencyKind, MetadataCommand};
use color_eyre::eyre::{bail, eyre, OptionExt, Result};
use fil_actor_bundler::Bundler;
use fs_err as fs;
use std::collections::HashSet;
use std::io::{BufRead, BufReader};
use std::ops::Deref;
use std::path::{Path, PathBuf};
Expand Down Expand Up @@ -220,10 +219,15 @@ fn build_all_wasm_blobs(
.iter()
.map(|actor| format!("-p={}", actor.package_name));

echo!("actors-custom-car", purple, "Target: {channel} {target}");
echo!(
"actors-custom-car",
purple,
"Target: channel={channel} target={target}"
);

let rustup = which::which("rustup")?;

let profile = "wasm-actor";
// Cargo build command for all test_actors at once.
let mut cmd = Command::new(rustup);
cmd.arg("run")
Expand All @@ -234,7 +238,8 @@ fn build_all_wasm_blobs(
.args(package_args)
.arg("--target")
.arg(target)
.arg("--profile=wasm")
.arg("--profile")
.arg(profile)
.arg("--features=fil-actor")
.arg(format!("--manifest-path={}", manifest_path.display()))
.stdout(Stdio::piped())
Expand Down Expand Up @@ -293,9 +298,11 @@ fn print_cargo_rerun_if_dependency_instructions(
let cargo_lock = find_cargo_lock(out_dir).ok_or_eyre("Couldn't find Cargo.lock")?;
rerun_if_changed(&cargo_lock);

let workspace = cargo_lock.parent().unwrap();
let workspace_dir = cargo_lock
.parent()
.expect("A file always should have a parent");

let metadata = create_metadata_command(workspace.join("Cargo.toml")).exec()?;
let metadata = create_metadata_command(workspace_dir.join("Cargo.toml")).exec()?;

let package = metadata
.packages
Expand All @@ -307,7 +314,7 @@ fn print_cargo_rerun_if_dependency_instructions(
let mut dependencies = Vec::from_iter(package.dependencies.iter());

// Collect all packages by follow the dependencies of all packages we find.
let mut packages = HashSet::new();
let mut packages = indexmap::IndexSet::new();
packages.insert(DeduplicatePackage::from(package));

while let Some(dependency) = dependencies.pop() {
Expand All @@ -325,7 +332,7 @@ fn print_cargo_rerun_if_dependency_instructions(
let maybe_package = metadata
.packages
.iter()
.filter(|p| !p.manifest_path.starts_with(workspace))
.filter(|p| !p.manifest_path.starts_with(workspace_dir))
.find(|p| {
// Check that the name matches and that the version matches or this is
// a git or path dep. A git or path dependency can only occur once, so we don't
Expand Down Expand Up @@ -382,8 +389,10 @@ fn main() -> Result<()> {
// `rustc` upgrades in `rust-toolchain.toml`
let out_dir = out_dir.join(&channel);

let profile = "wasm-actor";

// the joins represent the subdirectories under which `cargo` creates the actual WASM aritifacts
let wasm_blob_dir = out_dir.join(target).join("wasm");
let wasm_blob_dir = out_dir.join(target).join(profile);

echo!(
"actors-custom-car",
Expand Down
34 changes: 21 additions & 13 deletions ipc/provider/src/manager/evm/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ impl SubnetManager for EthSubnetManager {

let pending_tx = txn.send().await?;
let receipt = pending_tx.retries(TRANSACTION_RECEIPT_RETRIES).await?;
block_number_from_receipt(receipt)
block_number_from_positive_receipt(receipt)
}

async fn pre_fund(&self, subnet: SubnetID, from: Address, balance: TokenAmount) -> Result<()> {
Expand Down Expand Up @@ -575,7 +575,7 @@ impl SubnetManager for EthSubnetManager {

let pending_tx = txn.send().await?;
let receipt = pending_tx.retries(TRANSACTION_RECEIPT_RETRIES).await?;
block_number_from_receipt(receipt)
block_number_from_positive_receipt(receipt)
}

/// Approves the `from` address to use up to `amount` tokens from `token_address`.
Expand Down Expand Up @@ -609,7 +609,7 @@ impl SubnetManager for EthSubnetManager {

let pending_tx = txn.send().await?;
let receipt = pending_tx.retries(TRANSACTION_RECEIPT_RETRIES).await?;
block_number_from_receipt(receipt)
block_number_from_positive_receipt(receipt)
}

async fn fund_with_token(
Expand Down Expand Up @@ -641,7 +641,7 @@ impl SubnetManager for EthSubnetManager {

let pending_tx = txn.send().await?;
let receipt = pending_tx.retries(TRANSACTION_RECEIPT_RETRIES).await?;
block_number_from_receipt(receipt)
block_number_from_positive_receipt(receipt)
}

async fn release(
Expand Down Expand Up @@ -671,7 +671,7 @@ impl SubnetManager for EthSubnetManager {

let pending_tx = txn.send().await?;
let receipt = pending_tx.retries(TRANSACTION_RECEIPT_RETRIES).await?;
block_number_from_receipt(receipt)
block_number_from_positive_receipt(receipt)
}

/// Send value between two addresses in a subnet
Expand Down Expand Up @@ -926,7 +926,7 @@ impl SubnetManager for EthSubnetManager {
let txn = extend_call_with_pending_block(call).await?;
let pending_tx = txn.send().await?;
let receipt = pending_tx.retries(TRANSACTION_RECEIPT_RETRIES).await?;
block_number_from_receipt(receipt)
block_number_from_positive_receipt(receipt)
}
}

Expand Down Expand Up @@ -1210,7 +1210,7 @@ impl BottomUpCheckpointRelayer for EthSubnetManager {

let receipt = pending_tx.retries(TRANSACTION_RECEIPT_RETRIES).await?;

block_number_from_receipt(receipt)
block_number_from_positive_receipt(receipt)
}

async fn last_bottom_up_checkpoint_height(
Expand Down Expand Up @@ -1510,15 +1510,23 @@ where
}

/// Get the block number from the transaction receipt
fn block_number_from_receipt(
fn block_number_from_positive_receipt(
receipt: Option<ethers::types::TransactionReceipt>,
) -> Result<ChainEpoch> {
match receipt {
Some(r) => {
let block_number = r
.block_number
.ok_or_else(|| anyhow!("cannot get block number"))?;
Ok(block_number.as_u64() as ChainEpoch)
Some(r) =>
// success only
{
if r.status.as_ref().map(|x| x.as_u64()) != Some(1) {
let block_number = r
.block_number
.ok_or_else(|| anyhow!("cannot get block number"))?;
Ok(block_number.as_u64() as ChainEpoch)
} else {
Err(anyhow!(
"txn sent to network, but receipt was a revert receipt"
))
}
}
None => Err(anyhow!(
"txn sent to network, but receipt cannot be obtained, please check scanner"
Expand Down
Loading