@@ -19,8 +19,8 @@ import (
19
19
"golang.org/x/xerrors"
20
20
21
21
"github.com/filecoin-project/go-amt-ipld/v4"
22
- "github.com/filecoin-project/go-bitfield"
23
22
"github.com/filecoin-project/go-hamt-ipld/v3"
23
+ "github.com/filecoin-project/go-state-types/abi"
24
24
gstbuiltin "github.com/filecoin-project/go-state-types/builtin"
25
25
datacap16 "github.com/filecoin-project/go-state-types/builtin/v16/datacap"
26
26
market16 "github.com/filecoin-project/go-state-types/builtin/v16/market"
@@ -120,6 +120,10 @@ func matchAmtValues(values datamodel.Node) (string, error) {
120
120
} else if match != m {
121
121
return "" , xerrors .Errorf ("inconsistent types in AMT values" )
122
122
}
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)
123
127
}
124
128
}
125
129
if match != "" {
@@ -162,8 +166,12 @@ func matchHamtValues(hamtNode datamodel.Node) (string, error) {
162
166
if match == "" {
163
167
match = m
164
168
} 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 )
166
170
}
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)
167
175
}
168
176
}
169
177
}
@@ -202,10 +210,11 @@ func matchKnownBlockTypeFromBytes(b []byte) (string, error) {
202
210
if m , _ := matchWellKnownBlockType (b ); m != "" {
203
211
return m , nil
204
212
}
205
-
206
213
if _ , err := cbg .ReadCid (bytes .NewReader (b )); err == nil {
207
214
return "Cid" , nil
208
215
}
216
+ ci := cbg .CborInt (1 )
217
+ cb := cbg .CborBool (true )
209
218
known := map [string ]cbg.CBORUnmarshaler {
210
219
// Fill this out with known types when you see them missing and can identify them
211
220
"BlockHeader" : & types.BlockHeader {},
@@ -220,9 +229,16 @@ func matchKnownBlockTypeFromBytes(b []byte) (string, error) {
220
229
"miner16.SectorPreCommitOnChainInfo" : & miner16.SectorPreCommitOnChainInfo {},
221
230
"power16.State" : & power16.State {},
222
231
"market16.State" : & market16.State {},
232
+ "market16.DealProposal" : & market16.DealProposal {},
233
+ "market16.DealState" : & market16.DealState {},
223
234
"verifreg16.State" : & verifreg16.State {},
235
+ "verifreg16.Allocation" : & verifreg16.Allocation {},
236
+ "verifreg16.Claim" : & verifreg16.Claim {},
224
237
"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
226
242
}
227
243
for name , v := range known {
228
244
if err := v .UnmarshalCBOR (bytes .NewReader (b )); err == nil {
0 commit comments