Skip to content

Commit

Permalink
more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
liav-certora committed Dec 19, 2024
1 parent 1dc009a commit 1671c06
Show file tree
Hide file tree
Showing 4 changed files with 202 additions and 9 deletions.
21 changes: 12 additions & 9 deletions Quorum/auto_report/create_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,28 @@ def parse_args() -> argparse.Namespace:
return parser.parse_args()


def main():
args = parse_args()

pprinter.pretty_print(f'Generating a report using template in {args.template}', pprinter.Colors.INFO)
env = Environment(loader=FileSystemLoader(args.template.parent))
def create_report(proposal_id: int, template: Path):
pprinter.pretty_print(f'Generating a report using template in {template}', pprinter.Colors.INFO)
env = Environment(loader=FileSystemLoader(template.parent))
env.globals.update(zip=zip)
template = env.get_template(args.template.name)
template = env.get_template(template.name)

pprinter.pretty_print(f'Retrieving tag information for proposal {args.proposal_id}', pprinter.Colors.INFO)
tags = aave_tags.get_aave_tags(args.proposal_id)
pprinter.pretty_print(f'Retrieving tag information for proposal {proposal_id}', pprinter.Colors.INFO)
tags = aave_tags.get_aave_tags(proposal_id)
pprinter.pretty_print(f'Tag information retrieved', pprinter.Colors.INFO)

report = template.render(tags)

with open((report_path:=f'v3-{args.proposal_id}.md'), 'w') as f:
with open((report_path:=f'v3-{proposal_id}.md'), 'w') as f:
f.write(report)

pprinter.pretty_print(f'Created report at {report_path}.', pprinter.Colors.SUCCESS)


def main():
args = parse_args()
create_report(args.proposal_id, args.template)


if __name__ == '__main__':
main()
159 changes: 159 additions & 0 deletions Quorum/tests/expected/test_auto_report/v3-132.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
# Proposal 132. Aave v3.1 upgrade

### Voting Link
[Link to voting page](https://vote.onaave.com/proposal/?proposalId=132)

### Governance Forum Discussions
[Link to forum discussions](https://governance.aave.com/t/bgd-aave-v3-1-and-aave-origin/17305)

### Payloads

* Ethereum - [proposal payloads](https://etherscan.io/address/0x3bf13188225532Dbd685E2c61b78764F97082D7C)

* Polygon - [proposal payloads](https://polygonscan.com/address/0xA90ea303522c0df5028687aF2aD6D9231325Abe1)

* Avalanche - [proposal payloads](https://snowtrace.io/address/0x790B67496cB43b25527451Ff8f954e9198EC9bAb)

* OP Mainnet - [proposal payloads](https://optimistic.etherscan.io/address/0x9F6C2BC9464213b3C71B2b19A80fc3d56a48342F)

* Arbitrum One - [proposal payloads](https://arbiscan.io/address/0x9F6C2BC9464213b3C71B2b19A80fc3d56a48342F)

* Metis - [proposal payloads](https://explorer.metis.io/address/0x9720ce2Cd5742197D6793723B256282a8920Ed86)

* Base - [proposal payloads](https://basescan.org/address/0x0Ec40C6dA8C7fc6E39BBCe8c6f24c894389a69A7)

* Gnosis - [proposal payloads](https://gnosisscan.io/address/0xb7F0202604eF32AaAbdD79053a8777e928EdF70E)

* Scroll - [proposal payloads](https://scrollscan.com/address/0xa91a89a230568A86FC3E72610baeB0D917453790)

* BNB Smart Chain - [proposal payloads](https://bscscan.com/address/0xCa6dFc503f7024CB599Be40628232D74393C5d70)



## Certora Analysis

### Proposal Types
{**TODO: Choose types from the following list.**}
* :scroll: :small_red_triangle: Contract upgrades
* :moneybag: :receipt: Asset transfers
* :handshake: Permission granting and revoking
* :wrench: :bar_chart: Configuration updates
* :gem: :new: Listing new assets

### Context
{**TODO: Write context.**}

### Proposal Creation
Transaction: [0x423b2b381444d3a8a347536eaf643da3c7bc5e764ff4881863e012305d9542ba](https://etherscan.io/tx/0x423b2b381444d3a8a347536eaf643da3c7bc5e764ff4881863e012305d9542ba)
- `proposalId`: 132
- `creator`: 0xf71fc92e2949ccF6A5Fd369a0b402ba80Bc61E02
- `accessLevel`: 1
- `ipfsHash`: 0x392c2cdfd6c2f57a7be73b170d472b4b8e6c662cb941451b449a0b2988ab3d57

**`createProposal()` Parameters**
```
{
"payloads": [
{
"chain": "1",
"accessLevel": 1,
"payloadsController": "0xdAbad81aF85554E9ae636395611C58F7eC1aAEc5",
"payloadId": 146
},
{
"chain": "137",
"accessLevel": 1,
"payloadsController": "0x401B5D0294E23637c18fcc38b1Bca814CDa2637C",
"payloadId": 71
},
{
"chain": "43114",
"accessLevel": 1,
"payloadsController": "0x1140CB7CAfAcC745771C2Ea31e7B5C653c5d0B80",
"payloadId": 42
},
{
"chain": "10",
"accessLevel": 1,
"payloadsController": "0x0E1a3Af1f9cC76A62eD31eDedca291E63632e7c4",
"payloadId": 38
},
{
"chain": "42161",
"accessLevel": 1,
"payloadsController": "0x89644CA1bB8064760312AE4F03ea41b05dA3637C",
"payloadId": 39
},
{
"chain": "1088",
"accessLevel": 1,
"payloadsController": "0x2233F8A66A728FBa6E1dC95570B25360D07D5524",
"payloadId": 19
},
{
"chain": "8453",
"accessLevel": 1,
"payloadsController": "0x2DC219E716793fb4b21548C0f009Ba3Af753ab01",
"payloadId": 25
},
{
"chain": "100",
"accessLevel": 1,
"payloadsController": "0x9A1F491B86D09fC1484b5fab10041B189B60756b",
"payloadId": 23
},
{
"chain": "534352",
"accessLevel": 1,
"payloadsController": "0x6b6B41c0f8C223715f712BE83ceC3c37bbfDC3fE",
"payloadId": 15
},
{
"chain": "56",
"accessLevel": 1,
"payloadsController": "0xE5EF2Dd06755A97e975f7E282f828224F2C3e627",
"payloadId": 17
}
],
"votingPortal": "0x9b24C168d6A76b5459B1d47071a54962a4df36c3",
"ipfsHash": "0x392c2cdfd6c2f57a7be73b170d472b4b8e6c662cb941451b449a0b2988ab3d57"
}
```

### Aave Seatbelt Report
**Proposal Report**
[Link to Seatbelt proposal report](https://github.com/bgd-labs/seatbelt-gov-v3/blob/main/reports/proposals/132.md)

**Payload Reports**

* Ethereum - [payload Seatbelt report](https://github.com/bgd-labs/seatbelt-gov-v3/blob/main/reports/payloads/1/0xdAbad81aF85554E9ae636395611C58F7eC1aAEc5/146.md)

* Polygon - [payload Seatbelt report](https://github.com/bgd-labs/seatbelt-gov-v3/blob/main/reports/payloads/137/0x401B5D0294E23637c18fcc38b1Bca814CDa2637C/71.md)

* Avalanche - [payload Seatbelt report](https://github.com/bgd-labs/seatbelt-gov-v3/blob/main/reports/payloads/43114/0x1140CB7CAfAcC745771C2Ea31e7B5C653c5d0B80/42.md)

* OP Mainnet - [payload Seatbelt report](https://github.com/bgd-labs/seatbelt-gov-v3/blob/main/reports/payloads/10/0x0E1a3Af1f9cC76A62eD31eDedca291E63632e7c4/38.md)

* Arbitrum One - [payload Seatbelt report](https://github.com/bgd-labs/seatbelt-gov-v3/blob/main/reports/payloads/42161/0x89644CA1bB8064760312AE4F03ea41b05dA3637C/39.md)

* Metis - [payload Seatbelt report](https://github.com/bgd-labs/seatbelt-gov-v3/blob/main/reports/payloads/1088/0x2233F8A66A728FBa6E1dC95570B25360D07D5524/19.md)

* Base - [payload Seatbelt report](https://github.com/bgd-labs/seatbelt-gov-v3/blob/main/reports/payloads/8453/0x2DC219E716793fb4b21548C0f009Ba3Af753ab01/25.md)

* Gnosis - [payload Seatbelt report](https://github.com/bgd-labs/seatbelt-gov-v3/blob/main/reports/payloads/100/0x9A1F491B86D09fC1484b5fab10041B189B60756b/23.md)

* Scroll - [payload Seatbelt report](https://github.com/bgd-labs/seatbelt-gov-v3/blob/main/reports/payloads/534352/0x6b6B41c0f8C223715f712BE83ceC3c37bbfDC3fE/15.md)

* BNB Smart Chain - [payload Seatbelt report](https://github.com/bgd-labs/seatbelt-gov-v3/blob/main/reports/payloads/56/0xE5EF2Dd06755A97e975f7E282f828224F2C3e627/17.md)


### Technical Analysis
{**TODO: Write technical analysis.**}

The proposal is consistent with the description on both Snapshot and the governance forum.

### Certora validations
* :white_check_mark: The code on the proposal payload corresponds to the proposal specification.
* :white_check_mark: The proposal includes a proper tests suite, checking all necessary post-conditions.
* :white_check_mark: BGD reviewed the payload before the proposal was submitted.
* :white_check_mark: Certora reviewed the procedure followed to submit the proposal.
23 changes: 23 additions & 0 deletions Quorum/tests/test_auto_report.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import pytest

import Quorum.tests.conftest as conftest

import Quorum.auto_report.create_report as create_report

from pathlib import Path


EXPECTED_DIR = conftest.EXPECTED_DIR / 'test_auto_report'


def test_auto_report():
with open(EXPECTED_DIR / 'v3-132.md') as f:
expected = f.read()

create_report.create_report(132, create_report.DEFAULT_TEMPLATE_PATH)
with open(Path('v3-132.md')) as f:
actual = f.read()

assert expected == actual

Path('v3-132.md').unlink()
8 changes: 8 additions & 0 deletions Quorum/tests/test_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,11 @@ def test_price_feed(source_codes: list[SourceCode], tmp_output_path: Path):
price_feed_check.verify_price_feed()

assert sorted([p.name for p in price_feed_check.check_folder.iterdir()]) == ['AaveV2Ethereum']


@pytest.mark.parametrize('source_codes', ['ETH/0xAD6c03BF78A3Ee799b86De5aCE32Bb116eD24637'], indirect=True)
def test_new_listing(source_codes: list[SourceCode], tmp_output_path: Path):
new_listing_check = Checks.NewListingCheck('Aave', Chain.ETH, '', source_codes)
new_listing_check.new_listing_check()

assert next(new_listing_check.check_folder.iterdir(), None) is None

0 comments on commit 1671c06

Please sign in to comment.