Skip to content

Commit

Permalink
Test definitions ready
Browse files Browse the repository at this point in the history
  • Loading branch information
brickpop committed Oct 25, 2024
1 parent adb0993 commit 5f06467
Show file tree
Hide file tree
Showing 7 changed files with 173 additions and 152 deletions.
114 changes: 58 additions & 56 deletions TEST_TREE.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ EmergencyMultisigTest
│ └── It only creates the proposal
├── When calling hashActions
│ ├── It returns the right result
│ └── It reacts to any of the values changing
│ ├── It reacts to any of the values changing
│ └── It same input produces the same output
├── Given The proposal is not created
│ ├── When calling getProposal uncreated
│ │ └── It should return empty values
Expand Down Expand Up @@ -154,14 +155,19 @@ EmergencyMultisigTest
│ ├── When calling hasApproved passed
│ │ └── It hasApproved should return false until approved
│ ├── When calling canExecute and execute with modified data passed
│ │ └── It execute should revert, always
│ └── When calling canExecute and execute passed
│ ├── It canExecute should return true, always
│ ├── It execute should work, always
│ ├── It execute should emit an event, always
│ ├── It execute recreates the proposal on the destination plugin
│ ├── It The parameters of the recreated proposal match the hash of the executed one
│ └── It A ProposalCreated event is emitted on the destination plugin
│ │ ├── It execute should revert with modified metadata
│ │ ├── It execute should revert with modified actions
│ │ └── It execute should work with matching data
│ ├── When calling canExecute and execute passed
│ │ ├── It canExecute should return true, always
│ │ ├── It execute should work, when called by anyone with the actions
│ │ ├── It execute should emit an event, when called by anyone with the actions
│ │ ├── It execute recreates the proposal on the destination plugin
│ │ ├── It The parameters of the recreated proposal match the hash of the executed one
│ │ ├── It A ProposalCreated event is emitted on the destination plugin
│ │ └── It Execution is immediate on the destination plugin
│ └── Given TaikoL1 is incompatible
│ └── It executes successfully, regardless
├── Given The proposal is already executed
│ ├── When calling getProposal executed
│ │ └── It should return the right values
Expand Down Expand Up @@ -373,22 +379,16 @@ MultisigTest
│ │ └── It approve should revert (when unlisted on creation, unappointed now)
│ ├── When calling hasApproved passed
│ │ └── It hasApproved should return false until approved
│ └── When calling canExecute and execute passed
│ ├── It canExecute should return true (when listed on creation, self appointed now)
│ ├── It execute should work (when listed on creation, self appointed now)
│ ├── It execute should emit an event (when listed on creation, self appointed now)
│ ├── It canExecute should return true (when listed on creation, appointing someone else now)
│ ├── It execute should work (when listed on creation, appointing someone else now)
│ ├── It execute should emit an event (when listed on creation, appointing someone else now)
│ ├── It canExecute should return true (when currently appointed by a signer listed on creation)
│ ├── It execute should work (when currently appointed by a signer listed on creation)
│ ├── It execute should emit an event (when currently appointed by a signer listed on creation)
│ ├── It canExecute should return true (when unlisted on creation, unappointed now)
│ ├── It execute should work (when unlisted on creation, unappointed now)
│ ├── It execute should emit an event (when unlisted on creation, unappointed now)
│ ├── It execute recreates the proposal on the destination plugin
│ ├── It The parameters of the recreated proposal match those of the executed one
│ └── It A ProposalCreated event is emitted on the destination plugin
│ ├── When calling canExecute and execute passed
│ │ ├── It canExecute should return true, always
│ │ ├── It execute should work, when called by anyone
│ │ ├── It execute should emit an event, when called by anyone
│ │ ├── It execute recreates the proposal on the destination plugin
│ │ ├── It The parameters of the recreated proposal match those of the executed one
│ │ ├── It The proposal duration on the destination plugin matches the multisig settings
│ │ └── It A ProposalCreated event is emitted on the destination plugin
│ └── Given TaikoL1 is incompatible
│ └── It executes successfully, regardless
├── Given The proposal is already executed
│ ├── When calling getProposal executed
│ │ └── It should return the right values
Expand Down Expand Up @@ -452,8 +452,24 @@ SignerListTest
│ ├── It should emit the SignerListSettingsUpdated event
│ └── Given passing more addresses than supported
│ └── It should revert
├── When calling updateSettings
│ ├── When updateSettings without the permission
│ │ └── It should revert
│ ├── When encryptionRegistry is not compatible
│ │ └── It should revert
│ ├── When setting a minSignerListLength lower than the current list size
│ │ └── It should revert
│ ├── It set the new encryption registry
│ ├── It set the new minSignerListLength
│ └── It should emit a SignerListSettingsUpdated event
├── When calling supportsInterface
│ ├── It does not support the empty interface
│ ├── It supports IERC165Upgradeable
│ ├── It supports IPlugin
│ ├── It supports IProposal
│ └── It supports IMultisig
├── When calling addSigners
│ ├── When addSigners without the permission
│ ├── When adding without the permission
│ │ └── It should revert
│ ├── Given passing more addresses than allowed
│ │ └── It should revert
Expand All @@ -462,8 +478,10 @@ SignerListTest
│ ├── It should append the new addresses to the list
│ └── It should emit the SignersAddedEvent
├── When calling removeSigners
│ ├── When removeSigners without the permission
│ ├── When removing without the permission
│ │ └── It should revert
│ ├── When removing an unlisted address
│ │ └── It should continue gracefully
│ ├── Given removing too many addresses // The new list will be smaller than minSignerListLength
│ │ └── It should revert
│ ├── It should more the given addresses
Expand All @@ -484,16 +502,6 @@ SignerListTest
│ │ └── It returns false
│ └── Given the member is enlisted now
│ └── It returns false
├── When calling updateSettings
│ ├── When updateSettings without the permission
│ │ └── It should revert
│ ├── When encryptionRegistry is not compatible
│ │ └── It should revert
│ ├── When setting a minSignerListLength lower than the current list size
│ │ └── It should revert
│ ├── It set the new encryption registry
│ ├── It set the new minSignerListLength
│ └── It should emit a SignerListSettingsUpdated event
├── When calling resolveEncryptionAccountStatus
│ ├── Given the caller is a listed signer
│ │ ├── It ownerIsListed should be true
Expand All @@ -515,24 +523,18 @@ SignerListTest
│ └── Given the resolved owner is not listed
│ ├── It should return a zero owner
│ └── It should return a zero appointedWallet
├── When calling getEncryptionRecipients
│ ├── Given the encryption registry has no accounts
│ │ ├── It returns an empty list, even with signers
│ │ └── It returns an empty list, without signers
│ └── Given the encryption registry has accounts
│ ├── Given no overlap between registry and signerList // Some are on the encryption registry only and some are on the signerList only
│ │ └── It returns an empty list
│ └── Given some addresses are registered everywhere
│ ├── It returns a list containing the overlapping addresses
│ ├── It the result has the correct resolved addresses // appointed wallets are present, not the owner
│ ├── It result does not contain unregistered addresses
│ ├── It result does not contain unlisted addresses
│ └── It result does not contain non appointed addresses
└── When calling supportsInterface
├── It does not support the empty interface
├── It supports IERC165Upgradeable
├── It supports IPlugin
├── It supports IProposal
└── It supports IMultisig
└── When calling getEncryptionRecipients
├── Given the encryption registry has no accounts
│ ├── It returns an empty list, even with signers
│ └── It returns an empty list, without signers
└── Given the encryption registry has accounts
├── Given no overlap between registry and signerList // Some are on the encryption registry only and some are on the signerList only
│ └── It returns an empty list
└── Given some addresses are registered everywhere
├── It returns a list containing the overlapping addresses
├── It the result has the correct resolved addresses // appointed wallets are present, not the owner
├── It result does not contain unregistered addresses
├── It result does not contain unlisted addresses
└── It result does not contain non appointed addresses
```

15 changes: 12 additions & 3 deletions test/EmergencyMultisigTree.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ contract EmergencyMultisigTest is Test {
function test_WhenCallingHashActions() external {
// It returns the right result
// It reacts to any of the values changing
// It same input produces the same output
vm.skip(true);
}

Expand Down Expand Up @@ -333,17 +334,25 @@ contract EmergencyMultisigTest is Test {
}

function test_WhenCallingCanExecuteAndExecuteWithModifiedDataPassed() external givenTheProposalPassed {
// It execute should revert, always
// It execute should revert with modified metadata
// It execute should revert with modified actions
// It execute should work with matching data
vm.skip(true);
}

function test_WhenCallingCanExecuteAndExecutePassed() external givenTheProposalPassed {
// It canExecute should return true, always
// It execute should work, always
// It execute should emit an event, always
// It execute should work, when called by anyone with the actions
// It execute should emit an event, when called by anyone with the actions
// It execute recreates the proposal on the destination plugin
// It The parameters of the recreated proposal match the hash of the executed one
// It A ProposalCreated event is emitted on the destination plugin
// It Execution is immediate on the destination plugin
vm.skip(true);
}

function test_GivenTaikoL1IsIncompatible() external givenTheProposalPassed {
// It executes successfully, regardless
vm.skip(true);
}

Expand Down
13 changes: 10 additions & 3 deletions test/EmergencyMultisigTree.t.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ EmergencyMultisigTest:
then:
- it: returns the right result
- it: reacts to any of the values changing
- it: same input produces the same output

# Proposal lifecycle

Expand Down Expand Up @@ -238,17 +239,23 @@ EmergencyMultisigTest:
# Execution integrity
- when: calling canExecute and execute with modified data [passed]
then:
- it: execute should revert, always
- it: execute should revert with modified metadata
- it: execute should revert with modified actions
- it: execute should work with matching data
# Execution
- when: calling canExecute and execute [passed]
then:
- it: canExecute should return true, always
- it: execute should work, always
- it: execute should emit an event, always
- it: execute should work, when called by anyone with the actions
- it: execute should emit an event, when called by anyone with the actions
# Proposal forwarding on execution
- it: execute recreates the proposal on the destination plugin
- it: The parameters of the recreated proposal match the hash of the executed one
- it: A ProposalCreated event is emitted on the destination plugin
- it: Execution is immediate on the destination plugin
- given: TaikoL1 is incompatible
then:
- it: executes successfully, regardless

- given: The proposal is already executed
then:
Expand Down
21 changes: 9 additions & 12 deletions test/MultisigTree.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -345,24 +345,21 @@ contract MultisigTest is Test {
}

function test_WhenCallingCanExecuteAndExecutePassed() external givenTheProposalPassed {
// It canExecute should return true (when listed on creation, self appointed now)
// It execute should work (when listed on creation, self appointed now)
// It execute should emit an event (when listed on creation, self appointed now)
// It canExecute should return true (when listed on creation, appointing someone else now)
// It execute should work (when listed on creation, appointing someone else now)
// It execute should emit an event (when listed on creation, appointing someone else now)
// It canExecute should return true (when currently appointed by a signer listed on creation)
// It execute should work (when currently appointed by a signer listed on creation)
// It execute should emit an event (when currently appointed by a signer listed on creation)
// It canExecute should return true (when unlisted on creation, unappointed now)
// It execute should work (when unlisted on creation, unappointed now)
// It execute should emit an event (when unlisted on creation, unappointed now)
// It canExecute should return true, always
// It execute should work, when called by anyone
// It execute should emit an event, when called by anyone
// It execute recreates the proposal on the destination plugin
// It The parameters of the recreated proposal match those of the executed one
// It The proposal duration on the destination plugin matches the multisig settings
// It A ProposalCreated event is emitted on the destination plugin
vm.skip(true);
}

function test_GivenTaikoL1IsIncompatible() external givenTheProposalPassed {
// It executes successfully, regardless
vm.skip(true);
}

modifier givenTheProposalIsAlreadyExecuted() {
_;
}
Expand Down
19 changes: 7 additions & 12 deletions test/MultisigTree.t.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -251,22 +251,17 @@ MultisigTest:
# Execution
- when: calling canExecute and execute [passed]
then:
- it: canExecute should return true (when listed on creation, self appointed now)
- it: execute should work (when listed on creation, self appointed now)
- it: execute should emit an event (when listed on creation, self appointed now)
- it: canExecute should return true (when listed on creation, appointing someone else now)
- it: execute should work (when listed on creation, appointing someone else now)
- it: execute should emit an event (when listed on creation, appointing someone else now)
- it: canExecute should return true (when currently appointed by a signer listed on creation)
- it: execute should work (when currently appointed by a signer listed on creation)
- it: execute should emit an event (when currently appointed by a signer listed on creation)
- it: canExecute should return true (when unlisted on creation, unappointed now)
- it: execute should work (when unlisted on creation, unappointed now)
- it: execute should emit an event (when unlisted on creation, unappointed now)
- it: canExecute should return true, always
- it: execute should work, when called by anyone
- it: execute should emit an event, when called by anyone
# Proposal forwarding on execution
- it: execute recreates the proposal on the destination plugin
- it: The parameters of the recreated proposal match those of the executed one
- it: The proposal duration on the destination plugin matches the multisig settings
- it: A ProposalCreated event is emitted on the destination plugin
- given: TaikoL1 is incompatible
then:
- it: executes successfully, regardless

- given: The proposal is already executed
then:
Expand Down
Loading

0 comments on commit 5f06467

Please sign in to comment.