CarmineOptions / konoha

A toolkit for DAO-like governance on Starknet
Apache License 2.0
23 stars 33 forks source link

ODHack: Modular integration tests #95

Open tensojka opened 1 month ago

tensojka commented 1 month ago

We need to add modular integration tests for Konoha that can be used to test deployed instances. This will make it easier for the protocols using it to verify Konoha is working correctly and to gain confidence upgrading it.

Tasks

Pseudocode

tests/integration_tests.cairo:

fn deploy_governance(classhash, token_recipient):
    Deploy governance contract with given classhash and token recipient – use functions from setup.cairo here
    Return deployed contract address

fn upgrade(gov_address, tokenholders: Span<ContractAddress>, new_classhash):
    For each tokenholder:
        Vote to upgrade governance contract to new_classhash
    Assert that proposal passes, then:
        Apply the upgrade

fn healthcheck(gov_address, tokenholders):
    Submit new signal proposal
    Check proposal appears in get_live_proposals
    Verify get_proposal_details is correct
    For each tokenholder:
        Vote on the proposal
        Check get_vote_counts updates correctly
    Warp time and check that the proposal has passed

tests/integration_test_runner.cairo:

#[test]
#[fork("SEPOLIA")]
fn test_upgrade_sepolia_konoha():
    current_gov_address = 0x056dfcfa3c33c7a6852479f241f0cbbd2405791164754f16c0dcd90de13da059
    tokenholders = Array of Sepolia Konoha tokenholders – copy from https://sepolia.starkscan.co/token/0x02b91dd683bc4bcae7a9c5d0cbeba0e8d62fa657742e4640f1e8163dc10e9bd7#holders

    healthcheck(current_gov_address, tokenholders)

    new_classhash = declare current Governance.cairo 
    upgrade(current_gov_address, tokenholders, new_classhash)

    healthcheck(current_gov_address, tokenholders)

See the Contributor Guidelines for how to get started working on this issue.

Iwueseiter commented 1 month ago

Hi @tensojka can I work on this? Using this steps you have already mentioned, I would quickly execute the test within a time frame of 3 days.

tensojka commented 1 month ago

Yes you can, assigning you @Iwueseiter

Iwueseiter commented 1 month ago

thank you @tensojka

ptisserand commented 3 weeks ago

Hi @Iwueseiter any update on this issue ?

Iwueseiter commented 3 weeks ago

@ptisserand I'm working on it. I will create a PR soon.

od-hunter commented 1 week ago

Hey @Iwueseiter still on the issue?

Iwueseiter commented 1 week ago

@od-hunter yes.