Skip to content

Track changes to generated code in test vectors#1572

Merged
leighmcculloch merged 30 commits intomainfrom
i1544-test-improvements-expand
Sep 30, 2025
Merged

Track changes to generated code in test vectors#1572
leighmcculloch merged 30 commits intomainfrom
i1544-test-improvements-expand

Conversation

@leighmcculloch
Copy link
Copy Markdown
Member

@leighmcculloch leighmcculloch commented Sep 26, 2025

What

Add a job that expands the generated code of each test wasm both when built locally for the host with tests, and when built for wasm, and verifies if the committed files are up-to-date.

Why

So that PRs show diffs when there are changes to generated code. To catch unexpected and make hyper-visible the impact of changes to macros.

There's always an argument with this type of files we're committing that it will get too noisy, too cumbersome, and that it won't be the right balance and tradeoff in maintainence cost. This is an experiment to some degree and I think we'll find out during Q4 if it pays off or not and then we can retro, because we have changes planned that'll change the generated code (e.g. #1507 #1535) and we'll see how it goes. We can decide to remove this if the tradeoff doesn't end up being right.

For #1544

Dependent on:

github-merge-queue bot pushed a commit that referenced this pull request Sep 30, 2025
### What
Remove the rssdkver (Rust SDK Version) meta entry from the builds of the
test wasms in this repository.

And build the test wasms once with the minimum supported rust version
(msrv) and use that build for test runs.

  ### Why
When building contracts with the soroban-sdk imported, the Rust SDK
Version is embedded in a meta entry. For the test wasms in this
repository this makes their builds unstable, and inconsistent. Every
commit on the repository results in a slightly different build given
that the revision is included and is forever changing. This makes it
challenging to use the wasms in some places where the hash or the raw
bytes get captured, such as test snapshots, and soon expanded generated
code (#1572).

The simplest way to remove this problem is to remove the meta entry just
when building the local test vectors.

Each version of rust can also cause differences in the wasm build, so
for tests, only testing against the wasms built with the msrv keeps the
wasm binaries stable for the longest period of time. This change
required some refactoring of the ci process, to separate building and
testing. That refactor also moved us away from using a separate set of
commands in ci vs locally, now ci just runs make commands.

The local Makefile is updated to build the wasms with the msrv as well
for convenience.
@leighmcculloch leighmcculloch requested review from a team and graydon September 30, 2025 10:52
@leighmcculloch leighmcculloch mentioned this pull request Sep 30, 2025
8 tasks
@leighmcculloch leighmcculloch marked this pull request as ready for review September 30, 2025 19:50
@leighmcculloch leighmcculloch requested review from Copilot and removed request for graydon September 30, 2025 20:18
Copy link
Copy Markdown
Contributor

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 PR adds a job that expands the generated code of each test wasm for both host testing and wasm compilation, then verifies if the committed files are up-to-date. This allows PRs to show diffs when there are changes to generated code, making the impact of macro changes more visible.

The changes involve:

  • Adding numerous expanded test files showing generated code output for both test and wasm32v1-none targets
  • These files demonstrate the output from the Soroban SDK's procedural macros for various test contracts

Reviewed Changes

Copilot reviewed 43 out of 50 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests-expanded/test_udt_wasm32v1-none.rs Generated code for UDT (User Defined Types) test compiled for wasm32v1-none target
tests-expanded/test_udt_tests.rs Generated code for UDT test compiled for host testing with additional test utilities
tests-expanded/test_multiimpl_wasm32v1-none.rs Generated code for multi-implementation test compiled for wasm32v1-none target
tests-expanded/test_multiimpl_tests.rs Generated code for multi-implementation test compiled for host testing
tests-expanded/test_modular_wasm32v1-none.rs Generated code for modular contract test compiled for wasm32v1-none target
tests-expanded/test_modular_tests.rs Generated code for modular contract test compiled for host testing
tests-expanded/test_macros_wasm32v1-none.rs Generated code for macro test compiled for wasm32v1-none target
tests-expanded/test_macros_tests.rs Generated code for macro test compiled for host testing
tests-expanded/test_logging_wasm32v1-none.rs Generated code for logging test compiled for wasm32v1-none target
tests-expanded/test_logging_tests.rs Generated code for logging test compiled for host testing
tests-expanded/test_invoke_contract_wasm32v1-none.rs Generated code for contract invocation test compiled for wasm32v1-none target
tests-expanded/test_invoke_contract_tests.rs Generated code for contract invocation test compiled for host testing
tests-expanded/test_import_contract_wasm32v1-none.rs Generated code for contract import test compiled for wasm32v1-none target

@leighmcculloch leighmcculloch added this pull request to the merge queue Sep 30, 2025
Merged via the queue into main with commit 14af9ad Sep 30, 2025
35 checks passed
@leighmcculloch leighmcculloch deleted the i1544-test-improvements-expand branch September 30, 2025 23:25
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