diff --git a/cli/state.go b/cli/state.go index 7729e729a..62d751204 100644 --- a/cli/state.go +++ b/cli/state.go @@ -1344,12 +1344,12 @@ var stateMsgCostCmd = &cli.Command{ } if mgc != nil { - fmt.Printf("\nMessage CID: %d", mgc.Message) + fmt.Printf("Message CID: %s", mgc.Message) fmt.Printf("\nGas Used: %d", mgc.GasUsed) fmt.Printf("\nBase Fee Burn: %d", mgc.BaseFeeBurn) fmt.Printf("\nOverestimation Burn: %d", mgc.OverEstimationBurn) fmt.Printf("\nMiner Tip: %d", mgc.MinerTip) - fmt.Printf("\nRefundd: %d", mgc.Refund) + fmt.Printf("\nRefund: %d", mgc.Refund) fmt.Printf("\nTotal Cost: %d", mgc.TotalCost) fmt.Printf("\nMiner Penalty: %d", mgc.MinerPenalty) } else { diff --git a/documentation/en/api-methods.md b/documentation/en/api-methods.md index ec298d635..5bba832df 100644 --- a/documentation/en/api-methods.md +++ b/documentation/en/api-methods.md @@ -3743,7 +3743,15 @@ Inputs: [ { "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" - } + }, + [ + { + "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" + }, + { + "/": "bafy2bzacebp3shtrn43k7g3unredz7fxn4gj533d3o43tqn2p2ipxxhrvchve" + } + ] ] ``` @@ -3753,16 +3761,13 @@ Response: "Message": { "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" }, - "Receipt": { - "ExitCode": 0, - "Return": "Ynl0ZSBhcnJheQ==", - "GasUsed": 9 - }, + "GasUsed": "0", "BaseFeeBurn": "0", "OverEstimationBurn": "0", "MinerPenalty": "0", "MinerTip": "0", - "Refund": "0" + "Refund": "0", + "TotalCost": "0" } ``` diff --git a/extern/storage-sealing/upgrade_queue.go b/extern/storage-sealing/upgrade_queue.go index 650fdc83d..af2d1827d 100644 --- a/extern/storage-sealing/upgrade_queue.go +++ b/extern/storage-sealing/upgrade_queue.go @@ -67,6 +67,8 @@ func (m *Sealing) tryUpgradeSector(ctx context.Context, params *miner.SectorPreC params.ReplaceSectorDeadline = loc.Deadline params.ReplaceSectorPartition = loc.Partition + log.Infof("replacing sector %d with %d", *replace, params.SectorNumber) + ri, err := m.api.StateSectorGetInfo(ctx, m.maddr, *replace, nil) if err != nil { log.Errorf("error calling StateSectorGetInfo for replaced sector: %+v", err) diff --git a/node/impl/full/state.go b/node/impl/full/state.go index 1fb078001..c37ab9c3d 100644 --- a/node/impl/full/state.go +++ b/node/impl/full/state.go @@ -1238,15 +1238,25 @@ func (a *StateAPI) StateMsgGasCost(ctx context.Context, inputMsg cid.Cid, tsk ty return nil, xerrors.Errorf("loading tipset %s: %w", tsk, err) } } else { - msg, err := a.StateSearchMsg(ctx, inputMsg) + mlkp, err := a.StateSearchMsg(ctx, inputMsg) if err != nil { return nil, xerrors.Errorf("searching for msg %s: %w", inputMsg, err) } - - ts, err = a.Chain.GetTipSetFromKey(msg.TipSet) - if err != nil { - return nil, xerrors.Errorf("loading tipset %s: %w", msg.TipSet, err) + if mlkp == nil { + return nil, xerrors.Errorf("didn't find msg %s", inputMsg) } + + executionTs, err := a.Chain.GetTipSetFromKey(mlkp.TipSet) + if err != nil { + return nil, xerrors.Errorf("loading tipset %s: %w", mlkp.TipSet, err) + } + + ts, err = a.Chain.LoadTipSet(executionTs.Parents()) + if err != nil { + return nil, xerrors.Errorf("loading parent tipset %s: %w", mlkp.TipSet, err) + } + + msg = mlkp.Message } m, r, err := a.StateManager.Replay(ctx, ts, msg) @@ -1254,7 +1264,6 @@ func (a *StateAPI) StateMsgGasCost(ctx context.Context, inputMsg cid.Cid, tsk ty return nil, err } - gasSpent := big.Sub(big.NewInt(m.GasLimit), r.GasCosts.Refund) return &api.MsgGasCost{ Message: msg, GasUsed: big.NewInt(r.GasUsed), @@ -1263,6 +1272,6 @@ func (a *StateAPI) StateMsgGasCost(ctx context.Context, inputMsg cid.Cid, tsk ty MinerPenalty: r.GasCosts.MinerPenalty, MinerTip: r.GasCosts.MinerTip, Refund: r.GasCosts.Refund, - TotalCost: big.Mul(gasSpent, m.GasFeeCap), + TotalCost: big.Sub(m.RequiredFunds(), r.GasCosts.Refund), }, nil }