refactor: renames
This commit is contained in:
parent
dfaad08a8b
commit
c1a9cf7edd
@ -33,10 +33,10 @@ const (
|
||||
CallerValidationBranchNone CallerValidationBranch = iota
|
||||
// CallerValidationBranchTwice causes Runtime.ValidateImmediateCallerAcceptAny to be called twice.
|
||||
CallerValidationBranchTwice
|
||||
// CallerValidationBranchIs causes caller validation against CallerValidationArgs.Addrs.
|
||||
CallerValidationBranchIs
|
||||
// CallerValidationBranchType causes caller validation against CallerValidationArgs.Types.
|
||||
CallerValidationBranchType
|
||||
// CallerValidationBranchIsAddress causes caller validation against CallerValidationArgs.Addrs.
|
||||
CallerValidationBranchIsAddress
|
||||
// CallerValidationBranchIsType causes caller validation against CallerValidationArgs.Types.
|
||||
CallerValidationBranchIsType
|
||||
)
|
||||
|
||||
// MutateStateBranch is an enum used to select the type of state mutation to attempt.
|
||||
@ -136,17 +136,17 @@ type CallerValidationArgs struct {
|
||||
//
|
||||
// CallerValidationBranchNone performs no validation.
|
||||
// CallerValidationBranchTwice validates twice.
|
||||
// CallerValidationBranchIs validates caller against CallerValidationArgs.Addrs.
|
||||
// CallerValidationBranchType validates caller against CallerValidationArgs.Types.
|
||||
// CallerValidationBranchIsAddress validates caller against CallerValidationArgs.Addrs.
|
||||
// CallerValidationBranchIsType validates caller against CallerValidationArgs.Types.
|
||||
func (a Actor) CallerValidation(rt runtime.Runtime, args *CallerValidationArgs) *abi.EmptyValue {
|
||||
switch args.Branch {
|
||||
case CallerValidationBranchNone:
|
||||
case CallerValidationBranchTwice:
|
||||
rt.ValidateImmediateCallerAcceptAny()
|
||||
rt.ValidateImmediateCallerAcceptAny()
|
||||
case CallerValidationBranchIs:
|
||||
case CallerValidationBranchIsAddress:
|
||||
rt.ValidateImmediateCallerIs(args.Addrs...)
|
||||
case CallerValidationBranchType:
|
||||
case CallerValidationBranchIsType:
|
||||
rt.ValidateImmediateCallerType(args.Types...)
|
||||
default:
|
||||
panic("invalid branch passed to CallerValidation")
|
||||
|
@ -53,7 +53,7 @@ func TestCallerValidationIs(t *testing.T) {
|
||||
// FIXME: https://github.com/filecoin-project/specs-actors/pull/1155
|
||||
rt.ExpectAbort(exitcode.ErrForbidden, func() {
|
||||
rt.Call(a.CallerValidation, &CallerValidationArgs{
|
||||
Branch: CallerValidationBranchIs,
|
||||
Branch: CallerValidationBranchIsAddress,
|
||||
Addrs: caddrs,
|
||||
})
|
||||
})
|
||||
@ -61,7 +61,7 @@ func TestCallerValidationIs(t *testing.T) {
|
||||
|
||||
rt.ExpectValidateCallerAddr(caller)
|
||||
rt.Call(a.CallerValidation, &CallerValidationArgs{
|
||||
Branch: CallerValidationBranchIs,
|
||||
Branch: CallerValidationBranchIsAddress,
|
||||
Addrs: []address.Address{caller},
|
||||
})
|
||||
rt.Verify()
|
||||
@ -80,7 +80,7 @@ func TestCallerValidationType(t *testing.T) {
|
||||
// FIXME: https://github.com/filecoin-project/specs-actors/pull/1155
|
||||
rt.ExpectAbort(exitcode.ErrForbidden, func() {
|
||||
rt.Call(a.CallerValidation, &CallerValidationArgs{
|
||||
Branch: CallerValidationBranchType,
|
||||
Branch: CallerValidationBranchIsType,
|
||||
Types: []cid.Cid{builtin.CronActorCodeID},
|
||||
})
|
||||
})
|
||||
@ -88,7 +88,7 @@ func TestCallerValidationType(t *testing.T) {
|
||||
|
||||
rt.ExpectValidateCallerType(builtin.AccountActorCodeID)
|
||||
rt.Call(a.CallerValidation, &CallerValidationArgs{
|
||||
Branch: CallerValidationBranchType,
|
||||
Branch: CallerValidationBranchIsType,
|
||||
Types: []cid.Cid{builtin.AccountActorCodeID},
|
||||
})
|
||||
rt.Verify()
|
||||
|
Loading…
Reference in New Issue
Block a user