-
Notifications
You must be signed in to change notification settings - Fork 354
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
Migrate erc20 tests #1022
Migrate erc20 tests #1022
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.
Very nice, Eric! I left some minor suggestions—mostly removing unused imports
pub fn declare_and_deploy(contract_name: ByteArray, calldata: Array<felt252>) -> ContractAddress { | ||
let contract_class = declare(contract_name).unwrap(); | ||
match contract_class.deploy(@calldata) { | ||
Result::Ok((contract_address, _)) => contract_address, | ||
Result::Err(panic_data) => panic!("Failed to deploy, error: ${:?}", panic_data) | ||
} | ||
} | ||
|
||
pub fn declare_and_deploy_at( | ||
contract_name: ByteArray, target_address: ContractAddress, calldata: Array<felt252> | ||
) { | ||
let contract_class = declare(contract_name).unwrap(); | ||
if let Result::Err(panic_data) = contract_class.deploy_at(@calldata, target_address) { | ||
panic!("Failed to deploy, error: ${:?}", panic_data) | ||
} | ||
} | ||
|
||
pub fn spy_on(contract_address: ContractAddress) -> EventSpy { |
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.
Do we want these to be public?
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.
Since we are currently providing test utilities, we can include these new foundry utilities as well (and probably remove the old ones if they are not used anymore).
|
||
// Check indexed keys | ||
let mut indexed_keys = array![]; | ||
indexed_keys.append_serde(selector!("Approval")); | ||
indexed_keys.append_serde(owner); | ||
indexed_keys.append_serde(spender); | ||
utils::assert_indexed_keys(event, indexed_keys.span()) | ||
spy.assert_emitted(@array![(contract, expected)]); |
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.
So much cleaner! It's awesome that keys and data are checked under the hood
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.
Actually, I should have left a TODO, but this is not testing indexed keys as we did before, since with this approach removing a key attribute in an event won't make the test fail. I'm waiting for the next foundry version to add those, since I saw there's already some features in main that would make this easier.
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.
this is not testing indexed keys as we did before, since with this approach removing a key attribute in an event won't make the test fail
This feels a little redundant tbh since EventAssertion
checks keys and data, but I do see the benefit (especially in development) with manually checking keys
src/tests/utils.cairo
Outdated
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.
I believe we can remove most of the contents of this module since they're made for the cairo test runner. This is housekeeping though, so maybe it's better for a different PR?
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.
I agree we should, what do you think about letting that for the PR updating the test utils documentation after everything is merged? Then we can decide which utilities should be removed.
let contract_address = test_address(); | ||
let mut spy = utils::spy_on(contract_address); |
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 contract_address
, wdyt about target
or target_address
? Not a big deal if we keep the former, I just think it's a little bland in the context of the new test flow
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.
This address is not the target address for component tests, but the address of the current context in foundry (starknet foundry contract running the tests). contract address is probably still not the best name, but I vote we keep it over target_address, since to me is a bit more confusing.
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.
Right, target is not a good name. contract_address
works!
Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com>
Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com>
Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com>
Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com>
…lo/cairo-contracts into feat/migrate-erc20-tests-#1008
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.
LGTM!
* Migrate erc20 tests (#1022) * feat: migrate event tests * feat: update workflow * feat: add foundry utils * feat: finish erc20 and erc20votes migration * feat: remove dual case tests * refactor: format files * refactor: variable name * Update src/tests/token.cairo Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Update src/tests/token/erc20.cairo Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Update src/tests/utils/foundry.cairo Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Update src/tests/token/erc20/test_erc20_votes.cairo Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * feat: apply review updates --------- Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Snforge utils and some common changes (#1030) * Update gitignore with snfoundry cache dir * Delete foundry utils file * Add snfoundry-related test utils, comment out previous utils * Update ERC20 event helpers * Update ERC20 tests * Update ERC20Votes tests * Run linter * Add util function to drop single event * Fix review issues * Make Github workflow run on every PR * Fix review issues * Bump snforge version * Support snforge 0.26 in test utils * Update ERC20 tests to support snforge upgrade * Run linter * Re-add dual20 tests (#1028) * feat: migrate event tests * feat: update workflow * feat: add foundry utils * feat: finish erc20 and erc20votes migration * feat: remove dual case tests * refactor: format files * refactor: variable name * Update src/tests/token.cairo Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Update src/tests/token/erc20.cairo Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Update src/tests/utils/foundry.cairo Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Update src/tests/token/erc20/test_erc20_votes.cairo Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * feat: apply review updates * feat: readd dual20 tests * refactor: remove unnecessary import * feat: add dual20 import --------- Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Migrate security tests (#1034) * migrate pausable and initializable tests * migrate reentrancy guard tests * clean up tests * fix fmt * add event trait to pausable, fix tests * Apply suggestions from code review Co-authored-by: Eric Nordelo <eric.nordelo39@gmail.com> * fix fmt --------- Co-authored-by: Eric Nordelo <eric.nordelo39@gmail.com> * Migrate erc1155 tests (#1037) * feat: update common module * feat: migrate dual modules * feat: finish component test migration * refactor: remove unnecessary imports * feat: apply review updates * Migrate erc721 tests (#1027) * feat: migrate event tests * feat: update workflow * feat: add foundry utils * feat: finish erc20 and erc20votes migration * feat: remove dual case tests * refactor: format files * refactor: variable name * Update src/tests/token.cairo Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Update src/tests/token/erc20.cairo Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Update src/tests/utils/foundry.cairo Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Update src/tests/token/erc20/test_erc20_votes.cairo Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * feat: apply review updates * feat: migrate erc721 components tests * refactor: remove extra line * feat: apply review updates * feat: update utilities * feat: apply review updates * fix: ignore tests --------- Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Check ignored tests (#1049) * test: check ignored tests and add reason * feat: apply review updates * Migrate Ownable tests (#1033) * Update ERC20Votes tests * Run linter * Add test helpers for Ownable tests * Migrate Ownable tests * Migrate OwnableTwoStep tests * Migrate Ownable Dual Dispatcher tests * Support event changes in snforge 0.26 * Resolve review issues * Address review comments * Migrate Upgrades tests (#1051) * Migrate Upgrades tests to Foundry * Update src/tests/upgrades/test_upgradeable.cairo Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Update src/tests/upgrades/test_upgradeable.cairo Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> --------- Co-authored-by: Eric Nordelo <eric.nordelo39@gmail.com> Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Migrate erc20 preset tests (#1055) * feat: include erc20 preset tests * feat: tests updated * feat: remove unused imports * feat: add deployments * Update src/tests/utils/common.cairo Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * feat: apply review updates --------- Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * feat: update ignored tests messages (#1056) * Migrate erc1155 preset tests (#1057) * feat: update tests * refactor: remove unnecessary import * Migrate cryptography and UDC tests (#1059) * fix import name * migrate cryptography tests * migrate udc tests * fix fmt * fix impl name * fix event assertions * re-add class hash helper * Migrate eth account tests (#1058) * feat: update dual_eth_account tests * feat: update eth_account tests * refactor: remove unused helpers * refactor: some inconsistencies * Update src/tests/account/ethereum/test_eth_account.cairo Co-authored-by: immrsd <103599616+immrsd@users.noreply.github.com> * feat: apply review updates * refactor: format files * Update src/tests/account/ethereum/test_eth_account.cairo Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> --------- Co-authored-by: immrsd <103599616+immrsd@users.noreply.github.com> Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Migrate eth account preset tests (#1060) * feat: update dual_eth_account tests * feat: update eth_account tests * refactor: remove unused helpers * feat: update eth account preset tests * Update src/tests/account/ethereum/test_eth_account.cairo Co-authored-by: immrsd <103599616+immrsd@users.noreply.github.com> * Update src/tests/presets/test_eth_account.cairo Co-authored-by: immrsd <103599616+immrsd@users.noreply.github.com> * feat: apply review updates --------- Co-authored-by: immrsd <103599616+immrsd@users.noreply.github.com> * Migrate AccessControl Tests (#1044) * Migrate AccessControl tests * Migrate AccessControl Dual Dispatcher tests * Fix imports * Address review comments * Update error messages * Bring back separator line * Fix ignore reasons in access module * Fix review issues * Migrate Starknet Account tests (#1050) * Update test utils and helpers * Update signature tests * Update account tests * Update dual account tests * Run linter * Run linter * Fix review issues * Update ignore reason messages * Run linter * Support eth account tests changes * Run linter * Improve setup functions, remove unused imports * Remove unnecessary accept_ownership step, make use of serialized_sign fn * Migrate Starknet Account Preset tests (#1069) * Update test utils and helpers * Update signature tests * Update account tests * Update dual account tests * Run linter * Run linter * Fix review issues * Update ignore reason messages * Run linter * Support eth account tests changes * Run linter * Improve setup functions, remove unused imports * Remove unnecessary accept_ownership step, make use of serialized_sign fn * Migrate Starknet Account Preset tests, make some code improvements * Run linter * Remove unnecessary clone * Update the comment for assert_entrypoint_not_found_error function * Minor review fixes * Bump scarb, merge changes from main in snforge migration (#1076) * Remove unnecessary `mut`, minor fixes (#1032) * clean up code * change array syntax * fix fmt * Improve SNIP12 examples (#1036) * docs: improve examples * refactor: remove empty line * Update docs/modules/ROOT/pages/guides/snip12.adoc Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> --------- Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Release v0.15.0-rc.0 (#1039) * feat: update CHANGELOG * Bump version to 0.15.0-rc.0 * docs: add missing header * feat: apply review suggestions --------- Co-authored-by: ericnordelo <ericnordelo@users.noreply.github.com> * Bump cairo to 2.7.0-rc.1 (#1025) * feat: migrate modules * feat: delete cairo_project.toml * feat: update tests * feat: apply review updates * fix: remove extra line * feat: add CHANGELOG entry * fix: CHANGELOG * Bump Scarb to 2.7.0-rc.2 (#1052) * bump scarb to 2.7.0-rc.2 * add changelog entry * update changelog entry * bump scarb in installation page * Add timelock component (#996) * start timelock comp draft * move timelock to own dir, finish drafting component * tmp: add utility impls * add timelock mock * add test mod for timelock * fix commnet * add constructor to timelock mock * set min_delay in initializer * start tests * fix fmt * fix schedule assertion * add schedule tests * fix fmt * remove unused import * fix errs, _before_call * start execute tests * fix fmt * fix after_call * add execute tests * add abi interface * add reentrancy mock for timelock * add tests for cancel and update_delay * fix hash_op test * add execute with predecessor test * add timelock utils, add operation_state debug impl * fix fmt * improve imports * improve _execute * add basic mock for tests * add tmp call struct * add batch fns to interface * add batch fns * refactor tests to use dedicated mock, add batch tests * fix fmt * remove use clause * add timelock mixin * fix interface name * improve event assertions * fix execute and schedule events * fix fmt * add safe token transfer tests * fix fmt * tidy up code * add descriptions to events * clean up code * inline CallPartialEq fns * start fn descriptions * remove comments * remove comment * fix fmt * add changelog entries * improve spacing * add line break to hash test * clean up tests * clean up tests * fix constants in attacker impl * add initializer helper, register access control support * add _before_call and _after_call tests * fix reentrant batch mock call * add _schedule and _execute tests * add timelock description * fix formatting * fix comments * fix comment * fmt * tidy up tests * remove batch helper fn * remove event from mocks * Apply suggestions from code review Co-authored-by: Eric Nordelo <eric.nordelo39@gmail.com> * update spdx * remove token receiver support * add additional cancel tests * Apply suggestions from code review Co-authored-by: Eric Nordelo <eric.nordelo39@gmail.com> * initializer: remove mut, use while loop * fix fmt * add assert_only_self fn * fix getter comments re: pending/waiting * add assert_only_role * add specific op errors * make event names consistent * fix test * remove serialization from HashCallImpl * remove unused components from mock * clean up code * update to 2.7.0-rc.1 * fix fmt * import Call from corelib * update spdx * fix fmt * move OperationState, derive debug * fix fmt * fix hash impls * add for loops * fix PartialEq, add tests * fix fmt * simplify mixin fns * switch Poseidon to Pedersen * make admin a req in initializer * update tests with admin * fix fmt * fix comment * undo changes * add no admin initializer test --------- Co-authored-by: Eric Nordelo <eric.nordelo39@gmail.com> * bump scarb to 2.7.0-rc.4 (#1064) * bump scarb to 2.7.0-rc.4 * add changelog * bump scarb in installation page * feat: update workflow and fix warning (#1066) * Add actionlint (#1067) * add actionlint for workflows * remove codecov and gitmodules * bump checkout to v4, add double quotes, fmt * bump md lint * re-add cairo version * group redirects * fix link in security * add local actionlint matcher json * re-add changelog entry * add tmp usc install to ci * fix ci --------- Co-authored-by: Eric Nordelo <eric.nordelo39@gmail.com> Co-authored-by: ericnordelo <ericnordelo@users.noreply.github.com> Co-authored-by: JChoy <jchoyeclipse@gmail.com> * Migrate timelock tests (#1061) * Remove unnecessary `mut`, minor fixes (#1032) * clean up code * change array syntax * fix fmt * Improve SNIP12 examples (#1036) * docs: improve examples * refactor: remove empty line * Update docs/modules/ROOT/pages/guides/snip12.adoc Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> --------- Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Release v0.15.0-rc.0 (#1039) * feat: update CHANGELOG * Bump version to 0.15.0-rc.0 * docs: add missing header * feat: apply review suggestions --------- Co-authored-by: ericnordelo <ericnordelo@users.noreply.github.com> * Bump cairo to 2.7.0-rc.1 (#1025) * feat: migrate modules * feat: delete cairo_project.toml * feat: update tests * feat: apply review updates * fix: remove extra line * feat: add CHANGELOG entry * fix: CHANGELOG * Bump Scarb to 2.7.0-rc.2 (#1052) * bump scarb to 2.7.0-rc.2 * add changelog entry * update changelog entry * bump scarb in installation page * Add timelock component (#996) * start timelock comp draft * move timelock to own dir, finish drafting component * tmp: add utility impls * add timelock mock * add test mod for timelock * fix commnet * add constructor to timelock mock * set min_delay in initializer * start tests * fix fmt * fix schedule assertion * add schedule tests * fix fmt * remove unused import * fix errs, _before_call * start execute tests * fix fmt * fix after_call * add execute tests * add abi interface * add reentrancy mock for timelock * add tests for cancel and update_delay * fix hash_op test * add execute with predecessor test * add timelock utils, add operation_state debug impl * fix fmt * improve imports * improve _execute * add basic mock for tests * add tmp call struct * add batch fns to interface * add batch fns * refactor tests to use dedicated mock, add batch tests * fix fmt * remove use clause * add timelock mixin * fix interface name * improve event assertions * fix execute and schedule events * fix fmt * add safe token transfer tests * fix fmt * tidy up code * add descriptions to events * clean up code * inline CallPartialEq fns * start fn descriptions * remove comments * remove comment * fix fmt * add changelog entries * improve spacing * add line break to hash test * clean up tests * clean up tests * fix constants in attacker impl * add initializer helper, register access control support * add _before_call and _after_call tests * fix reentrant batch mock call * add _schedule and _execute tests * add timelock description * fix formatting * fix comments * fix comment * fmt * tidy up tests * remove batch helper fn * remove event from mocks * Apply suggestions from code review Co-authored-by: Eric Nordelo <eric.nordelo39@gmail.com> * update spdx * remove token receiver support * add additional cancel tests * Apply suggestions from code review Co-authored-by: Eric Nordelo <eric.nordelo39@gmail.com> * initializer: remove mut, use while loop * fix fmt * add assert_only_self fn * fix getter comments re: pending/waiting * add assert_only_role * add specific op errors * make event names consistent * fix test * remove serialization from HashCallImpl * remove unused components from mock * clean up code * update to 2.7.0-rc.1 * fix fmt * import Call from corelib * update spdx * fix fmt * move OperationState, derive debug * fix fmt * fix hash impls * add for loops * fix PartialEq, add tests * fix fmt * simplify mixin fns * switch Poseidon to Pedersen * make admin a req in initializer * update tests with admin * fix fmt * fix comment * undo changes * add no admin initializer test --------- Co-authored-by: Eric Nordelo <eric.nordelo39@gmail.com> * fix fmt * bump scarb to 2.7.0-rc.4 (#1064) * bump scarb to 2.7.0-rc.4 * add changelog * bump scarb in installation page * fix fmt * feat: update workflow and fix warning (#1066) * bump scarb * add tmp usc install in ci * fix changelog --------- Co-authored-by: Eric Nordelo <eric.nordelo39@gmail.com> Co-authored-by: ericnordelo <ericnordelo@users.noreply.github.com> Co-authored-by: JChoy <jchoyeclipse@gmail.com> --------- Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> Co-authored-by: immrsd <103599616+immrsd@users.noreply.github.com> Co-authored-by: Andrew Fleming <fleming-andrew@protonmail.com> Co-authored-by: ericnordelo <ericnordelo@users.noreply.github.com> Co-authored-by: JChoy <jchoyeclipse@gmail.com>
* Migrate erc20 tests (#1022) * feat: migrate event tests * feat: update workflow * feat: add foundry utils * feat: finish erc20 and erc20votes migration * feat: remove dual case tests * refactor: format files * refactor: variable name * Update src/tests/token.cairo Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Update src/tests/token/erc20.cairo Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Update src/tests/utils/foundry.cairo Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Update src/tests/token/erc20/test_erc20_votes.cairo Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * feat: apply review updates --------- Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Snforge utils and some common changes (#1030) * Update gitignore with snfoundry cache dir * Delete foundry utils file * Add snfoundry-related test utils, comment out previous utils * Update ERC20 event helpers * Update ERC20 tests * Update ERC20Votes tests * Run linter * Add util function to drop single event * Fix review issues * Make Github workflow run on every PR * Fix review issues * Bump snforge version * Support snforge 0.26 in test utils * Update ERC20 tests to support snforge upgrade * Run linter * Re-add dual20 tests (#1028) * feat: migrate event tests * feat: update workflow * feat: add foundry utils * feat: finish erc20 and erc20votes migration * feat: remove dual case tests * refactor: format files * refactor: variable name * Update src/tests/token.cairo Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Update src/tests/token/erc20.cairo Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Update src/tests/utils/foundry.cairo Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Update src/tests/token/erc20/test_erc20_votes.cairo Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * feat: apply review updates * feat: readd dual20 tests * refactor: remove unnecessary import * feat: add dual20 import --------- Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Migrate security tests (#1034) * migrate pausable and initializable tests * migrate reentrancy guard tests * clean up tests * fix fmt * add event trait to pausable, fix tests * Apply suggestions from code review Co-authored-by: Eric Nordelo <eric.nordelo39@gmail.com> * fix fmt --------- Co-authored-by: Eric Nordelo <eric.nordelo39@gmail.com> * refacto repo into packages * fmt * Migrate erc1155 tests (#1037) * feat: update common module * feat: migrate dual modules * feat: finish component test migration * refactor: remove unnecessary imports * feat: apply review updates * Migrate erc721 tests (#1027) * feat: migrate event tests * feat: update workflow * feat: add foundry utils * feat: finish erc20 and erc20votes migration * feat: remove dual case tests * refactor: format files * refactor: variable name * Update src/tests/token.cairo Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Update src/tests/token/erc20.cairo Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Update src/tests/utils/foundry.cairo Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Update src/tests/token/erc20/test_erc20_votes.cairo Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * feat: apply review updates * feat: migrate erc721 components tests * refactor: remove extra line * feat: apply review updates * feat: update utilities * feat: apply review updates * fix: ignore tests --------- Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Check ignored tests (#1049) * test: check ignored tests and add reason * feat: apply review updates * Migrate Ownable tests (#1033) * Update ERC20Votes tests * Run linter * Add test helpers for Ownable tests * Migrate Ownable tests * Migrate OwnableTwoStep tests * Migrate Ownable Dual Dispatcher tests * Support event changes in snforge 0.26 * Resolve review issues * Address review comments * Migrate Upgrades tests (#1051) * Migrate Upgrades tests to Foundry * Update src/tests/upgrades/test_upgradeable.cairo Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Update src/tests/upgrades/test_upgradeable.cairo Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> --------- Co-authored-by: Eric Nordelo <eric.nordelo39@gmail.com> Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Migrate erc20 preset tests (#1055) * feat: include erc20 preset tests * feat: tests updated * feat: remove unused imports * feat: add deployments * Update src/tests/utils/common.cairo Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * feat: apply review updates --------- Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * feat: update ignored tests messages (#1056) * Migrate erc1155 preset tests (#1057) * feat: update tests * refactor: remove unnecessary import * Migrate cryptography and UDC tests (#1059) * fix import name * migrate cryptography tests * migrate udc tests * fix fmt * fix impl name * fix event assertions * re-add class hash helper * Migrate eth account tests (#1058) * feat: update dual_eth_account tests * feat: update eth_account tests * refactor: remove unused helpers * refactor: some inconsistencies * Update src/tests/account/ethereum/test_eth_account.cairo Co-authored-by: immrsd <103599616+immrsd@users.noreply.github.com> * feat: apply review updates * refactor: format files * Update src/tests/account/ethereum/test_eth_account.cairo Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> --------- Co-authored-by: immrsd <103599616+immrsd@users.noreply.github.com> Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Migrate eth account preset tests (#1060) * feat: update dual_eth_account tests * feat: update eth_account tests * refactor: remove unused helpers * feat: update eth account preset tests * Update src/tests/account/ethereum/test_eth_account.cairo Co-authored-by: immrsd <103599616+immrsd@users.noreply.github.com> * Update src/tests/presets/test_eth_account.cairo Co-authored-by: immrsd <103599616+immrsd@users.noreply.github.com> * feat: apply review updates --------- Co-authored-by: immrsd <103599616+immrsd@users.noreply.github.com> * Migrate AccessControl Tests (#1044) * Migrate AccessControl tests * Migrate AccessControl Dual Dispatcher tests * Fix imports * Address review comments * Update error messages * Bring back separator line * Fix ignore reasons in access module * Fix review issues * Migrate Starknet Account tests (#1050) * Update test utils and helpers * Update signature tests * Update account tests * Update dual account tests * Run linter * Run linter * Fix review issues * Update ignore reason messages * Run linter * Support eth account tests changes * Run linter * Improve setup functions, remove unused imports * Remove unnecessary accept_ownership step, make use of serialized_sign fn * feat: make contracts build * feat: update packages Scarb.toml * refactor: remove gitmodules file * feat: refactor tests * feat: update workflow * feat: test utils * feat: add missing tests * fix: tests * fix: remaining tests * refactor: format files * tmp: workflow update * feat: add entry to CHANGELOG and update README * doc: update imports * Migrate Starknet Account Preset tests (#1069) * Update test utils and helpers * Update signature tests * Update account tests * Update dual account tests * Run linter * Run linter * Fix review issues * Update ignore reason messages * Run linter * Support eth account tests changes * Run linter * Improve setup functions, remove unused imports * Remove unnecessary accept_ownership step, make use of serialized_sign fn * Migrate Starknet Account Preset tests, make some code improvements * Run linter * Remove unnecessary clone * Update the comment for assert_entrypoint_not_found_error function * Minor review fixes * Bump scarb, merge changes from main in snforge migration (#1076) * Remove unnecessary `mut`, minor fixes (#1032) * clean up code * change array syntax * fix fmt * Improve SNIP12 examples (#1036) * docs: improve examples * refactor: remove empty line * Update docs/modules/ROOT/pages/guides/snip12.adoc Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> --------- Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Release v0.15.0-rc.0 (#1039) * feat: update CHANGELOG * Bump version to 0.15.0-rc.0 * docs: add missing header * feat: apply review suggestions --------- Co-authored-by: ericnordelo <ericnordelo@users.noreply.github.com> * Bump cairo to 2.7.0-rc.1 (#1025) * feat: migrate modules * feat: delete cairo_project.toml * feat: update tests * feat: apply review updates * fix: remove extra line * feat: add CHANGELOG entry * fix: CHANGELOG * Bump Scarb to 2.7.0-rc.2 (#1052) * bump scarb to 2.7.0-rc.2 * add changelog entry * update changelog entry * bump scarb in installation page * Add timelock component (#996) * start timelock comp draft * move timelock to own dir, finish drafting component * tmp: add utility impls * add timelock mock * add test mod for timelock * fix commnet * add constructor to timelock mock * set min_delay in initializer * start tests * fix fmt * fix schedule assertion * add schedule tests * fix fmt * remove unused import * fix errs, _before_call * start execute tests * fix fmt * fix after_call * add execute tests * add abi interface * add reentrancy mock for timelock * add tests for cancel and update_delay * fix hash_op test * add execute with predecessor test * add timelock utils, add operation_state debug impl * fix fmt * improve imports * improve _execute * add basic mock for tests * add tmp call struct * add batch fns to interface * add batch fns * refactor tests to use dedicated mock, add batch tests * fix fmt * remove use clause * add timelock mixin * fix interface name * improve event assertions * fix execute and schedule events * fix fmt * add safe token transfer tests * fix fmt * tidy up code * add descriptions to events * clean up code * inline CallPartialEq fns * start fn descriptions * remove comments * remove comment * fix fmt * add changelog entries * improve spacing * add line break to hash test * clean up tests * clean up tests * fix constants in attacker impl * add initializer helper, register access control support * add _before_call and _after_call tests * fix reentrant batch mock call * add _schedule and _execute tests * add timelock description * fix formatting * fix comments * fix comment * fmt * tidy up tests * remove batch helper fn * remove event from mocks * Apply suggestions from code review Co-authored-by: Eric Nordelo <eric.nordelo39@gmail.com> * update spdx * remove token receiver support * add additional cancel tests * Apply suggestions from code review Co-authored-by: Eric Nordelo <eric.nordelo39@gmail.com> * initializer: remove mut, use while loop * fix fmt * add assert_only_self fn * fix getter comments re: pending/waiting * add assert_only_role * add specific op errors * make event names consistent * fix test * remove serialization from HashCallImpl * remove unused components from mock * clean up code * update to 2.7.0-rc.1 * fix fmt * import Call from corelib * update spdx * fix fmt * move OperationState, derive debug * fix fmt * fix hash impls * add for loops * fix PartialEq, add tests * fix fmt * simplify mixin fns * switch Poseidon to Pedersen * make admin a req in initializer * update tests with admin * fix fmt * fix comment * undo changes * add no admin initializer test --------- Co-authored-by: Eric Nordelo <eric.nordelo39@gmail.com> * bump scarb to 2.7.0-rc.4 (#1064) * bump scarb to 2.7.0-rc.4 * add changelog * bump scarb in installation page * feat: update workflow and fix warning (#1066) * Add actionlint (#1067) * add actionlint for workflows * remove codecov and gitmodules * bump checkout to v4, add double quotes, fmt * bump md lint * re-add cairo version * group redirects * fix link in security * add local actionlint matcher json * re-add changelog entry * add tmp usc install to ci * fix ci --------- Co-authored-by: Eric Nordelo <eric.nordelo39@gmail.com> Co-authored-by: ericnordelo <ericnordelo@users.noreply.github.com> Co-authored-by: JChoy <jchoyeclipse@gmail.com> * Migrate timelock tests (#1061) * Remove unnecessary `mut`, minor fixes (#1032) * clean up code * change array syntax * fix fmt * Improve SNIP12 examples (#1036) * docs: improve examples * refactor: remove empty line * Update docs/modules/ROOT/pages/guides/snip12.adoc Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> --------- Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Release v0.15.0-rc.0 (#1039) * feat: update CHANGELOG * Bump version to 0.15.0-rc.0 * docs: add missing header * feat: apply review suggestions --------- Co-authored-by: ericnordelo <ericnordelo@users.noreply.github.com> * Bump cairo to 2.7.0-rc.1 (#1025) * feat: migrate modules * feat: delete cairo_project.toml * feat: update tests * feat: apply review updates * fix: remove extra line * feat: add CHANGELOG entry * fix: CHANGELOG * Bump Scarb to 2.7.0-rc.2 (#1052) * bump scarb to 2.7.0-rc.2 * add changelog entry * update changelog entry * bump scarb in installation page * Add timelock component (#996) * start timelock comp draft * move timelock to own dir, finish drafting component * tmp: add utility impls * add timelock mock * add test mod for timelock * fix commnet * add constructor to timelock mock * set min_delay in initializer * start tests * fix fmt * fix schedule assertion * add schedule tests * fix fmt * remove unused import * fix errs, _before_call * start execute tests * fix fmt * fix after_call * add execute tests * add abi interface * add reentrancy mock for timelock * add tests for cancel and update_delay * fix hash_op test * add execute with predecessor test * add timelock utils, add operation_state debug impl * fix fmt * improve imports * improve _execute * add basic mock for tests * add tmp call struct * add batch fns to interface * add batch fns * refactor tests to use dedicated mock, add batch tests * fix fmt * remove use clause * add timelock mixin * fix interface name * improve event assertions * fix execute and schedule events * fix fmt * add safe token transfer tests * fix fmt * tidy up code * add descriptions to events * clean up code * inline CallPartialEq fns * start fn descriptions * remove comments * remove comment * fix fmt * add changelog entries * improve spacing * add line break to hash test * clean up tests * clean up tests * fix constants in attacker impl * add initializer helper, register access control support * add _before_call and _after_call tests * fix reentrant batch mock call * add _schedule and _execute tests * add timelock description * fix formatting * fix comments * fix comment * fmt * tidy up tests * remove batch helper fn * remove event from mocks * Apply suggestions from code review Co-authored-by: Eric Nordelo <eric.nordelo39@gmail.com> * update spdx * remove token receiver support * add additional cancel tests * Apply suggestions from code review Co-authored-by: Eric Nordelo <eric.nordelo39@gmail.com> * initializer: remove mut, use while loop * fix fmt * add assert_only_self fn * fix getter comments re: pending/waiting * add assert_only_role * add specific op errors * make event names consistent * fix test * remove serialization from HashCallImpl * remove unused components from mock * clean up code * update to 2.7.0-rc.1 * fix fmt * import Call from corelib * update spdx * fix fmt * move OperationState, derive debug * fix fmt * fix hash impls * add for loops * fix PartialEq, add tests * fix fmt * simplify mixin fns * switch Poseidon to Pedersen * make admin a req in initializer * update tests with admin * fix fmt * fix comment * undo changes * add no admin initializer test --------- Co-authored-by: Eric Nordelo <eric.nordelo39@gmail.com> * fix fmt * bump scarb to 2.7.0-rc.4 (#1064) * bump scarb to 2.7.0-rc.4 * add changelog * bump scarb in installation page * fix fmt * feat: update workflow and fix warning (#1066) * bump scarb * add tmp usc install in ci * fix changelog --------- Co-authored-by: Eric Nordelo <eric.nordelo39@gmail.com> Co-authored-by: ericnordelo <ericnordelo@users.noreply.github.com> Co-authored-by: JChoy <jchoyeclipse@gmail.com> * Update docs/modules/ROOT/pages/components.adoc Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Update docs/modules/ROOT/pages/components.adoc Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * feat: apply review updates * feat: update governance package * refactor: format files * refactor: remove unused files * fix: workflow * refactor: remove warnings * feat: remove old tests --------- Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> Co-authored-by: immrsd <103599616+immrsd@users.noreply.github.com> Co-authored-by: Andrew Fleming <fleming-andrew@protonmail.com> Co-authored-by: Alex Metelli <alex-metelli@gmx.com> Co-authored-by: ericnordelo <ericnordelo@users.noreply.github.com> Co-authored-by: JChoy <jchoyeclipse@gmail.com>
* Migrate erc20 tests (#1022) * feat: migrate event tests * feat: update workflow * feat: add foundry utils * feat: finish erc20 and erc20votes migration * feat: remove dual case tests * refactor: format files * refactor: variable name * Update src/tests/token.cairo Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Update src/tests/token/erc20.cairo Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Update src/tests/utils/foundry.cairo Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Update src/tests/token/erc20/test_erc20_votes.cairo Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * feat: apply review updates --------- Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Snforge utils and some common changes (#1030) * Update gitignore with snfoundry cache dir * Delete foundry utils file * Add snfoundry-related test utils, comment out previous utils * Update ERC20 event helpers * Update ERC20 tests * Update ERC20Votes tests * Run linter * Add util function to drop single event * Fix review issues * Make Github workflow run on every PR * Fix review issues * Bump snforge version * Support snforge 0.26 in test utils * Update ERC20 tests to support snforge upgrade * Run linter * Re-add dual20 tests (#1028) * feat: migrate event tests * feat: update workflow * feat: add foundry utils * feat: finish erc20 and erc20votes migration * feat: remove dual case tests * refactor: format files * refactor: variable name * Update src/tests/token.cairo Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Update src/tests/token/erc20.cairo Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Update src/tests/utils/foundry.cairo Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Update src/tests/token/erc20/test_erc20_votes.cairo Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * feat: apply review updates * feat: readd dual20 tests * refactor: remove unnecessary import * feat: add dual20 import --------- Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Migrate security tests (#1034) * migrate pausable and initializable tests * migrate reentrancy guard tests * clean up tests * fix fmt * add event trait to pausable, fix tests * Apply suggestions from code review Co-authored-by: Eric Nordelo <eric.nordelo39@gmail.com> * fix fmt --------- Co-authored-by: Eric Nordelo <eric.nordelo39@gmail.com> * Migrate erc1155 tests (#1037) * feat: update common module * feat: migrate dual modules * feat: finish component test migration * refactor: remove unnecessary imports * feat: apply review updates * Migrate erc721 tests (#1027) * feat: migrate event tests * feat: update workflow * feat: add foundry utils * feat: finish erc20 and erc20votes migration * feat: remove dual case tests * refactor: format files * refactor: variable name * Update src/tests/token.cairo Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Update src/tests/token/erc20.cairo Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Update src/tests/utils/foundry.cairo Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Update src/tests/token/erc20/test_erc20_votes.cairo Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * feat: apply review updates * feat: migrate erc721 components tests * refactor: remove extra line * feat: apply review updates * feat: update utilities * feat: apply review updates * fix: ignore tests --------- Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Check ignored tests (#1049) * test: check ignored tests and add reason * feat: apply review updates * Migrate Ownable tests (#1033) * Update ERC20Votes tests * Run linter * Add test helpers for Ownable tests * Migrate Ownable tests * Migrate OwnableTwoStep tests * Migrate Ownable Dual Dispatcher tests * Support event changes in snforge 0.26 * Resolve review issues * Address review comments * Migrate Upgrades tests (#1051) * Migrate Upgrades tests to Foundry * Update src/tests/upgrades/test_upgradeable.cairo Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Update src/tests/upgrades/test_upgradeable.cairo Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> --------- Co-authored-by: Eric Nordelo <eric.nordelo39@gmail.com> Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Migrate erc20 preset tests (#1055) * feat: include erc20 preset tests * feat: tests updated * feat: remove unused imports * feat: add deployments * Update src/tests/utils/common.cairo Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * feat: apply review updates --------- Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * feat: update ignored tests messages (#1056) * Migrate erc1155 preset tests (#1057) * feat: update tests * refactor: remove unnecessary import * Migrate cryptography and UDC tests (#1059) * fix import name * migrate cryptography tests * migrate udc tests * fix fmt * fix impl name * fix event assertions * re-add class hash helper * Migrate eth account tests (#1058) * feat: update dual_eth_account tests * feat: update eth_account tests * refactor: remove unused helpers * refactor: some inconsistencies * Update src/tests/account/ethereum/test_eth_account.cairo Co-authored-by: immrsd <103599616+immrsd@users.noreply.github.com> * feat: apply review updates * refactor: format files * Update src/tests/account/ethereum/test_eth_account.cairo Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> --------- Co-authored-by: immrsd <103599616+immrsd@users.noreply.github.com> Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Migrate eth account preset tests (#1060) * feat: update dual_eth_account tests * feat: update eth_account tests * refactor: remove unused helpers * feat: update eth account preset tests * Update src/tests/account/ethereum/test_eth_account.cairo Co-authored-by: immrsd <103599616+immrsd@users.noreply.github.com> * Update src/tests/presets/test_eth_account.cairo Co-authored-by: immrsd <103599616+immrsd@users.noreply.github.com> * feat: apply review updates --------- Co-authored-by: immrsd <103599616+immrsd@users.noreply.github.com> * Migrate AccessControl Tests (#1044) * Migrate AccessControl tests * Migrate AccessControl Dual Dispatcher tests * Fix imports * Address review comments * Update error messages * Bring back separator line * Fix ignore reasons in access module * Fix review issues * Migrate Starknet Account tests (#1050) * Update test utils and helpers * Update signature tests * Update account tests * Update dual account tests * Run linter * Run linter * Fix review issues * Update ignore reason messages * Run linter * Support eth account tests changes * Run linter * Improve setup functions, remove unused imports * Remove unnecessary accept_ownership step, make use of serialized_sign fn * Migrate Starknet Account Preset tests (#1069) * Update test utils and helpers * Update signature tests * Update account tests * Update dual account tests * Run linter * Run linter * Fix review issues * Update ignore reason messages * Run linter * Support eth account tests changes * Run linter * Improve setup functions, remove unused imports * Remove unnecessary accept_ownership step, make use of serialized_sign fn * Migrate Starknet Account Preset tests, make some code improvements * Run linter * Remove unnecessary clone * Update the comment for assert_entrypoint_not_found_error function * Minor review fixes * Refactor Eth Account tests * Fix review issues * Fix account tests after merge * Fix ETH account tests * Remove tests dir at wrong location * Fix var name in test * Fix import --------- Co-authored-by: Eric Nordelo <eric.nordelo39@gmail.com> Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> Co-authored-by: Andrew Fleming <fleming-andrew@protonmail.com>
Fixes #1008
PR Checklist