Remove use of exitcode.SysErrInvalidParameters
This commit is contained in:
parent
2080458f0d
commit
a8dcea1422
@ -341,7 +341,7 @@ func (rt *Runtime) Send(to address.Address, method abi.MethodNum, m vmr.CBORMars
|
|||||||
if m != nil {
|
if m != nil {
|
||||||
buf := new(bytes.Buffer)
|
buf := new(bytes.Buffer)
|
||||||
if err := m.MarshalCBOR(buf); err != nil {
|
if err := m.MarshalCBOR(buf); err != nil {
|
||||||
rt.Abortf(exitcode.SysErrInvalidParameters, "failed to marshal input parameters: %s", err)
|
rt.Abortf(exitcode.ErrSerialization, "failed to marshal input parameters: %s", err)
|
||||||
}
|
}
|
||||||
params = buf.Bytes()
|
params = buf.Bytes()
|
||||||
}
|
}
|
||||||
|
@ -40,23 +40,23 @@ var actorLog = logging.Logger("actors")
|
|||||||
var gasOnActorExec = newGasCharge("OnActorExec", 0, 0)
|
var gasOnActorExec = newGasCharge("OnActorExec", 0, 0)
|
||||||
|
|
||||||
// ResolveToKeyAddr returns the public key type of address (`BLS`/`SECP256K1`) of an account actor identified by `addr`.
|
// ResolveToKeyAddr returns the public key type of address (`BLS`/`SECP256K1`) of an account actor identified by `addr`.
|
||||||
func ResolveToKeyAddr(state types.StateTree, cst cbor.IpldStore, addr address.Address) (address.Address, aerrors.ActorError) {
|
func ResolveToKeyAddr(state types.StateTree, cst cbor.IpldStore, addr address.Address) (address.Address, error) {
|
||||||
if addr.Protocol() == address.BLS || addr.Protocol() == address.SECP256K1 {
|
if addr.Protocol() == address.BLS || addr.Protocol() == address.SECP256K1 {
|
||||||
return addr, nil
|
return addr, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
act, err := state.GetActor(addr)
|
act, err := state.GetActor(addr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return address.Undef, aerrors.Newf(exitcode.SysErrInvalidParameters, "failed to find actor: %s", addr)
|
return address.Undef, xerrors.Errorf("failed to find actor: %s", addr)
|
||||||
}
|
}
|
||||||
|
|
||||||
if act.Code != builtin.AccountActorCodeID {
|
if act.Code != builtin.AccountActorCodeID {
|
||||||
return address.Undef, aerrors.Newf(exitcode.SysErrInvalidParameters, "address %s was not for an account actor", addr)
|
return address.Undef, xerrors.Errorf("address %s was not for an account actor", addr)
|
||||||
}
|
}
|
||||||
|
|
||||||
var aast account.State
|
var aast account.State
|
||||||
if err := cst.Get(context.TODO(), act.Head, &aast); err != nil {
|
if err := cst.Get(context.TODO(), act.Head, &aast); err != nil {
|
||||||
return address.Undef, aerrors.Absorb(err, exitcode.SysErrInvalidParameters, fmt.Sprintf("failed to get account actor state for %s", addr))
|
return address.Undef, xerrors.Errorf("failed to get account actor state for %s: %w", addr, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return aast.Address, nil
|
return aast.Address, nil
|
||||||
|
Loading…
Reference in New Issue
Block a user