-
Notifications
You must be signed in to change notification settings - Fork 22
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
feat: integrate koba & migrate e2e tests to alloy #80
Conversation
✅ Deploy Preview for contracts-stylus canceled.
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files
|
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.
Looks good, left some minor comments.
contract AccessControlExample { | ||
mapping(address => uint256) _balances; | ||
mapping(address => mapping(address => uint256)) _allowances; | ||
uint256 _total_supply; |
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.
snake_case here, camelCase below, e.g. hasRole
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.
Ah, good catch, I copy/pasted some from our contracts, which use snake case. I'll fix it
examples/ownable/src/constructor.sol
Outdated
contract OwnableExample { | ||
mapping(address => uint256) _balances; | ||
mapping(address => mapping(address => uint256)) _allowances; | ||
uint256 _total_supply; |
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.
snake_case here, cammelCase later.
Great job! |
No worries, I'll do it. |
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.
Looks great 🚀
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.
Looks great! 🚀
examples/erc721/tests/main.rs
Outdated
Ok(contract_addr) | ||
} | ||
|
||
macro_rules! send { |
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.
IMHO it should be common for all e2e
tests
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.
Yes, it should live in e2e
. I'll leave it in your hands 🙏
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.
E2e Tests passes on my local machine.
Great work, writing e2e
test looks developer-friendly and very intuitive.
Left some minor comments, but good to go without fixing.
const TOKEN_SYMBOL: &str = "TTK"; | ||
const CAP: usize = 1; | ||
|
||
async fn deploy(rpc_url: &str, private_key: &str) -> eyre::Result<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.
IMHO deploy should be common function for the whole e2e
, just passing args
should be fine.
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.
It's sadly not possible with the current implementation because we rely on compile-time env vars.
let name = env!("CARGO_PKG_NAME").replace('-', "_");
let pkg_dir = env!("CARGO_MANIFEST_DIR");
The env!
macro substitutes at compile time the value of those variables. If we move deploy
to a separate crate, like e2e
for example, those variables wouldn't be the same, and it would break the deployment.
We need to figure out a better implementation.
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 can think about it while working on e2e
tests for ERC20
.
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!
This is follow-up work to #80 which fixes concerns surrounding: - Having too much infra code in the test files themselves. - Decoupling the e2e tests from workspaces. Now, they can be run in standalone crates as well. It also includes some work documenting infra functions, reducing the public API of the `e2e` crate, and making the internal interfaces of the e2e infra more cohesive. Resolves #90
Follow-up work to #80 We were previously just checking that an error's signature was contained in the JSON-RPC response, but now we check the revert data fully. Also polished the API.
We have constructors now!
I will update the docs in a separate PR because I'm not sure what they will look like yet.