Skip to content

Commit

Permalink
Merge branch 'main' into shashank/Rpc-EthMaxPriorityFeePerGas
Browse files Browse the repository at this point in the history
  • Loading branch information
sudo-shashank committed Jul 16, 2024
2 parents 8375d50 + ffa9312 commit abaeeb8
Show file tree
Hide file tree
Showing 40 changed files with 536 additions and 214 deletions.
1 change: 1 addition & 0 deletions .github/workflows/forest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ jobs:
- build-ubuntu
name: Calibnet eth mapping check
runs-on: ubuntu-latest
if: false # Disabled due to spurious failures.
steps:
- run: lscpu
- uses: actions/cache@v4
Expand Down
19 changes: 16 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,22 @@

### Added

- [#4503](https://github.com/ChainSafe/forest/pull/4503) Add support for the
`Filecoin.StateMinerAllocated` RPC method.

- [#4512](https://github.com/ChainSafe/forest/pull/4512) Add support for the
`Filecoin.StateGetAllocationIdForPendingDeal` RPC method.

- [#4514](https://github.com/ChainSafe/forest/pull/4514) Add support for the
`Filecoin.WalletSignMessage` RPC method.

- [#4517](https://github.com/ChainSafe/forest/pull/4517) Add support for the
`Filecoin.StateGetAllocationForPendingDeal` RPC method.

- [#4526](https://github.com/ChainSafe/forest/pull/4526) Added
`forest-cli state compute` method, and a corresponding RPC method
`Forest.StateCompute`.

### Changed

### Removed
Expand All @@ -50,9 +66,6 @@ most notably, garbage collection fix.
- [#4352](https://github.com/ChainSafe/forest/pull/4352) Add support for the
`Filecoin.StateGetClaim` RPC method.

- [#4503](https://github.com/ChainSafe/forest/pull/4503) Add support for the
`Filecoin.StateMinerAllocated` RPC method.

- [#4356](https://github.com/ChainSafe/forest/pull/4356) Add support for the
`Filecoin.NetProtectAdd` RPC method.

Expand Down
1 change: 0 additions & 1 deletion documentation/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
- [State migration spike NV17-NV18](./developer_documentation/state_migration_spike.md)
- [Test plan](./developer_documentation/test_plan.md)
- [Devnet Notes](./developer_documentation/devnet_notes.md)
- [Filecoin Archive](./developer_documentation/filecoin_archive.md)
- [Archie and Fuzzy](./developer_documentation/archie_and_fuzzy.md)
- [RPC API Compatibility](./developer_documentation/rpc_api_compatibility.md)
- [Notes and sketches](./developer_documentation/notes_and_sketches.md)
Expand Down

This file was deleted.

109 changes: 0 additions & 109 deletions documentation/src/developer_documentation/filecoin_archive.md

This file was deleted.

2 changes: 1 addition & 1 deletion scripts/tests/api_compare/.env
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Note: this should be a `fat` image so that it contains the pre-downloaded filecoin proof parameters
FOREST_IMAGE=ghcr.io/chainsafe/forest:edge-fat
LOTUS_IMAGE=filecoin/lotus-all-in-one:v1.28.0-rc4-calibnet
LOTUS_IMAGE=filecoin/lotus-all-in-one:v1.28.0-rc5-calibnet
FIL_PROOFS_PARAMETER_CACHE=/var/tmp/filecoin-proof-parameters
LOTUS_RPC_PORT=1234
FOREST_RPC_PORT=2345
Expand Down
8 changes: 8 additions & 0 deletions scripts/tests/calibnet_other_check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ forest_init
echo "Verifying the non calibnet snapshot (./test-snapshots/chain4.car) is being served properly."
$FOREST_CLI_PATH chain read-obj -c bafy2bzacedjrqan2fwfvhfopi64yickki7miiksecglpeiavf7xueytnzevlu

echo "Test subcommand: state compute"
cid=$($FOREST_CLI_PATH state compute --epoch 0)
# Expected state root CID, same reported as in Lotus. This should break only if the network is reset.
if [ "$cid" != "bafy2bzacecgqgzh3gxpariy3mzqb37y2vvxoaw5nwbrlzkhso6owus3zqckwe" ]; then
echo "Unexpected state root CID: $cid"
exit 1
fi

echo "Test dev commands (which could brick the node/cause subsequent snapshots to fail)"

echo "Test subcommand: chain set-head"
Expand Down
2 changes: 1 addition & 1 deletion scripts/tests/snapshot_parity/.env
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
LOTUS_IMAGE=filecoin/lotus-all-in-one:v1.28.0-rc4-calibnet
LOTUS_IMAGE=filecoin/lotus-all-in-one:v1.28.0-rc5-calibnet
FIL_PROOFS_PARAMETER_CACHE=/var/tmp/filecoin-proof-parameters
LOTUS_RPC_PORT=1234
FOREST_RPC_PORT=2345
Expand Down
4 changes: 2 additions & 2 deletions src/blocks/tests/serialization_vectors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ fn signing_test() {
} in cases
{
let priv_key = PrivateKey::from_bytes(&private_key).unwrap();
let msg_sign_bz = unsigned.cid().unwrap().to_bytes();
let msg_sign_bz = unsigned.cid().to_bytes();
let bls_sig = priv_key.sign(&msg_sign_bz);
let sig = Signature::new_bls(bls_sig.as_bytes());
assert_eq!(sig, signature);

let smsg = SignedMessage::new_from_parts(unsigned, sig).unwrap();
let actual_cid = smsg.cid().unwrap();
let actual_cid = smsg.cid();

assert_eq!(actual_cid, expected_cid);
}
Expand Down
4 changes: 2 additions & 2 deletions src/chain/store/base_fee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,14 @@ where
for b in ts.block_headers() {
let (msg1, msg2) = crate::chain::block_messages(db, b)?;
for m in msg1 {
let m_cid = m.cid()?;
let m_cid = m.cid();
if !seen.contains(&m_cid) {
total_limit += m.gas_limit();
seen.insert(m_cid);
}
}
for m in msg2 {
let m_cid = m.cid()?;
let m_cid = m.cid();
if !seen.contains(&m_cid) {
total_limit += m.gas_limit();
seen.insert(m_cid);
Expand Down
2 changes: 1 addition & 1 deletion src/chain/store/chain_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ where
{
if let Ok(hash) = tx.eth_hash() {
// newest messages are the ones with lowest index
Some((hash, smsg.cid().unwrap(), *timestamp, i))
Some((hash, smsg.cid(), *timestamp, i))
} else {
None
}
Expand Down
12 changes: 2 additions & 10 deletions src/chain_sync/tipset_syncer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1457,15 +1457,7 @@ async fn check_block_messages<DB: Blockstore + Send + Sync + 'static>(
for m in block.bls_msgs() {
let pk = StateManager::get_bls_public_key(&db, &m.from, *base_tipset.parent_state())?;
pub_keys.push(pk);
cids.push(
m.cid()
.map_err(|e| {
TipsetRangeSyncerError::Validation(format!(
"Failed to get bls message cid: {e}"
))
})?
.to_bytes(),
);
cids.push(m.cid().to_bytes());
}

if !verify_bls_aggregate(
Expand Down Expand Up @@ -1573,7 +1565,7 @@ async fn check_block_messages<DB: Blockstore + Send + Sync + 'static>(
.map_err(|e| TipsetRangeSyncerError::ResolvingAddressFromMessage(e.to_string()))?;
// SecP256K1 Signature validation
msg.signature
.verify(&msg.message().cid().unwrap().to_bytes(), &key_addr)
.verify(&msg.message().cid().to_bytes(), &key_addr)
.map_err(TipsetRangeSyncerError::MessageSignatureInvalid)?;
}

Expand Down
2 changes: 1 addition & 1 deletion src/cli/subcommands/chain_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ impl ChainCommands {
match fvm_ipld_encoding::from_slice::<ChainMessage>(&bytes)? {
ChainMessage::Unsigned(m) => print_pretty_lotus_json(m),
ChainMessage::Signed(m) => {
let cid = m.cid()?;
let cid = m.cid();
println!(
"{}",
serde_json::to_string_pretty(&m.into_lotus_json().with_cid(cid))?
Expand Down
2 changes: 1 addition & 1 deletion src/cli/subcommands/mpool_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ impl MpoolCommands {

for msg in filtered_messages {
if cids {
println!("{}", msg.cid().unwrap());
println!("{}", msg.cid());
} else {
println!("{}", msg.into_lotus_json_string_pretty()?);
}
Expand Down
2 changes: 1 addition & 1 deletion src/cli/subcommands/send_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ impl SendCommand {

let signed_msg = MpoolPushMessage::call(&client, (message, None)).await?;

println!("{}", signed_msg.cid().unwrap());
println!("{}", signed_msg.cid());

Ok(())
}
Expand Down
12 changes: 12 additions & 0 deletions src/cli/subcommands/state_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
use std::path::PathBuf;
use std::time::Duration;

use crate::rpc::state::StateCompute;
use crate::rpc::{self, prelude::*};
use crate::shim::clock::ChainEpoch;
use crate::shim::econ::TokenAmount;
Expand All @@ -30,6 +31,11 @@ pub enum StateCommands {
#[arg(short, long)]
save_to_file: Option<PathBuf>,
},
Compute {
/// Which epoch to compute the state transition for
#[arg(long)]
epoch: ChainEpoch,
},
}

impl StateCommands {
Expand All @@ -43,6 +49,12 @@ impl StateCommands {
.await?;
println!("{ret}");
}
StateCommands::Compute { epoch } => {
let ret = client
.call(StateCompute::request((epoch,))?.with_timeout(Duration::MAX))
.await?;
println!("{ret}");
}
}
Ok(())
}
Expand Down
4 changes: 2 additions & 2 deletions src/db/ttl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ mod test {

let timestamp = unix_timestamp.timestamp() as u64;
blockstore
.write_obj(&key0, &(secp0.cid().unwrap(), timestamp))
.write_obj(&key0, &(secp0.cid(), timestamp))
.unwrap();

assert!(blockstore.exists(&key0).unwrap());
Expand All @@ -140,7 +140,7 @@ mod test {
.write_obj(
&key1,
&(
secp1.cid().unwrap(),
secp1.cid(),
unix_timestamp.timestamp() as u64 + 2 * TTL_DURATION.as_secs(),
),
)
Expand Down
6 changes: 3 additions & 3 deletions src/interpreter/vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ where

if let Some(mut callback) = callback {
callback(MessageCallbackCtx {
cid: cron_msg.cid()?,
cid: cron_msg.cid(),
message: &ChainMessage::Unsigned(cron_msg),
apply_ret: &ret,
at: CalledAt::Cron,
Expand All @@ -360,7 +360,7 @@ where
let mut gas_reward = TokenAmount::zero();

let mut process_msg = |message: &ChainMessage| -> Result<(), anyhow::Error> {
let cid = message.cid()?;
let cid = message.cid();
// Ensure no duplicate processing of a message
if processed.contains(&cid) {
return Ok(());
Expand Down Expand Up @@ -414,7 +414,7 @@ where

if let Some(callback) = &mut callback {
callback(MessageCallbackCtx {
cid: rew_msg.cid()?,
cid: rew_msg.cid(),
message: &ChainMessage::Unsigned(rew_msg),
apply_ret: &ret,
at: CalledAt::Reward,
Expand Down
2 changes: 1 addition & 1 deletion src/lotus_json/signed_message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ impl HasLotusJson for SignedMessage {
}

fn into_lotus_json(self) -> Self::LotusJson {
let cid = self.cid().ok();
let cid = Some(self.cid());
let Self { message, signature } = self;
Self::LotusJson {
message,
Expand Down
4 changes: 2 additions & 2 deletions src/message/chain_message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

use crate::shim::message::MethodNum;
use crate::shim::{address::Address, econ::TokenAmount, message::Message};
use fvm_ipld_encoding::{Error, RawBytes};
use fvm_ipld_encoding::RawBytes;
use serde::{Deserialize, Serialize};

use super::Message as MessageTrait;
Expand All @@ -26,7 +26,7 @@ impl ChainMessage {
}
}

pub fn cid(&self) -> Result<cid::Cid, Error> {
pub fn cid(&self) -> cid::Cid {
match self {
ChainMessage::Unsigned(msg) => msg.cid(),
ChainMessage::Signed(msg) => msg.cid(),
Expand Down
Loading

0 comments on commit abaeeb8

Please sign in to comment.