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

feat: integrate koba & migrate e2e tests to alloy #80

Merged
merged 90 commits into from
Jun 1, 2024
Merged

Conversation

alexfertel
Copy link
Contributor

@alexfertel alexfertel commented May 23, 2024

We have constructors now!

I will update the docs in a separate PR because I'm not sure what they will look like yet.

@alexfertel alexfertel added priority: 2 We will resolve this in a short timeframe. type: feature New feature request. effort: high Large or difficult task. labels May 23, 2024
@alexfertel alexfertel added this to the Release v0.1.0 milestone May 23, 2024
@alexfertel alexfertel self-assigned this May 23, 2024
Copy link

netlify bot commented May 23, 2024

Deploy Preview for contracts-stylus canceled.

Name Link
🔨 Latest commit b94bfb6
🔍 Latest deploy log https://app.netlify.com/sites/contracts-stylus/deploys/6659cd736503190008f68270

Copy link

codecov bot commented May 23, 2024

Codecov Report

Attention: Patch coverage is 60.00000% with 8 lines in your changes are missing coverage. Please review.

Project coverage is 83.5%. Comparing base (5f3915e) to head (b94bfb6).

Additional details and impacted files
Files Coverage Δ
contracts/src/access/ownable.rs 91.7% <100.0%> (+2.1%) ⬆️
contracts/src/erc20/extensions/metadata.rs 0.0% <ø> (-81.5%) ⬇️
contracts/src/erc721/extensions/metadata.rs 0.0% <ø> (-86.9%) ⬇️
contracts/src/erc721/mod.rs 64.9% <100.0%> (+0.2%) ⬆️
contracts/src/utils/metadata.rs 0.0% <ø> (-75.0%) ⬇️
contracts/src/utils/pausable.rs 82.0% <100.0%> (+0.3%) ⬆️
contracts/src/erc20/extensions/capped.rs 60.0% <11.1%> (-20.3%) ⬇️

bidzyyys
bidzyyys previously approved these changes May 23, 2024
Copy link
Collaborator

@bidzyyys bidzyyys left a 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.

examples/erc721/src/constructor.sol Show resolved Hide resolved
examples/erc20/src/constructor.sol Show resolved Hide resolved
contract AccessControlExample {
mapping(address => uint256) _balances;
mapping(address => mapping(address => uint256)) _allowances;
uint256 _total_supply;
Copy link
Collaborator

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

Copy link
Contributor Author

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

contract OwnableExample {
mapping(address => uint256) _balances;
mapping(address => mapping(address => uint256)) _allowances;
uint256 _total_supply;
Copy link
Collaborator

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.

@qalisander
Copy link
Member

qalisander commented May 23, 2024

Great job!
We should merge integration tests to it though.
Do you need help making it work together?

@alexfertel
Copy link
Contributor Author

Do you need help making it work together?

No worries, I'll do it.

@alexfertel alexfertel marked this pull request as draft May 26, 2024 21:17
@bidzyyys bidzyyys self-requested a review May 27, 2024 08:19
Copy link
Collaborator

@bidzyyys bidzyyys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great 🚀

@bidzyyys bidzyyys self-requested a review May 31, 2024 07:22
Copy link
Collaborator

@bidzyyys bidzyyys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! 🚀

Ok(contract_addr)
}

macro_rules! send {
Copy link
Collaborator

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

Copy link
Contributor Author

@alexfertel alexfertel May 31, 2024

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 🙏

@alexfertel alexfertel marked this pull request as ready for review May 31, 2024 10:55
@bidzyyys bidzyyys self-requested a review May 31, 2024 12:12
bidzyyys
bidzyyys previously approved these changes May 31, 2024
Copy link
Collaborator

@bidzyyys bidzyyys left a 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.

scripts/e2e-tests.sh Show resolved Hide resolved
examples/erc20/tests/erc20.rs Show resolved Hide resolved
lib/e2e/src/system.rs Outdated Show resolved Hide resolved
lib/e2e/src/system.rs Outdated Show resolved Hide resolved
lib/e2e/src/system.rs Show resolved Hide resolved
const TOKEN_SYMBOL: &str = "TTK";
const CAP: usize = 1;

async fn deploy(rpc_url: &str, private_key: &str) -> eyre::Result<Address> {
Copy link
Collaborator

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.

Copy link
Contributor Author

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.

Copy link
Collaborator

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.

examples/erc721/tests/erc721.rs Show resolved Hide resolved
examples/erc721/tests/erc721.rs Show resolved Hide resolved
examples/erc721/tests/erc721.rs Show resolved Hide resolved
examples/erc721/tests/erc721.rs Outdated Show resolved Hide resolved
@bidzyyys bidzyyys self-requested a review May 31, 2024 14:18
Copy link
Collaborator

@bidzyyys bidzyyys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@alexfertel alexfertel changed the title feat: add support for constructors using Koba feat: add support for constructors & migrate e2e test to alloy May 31, 2024
@alexfertel alexfertel changed the title feat: add support for constructors & migrate e2e test to alloy feat: integrate koba & migrate e2e test to alloy Jun 1, 2024
@alexfertel alexfertel changed the title feat: integrate koba & migrate e2e test to alloy feat: integrate koba & migrate e2e tests to alloy Jun 1, 2024
@alexfertel alexfertel merged commit 71e7782 into main Jun 1, 2024
20 checks passed
@alexfertel alexfertel deleted the constructors branch June 1, 2024 07:50
@alexfertel alexfertel removed this from the Release v0.1.0 milestone Jun 1, 2024
alexfertel added a commit that referenced this pull request Jun 2, 2024
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
alexfertel added a commit that referenced this pull request Jun 7, 2024
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort: high Large or difficult task. priority: 2 We will resolve this in a short timeframe. type: feature New feature request.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants