Skip to content

Add e2e tests#12

Merged
smiasojed merged 11 commits intomainfrom
sm/e2e-tests
Mar 5, 2026
Merged

Add e2e tests#12
smiasojed merged 11 commits intomainfrom
sm/e2e-tests

Conversation

@smiasojed
Copy link
Copy Markdown
Collaborator

No description provided.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 25, 2026

Benchmark Size Comparison (vs main)

Artifact Baseline Current Delta Status
fibonacci_builder-dsl.debug.polkavm 36458 36466 +0.02% OK
fibonacci_builder-dsl.release.polkavm 1194 1194 +0.00% OK
fibonacci_no-alloc.debug.polkavm 35699 35699 +0.00% OK
fibonacci_no-alloc.release.polkavm 469 469 +0.00% OK
fibonacci_with-alloc.debug.polkavm 44932 44932 +0.00% OK
fibonacci_with-alloc.release.polkavm 448 448 +0.00% OK
multi_builder-dsl.debug.polkavm 53561 53561 +0.00% OK
multi_builder-dsl.release.polkavm 3568 3568 +0.00% OK
multi_no-alloc.debug.polkavm 55413 55413 +0.00% OK
multi_no-alloc.release.polkavm 3419 3419 +0.00% OK
multi_with-alloc.debug.polkavm 64463 64463 +0.00% OK
multi_with-alloc.release.polkavm 3864 3864 +0.00% OK
mytoken_builder-dsl.debug.polkavm 49832 49840 +0.02% OK
mytoken_builder-dsl.release.polkavm 4097 4097 +0.00% OK
mytoken_no-alloc.debug.polkavm 51840 51840 +0.00% OK
mytoken_no-alloc.release.polkavm 3751 3751 +0.00% OK
mytoken_with-alloc.debug.polkavm 62694 62694 +0.00% OK
mytoken_with-alloc.release.polkavm 4301 4301 +0.00% OK
---------------------------------------------------- ------------ ------------ ---------- --------
Total 480003 480019 +0.00%

OK: All artifacts within 5% regression threshold

Run 22708133635 | a900bbc | 2026-03-05 08:25 UTC

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request adds comprehensive end-to-end testing infrastructure and test contracts to the cargo-pvm-contract project. The PR introduces a new e2e testing crate, nine test contracts covering various scenarios, integration tests, and updates to code generation for proper handling of composite types in return values.

Changes:

  • Adds pvm-contract-e2e-tests crate with utilities for running anvil-polkadot nodes, building contracts, and interacting with the blockchain via cast
  • Introduces nine test contracts (flipper, storage-types, return-values, caller-check, error-handling, events, multi-method, dynamic-types, composite-types) with corresponding Solidity interfaces
  • Updates dispatch code generation to correctly handle FixedArray and Tuple types in single return values, and adds special handling for DynBytes encoding

Reviewed changes

Copilot reviewed 34 out of 36 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
crates/pvm-contract-e2e-tests/ New testing infrastructure with anvil management, contract building, and cast client
crates/pvm-contract-e2e-tests/tests/ Integration and E2E tests for contract functionality and build artifacts
examples/test-contracts/src/ Nine new test contracts demonstrating various contract patterns
examples/test-contracts/*.sol Solidity interface files for test contracts
examples/test-contracts/Cargo.toml Build configuration for test contracts
crates/pvm-contract-macros/src/codegen/dispatch.rs Fixed encoding for FixedArray/Tuple returns and DynBytes special handling
Cargo.toml Added pvm-contract-e2e-tests to workspace

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread crates/pvm-contract-e2e-tests/src/anvil.rs
Comment thread crates/pvm-contract-e2e-tests/src/cast.rs
Comment thread crates/pvm-contract-e2e-tests/tests/e2e_tests.rs Outdated
};

// totalSupply() -> uint256, view
let f = find_fn("totalSupply");
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

all these asserts are quite verbose. I would just assert the whole things against a golden json file

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done

}

#[test]
#[ignore]
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

why do we ignore all the tests?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I assumed that use may not have the anvil-polkadot installed. Removed ignore

Comment on lines +1 to +2
#![cfg_attr(not(feature = "abi-gen"), no_main)]
#![cfg_attr(not(feature = "abi-gen"), no_std)]
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit we should have the template generate that as
#![cfg_attr(not(feature = "abi-gen"), no_main, no_std)]

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

done

@smiasojed smiasojed requested a review from pgherveou March 5, 2026 08:34
@smiasojed smiasojed merged commit c97af21 into main Mar 5, 2026
4 checks passed
@smiasojed smiasojed deleted the sm/e2e-tests branch March 16, 2026 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants