-
Notifications
You must be signed in to change notification settings - Fork 42
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
Implement tests according to missing test list #58 #61
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We want to be testing the Governance contract itself, not the Carmine deployment of it.
The setup.cairo should Deploy the contract, distribute tokens to a few addresses, and then have these addresses vote.
The reason is that the tests must be testing the current version in master, in some branch, not the currently deployed version – tests need to catch issues before we deploy with those issues
Also, please run scarb fmt
Lacks setting of custom proposal configuration during deployment
…pgrade root and passes it
…te to sample addresses and then vote on update root proposal
* add: basic ui displaying proposals * feat: voting invocations * feat: ✨ new proposal form * feat: ✨ use async for proposal creation * fix: 🐛 bad voting code * chore: 🗑️ cleanup * feat: ✨ add logo * fix: 🐛 wrong site title --------- Co-authored-by: Tomáš Hobza <[email protected]>
Co-authored-by: Tomáš Hobza <[email protected]>
* initial commit * change to testnet * Add basic working event printing * notification telegram bot working * add gitignore * Remove node_modules folder and update .gitignore * update config.toml * removing unused address * Delete accidentally committed tests/proposal.cairo * code review changes * rest of the code-review changes * Update packages according to code review feedback * Add error print when unable to send messages to Telegram * Add automatic retrieval of chain id * Polish formatting * Refactor config file reading * code-review changes in index.ts, package-lock * Add CI runner * Trigger CI * Fix CI * Fix CI * Fix CI * Fix CI --------- Co-authored-by: Ondřej Sojka <[email protected]> Co-authored-by: Ondřej Sojka <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you rebase on top of master? I see changes such as frontend and notification-bot in the Changes tab.
I don't think the deploy_and_distribute_gov_tokens function is okay since both test_proposal_expiry and test_vote_on_expired fail with 'Failed to deserialize param'
src/testing/setup.cairo
Outdated
fn deploy_and_distribute_gov_tokens(recipient: ContractAddress) -> IERC20Dispatcher { | ||
let mut calldata = ArrayTrait::new(); | ||
calldata.append(GOV_TOKEN_INITIAL_SUPPLY); | ||
calldata.append(recipient.into()); | ||
|
||
let gov_token_contract = declare("FloatingToken"); | ||
let token_addr = gov_token_contract.deploy(@calldata).expect('unable to deploy FloatingToken'); | ||
let token: IERC20Dispatcher = IERC20Dispatcher { contract_address: token_addr }; | ||
|
||
start_prank(CheatTarget::One(token_addr), admin_addr.try_into().unwrap()); | ||
|
||
token.transfer(first_address.try_into().unwrap(), 100000); | ||
token.transfer(second_address.try_into().unwrap(), 100000); | ||
token |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are you trying to do here? You can't just transfer the tokens from the token address as on deployment, there aren't any. Maybe you wanted to use mint?
tests/proposals_tests.cairo
Outdated
assert!(dispatcher.get_proposal_status(prop_id) == 1, "proposal not passed!"); | ||
} | ||
|
||
#[should_panic] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of a generic 'should panic', you should also put the expected error message here.
let end_timestamp = current_timestamp + constants::PROPOSAL_VOTING_SECONDS; | ||
start_warp(CheatTarget::One(gov_contract_addr), end_timestamp + 1); | ||
|
||
let status = dispatcher.get_proposal_status(prop_id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to add check that status is -1 (or 2? not sure) meaning it failed.
* add: basic ui displaying proposals * feat: voting invocations * feat: ✨ new proposal form * feat: ✨ use async for proposal creation * fix: 🐛 bad voting code * chore: 🗑️ cleanup * feat: ✨ add logo * fix: 🐛 wrong site title --------- Co-authored-by: Tomáš Hobza <[email protected]>
Co-authored-by: Tomáš Hobza <[email protected]>
* Add mdbook stub * Update license to Apache 2.0 * Add some docs
* Add custom proposal implementation Lacks setting of custom proposal configuration during deployment * Add arbitrary proposal * Polish apply_passed_proposal * Polish scarb fmt * Cherry pick setup.cairo from 1fab54f * Move test setup to src/ * Remove unrelated functions from setup.cairo * Fix setup * Polish tests * Fix import naming * Add addition of custom proposal
* Update Scarb.toml, add [lib] * Add custom proposal implementation Lacks setting of custom proposal configuration during deployment * Add arbitrary proposal * Polish apply_passed_proposal * Polish scarb fmt * Cherry pick setup.cairo from 1fab54f * Move test setup to src/ * Remove unrelated functions from setup.cairo * Fix setup * Polish tests * Fix import naming * Add addition of custom proposal * Remove part of Carmine code * Remove rest of Carmine stuff * Polish with scarb fmt * Bump version to 0.4.0 * Fix imports in tests * Remove unused test from lib.cairo * Remove cubit as dependency * Update package description * Update error message to not mention CARM * Move snforge_std to dev-dependency * Update snforge_std to v0.23.0 * Update snforge in CI * Trigger CI * Format
… them in deploy token function
* Add custom proposal implementation Lacks setting of custom proposal configuration during deployment * Add arbitrary proposal * Polish apply_passed_proposal * Polish scarb fmt * Cherry pick setup.cairo from 1fab54f * Move test setup to src/ * Remove unrelated functions from setup.cairo * Fix setup * Polish tests * Add airdrop tests * Adding setup file with generic function which applies a proposal to upgrade root and passes it * Setup environment to deploy governance, deploy gov token and distribute to sample addresses and then vote on update root proposal * Add tests on proposals * fix some issues on proposal tests * Proposals Frontend (#66) * add: basic ui displaying proposals * feat: voting invocations * feat: ✨ new proposal form * feat: ✨ use async for proposal creation * fix: 🐛 bad voting code * chore: 🗑️ cleanup * feat: ✨ add logo * fix: 🐛 wrong site title --------- Co-authored-by: Tomáš Hobza <[email protected]> * Update README.md * Update README.md * feat: default to_upgrade value (#69) Co-authored-by: Tomáš Hobza <[email protected]> * Telegram Notification bot for proposal (#71) * initial commit * change to testnet * Add basic working event printing * notification telegram bot working * add gitignore * Remove node_modules folder and update .gitignore * update config.toml * removing unused address * Delete accidentally committed tests/proposal.cairo * code review changes * rest of the code-review changes * Update packages according to code review feedback * Add error print when unable to send messages to Telegram * Add automatic retrieval of chain id * Polish formatting * Refactor config file reading * code-review changes in index.ts, package-lock * Add CI runner * Trigger CI * Fix CI * Fix CI * Fix CI * Fix CI --------- Co-authored-by: Ondřej Sojka <[email protected]> Co-authored-by: Ondřej Sojka <[email protected]> * Adding proposals tests * Comment code for airdrop_tests and remove old setup file * Add minor fixes towards compilability * Fix all proposals tests * Fix formatting * Proposals Frontend (#66) * add: basic ui displaying proposals * feat: voting invocations * feat: ✨ new proposal form * feat: ✨ use async for proposal creation * fix: 🐛 bad voting code * chore: 🗑️ cleanup * feat: ✨ add logo * fix: 🐛 wrong site title --------- Co-authored-by: Tomáš Hobza <[email protected]> * feat: default to_upgrade value (#69) Co-authored-by: Tomáš Hobza <[email protected]> * Update frontend domain to konoha.vote * Rename package from 'governance' to 'konoha' * Add contributor guidelines * Update README.md with contributing info * Update CONTRIBUTING.md * Add mdbook scaffolding (#75) * Add mdbook stub * Update license to Apache 2.0 * Add some docs * Add custom proposal implementation (#64) * Add custom proposal implementation Lacks setting of custom proposal configuration during deployment * Add arbitrary proposal * Polish apply_passed_proposal * Polish scarb fmt * Cherry pick setup.cairo from 1fab54f * Move test setup to src/ * Remove unrelated functions from setup.cairo * Fix setup * Polish tests * Fix import naming * Add addition of custom proposal * Remove mentions of Carmine in this repository (#73) * Update Scarb.toml, add [lib] * Add custom proposal implementation Lacks setting of custom proposal configuration during deployment * Add arbitrary proposal * Polish apply_passed_proposal * Polish scarb fmt * Cherry pick setup.cairo from 1fab54f * Move test setup to src/ * Remove unrelated functions from setup.cairo * Fix setup * Polish tests * Fix import naming * Add addition of custom proposal * Remove part of Carmine code * Remove rest of Carmine stuff * Polish with scarb fmt * Bump version to 0.4.0 * Fix imports in tests * Remove unused test from lib.cairo * Remove cubit as dependency * Update package description * Update error message to not mention CARM * Move snforge_std to dev-dependency * Update snforge_std to v0.23.0 * Update snforge in CI * Trigger CI * Format * Rename governance:: to konoha:: * Fix proposals tests and mint tokens to admin addr before distributing them in deploy token function * Add quorum tests * Move setup to testing, fix tests so they compile * Merge branch master --------- Co-authored-by: Ondřej Sojka <[email protected]> Co-authored-by: Tomáš Hobza <[email protected]> Co-authored-by: Tomáš Hobza <[email protected]> Co-authored-by: Ondřej Sojka <[email protected]> Co-authored-by: xkrivan5 <[email protected]>
Implementing a first batch of airdrop tests
i'm not sure about the hash to use for the root or the proofs (shall I use the same as those in the defi repo ?)
for the test_update_root_and_claim_attempts function i still have to check the fail, not sure of the behaviour of the should_panic function
finally there is still the check claimed event test to be implemented which I haven't digged yet, maybe there is a further environment to implement to do this one ?
also the valid claim attempt is tested on the test_update_root_and_claim_attempts function