Move the zero bls actor creation check into the VM

This commit is contained in:
Aayush Rajasekaran 2021-02-18 15:36:16 -05:00
parent 5aff54161a
commit 2ca70e600d

View File

@ -3,6 +3,10 @@ package vm
import ( import (
"context" "context"
"github.com/filecoin-project/go-state-types/network"
"github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/go-state-types/exitcode" "github.com/filecoin-project/go-state-types/exitcode"
"github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors"
@ -39,6 +43,10 @@ func TryCreateAccountActor(rt *Runtime, addr address.Address) (*types.Actor, add
return nil, address.Undef, err return nil, address.Undef, err
} }
if addr == build.ZeroAddress && rt.NetworkVersion() >= network.Version10 {
return nil, address.Undef, aerrors.New(exitcode.ErrIllegalArgument, "cannot create the zero bls actor")
}
addrID, err := rt.state.RegisterNewAddress(addr) addrID, err := rt.state.RegisterNewAddress(addr)
if err != nil { if err != nil {
return nil, address.Undef, aerrors.Escalate(err, "registering actor address") return nil, address.Undef, aerrors.Escalate(err, "registering actor address")