filecoin-project / specs-actors

DEPRECATED Specification of builtin actors, in the form of executable code.
Other
86 stars 102 forks source link

Incorrect errorcode? #1536

Open laudiacay opened 2 years ago

laudiacay commented 2 years ago

https://github.com/filecoin-project/specs-actors/blob/97fc4480cbc9b7078c67276d8c3394e3423ef513/actors/builtin/miner/miner_actor.go#L869-L870

this should probably be an errIllegalArgument, no? the params failed validation?

ZenGround0 commented 2 years ago

It's a bit of an edge case but I don't think so. ErrIllegalArgument for values actor logic forbids. ErrIllegalState for failures that should be impossible. In this case the bitfield was serialized correctly but makes Count fail which I wouldn't expect to be possible. If you look into it and Count errors are expected for certain valid serializations I'll support changing to ErrIllegalArgument.

Stebalien commented 2 years ago

Well, the serialization may not actually be valid. We check lazily when we actually operate on the bitfield to avoid validating bitfields in the state every time we rehydrate them.