diff --git a/docs/openrpc-specs/v0.json b/docs/openrpc-specs/v0.json index c6fdc7433f44..875dee640c79 100644 --- a/docs/openrpc-specs/v0.json +++ b/docs/openrpc-specs/v0.json @@ -432,7 +432,7 @@ "name": "Filecoin.ChainGetMessage.Result", "required": true, "schema": { - "$ref": "#/components/schemas/FlattenedApiMessage" + "$ref": "#/components/schemas/Message" } }, "paramStructure": "by-position" @@ -2280,7 +2280,7 @@ "name": "Filecoin.GasEstimateMessageGas.Result", "required": true, "schema": { - "$ref": "#/components/schemas/FlattenedApiMessage" + "$ref": "#/components/schemas/Message" } }, "paramStructure": "by-position" @@ -9556,6 +9556,20 @@ } ] }, + "IpldOps": { + "description": "See ", + "type": "array", + "items": { + "$ref": "#/components/schemas/TraceIpld" + } + }, + "Logs": { + "description": "FVM invocation logs (not EVM actor / `eth_getLogs` event logs).\nSee ", + "type": "array", + "items": { + "type": "string" + } + }, "Msg": { "$ref": "#/components/schemas/MessageTrace" }, @@ -9828,64 +9842,6 @@ "Signature" ] }, - "FlattenedApiMessage": { - "type": "object", - "properties": { - "CID": { - "$ref": "#/components/schemas/Cid" - }, - "From": { - "$ref": "#/components/schemas/Address" - }, - "GasFeeCap": { - "$ref": "#/components/schemas/TokenAmount", - "default": "0" - }, - "GasLimit": { - "type": "integer", - "format": "uint64", - "default": 0, - "minimum": 0 - }, - "GasPremium": { - "$ref": "#/components/schemas/TokenAmount", - "default": "0" - }, - "Method": { - "type": "integer", - "format": "uint64", - "default": 0, - "minimum": 0 - }, - "Nonce": { - "type": "integer", - "format": "uint64", - "default": 0, - "minimum": 0 - }, - "Params": { - "$ref": "#/components/schemas/Nullable_Base64String" - }, - "To": { - "$ref": "#/components/schemas/Address" - }, - "Value": { - "$ref": "#/components/schemas/TokenAmount", - "default": "0" - }, - "Version": { - "type": "integer", - "format": "uint64", - "default": 0, - "minimum": 0 - } - }, - "required": [ - "To", - "From", - "CID" - ] - }, "ForestChainExportDiffParams": { "type": "object", "properties": { @@ -10094,6 +10050,10 @@ "type": "integer", "format": "int64" }, + "UpgradeFireHorseHeight": { + "type": "integer", + "format": "int64" + }, "UpgradeGoldenWeekHeight": { "type": "integer", "format": "int64" @@ -10227,7 +10187,8 @@ "UpgradeTuktukHeight", "UpgradeTeepHeight", "UpgradeTockHeight", - "UpgradeGoldenWeekHeight" + "UpgradeGoldenWeekHeight", + "UpgradeFireHorseHeight" ] }, "GasTrace": { @@ -10381,6 +10342,9 @@ "Message": { "type": "object", "properties": { + "CID": { + "$ref": "#/components/schemas/Nullable_Cid" + }, "From": { "$ref": "#/components/schemas/Address" }, @@ -10411,7 +10375,8 @@ "minimum": 0 }, "Params": { - "$ref": "#/components/schemas/Nullable_Base64String" + "$ref": "#/components/schemas/Base64String", + "default": null }, "To": { "$ref": "#/components/schemas/Address" @@ -10868,6 +10833,12 @@ "ForkUpgradeParams": { "$ref": "#/components/schemas/ForkUpgradeParams" }, + "GenesisTimestamp": { + "description": "See ", + "type": "integer", + "format": "uint64", + "minimum": 0 + }, "NetworkName": { "type": "string" }, @@ -10882,7 +10853,8 @@ "ConsensusMinerMinPower", "PreCommitChallengeDelay", "ForkUpgradeParams", - "Eip155ChainID" + "Eip155ChainID", + "GenesisTimestamp" ] }, "NetworkVersion": { @@ -11139,16 +11111,6 @@ "minimum": 0 } }, - "Nullable_Base64String": { - "anyOf": [ - { - "$ref": "#/components/schemas/Base64String" - }, - { - "type": "null" - } - ] - }, "Nullable_Cid": { "anyOf": [ { @@ -11418,6 +11380,10 @@ "APIVersion": { "$ref": "#/components/schemas/ShiftingVersion" }, + "Agent": { + "description": "See ", + "type": "string" + }, "BlockDelay": { "type": "integer", "format": "uint32", @@ -11430,7 +11396,8 @@ "required": [ "Version", "APIVersion", - "BlockDelay" + "BlockDelay", + "Agent" ] }, "Receipt": { @@ -11917,6 +11884,36 @@ } ] }, + "TraceIpld": { + "description": "IPLD operation details attached to an [`ExecutionTrace`].", + "type": "object", + "properties": { + "Cid": { + "$ref": "#/components/schemas/Cid" + }, + "Op": { + "$ref": "#/components/schemas/TraceIpldOp" + }, + "Size": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "Op", + "Cid", + "Size" + ] + }, + "TraceIpldOp": { + "type": "string", + "enum": [ + "Get", + "Put", + "Unknown" + ] + }, "TraceResult": { "anyOf": [ { diff --git a/docs/openrpc-specs/v1.json b/docs/openrpc-specs/v1.json index b1a2ab6e89a5..d18d854c29bb 100644 --- a/docs/openrpc-specs/v1.json +++ b/docs/openrpc-specs/v1.json @@ -424,7 +424,7 @@ "name": "Filecoin.ChainGetMessage.Result", "required": true, "schema": { - "$ref": "#/components/schemas/FlattenedApiMessage" + "$ref": "#/components/schemas/Message" } }, "paramStructure": "by-position" @@ -2272,7 +2272,7 @@ "name": "Filecoin.GasEstimateMessageGas.Result", "required": true, "schema": { - "$ref": "#/components/schemas/FlattenedApiMessage" + "$ref": "#/components/schemas/Message" } }, "paramStructure": "by-position" @@ -9770,6 +9770,20 @@ } ] }, + "IpldOps": { + "description": "See ", + "type": "array", + "items": { + "$ref": "#/components/schemas/TraceIpld" + } + }, + "Logs": { + "description": "FVM invocation logs (not EVM actor / `eth_getLogs` event logs).\nSee ", + "type": "array", + "items": { + "type": "string" + } + }, "Msg": { "$ref": "#/components/schemas/MessageTrace" }, @@ -10042,64 +10056,6 @@ "Signature" ] }, - "FlattenedApiMessage": { - "type": "object", - "properties": { - "CID": { - "$ref": "#/components/schemas/Cid" - }, - "From": { - "$ref": "#/components/schemas/Address" - }, - "GasFeeCap": { - "$ref": "#/components/schemas/TokenAmount", - "default": "0" - }, - "GasLimit": { - "type": "integer", - "format": "uint64", - "default": 0, - "minimum": 0 - }, - "GasPremium": { - "$ref": "#/components/schemas/TokenAmount", - "default": "0" - }, - "Method": { - "type": "integer", - "format": "uint64", - "default": 0, - "minimum": 0 - }, - "Nonce": { - "type": "integer", - "format": "uint64", - "default": 0, - "minimum": 0 - }, - "Params": { - "$ref": "#/components/schemas/Nullable_Base64String" - }, - "To": { - "$ref": "#/components/schemas/Address" - }, - "Value": { - "$ref": "#/components/schemas/TokenAmount", - "default": "0" - }, - "Version": { - "type": "integer", - "format": "uint64", - "default": 0, - "minimum": 0 - } - }, - "required": [ - "To", - "From", - "CID" - ] - }, "ForestChainExportDiffParams": { "type": "object", "properties": { @@ -10308,6 +10264,10 @@ "type": "integer", "format": "int64" }, + "UpgradeFireHorseHeight": { + "type": "integer", + "format": "int64" + }, "UpgradeGoldenWeekHeight": { "type": "integer", "format": "int64" @@ -10441,7 +10401,8 @@ "UpgradeTuktukHeight", "UpgradeTeepHeight", "UpgradeTockHeight", - "UpgradeGoldenWeekHeight" + "UpgradeGoldenWeekHeight", + "UpgradeFireHorseHeight" ] }, "GasTrace": { @@ -10762,6 +10723,9 @@ "Message": { "type": "object", "properties": { + "CID": { + "$ref": "#/components/schemas/Nullable_Cid" + }, "From": { "$ref": "#/components/schemas/Address" }, @@ -10792,7 +10756,8 @@ "minimum": 0 }, "Params": { - "$ref": "#/components/schemas/Nullable_Base64String" + "$ref": "#/components/schemas/Base64String", + "default": null }, "To": { "$ref": "#/components/schemas/Address" @@ -11249,6 +11214,12 @@ "ForkUpgradeParams": { "$ref": "#/components/schemas/ForkUpgradeParams" }, + "GenesisTimestamp": { + "description": "See ", + "type": "integer", + "format": "uint64", + "minimum": 0 + }, "NetworkName": { "type": "string" }, @@ -11263,7 +11234,8 @@ "ConsensusMinerMinPower", "PreCommitChallengeDelay", "ForkUpgradeParams", - "Eip155ChainID" + "Eip155ChainID", + "GenesisTimestamp" ] }, "NetworkVersion": { @@ -11531,16 +11503,6 @@ "minimum": 0 } }, - "Nullable_Base64String": { - "anyOf": [ - { - "$ref": "#/components/schemas/Base64String" - }, - { - "type": "null" - } - ] - }, "Nullable_Cid": { "anyOf": [ { @@ -11830,6 +11792,10 @@ "APIVersion": { "$ref": "#/components/schemas/ShiftingVersion" }, + "Agent": { + "description": "See ", + "type": "string" + }, "BlockDelay": { "type": "integer", "format": "uint32", @@ -11842,7 +11808,8 @@ "required": [ "Version", "APIVersion", - "BlockDelay" + "BlockDelay", + "Agent" ] }, "Receipt": { @@ -12329,6 +12296,36 @@ } ] }, + "TraceIpld": { + "description": "IPLD operation details attached to an [`ExecutionTrace`].", + "type": "object", + "properties": { + "Cid": { + "$ref": "#/components/schemas/Cid" + }, + "Op": { + "$ref": "#/components/schemas/TraceIpldOp" + }, + "Size": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "Op", + "Cid", + "Size" + ] + }, + "TraceIpldOp": { + "type": "string", + "enum": [ + "Get", + "Put", + "Unknown" + ] + }, "TraceResult": { "anyOf": [ { diff --git a/scripts/tests/api_compare/docker-compose.yml b/scripts/tests/api_compare/docker-compose.yml index 0d4dc88029c1..38a8df93106c 100644 --- a/scripts/tests/api_compare/docker-compose.yml +++ b/scripts/tests/api_compare/docker-compose.yml @@ -266,6 +266,7 @@ services: - RUST_LOG=info,forest::tool::subcommands=debug - FOREST_RPC_DEFAULT_TIMEOUT=120 - FIL_PROOFS_PARAMETER_CACHE=${FIL_PROOFS_PARAMETER_CACHE} + - FOREST_STRICT_JSON=1 entrypoint: ["/bin/bash", "-c"] user: 0:0 command: @@ -310,6 +311,7 @@ services: - RUST_LOG=info,forest::tool::subcommands=debug - FOREST_RPC_DEFAULT_TIMEOUT=120 - FIL_PROOFS_PARAMETER_CACHE=${FIL_PROOFS_PARAMETER_CACHE} + - FOREST_STRICT_JSON=1 entrypoint: ["/bin/bash", "-c"] user: 0:0 command: @@ -379,6 +381,7 @@ services: - RUST_LOG=info,forest::tool::subcommands=debug - FOREST_RPC_DEFAULT_TIMEOUT=120 - FIL_PROOFS_PARAMETER_CACHE=${FIL_PROOFS_PARAMETER_CACHE} + - FOREST_STRICT_JSON=1 entrypoint: ["/bin/bash", "-c"] user: 0:0 command: diff --git a/src/lotus_json/message.rs b/src/lotus_json/message.rs index 306803b95821..37133b5dc9ff 100644 --- a/src/lotus_json/message.rs +++ b/src/lotus_json/message.rs @@ -5,6 +5,7 @@ use super::*; use crate::shim::{address::Address, econ::TokenAmount, message::Message}; use fvm_ipld_encoding::RawBytes; +use ::cid::Cid; #[derive(Debug, PartialEq, Clone, Serialize, Deserialize, JsonSchema)] #[serde(rename_all = "PascalCase")] @@ -33,13 +34,17 @@ pub struct MessageLotusJson { gas_premium: TokenAmount, #[serde(default)] method: u64, - #[schemars(with = "LotusJson>")] + #[schemars(with = "LotusJson")] + #[serde(with = "crate::lotus_json", default)] + params: RawBytes, + #[schemars(with = "LotusJson>")] #[serde( with = "crate::lotus_json", - skip_serializing_if = "Option::is_none", - default + rename = "CID", + default, + skip_serializing_if = "Option::is_none" )] - params: Option, + cid: Option, } impl HasLotusJson for Message { @@ -47,6 +52,8 @@ impl HasLotusJson for Message { #[cfg(test)] fn snapshots() -> Vec<(serde_json::Value, Self)> { + let msg = Message::default(); + let cid = msg.cid(); vec![( json!({ "From": "f00", @@ -59,12 +66,14 @@ impl HasLotusJson for Message { "To": "f00", "Value": "0", "Version": 0, + "CID": { "/": cid.to_string() }, }), - Message::default(), + msg, )] } fn into_lotus_json(self) -> Self::LotusJson { + let cid = self.cid(); let Self { version, from, @@ -87,7 +96,8 @@ impl HasLotusJson for Message { gas_fee_cap, gas_premium, method: method_num, - params: Some(params), + params, + cid: Some(cid), } } @@ -103,6 +113,7 @@ impl HasLotusJson for Message { gas_premium, method, params, + cid: _, } = lotus_json; Self { version, @@ -111,7 +122,7 @@ impl HasLotusJson for Message { sequence: nonce, value, method_num: method, - params: params.unwrap_or_default(), + params, gas_limit, gas_fee_cap, gas_premium, diff --git a/src/lotus_json/signed_message.rs b/src/lotus_json/signed_message.rs index 08d029c22693..2043f76c37f8 100644 --- a/src/lotus_json/signed_message.rs +++ b/src/lotus_json/signed_message.rs @@ -52,6 +52,9 @@ impl HasLotusJson for SignedMessage { "To": "f00", "Value": "0", "Version": 0, + "CID": { + "/": "bafy2bzaced3xdk2uf6azekyxgcttujvy3fzyeqmibtpjf2fxcpfdx2zcx4s3g" + }, }, "Signature": {"Type": 2, "Data": "aGVsbG8gd29ybGQh"}, "CID": { diff --git a/src/rpc/methods/chain.rs b/src/rpc/methods/chain.rs index 8ec3ecea3055..bead71263345 100644 --- a/src/rpc/methods/chain.rs +++ b/src/rpc/methods/chain.rs @@ -182,7 +182,7 @@ impl RpcMethod<1> for ChainGetMessage { const DESCRIPTION: Option<&'static str> = Some("Returns the message with the specified CID."); type Params = (Cid,); - type Ok = FlattenedApiMessage; + type Ok = Message; async fn handle( ctx: Ctx, @@ -198,8 +198,7 @@ impl RpcMethod<1> for ChainGetMessage { ChainMessage::Unsigned(m) => Arc::unwrap_or_clone(m), }; - let cid = message.cid(); - Ok(FlattenedApiMessage { message, cid }) + Ok(message) } } @@ -1521,18 +1520,6 @@ pub struct ApiMessage { lotus_json_with_self!(ApiMessage); -#[derive(Serialize, Deserialize, JsonSchema, Clone, Debug, Eq, PartialEq)] -pub struct FlattenedApiMessage { - #[serde(flatten, with = "crate::lotus_json")] - #[schemars(with = "LotusJson")] - pub message: Message, - #[serde(rename = "CID", with = "crate::lotus_json")] - #[schemars(with = "LotusJson")] - pub cid: Cid, -} - -lotus_json_with_self!(FlattenedApiMessage); - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)] pub struct ForestChainExportParams { pub version: FilecoinSnapshotVersion, diff --git a/src/rpc/methods/common.rs b/src/rpc/methods/common.rs index 75653a7fca99..8f343e479c72 100644 --- a/src/rpc/methods/common.rs +++ b/src/rpc/methods/common.rs @@ -55,6 +55,7 @@ impl RpcMethod<0> for Version { // For the API v0, we don't support it but it should be `1.5.0`. api_version: ShiftingVersion::new(2, 3, 0), block_delay: ctx.chain_config().block_delay_secs, + agent: "forest".into(), }) } } @@ -106,6 +107,8 @@ pub struct PublicVersion { #[serde(rename = "APIVersion")] pub api_version: ShiftingVersion, pub block_delay: u32, + /// See + pub agent: String, } lotus_json_with_self!(PublicVersion); diff --git a/src/rpc/methods/eth.rs b/src/rpc/methods/eth.rs index 2c5c6a712712..72dce561f793 100644 --- a/src/rpc/methods/eth.rs +++ b/src/rpc/methods/eth.rs @@ -4503,6 +4503,8 @@ mod test { invoked_actor: None, gas_charges: vec![], subcalls: vec![], + logs: vec![], + ipld_ops: vec![], } } diff --git a/src/rpc/methods/gas.rs b/src/rpc/methods/gas.rs index 167269dd92b7..6dba16353fc5 100644 --- a/src/rpc/methods/gas.rs +++ b/src/rpc/methods/gas.rs @@ -5,7 +5,6 @@ use super::state::InvocResult; use crate::blocks::Tipset; use crate::chain::{BASE_FEE_MAX_CHANGE_DENOM, BLOCK_GAS_TARGET}; use crate::message::{ChainMessage, MessageRead as _, MessageReadWrite as _, SignedMessage}; -use crate::rpc::chain::FlattenedApiMessage; use crate::rpc::{ApiPaths, Ctx, Permission, RpcMethod, error::ServerError, types::*}; use crate::shim::executor::ApplyRet; use crate::shim::{ @@ -305,7 +304,7 @@ impl RpcMethod<3> for GasEstimateMessageGas { Some("Returns the estimated gas for the given parameters."); type Params = (Message, Option, ApiTipsetKey); - type Ok = FlattenedApiMessage; + type Ok = Message; async fn handle( ctx: Ctx, @@ -313,8 +312,7 @@ impl RpcMethod<3> for GasEstimateMessageGas { _: &http::Extensions, ) -> Result { let message = estimate_message_gas(&ctx, msg, spec, tsk).await?; - let cid = message.cid(); - Ok(FlattenedApiMessage { message, cid }) + Ok(message) } } diff --git a/src/rpc/methods/state.rs b/src/rpc/methods/state.rs index 52c8db8f38fd..302901998b68 100644 --- a/src/rpc/methods/state.rs +++ b/src/rpc/methods/state.rs @@ -3172,6 +3172,7 @@ impl RpcMethod<0> for StateGetNetworkParams { fork_upgrade_params: ForkUpgradeParams::try_from(config) .context("Failed to get fork upgrade params")?, eip155_chain_id: config.eth_chain_id, + genesis_timestamp: ctx.chain_store().genesis_block_header().timestamp, }; Ok(params) @@ -3190,6 +3191,8 @@ pub struct NetworkParams { fork_upgrade_params: ForkUpgradeParams, #[serde(rename = "Eip155ChainID")] eip155_chain_id: EthChainId, + /// See + genesis_timestamp: u64, } lotus_json_with_self!(NetworkParams); @@ -3229,6 +3232,7 @@ pub struct ForkUpgradeParams { upgrade_teep_height: ChainEpoch, upgrade_tock_height: ChainEpoch, upgrade_golden_week_height: ChainEpoch, + upgrade_fire_horse_height: ChainEpoch, //upgrade_xxx_height: ChainEpoch, } @@ -3278,7 +3282,7 @@ impl TryFrom<&ChainConfig> for ForkUpgradeParams { upgrade_teep_height: get_height(Teep)?, upgrade_tock_height: get_height(Tock)?, upgrade_golden_week_height: get_height(GoldenWeek)?, - //upgrade_firehorse_height: get_height(FireHorse)?, + upgrade_fire_horse_height: get_height(FireHorse)?, }) } } diff --git a/src/rpc/methods/state/types.rs b/src/rpc/methods/state/types.rs index 4edd6a6e3575..ec47a5980cdb 100644 --- a/src/rpc/methods/state/types.rs +++ b/src/rpc/methods/state/types.rs @@ -11,14 +11,16 @@ use crate::shim::{ econ::TokenAmount, error::ExitCode, executor::Receipt, + fvm_latest::trace::IpldOperation, message::Message, state_tree::{ActorID, ActorState}, }; use cid::Cid; use fvm_ipld_encoding::RawBytes; use num::Zero as _; -use schemars::JsonSchema; +use schemars::{JsonSchema, Schema, SchemaGenerator}; use serde::{Deserialize, Serialize}; +use serde_with::{DeserializeFromStr, SerializeDisplay}; #[derive(Debug, Serialize, Deserialize, Clone, JsonSchema, PartialEq)] #[serde(rename_all = "PascalCase")] @@ -139,6 +141,60 @@ impl MessageGasCost { } } +/// IPLD operation kind for [`TraceIpld`]. +#[derive( + Debug, + Clone, + PartialEq, + Eq, + SerializeDisplay, + DeserializeFromStr, + strum::Display, + strum::EnumString, +)] +#[strum(serialize_all = "PascalCase")] +pub enum TraceIpldOp { + Get, + Put, + #[strum(to_string = "Unknown", default)] + Unknown(String), +} + +impl JsonSchema for TraceIpldOp { + fn schema_name() -> std::borrow::Cow<'static, str> { + "TraceIpldOp".into() + } + + fn json_schema(_: &mut SchemaGenerator) -> Schema { + schemars::json_schema!({ + "type": "string", + "enum": ["Get", "Put", "Unknown"], + }) + } +} + +impl From for TraceIpldOp { + fn from(op: IpldOperation) -> Self { + match op { + IpldOperation::Get => Self::Get, + IpldOperation::Put => Self::Put, + } + } +} + +/// IPLD operation details attached to an [`ExecutionTrace`]. +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] +#[serde(rename_all = "PascalCase")] +pub struct TraceIpld { + pub op: TraceIpldOp, + #[serde(with = "crate::lotus_json")] + #[schemars(with = "LotusJson")] + pub cid: Cid, + pub size: u64, +} + +lotus_json_with_self!(TraceIpld); + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)] #[serde(rename_all = "PascalCase")] pub struct ExecutionTrace { @@ -149,6 +205,13 @@ pub struct ExecutionTrace { #[serde(with = "crate::lotus_json")] #[schemars(with = "LotusJson>")] pub subcalls: Vec, + /// FVM invocation logs (not EVM actor / `eth_getLogs` event logs). + /// See + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub logs: Vec, + /// See + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub ipld_ops: Vec, } impl ExecutionTrace { @@ -228,7 +291,7 @@ pub struct GasTrace { lotus_json_with_self!(GasTrace); impl PartialEq for GasTrace { - /// Ignore [`Self::total_gas`] as it is implementation-dependent + /// Ignore [`Self::time_taken`] as it is implementation-dependent fn eq(&self, other: &Self) -> bool { self.name == other.name && self.total_gas == other.total_gas diff --git a/src/rpc/snapshots/forest__rpc__tests__rpc__v0.snap b/src/rpc/snapshots/forest__rpc__tests__rpc__v0.snap index 509157d0a6c9..cdaf0e227174 100644 --- a/src/rpc/snapshots/forest__rpc__tests__rpc__v0.snap +++ b/src/rpc/snapshots/forest__rpc__tests__rpc__v0.snap @@ -147,7 +147,7 @@ methods: name: Filecoin.ChainGetMessage.Result required: true schema: - $ref: "#/components/schemas/FlattenedApiMessage" + $ref: "#/components/schemas/Message" paramStructure: by-position - name: Filecoin.ChainGetMessagesInTipset params: @@ -1846,7 +1846,7 @@ methods: name: Filecoin.GasEstimateMessageGas.Result required: true schema: - $ref: "#/components/schemas/FlattenedApiMessage" + $ref: "#/components/schemas/Message" paramStructure: by-position - name: Filecoin.MarketAddBalance params: @@ -5977,6 +5977,16 @@ components: anyOf: - $ref: "#/components/schemas/ActorTrace" - type: "null" + IpldOps: + description: "See " + type: array + items: + $ref: "#/components/schemas/TraceIpld" + Logs: + description: "FVM invocation logs (not EVM actor / `eth_getLogs` event logs).\nSee " + type: array + items: + type: string Msg: $ref: "#/components/schemas/MessageTrace" MsgRct: @@ -6179,50 +6189,6 @@ components: - SupplementalData - Signers - Signature - FlattenedApiMessage: - type: object - properties: - CID: - $ref: "#/components/schemas/Cid" - From: - $ref: "#/components/schemas/Address" - GasFeeCap: - $ref: "#/components/schemas/TokenAmount" - default: "0" - GasLimit: - type: integer - format: uint64 - default: 0 - minimum: 0 - GasPremium: - $ref: "#/components/schemas/TokenAmount" - default: "0" - Method: - type: integer - format: uint64 - default: 0 - minimum: 0 - Nonce: - type: integer - format: uint64 - default: 0 - minimum: 0 - Params: - $ref: "#/components/schemas/Nullable_Base64String" - To: - $ref: "#/components/schemas/Address" - Value: - $ref: "#/components/schemas/TokenAmount" - default: "0" - Version: - type: integer - format: uint64 - default: 0 - minimum: 0 - required: - - To - - From - - CID ForestChainExportDiffParams: type: object properties: @@ -6374,6 +6340,9 @@ components: UpgradeDragonHeight: type: integer format: int64 + UpgradeFireHorseHeight: + type: integer + format: int64 UpgradeGoldenWeekHeight: type: integer format: int64 @@ -6482,6 +6451,7 @@ components: - UpgradeTeepHeight - UpgradeTockHeight - UpgradeGoldenWeekHeight + - UpgradeFireHorseHeight GasTrace: type: object properties: @@ -6595,6 +6565,8 @@ components: Message: type: object properties: + CID: + $ref: "#/components/schemas/Nullable_Cid" From: $ref: "#/components/schemas/Address" GasFeeCap: @@ -6619,7 +6591,8 @@ components: default: 0 minimum: 0 Params: - $ref: "#/components/schemas/Nullable_Base64String" + $ref: "#/components/schemas/Base64String" + default: ~ To: $ref: "#/components/schemas/Address" Value: @@ -6952,6 +6925,11 @@ components: minimum: 0 ForkUpgradeParams: $ref: "#/components/schemas/ForkUpgradeParams" + GenesisTimestamp: + description: "See " + type: integer + format: uint64 + minimum: 0 NetworkName: type: string PreCommitChallengeDelay: @@ -6964,6 +6942,7 @@ components: - PreCommitChallengeDelay - ForkUpgradeParams - Eip155ChainID + - GenesisTimestamp NetworkVersion: description: "Specifies the network version\n\n# Examples\n```\n# use forest::doctest_private::NetworkVersion;\nlet v0 = NetworkVersion::V0;\n\n// dereference to convert to FVM4\nassert_eq!(fvm_shared4::version::NetworkVersion::V0, *v0);\n\n// use `.into()` when FVM3 has to be specified.\nassert_eq!(fvm_shared3::version::NetworkVersion::V0, v0.into());\n\n// use `.into()` when FVM2 has to be specified.\nassert_eq!(fvm_shared2::version::NetworkVersion::V0, v0.into());\n```" type: integer @@ -7135,10 +7114,6 @@ components: type: integer format: uint64 minimum: 0 - Nullable_Base64String: - anyOf: - - $ref: "#/components/schemas/Base64String" - - type: "null" Nullable_Cid: anyOf: - $ref: "#/components/schemas/Cid" @@ -7308,6 +7283,9 @@ components: properties: APIVersion: $ref: "#/components/schemas/ShiftingVersion" + Agent: + description: "See " + type: string BlockDelay: type: integer format: uint32 @@ -7318,6 +7296,7 @@ components: - Version - APIVersion - BlockDelay + - Agent Receipt: type: object properties: @@ -7665,6 +7644,28 @@ components: anyOf: - $ref: "#/components/schemas/EthCallTraceAction" - $ref: "#/components/schemas/EthCreateTraceAction" + TraceIpld: + description: "IPLD operation details attached to an [`ExecutionTrace`]." + type: object + properties: + Cid: + $ref: "#/components/schemas/Cid" + Op: + $ref: "#/components/schemas/TraceIpldOp" + Size: + type: integer + format: uint64 + minimum: 0 + required: + - Op + - Cid + - Size + TraceIpldOp: + type: string + enum: + - Get + - Put + - Unknown TraceResult: anyOf: - $ref: "#/components/schemas/EthCallTraceResult" diff --git a/src/rpc/snapshots/forest__rpc__tests__rpc__v1.snap b/src/rpc/snapshots/forest__rpc__tests__rpc__v1.snap index aea2ec0e95fb..5dbeaec4efb7 100644 --- a/src/rpc/snapshots/forest__rpc__tests__rpc__v1.snap +++ b/src/rpc/snapshots/forest__rpc__tests__rpc__v1.snap @@ -143,7 +143,7 @@ methods: name: Filecoin.ChainGetMessage.Result required: true schema: - $ref: "#/components/schemas/FlattenedApiMessage" + $ref: "#/components/schemas/Message" paramStructure: by-position - name: Filecoin.ChainGetMessagesInTipset params: @@ -1926,7 +1926,7 @@ methods: name: Filecoin.GasEstimateMessageGas.Result required: true schema: - $ref: "#/components/schemas/FlattenedApiMessage" + $ref: "#/components/schemas/Message" paramStructure: by-position - name: Filecoin.MarketAddBalance params: @@ -6096,6 +6096,16 @@ components: anyOf: - $ref: "#/components/schemas/ActorTrace" - type: "null" + IpldOps: + description: "See " + type: array + items: + $ref: "#/components/schemas/TraceIpld" + Logs: + description: "FVM invocation logs (not EVM actor / `eth_getLogs` event logs).\nSee " + type: array + items: + type: string Msg: $ref: "#/components/schemas/MessageTrace" MsgRct: @@ -6298,50 +6308,6 @@ components: - SupplementalData - Signers - Signature - FlattenedApiMessage: - type: object - properties: - CID: - $ref: "#/components/schemas/Cid" - From: - $ref: "#/components/schemas/Address" - GasFeeCap: - $ref: "#/components/schemas/TokenAmount" - default: "0" - GasLimit: - type: integer - format: uint64 - default: 0 - minimum: 0 - GasPremium: - $ref: "#/components/schemas/TokenAmount" - default: "0" - Method: - type: integer - format: uint64 - default: 0 - minimum: 0 - Nonce: - type: integer - format: uint64 - default: 0 - minimum: 0 - Params: - $ref: "#/components/schemas/Nullable_Base64String" - To: - $ref: "#/components/schemas/Address" - Value: - $ref: "#/components/schemas/TokenAmount" - default: "0" - Version: - type: integer - format: uint64 - default: 0 - minimum: 0 - required: - - To - - From - - CID ForestChainExportDiffParams: type: object properties: @@ -6493,6 +6459,9 @@ components: UpgradeDragonHeight: type: integer format: int64 + UpgradeFireHorseHeight: + type: integer + format: int64 UpgradeGoldenWeekHeight: type: integer format: int64 @@ -6601,6 +6570,7 @@ components: - UpgradeTeepHeight - UpgradeTockHeight - UpgradeGoldenWeekHeight + - UpgradeFireHorseHeight GasTrace: type: object properties: @@ -6811,6 +6781,8 @@ components: Message: type: object properties: + CID: + $ref: "#/components/schemas/Nullable_Cid" From: $ref: "#/components/schemas/Address" GasFeeCap: @@ -6835,7 +6807,8 @@ components: default: 0 minimum: 0 Params: - $ref: "#/components/schemas/Nullable_Base64String" + $ref: "#/components/schemas/Base64String" + default: ~ To: $ref: "#/components/schemas/Address" Value: @@ -7168,6 +7141,11 @@ components: minimum: 0 ForkUpgradeParams: $ref: "#/components/schemas/ForkUpgradeParams" + GenesisTimestamp: + description: "See " + type: integer + format: uint64 + minimum: 0 NetworkName: type: string PreCommitChallengeDelay: @@ -7180,6 +7158,7 @@ components: - PreCommitChallengeDelay - ForkUpgradeParams - Eip155ChainID + - GenesisTimestamp NetworkVersion: description: "Specifies the network version\n\n# Examples\n```\n# use forest::doctest_private::NetworkVersion;\nlet v0 = NetworkVersion::V0;\n\n// dereference to convert to FVM4\nassert_eq!(fvm_shared4::version::NetworkVersion::V0, *v0);\n\n// use `.into()` when FVM3 has to be specified.\nassert_eq!(fvm_shared3::version::NetworkVersion::V0, v0.into());\n\n// use `.into()` when FVM2 has to be specified.\nassert_eq!(fvm_shared2::version::NetworkVersion::V0, v0.into());\n```" type: integer @@ -7359,10 +7338,6 @@ components: type: integer format: uint64 minimum: 0 - Nullable_Base64String: - anyOf: - - $ref: "#/components/schemas/Base64String" - - type: "null" Nullable_Cid: anyOf: - $ref: "#/components/schemas/Cid" @@ -7544,6 +7519,9 @@ components: properties: APIVersion: $ref: "#/components/schemas/ShiftingVersion" + Agent: + description: "See " + type: string BlockDelay: type: integer format: uint32 @@ -7554,6 +7532,7 @@ components: - Version - APIVersion - BlockDelay + - Agent Receipt: type: object properties: @@ -7901,6 +7880,28 @@ components: anyOf: - $ref: "#/components/schemas/EthCallTraceAction" - $ref: "#/components/schemas/EthCreateTraceAction" + TraceIpld: + description: "IPLD operation details attached to an [`ExecutionTrace`]." + type: object + properties: + Cid: + $ref: "#/components/schemas/Cid" + Op: + $ref: "#/components/schemas/TraceIpldOp" + Size: + type: integer + format: uint64 + minimum: 0 + required: + - Op + - Cid + - Size + TraceIpldOp: + type: string + enum: + - Get + - Put + - Unknown TraceResult: anyOf: - $ref: "#/components/schemas/EthCallTraceResult" diff --git a/src/state_manager/utils.rs b/src/state_manager/utils.rs index b8fbda9f7de0..8881732e7ff3 100644 --- a/src/state_manager/utils.rs +++ b/src/state_manager/utils.rs @@ -489,7 +489,7 @@ mod test { /// Parsed tree of [`fvm4::trace::ExecutionEvent`]s pub mod structured { use crate::{ - rpc::state::{ActorTrace, ExecutionTrace, GasTrace, MessageTrace, ReturnTrace}, + rpc::state::{ActorTrace, ExecutionTrace, GasTrace, MessageTrace, ReturnTrace, TraceIpld}, shim::kernel::ErrorNumber, }; use std::collections::VecDeque; @@ -626,6 +626,8 @@ pub mod structured { let mut gas_charges = vec![]; let mut subcalls = vec![]; let mut actor_trace = None; + let mut logs = vec![]; + let mut ipld_ops = vec![]; // we don't use a for loop over `events` so we can pass them to recursive calls while let Some(event) = events.pop_front() { @@ -641,7 +643,10 @@ pub mod structured { ExecutionEvent::CallReturn(ret) => Some(CallTreeReturn::Return(ret)), ExecutionEvent::CallAbort(ab) => Some(CallTreeReturn::Abort(ab)), ExecutionEvent::CallError(e) => Some(CallTreeReturn::Error(e)), - ExecutionEvent::Log(_ignored) => None, + ExecutionEvent::Log(log) => { + logs.push(log); + None + } ExecutionEvent::InvokeActor(cid) => { actor_trace = match cid { Either::Left(_cid) => None, @@ -652,7 +657,14 @@ pub mod structured { }; None } - ExecutionEvent::Ipld { .. } => None, + ExecutionEvent::Ipld { op, cid, size } => { + ipld_ops.push(TraceIpld { + op: op.into(), + cid, + size: size as u64, + }); + None + } // RUST: This should be caught at compile time with #[deny(non_exhaustive_omitted_patterns)] // So that BuildExecutionTraceError::UnrecognisedEvent is never constructed // But that lint is not yet stabilised: https://github.com/rust-lang/rust/issues/89554 @@ -669,6 +681,8 @@ pub mod structured { gas_charges, subcalls, invoked_actor: actor_trace, + logs, + ipld_ops, }); } } diff --git a/src/tool/subcommands/api_cmd/api_compare_tests.rs b/src/tool/subcommands/api_cmd/api_compare_tests.rs index 6d5bad680bcc..1319fafd73ab 100644 --- a/src/tool/subcommands/api_cmd/api_compare_tests.rs +++ b/src/tool/subcommands/api_cmd/api_compare_tests.rs @@ -2375,9 +2375,7 @@ fn gas_tests_with_tipset(shared_tipset: &Tipset) -> Vec { shared_tipset.key().into(), )) .unwrap(), - |forest_api_msg, lotus_api_msg| { - let forest_msg = forest_api_msg.message; - let lotus_msg = lotus_api_msg.message; + |forest_msg, lotus_msg| { // Validate that the gas limit is identical (must be deterministic) if forest_msg.gas_limit != lotus_msg.gas_limit { return false; diff --git a/src/tool/subcommands/api_cmd/stateful_tests.rs b/src/tool/subcommands/api_cmd/stateful_tests.rs index 53658b54717f..7feed17c22e2 100644 --- a/src/tool/subcommands/api_cmd/stateful_tests.rs +++ b/src/tool/subcommands/api_cmd/stateful_tests.rs @@ -344,14 +344,14 @@ async fn invoke_contract(client: &rpc::Client, tx: &TestTransaction) -> anyhow:: let eth_tx_args = crate::eth::EthEip1559TxArgsBuilder::default() .chain_id(ETH_CHAIN_ID) - .unsigned_message(&unsigned_msg.message)? + .unsigned_message(&unsigned_msg)? .build() .map_err(|e| anyhow::anyhow!("Failed to build EIP-1559 transaction: {}", e))?; let eth_tx = crate::eth::EthTx::from(eth_tx_args); let data = eth_tx.rlp_unsigned_message(ETH_CHAIN_ID)?; let sig = client.call(WalletSign::request((tx.from, data))?).await?; - let smsg = SignedMessage::new_unchecked(unsigned_msg.message, sig); + let smsg = SignedMessage::new_unchecked(unsigned_msg, sig); let cid = smsg.cid(); client.call(MpoolPush::request((smsg,))?).await?; diff --git a/src/tool/subcommands/api_cmd/test_snapshots.txt b/src/tool/subcommands/api_cmd/test_snapshots.txt index bf6f1c036657..f4dc4428dc30 100644 --- a/src/tool/subcommands/api_cmd/test_snapshots.txt +++ b/src/tool/subcommands/api_cmd/test_snapshots.txt @@ -252,9 +252,9 @@ filecoin_power_onepochtickend_statedecodeparams_1754479441718920.rpcsnap.json.zs filecoin_reward_thisepochreward_statedecodeparams_1754479441718972.rpcsnap.json.zst filecoin_session_1741781372985818.rpcsnap.json.zst filecoin_stateaccountkey_1741783761556416.rpcsnap.json.zst -filecoin_statecall_1743503294940970.rpcsnap.json.zst +filecoin_statecall_1778013726767345.rpcsnap.json.zst filecoin_statecirculatingsupply_1737546950391069.rpcsnap.json.zst -filecoin_statecompute_1743430909413047.rpcsnap.json.zst +filecoin_statecompute_1778013740986027.rpcsnap.json.zst filecoin_statedealprovidercollateralbounds_1737546933164491.rpcsnap.json.zst filecoin_statedecodeparams_1749826976834943.rpcsnap.json.zst filecoin_statedecodeparams_1749826976835026.rpcsnap.json.zst @@ -283,7 +283,7 @@ filecoin_stategetbeaconentry_1737546933208724.rpcsnap.json.zst filecoin_stategetclaim_1737546933208940.rpcsnap.json.zst filecoin_stategetclaims_1737546933208977.rpcsnap.json.zst filecoin_stategetid_1764943126105310.rpcsnap.json.zst -filecoin_stategetnetworkparams_1774522153615694.rpcsnap.json.zst +filecoin_stategetnetworkparams_1777517671344321.rpcsnap.json.zst filecoin_stategetrandomnessdigestfrombeacon_1737546933236534.rpcsnap.json.zst filecoin_stategetrandomnessdigestfromtickets_1737546933236558.rpcsnap.json.zst filecoin_stategetrandomnessfrombeacon_1737546933236581.rpcsnap.json.zst @@ -329,7 +329,7 @@ filecoin_statereadstate_1748425541558368.rpcsnap.json.zst filecoin_statereadstate_1748444218790447.rpcsnap.json.zst filecoin_statereadstate_1748444218790807.rpcsnap.json.zst filecoin_statereadstate_1749657617007020.rpcsnap.json.zst -filecoin_statereplay_1743504051038215.rpcsnap.json.zst +filecoin_statereplay_1778013757068094.rpcsnap.json.zst filecoin_statesearchmsg_1767947430707712.rpcsnap.json.zst filecoin_statesearchmsglimited_1767936905056090.rpcsnap.json.zst filecoin_statesectorexpiration_1741784727996672.rpcsnap.json.zst diff --git a/src/wallet/subcommands/wallet_cmd.rs b/src/wallet/subcommands/wallet_cmd.rs index c5aa7940f07e..f771a3ebcea5 100644 --- a/src/wallet/subcommands/wallet_cmd.rs +++ b/src/wallet/subcommands/wallet_cmd.rs @@ -545,8 +545,7 @@ impl WalletCommands { &backend.remote, (message, spec, ApiTipsetKey(None)), ) - .await? - .message; + .await?; if message.gas_premium > message.gas_fee_cap { anyhow::bail!("After estimation, gas premium is greater than gas fee cap")