Skip to content
This repository has been archived by the owner on Aug 22, 2023. It is now read-only.

test: add actor deletion test vectors #92

Merged
merged 10 commits into from
Sep 2, 2020
Merged

Conversation

alanshaw
Copy link
Member

@alanshaw alanshaw commented Sep 1, 2020

This PR adds tests for actor deletion.

It adds a method to the chaos actor allowing it to delete itself.

...and adds test vectors for:

  • Successful deletion of actor with zero balance
  • Successful deletion of actor with non-zero balance, with transfer to beneficiary
  • Failure to delete actor with non zero balance and beneficiary is unknown
  • Failure to delete actor with non zero balance and beneficiary is calling actor

resolves #14

ID: "fail-delete-w-balance-and-self-beneficiary",
Version: "v1",
Desc: "fails when actor with non-zero balance is deleted but beneficiary is the calling actor",
Comment: "should abort if the beneficiary is the calling actor, see https://github.com/filecoin-project/specs-actors/blob/bcd83e8eb0a98b684851e574a2bd8d4130e21a51/actors/runtime/runtime.go#L117",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ZenGround0 @anorth 🙏 can you confirm what the exit code should be? My guess would be SysErrorIllegalArgument based on https://github.com/filecoin-project/specs-actors/blob/master/actors/runtime/exitcode/reserved.go#L48?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SysErrorIllegalArgument sounds perfect

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// Desc: "fails when actor with non-zero balance is deleted but beneficiary address is unknown",
// },
// Selector: Selector{"chaos_actor": "true"},
// Func: deleteActorWithBeneficiary(big.NewInt(50), MustNewSECP256K1Addr("!👹*_👹!"), exitcode.SysErrorIllegalActor),
Copy link
Member Author

@alanshaw alanshaw Sep 1, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ZenGround0 @anorth can you confirm that this shouldn't cause a fatal panic and instead should abort and return an SysErrorIllegalActor exit code?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you confirm that this shouldn't cause a fatal panic and instead should abort

Looks like it. FYI @magik6k

Seems like a fine exit code

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@anorth
Copy link
Member

anorth commented Sep 2, 2020

Roll with those suggestions.

We could also consider changing the defined behaviour to burn the funds if the beneficiary is either the actor itself, or an unresolvable ID- or Actor- address (i.e. still allow a pubkey beneficiary). Since we control all the callers of DeleteActor right now and are pretty sure they won't exercise this, it's not critical to decide now, and aborting is fine.

Copy link
Member

@raulk raulk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alanshaw This LGTM so far! A few comments. Re-request another review from me when you're done adjusting based on Wyatt's and Alex's feedback!

gen/builders/asserter.go Show resolved Hide resolved
gen/builders/asserter.go Show resolved Hide resolved
gen/suites/actor_deletion/main.go Outdated Show resolved Hide resolved
gen/suites/actor_deletion/main.go Outdated Show resolved Hide resolved
gen/suites/actor_deletion/main.go Outdated Show resolved Hide resolved
gen/suites/actor_deletion/main.go Outdated Show resolved Hide resolved
@alanshaw alanshaw requested a review from raulk September 2, 2020 11:07
chaos/actor.go Outdated Show resolved Hide resolved
gen/suites/actor_deletion/main.go Show resolved Hide resolved
Alan Shaw and others added 3 commits September 2, 2020 14:56
@alanshaw alanshaw merged commit 91a04a4 into master Sep 2, 2020
@alanshaw alanshaw deleted the test/actor-deletion branch September 2, 2020 14:00
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Test behaviour of DeleteActor and beneficiary
4 participants