Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ODHack: Modular integration tests #95

Open
tensojka opened this issue May 28, 2024 · 9 comments
Open

ODHack: Modular integration tests #95

tensojka opened this issue May 28, 2024 · 9 comments

Comments

@tensojka
Copy link
Contributor

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

  • Create a new file tests/integration_tests.cairo with the following functions:
    • deploy_governance(classhash, token_recipient): Deploys the governance contract
    • upgrade(gov_address, tokenholders, new_classhash): Upgrades a governance contract to a new classhash
    • healthcheck(gov_address, tokenholders): Runs a series of checks on a deployed governance contract
  • Create a new file tests/integration_test_runner.cairo that uses the above functions to test upgrading the current Konoha Sepolia deployment to the latest master

Pseudocode

tests/integration_tests.cairo:

fn deploy_governance(classhash, token_recipient):
    Deploy governance contract with given classhash and token recipientuse 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 tokenholderscopy 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
Copy link

Iwueseiter commented May 28, 2024

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
Copy link
Contributor Author

Yes you can, assigning you @Iwueseiter

@Iwueseiter
Copy link

thank you @tensojka

@ptisserand
Copy link
Contributor

Hi @Iwueseiter any update on this issue ?

@Iwueseiter
Copy link

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

@od-hunter
Copy link

Hey @Iwueseiter still on the issue?

@Iwueseiter
Copy link

@od-hunter yes.

@tensojka tensojka assigned ptisserand and unassigned Iwueseiter Jun 30, 2024
@tensojka
Copy link
Contributor Author

@ptisserand You are now assigned as @Iwueseiter hasn't posted a draft PR.

@ptisserand
Copy link
Contributor

ptisserand commented Jul 16, 2024

Hi @tensojka sorry I didn't have time before to work on this issue before.

I have look at setup.cairo implementation and I think in tests/integration_tests.cairo the prototype for deploy_governance should be:

fn deploy_governance(classhash: ClassHash, voting_token_class: ClassHash, floating_token_class: ClassHash, token_recipient: ContractAddress) -> ContractAddress;

instead of

fn deploy_governance(classhash: ClassHash, token_recipient: ContractAddress) -> ContractAddress;

Are you agree?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants