Skip to content
This repository has been archived by the owner on Nov 27, 2024. It is now read-only.

Commit

Permalink
test: add integration test for instance-to-instance interaction (#481)
Browse files Browse the repository at this point in the history
**Motivation:**

Before deployment, we want to test common workflows such as a Llama
instance delegating responsibility to authorize additional strategy
logics to another instance and the ability to instantly execute actions
when the strategy permits.

**Modifications:**

- Adding tests for atomic execution strategies. There are multiple ways
to create, queue, and execute actions in a single block. A multi-call
contract can be used with `createActionBySig` or we can deploy a custom
contract for this purpose.
- Added an integration test that walks through the entire workflow of
deploying two instances that have a working relationship. In this
example one instance can propose "updating" (authorizing additional
strategy logics) another instance. This test walks through a realistic
example on how instances could use scripts to simplify steps.

**Result:**

A more robust test suite as we're nearing launch.
  • Loading branch information
AustinGreen authored Aug 17, 2023
1 parent 820fc00 commit 77d065d
Show file tree
Hide file tree
Showing 8 changed files with 801 additions and 0 deletions.
77 changes: 77 additions & 0 deletions script/input/11155111/llamaInstanceConfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{
"comment": "The factory address is from https://gist.github.com/mds1/da90e8a4db922fd684dac88bb4c08f92#attempt-3. The strategy logic is the `LlamaRelativeQuantityQuorum` contract.",
"factory": "0xAFF71a204beD7342d21827a607496f5f1806777F",
"instanceName": "Llama",
"instanceColor": "#6A45EC",
"instanceLogo": "<g fill='#6A45EC'><path d='M44.876 462c-3.783 0-6.883-.881-9.3-2.645-2.384-1.794-3.576-4.344-3.576-7.65 0-.692.08-1.542.238-2.55.414-2.266 1.002-4.989 1.765-8.169C36.165 432.329 41.744 428 50.742 428c2.448 0 4.641.409 6.58 1.228 1.94.787 3.466 1.983 4.579 3.589 1.112 1.574 1.669 3.463 1.669 5.666 0 .661-.08 1.496-.239 2.503a106.077 106.077 0 0 1-1.716 8.169c-1.113 4.314-3.037 7.54-5.77 9.681-2.735 2.109-6.39 3.164-10.97 3.164Zm.668-6.8c1.78 0 3.29-.52 4.53-1.558 1.272-1.039 2.178-2.629 2.718-4.77.731-2.959 1.288-5.541 1.67-7.744.127-.661.19-1.338.19-2.031 0-2.865-1.51-4.297-4.53-4.297-1.78 0-3.307.519-4.578 1.558-1.24 1.039-2.13 2.629-2.671 4.77-.572 2.109-1.145 4.691-1.717 7.744-.127.63-.19 1.291-.19 1.983 0 2.897 1.526 4.345 4.578 4.345ZM68.409 461.528c-.35 0-.62-.11-.81-.331a1.12 1.12 0 0 1-.144-.85l6.581-30.694c.064-.347.239-.63.525-.85.286-.221.588-.331.906-.331h12.685c3.529 0 6.358.724 8.489 2.172 2.161 1.449 3.242 3.542 3.242 6.281 0 .787-.095 1.605-.286 2.455-.795 3.621-2.4 6.297-4.816 8.028-2.385 1.732-5.66 2.597-9.824 2.597h-6.438l-2.194 10.342a1.35 1.35 0 0 1-.524.85c-.287.221-.588.331-.907.331H68.41Zm16.882-18.039c1.335 0 2.495-.362 3.48-1.086 1.018-.724 1.686-1.763 2.004-3.117a8.185 8.185 0 0 0 .143-1.417c0-.913-.27-1.605-.81-2.077-.541-.504-1.463-.756-2.767-.756H81.62l-1.813 8.453h5.485ZM110.628 461.528c-.349 0-.62-.11-.81-.331-.191-.252-.255-.535-.191-.85l5.293-24.461h-8.488c-.35 0-.62-.11-.811-.33a1.12 1.12 0 0 1-.143-.851l1.097-5.052c.063-.347.238-.63.524-.85.286-.221.588-.331.906-.331h25.657c.35 0 .62.11.811.331.127.189.19.378.19.566a.909.909 0 0 1-.047.284l-1.097 5.052c-.064.347-.239.63-.525.851-.254.22-.556.33-.906.33h-8.441l-5.293 24.461c-.064.346-.239.63-.525.85-.286.221-.588.331-.906.331h-6.295ZM135.88 461.528c-.35 0-.62-.11-.811-.331a1.016 1.016 0 0 1-.191-.85l6.629-30.694a1.35 1.35 0 0 1 .525-.85c.286-.221.588-.331.906-.331h6.438c.349 0 .62.11.81.331.128.189.191.378.191.566a.882.882 0 0 1-.048.284l-6.581 30.694c-.063.346-.238.63-.524.85-.286.221-.588.331-.906.331h-6.438ZM154.038 461.528c-.349 0-.62-.11-.81-.331-.191-.22-.255-.504-.191-.85l6.581-30.694c.064-.347.238-.63.524-.85.287-.221.605-.331.954-.331h5.151c.763 0 1.255.346 1.478 1.039l5.198 14.875 11.588-14.875c.159-.252.382-.488.668-.708.318-.221.7-.331 1.145-.331h5.198c.349 0 .62.11.81.331.127.189.191.378.191.566a.882.882 0 0 1-.048.284l-6.581 30.694c-.063.346-.238.63-.524.85-.286.221-.588.331-.906.331h-5.771c-.349 0-.62-.11-.81-.331a1.118 1.118 0 0 1-.143-.85l3.719-17.425-7.296 9.586c-.318.347-.62.614-.906.803-.286.189-.62.283-1.002.283h-2.479c-.668 0-1.129-.362-1.383-1.086l-3.386-10.011-3.815 17.85c-.064.346-.239.63-.525.85-.286.221-.588.331-.906.331h-5.723ZM196.132 461.528c-.35 0-.62-.11-.81-.331-.191-.252-.255-.535-.191-.85l6.628-30.694a1.35 1.35 0 0 1 .525-.85c.285-.221.588-.331.906-.331h6.438c.35 0 .62.11.811.331.127.189.19.378.19.566a.88.88 0 0 1-.047.284l-6.581 30.694c-.063.346-.238.63-.525.85a1.46 1.46 0 0 1-.907.331h-6.437ZM226.07 462c-2.798 0-5.198-.378-7.201-1.133-1.972-.756-3.466-1.763-4.483-3.022-.986-1.26-1.479-2.661-1.479-4.203 0-.252.033-.63.095-1.134.065-.283.193-.519.383-.708.223-.189.476-.283.763-.283h6.103c.383 0 .668.063.859.188.222.126.445.347.668.662.223.818.731 1.495 1.526 2.03.827.535 1.955.803 3.385.803 1.812 0 3.276-.283 4.388-.85 1.113-.567 1.781-1.338 2.002-2.314a2.42 2.42 0 0 0 .048-.566c0-.788-.491-1.401-1.477-1.842-.986-.473-2.798-1.023-5.437-1.653-3.084-.661-5.421-1.653-7.011-2.975-1.589-1.354-2.383-3.117-2.383-5.289 0-.755.095-1.527.286-2.314.635-2.928 2.21-5.226 4.72-6.894 2.544-1.669 5.818-2.503 9.825-2.503 2.415 0 4.563.425 6.438 1.275 1.875.85 3.321 1.936 4.34 3.258 1.049 1.291 1.572 2.582 1.572 3.873 0 .377-.015.645-.047.802-.063.284-.206.52-.429.709a.975.975 0 0 1-.715.283h-6.391c-.698 0-1.176-.268-1.429-.803-.033-.724-.415-1.338-1.146-1.841-.731-.504-1.685-.756-2.861-.756-1.399 0-2.559.252-3.482.756-.889.503-1.447 1.243-1.668 2.219a3.172 3.172 0 0 0-.049.614c0 .755.445 1.385 1.336 1.889.922.472 2.528.96 4.816 1.464 3.562.692 6.153 1.684 7.774 2.975 1.653 1.29 2.479 3.006 2.479 5.147 0 .724-.095 1.511-.286 2.361-.698 3.211-2.4 5.651-5.103 7.32-2.669 1.636-6.246 2.455-10.729 2.455ZM248.515 461.528c-.35 0-.62-.11-.81-.331-.191-.22-.255-.504-.191-.85l6.581-30.694c.063-.347.238-.63.525-.85.286-.221.604-.331.954-.331h5.149c.763 0 1.256.346 1.479 1.039l5.199 14.875 11.587-14.875c.16-.252.382-.488.668-.708.318-.221.699-.331 1.144-.331h5.199c.35 0 .62.11.811.331.127.189.19.378.19.566a.856.856 0 0 1-.048.284l-6.58 30.694c-.065.346-.24.63-.526.85a1.456 1.456 0 0 1-.906.331h-5.769c-.351 0-.621-.11-.811-.331a1.109 1.109 0 0 1-.143-.85l3.719-17.425-7.296 9.586c-.318.347-.62.614-.906.803a1.776 1.776 0 0 1-1.001.283h-2.481c-.668 0-1.128-.362-1.382-1.086l-3.386-10.011-3.815 17.85a1.36 1.36 0 0 1-.525.85c-.286.221-.588.331-.906.331h-5.723Z'/></g>",
"strategyLogic": "0xdF0a44747120C1BE2B0b4bDC4B9759218dFA6379",
"accountLogic": "0x2b0C5DDD817cE1F3dACC0CA7613E2DF038d924C4",
"initialStrategies": [
{
"approvalPeriod": 172800,
"approvalRole": 1,
"disapprovalRole": 1,
"expirationPeriod": 691200,
"forceApprovalRoles": [],
"forceDisapprovalRoles": [],
"isFixedLengthApprovalPeriod": false,
"minApprovalPct": 5000,
"minDisapprovalPct": 10100,
"queuingPeriod": 0
},
{
"approvalPeriod": 0,
"approvalRole": 1,
"disapprovalRole": 1,
"expirationPeriod": 86400,
"forceApprovalRoles": [],
"forceDisapprovalRoles": [],
"isFixedLengthApprovalPeriod": false,
"minApprovalPct": 0,
"minDisapprovalPct": 1000,
"queuingPeriod": 691200
},
{
"approvalPeriod": 0,
"approvalRole": 1,
"disapprovalRole": 1,
"expirationPeriod": 100,
"forceApprovalRoles": [],
"forceDisapprovalRoles": [],
"isFixedLengthApprovalPeriod": false,
"minApprovalPct": 0,
"minDisapprovalPct": 0,
"queuingPeriod": 0
}
],
"initialAccounts": [
{
"name": "Treasury"
}
],
"initialRoleDescriptions": ["Core Team"],
"initialRoleHolders": [
{
"comment": "This assigns role #1 llamaAlice.",
"expiration": 18446744073709551615,
"policyholder": "0xCF468ee5E8eCfaCE78851da762E850Ed0Fc7E7A0",
"quantity": 1,
"role": 1
},
{
"comment": "This assigns role #1 llamaBob.",
"expiration": 18446744073709551615,
"policyholder": "0x9E2962bb94b767Dea9e52b5D73b71394d373CC60",
"quantity": 1,
"role": 1
},
{
"comment": "This assigns role #1 llamaCharlie.",
"expiration": 18446744073709551615,
"policyholder": "0x85Ff2f6d6D05AA7F94A0c69F2cEecEd6F21C5E6B",
"quantity": 1,
"role": 1
}
],
"initialRolePermissions": []
}
91 changes: 91 additions & 0 deletions script/input/31337/llamaInstanceConfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
{
"comment": "These addresses are what you get when you run the DeployLlamaFactory script test. The strategy logic is the LlamaRelativeQuantityQuorum contract.",
"factory": "0xDEb1E9a6Be7Baf84208BB6E10aC9F9bbE1D70809",
"instanceName": "Llama",
"instanceColor": "#6A45EC",
"instanceLogo": "<g fill='#6A45EC'><path d='M44.876 462c-3.783 0-6.883-.881-9.3-2.645-2.384-1.794-3.576-4.344-3.576-7.65 0-.692.08-1.542.238-2.55.414-2.266 1.002-4.989 1.765-8.169C36.165 432.329 41.744 428 50.742 428c2.448 0 4.641.409 6.58 1.228 1.94.787 3.466 1.983 4.579 3.589 1.112 1.574 1.669 3.463 1.669 5.666 0 .661-.08 1.496-.239 2.503a106.077 106.077 0 0 1-1.716 8.169c-1.113 4.314-3.037 7.54-5.77 9.681-2.735 2.109-6.39 3.164-10.97 3.164Zm.668-6.8c1.78 0 3.29-.52 4.53-1.558 1.272-1.039 2.178-2.629 2.718-4.77.731-2.959 1.288-5.541 1.67-7.744.127-.661.19-1.338.19-2.031 0-2.865-1.51-4.297-4.53-4.297-1.78 0-3.307.519-4.578 1.558-1.24 1.039-2.13 2.629-2.671 4.77-.572 2.109-1.145 4.691-1.717 7.744-.127.63-.19 1.291-.19 1.983 0 2.897 1.526 4.345 4.578 4.345ZM68.409 461.528c-.35 0-.62-.11-.81-.331a1.12 1.12 0 0 1-.144-.85l6.581-30.694c.064-.347.239-.63.525-.85.286-.221.588-.331.906-.331h12.685c3.529 0 6.358.724 8.489 2.172 2.161 1.449 3.242 3.542 3.242 6.281 0 .787-.095 1.605-.286 2.455-.795 3.621-2.4 6.297-4.816 8.028-2.385 1.732-5.66 2.597-9.824 2.597h-6.438l-2.194 10.342a1.35 1.35 0 0 1-.524.85c-.287.221-.588.331-.907.331H68.41Zm16.882-18.039c1.335 0 2.495-.362 3.48-1.086 1.018-.724 1.686-1.763 2.004-3.117a8.185 8.185 0 0 0 .143-1.417c0-.913-.27-1.605-.81-2.077-.541-.504-1.463-.756-2.767-.756H81.62l-1.813 8.453h5.485ZM110.628 461.528c-.349 0-.62-.11-.81-.331-.191-.252-.255-.535-.191-.85l5.293-24.461h-8.488c-.35 0-.62-.11-.811-.33a1.12 1.12 0 0 1-.143-.851l1.097-5.052c.063-.347.238-.63.524-.85.286-.221.588-.331.906-.331h25.657c.35 0 .62.11.811.331.127.189.19.378.19.566a.909.909 0 0 1-.047.284l-1.097 5.052c-.064.347-.239.63-.525.851-.254.22-.556.33-.906.33h-8.441l-5.293 24.461c-.064.346-.239.63-.525.85-.286.221-.588.331-.906.331h-6.295ZM135.88 461.528c-.35 0-.62-.11-.811-.331a1.016 1.016 0 0 1-.191-.85l6.629-30.694a1.35 1.35 0 0 1 .525-.85c.286-.221.588-.331.906-.331h6.438c.349 0 .62.11.81.331.128.189.191.378.191.566a.882.882 0 0 1-.048.284l-6.581 30.694c-.063.346-.238.63-.524.85-.286.221-.588.331-.906.331h-6.438ZM154.038 461.528c-.349 0-.62-.11-.81-.331-.191-.22-.255-.504-.191-.85l6.581-30.694c.064-.347.238-.63.524-.85.287-.221.605-.331.954-.331h5.151c.763 0 1.255.346 1.478 1.039l5.198 14.875 11.588-14.875c.159-.252.382-.488.668-.708.318-.221.7-.331 1.145-.331h5.198c.349 0 .62.11.81.331.127.189.191.378.191.566a.882.882 0 0 1-.048.284l-6.581 30.694c-.063.346-.238.63-.524.85-.286.221-.588.331-.906.331h-5.771c-.349 0-.62-.11-.81-.331a1.118 1.118 0 0 1-.143-.85l3.719-17.425-7.296 9.586c-.318.347-.62.614-.906.803-.286.189-.62.283-1.002.283h-2.479c-.668 0-1.129-.362-1.383-1.086l-3.386-10.011-3.815 17.85c-.064.346-.239.63-.525.85-.286.221-.588.331-.906.331h-5.723ZM196.132 461.528c-.35 0-.62-.11-.81-.331-.191-.252-.255-.535-.191-.85l6.628-30.694a1.35 1.35 0 0 1 .525-.85c.285-.221.588-.331.906-.331h6.438c.35 0 .62.11.811.331.127.189.19.378.19.566a.88.88 0 0 1-.047.284l-6.581 30.694c-.063.346-.238.63-.525.85a1.46 1.46 0 0 1-.907.331h-6.437ZM226.07 462c-2.798 0-5.198-.378-7.201-1.133-1.972-.756-3.466-1.763-4.483-3.022-.986-1.26-1.479-2.661-1.479-4.203 0-.252.033-.63.095-1.134.065-.283.193-.519.383-.708.223-.189.476-.283.763-.283h6.103c.383 0 .668.063.859.188.222.126.445.347.668.662.223.818.731 1.495 1.526 2.03.827.535 1.955.803 3.385.803 1.812 0 3.276-.283 4.388-.85 1.113-.567 1.781-1.338 2.002-2.314a2.42 2.42 0 0 0 .048-.566c0-.788-.491-1.401-1.477-1.842-.986-.473-2.798-1.023-5.437-1.653-3.084-.661-5.421-1.653-7.011-2.975-1.589-1.354-2.383-3.117-2.383-5.289 0-.755.095-1.527.286-2.314.635-2.928 2.21-5.226 4.72-6.894 2.544-1.669 5.818-2.503 9.825-2.503 2.415 0 4.563.425 6.438 1.275 1.875.85 3.321 1.936 4.34 3.258 1.049 1.291 1.572 2.582 1.572 3.873 0 .377-.015.645-.047.802-.063.284-.206.52-.429.709a.975.975 0 0 1-.715.283h-6.391c-.698 0-1.176-.268-1.429-.803-.033-.724-.415-1.338-1.146-1.841-.731-.504-1.685-.756-2.861-.756-1.399 0-2.559.252-3.482.756-.889.503-1.447 1.243-1.668 2.219a3.172 3.172 0 0 0-.049.614c0 .755.445 1.385 1.336 1.889.922.472 2.528.96 4.816 1.464 3.562.692 6.153 1.684 7.774 2.975 1.653 1.29 2.479 3.006 2.479 5.147 0 .724-.095 1.511-.286 2.361-.698 3.211-2.4 5.651-5.103 7.32-2.669 1.636-6.246 2.455-10.729 2.455ZM248.515 461.528c-.35 0-.62-.11-.81-.331-.191-.22-.255-.504-.191-.85l6.581-30.694c.063-.347.238-.63.525-.85.286-.221.604-.331.954-.331h5.149c.763 0 1.256.346 1.479 1.039l5.199 14.875 11.587-14.875c.16-.252.382-.488.668-.708.318-.221.699-.331 1.144-.331h5.199c.35 0 .62.11.811.331.127.189.19.378.19.566a.856.856 0 0 1-.048.284l-6.58 30.694c-.065.346-.24.63-.526.85a1.456 1.456 0 0 1-.906.331h-5.769c-.351 0-.621-.11-.811-.331a1.109 1.109 0 0 1-.143-.85l3.719-17.425-7.296 9.586c-.318.347-.62.614-.906.803a1.776 1.776 0 0 1-1.001.283h-2.481c-.668 0-1.128-.362-1.382-1.086l-3.386-10.011-3.815 17.85a1.36 1.36 0 0 1-.525.85c-.286.221-.588.331-.906.331h-5.723Z'/></g>",
"strategyLogic": "0x416C42991d05b31E9A6dC209e91AD22b79D87Ae6",
"accountLogic": "0xDB8cFf278adCCF9E9b5da745B44E754fC4EE3C76",
"initialStrategies": [
{
"approvalPeriod": 172800,
"approvalRole": 1,
"disapprovalRole": 1,
"expirationPeriod": 691200,
"forceApprovalRoles": [],
"forceDisapprovalRoles": [],
"isFixedLengthApprovalPeriod": false,
"minApprovalPct": 5000,
"minDisapprovalPct": 10100,
"queuingPeriod": 0
},
{
"approvalPeriod": 0,
"approvalRole": 1,
"disapprovalRole": 1,
"expirationPeriod": 86400,
"forceApprovalRoles": [],
"forceDisapprovalRoles": [],
"isFixedLengthApprovalPeriod": false,
"minApprovalPct": 0,
"minDisapprovalPct": 1000,
"queuingPeriod": 691200
},
{
"approvalPeriod": 0,
"approvalRole": 1,
"disapprovalRole": 1,
"expirationPeriod": 100,
"forceApprovalRoles": [],
"forceDisapprovalRoles": [],
"isFixedLengthApprovalPeriod": false,
"minApprovalPct": 0,
"minDisapprovalPct": 10100,
"queuingPeriod": 0
}
],
"initialAccounts": [
{
"name": "Treasury"
}
],
"initialRoleDescriptions": ["Core Team"],
"initialRoleHolders": [
{
"comment": "This assigns role #1 llamaAlice.",
"expiration": 18446744073709551615,
"policyholder": "0x412e8b18F7263B1cAFF489f3ccC873424E438101",
"quantity": 1,
"role": 1
},
{
"comment": "This assigns role #1 llamaBob.",
"expiration": 18446744073709551615,
"policyholder": "0xDF01c61Fbf37055Fb4ff895393b27857f412236F",
"quantity": 1,
"role": 1
},
{
"comment": "This assigns role #1 llamaCharlie.",
"expiration": 18446744073709551615,
"policyholder": "0xc484b0CB07a9585d17a047F9AE068c34F5A5686f",
"quantity": 1,
"role": 1
},
{
"comment": "This assigns role #1 llamaDale.",
"expiration": 18446744073709551615,
"policyholder": "0x134b822179CcC24b89Fe82fDd8F914a2b141f935",
"quantity": 1,
"role": 1
},
{
"comment": "This assigns role #1 llamaErica.",
"expiration": 18446744073709551615,
"policyholder": "0x4664246b589528C7d931b90988419F581943B20C",
"quantity": 1,
"role": 1
}
],
"initialRolePermissions": []
}
Loading

0 comments on commit 77d065d

Please sign in to comment.