Skip to content

Commit 0f4fc44

Browse files
committed
fixup! feat(exec): dump intermediate cache blocks from FVM exec in StateReplay
1 parent fc5d4b1 commit 0f4fc44

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

cmd/lotus-shed/block-matcher.go

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ import (
1919
"golang.org/x/xerrors"
2020

2121
"github.com/filecoin-project/go-amt-ipld/v4"
22-
"github.com/filecoin-project/go-bitfield"
2322
"github.com/filecoin-project/go-hamt-ipld/v3"
23+
"github.com/filecoin-project/go-state-types/abi"
2424
gstbuiltin "github.com/filecoin-project/go-state-types/builtin"
2525
datacap16 "github.com/filecoin-project/go-state-types/builtin/v16/datacap"
2626
market16 "github.com/filecoin-project/go-state-types/builtin/v16/market"
@@ -120,6 +120,10 @@ func matchAmtValues(values datamodel.Node) (string, error) {
120120
} else if match != m {
121121
return "", xerrors.Errorf("inconsistent types in AMT values")
122122
}
123+
// To debug unknown AMT types, uncomment this block:
124+
// } else {
125+
// enc, _ := ipld.Encode(v, dagjson.Encode)
126+
// return "", xerrors.Errorf("unknown type in AMT values: %s", enc)
123127
}
124128
}
125129
if match != "" {
@@ -162,8 +166,12 @@ func matchHamtValues(hamtNode datamodel.Node) (string, error) {
162166
if match == "" {
163167
match = m
164168
} else if match != m {
165-
return "", xerrors.Errorf("inconsistent types in HAMT values")
169+
return "", xerrors.Errorf("inconsistent types in HAMT values: %s != %s", match, m)
166170
}
171+
// To debug unknown HAMT types, uncomment this block:
172+
// } else {
173+
// enc, _ := ipld.Encode(bval, dagjson.Encode)
174+
// return "", xerrors.Errorf("unknown type in HAMT values: %s", enc)
167175
}
168176
}
169177
}
@@ -202,10 +210,11 @@ func matchKnownBlockTypeFromBytes(b []byte) (string, error) {
202210
if m, _ := matchWellKnownBlockType(b); m != "" {
203211
return m, nil
204212
}
205-
206213
if _, err := cbg.ReadCid(bytes.NewReader(b)); err == nil {
207214
return "Cid", nil
208215
}
216+
ci := cbg.CborInt(1)
217+
cb := cbg.CborBool(true)
209218
known := map[string]cbg.CBORUnmarshaler{
210219
// Fill this out with known types when you see them missing and can identify them
211220
"BlockHeader": &types.BlockHeader{},
@@ -220,9 +229,16 @@ func matchKnownBlockTypeFromBytes(b []byte) (string, error) {
220229
"miner16.SectorPreCommitOnChainInfo": &miner16.SectorPreCommitOnChainInfo{},
221230
"power16.State": &power16.State{},
222231
"market16.State": &market16.State{},
232+
"market16.DealProposal": &market16.DealProposal{},
233+
"market16.DealState": &market16.DealState{},
223234
"verifreg16.State": &verifreg16.State{},
235+
"verifreg16.Allocation": &verifreg16.Allocation{},
236+
"verifreg16.Claim": &verifreg16.Claim{},
224237
"datacap16.State": &datacap16.State{},
225-
"Bitfield": &bitfield.BitField{},
238+
"[Int]": &market16.SectorDealIDs{}, // verifreg16.RmDcProposalID is one of these too, as are probably others, we can't be certain, it would be context dependent
239+
"Int": &ci,
240+
"Bool": &cb,
241+
"Bytes": &abi.CborBytes{}, // could be TokenAmount, BigInt, etc
226242
}
227243
for name, v := range known {
228244
if err := v.UnmarshalCBOR(bytes.NewReader(b)); err == nil {

0 commit comments

Comments
 (0)