Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: fvm: update the FVM/FFI to v4.1 #11608

Merged
merged 2 commits into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
46 changes: 46 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,52 @@

## Improvements

### Tracing API

Replace the `CodeCid` field in the message trace (added in 1.23.4) with an `InvokedActor` field.

**Before:**

```javascript
{
"Msg": {
"From": ...,
"To": ...,
...
"CodeCid": ... // The actor's code CID.
}
"MsgRct": ...,
"GasCharges": [],
"Subcalls": [],
}
```

**After:**

```javascript
{
"Msg": {
"From": ...,
"To": ...
}
"InvokedActor": { // The invoked actor (ommitted if the actor wasn't invoked).
"Id": 1234, // The ID of the actor.
"State": { // The actor's state object (may change between network versions).
"Code": ..., // The actor's code CID.
"Head": ..., // The actor's state-root (when invoked).
"CallSeqNum": ..., // The actor's nonce.
"Balance": ..., // The actor's balance (when invoked).
"Address": ..., // Delegated address (FEVM only).
}
}
"MsgRct": ...,
"GasCharges": [],
"Subcalls": [],
}
```

This means the trace now contains an accurate "snapshot" of the actor at the time of the call, information that may not be present in the final state-tree (e.g., due to reverts). This will hopefully improve the performance and accuracy of indexing services.

# v1.25.2 / 2024-01-11

This is an optional but **highly recommended feature release** of Lotus, as it includes fixes for synchronizations issues that users have experienced. The feature release also introduces `Lotus-Provider` in its alpha testing phase, as well as the ability to call external PC2-binaries during the sealing process.
Expand Down
8 changes: 4 additions & 4 deletions api/docgen/docgen.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,14 @@ func init() {
addExample(map[verifreg.ClaimId]verifreg.Claim{})
addExample(map[string]int{"name": 42})
addExample(map[string]time.Time{"name": time.Unix(1615243938, 0).UTC()})
addExample(abi.ActorID(1000))
addExample(map[string]types.Actor{
"t01236": ExampleValue("init", reflect.TypeOf(types.Actor{}), nil).(types.Actor),
})
addExample(&types.ExecutionTrace{
Msg: ExampleValue("init", reflect.TypeOf(types.MessageTrace{}), nil).(types.MessageTrace),
MsgRct: ExampleValue("init", reflect.TypeOf(types.ReturnTrace{}), nil).(types.ReturnTrace),
})
addExample(map[string]types.Actor{
"t01236": ExampleValue("init", reflect.TypeOf(types.Actor{}), nil).(types.Actor),
})
addExample(map[string]api.MarketDeal{
"t026363": ExampleValue("init", reflect.TypeOf(api.MarketDeal{}), nil).(api.MarketDeal),
})
Expand Down Expand Up @@ -209,7 +210,6 @@ func init() {
si := uint64(12)
addExample(&si)
addExample(retrievalmarket.DealID(5))
addExample(abi.ActorID(1000))
addExample(map[string]cid.Cid{})
addExample(map[string][]api.SealedRef{
"98000": {
Expand Down
Binary file modified build/openrpc/full.json.gz
Binary file not shown.
Binary file modified build/openrpc/gateway.json.gz
Binary file not shown.
127 changes: 104 additions & 23 deletions chain/types/cbor_gen.go

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

17 changes: 10 additions & 7 deletions chain/types/execresult.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import (
"encoding/json"
"time"

"github.com/ipfs/go-cid"

"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/exitcode"
Expand All @@ -28,7 +26,11 @@ type MessageTrace struct {
ParamsCodec uint64
GasLimit uint64
ReadOnly bool
CodeCid cid.Cid
}

type ActorTrace struct {
Id abi.ActorID
State Actor
}

type ReturnTrace struct {
Expand All @@ -38,10 +40,11 @@ type ReturnTrace struct {
}

type ExecutionTrace struct {
Msg MessageTrace
MsgRct ReturnTrace
GasCharges []*GasTrace `cborgen:"maxlen=1000000000"`
Subcalls []ExecutionTrace `cborgen:"maxlen=1000000000"`
Msg MessageTrace
MsgRct ReturnTrace
InvokedActor *ActorTrace `json:",omitempty"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this nullable to make it backward compatible, do we guarantee it exists on traces from this point forward? There's usage in node/impl/full/eth_trace.go that assumes it exists and will panic otherwise (3 instances of et.InvokedActor.State.Code).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it can definitely not be set. Nice catch!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed by simply skipping these traces. It can only happen if we fail to resolve the target actor, and that's not a case that's even possible in the EVM (i.e., the EVM would have aborted the call before it even hit the tracing logic).

GasCharges []*GasTrace `cborgen:"maxlen=1000000000"`
Subcalls []ExecutionTrace `cborgen:"maxlen=1000000000"`
}

func (et ExecutionTrace) SumGas() GasTrace {
Expand Down