Skip to content

feat: add test script and fix templates for latest tari_template_lib#49

Merged
sdbondi merged 5 commits intomainfrom
ci
Mar 26, 2026
Merged

feat: add test script and fix templates for latest tari_template_lib#49
sdbondi merged 5 commits intomainfrom
ci

Conversation

@sdbondi
Copy link
Copy Markdown
Member

@sdbondi sdbondi commented Mar 26, 2026

Summary

  • Add scripts/test-templates.sh with --no-bail, --template, --no-clean, and --output-dir flags plus a test summary
  • Add GitHub Actions CI workflow
  • Fix ResourceBuilder::fungible()public_fungible() across all templates
  • Fix strip = true in all template release profiles for smaller WASM binaries
  • Fix Amount unsigned type changes and import path updates for tari_template_lib 0.22.x
  • Fix test file API changes (call_argsargs, import paths)
  • Fix cargo-generate underscore→hyphen directory normalization in test script

Test plan

  • ./scripts/test-templates.sh --template empty passes
  • ./scripts/test-templates.sh --template counter passes
  • ./scripts/test-templates.sh --no-bail runs all templates and reports summary
  • Remaining template fixes in follow-up PRs

🤖 Generated with Claude Code

Add scripts/test-templates.sh with flags:
  --no-bail: continue past failures
  --template <name>: test a specific template
  --no-clean: preserve generated dirs for inspection
  --output-dir <path>: custom output directory

Template fixes:
  - ResourceBuilder::fungible() -> public_fungible()
  - strip = true for smaller WASM binaries
  - Fix Amount unsigned type changes
  - Fix stable_coin access rules and import paths
  - Fix test imports and API renames (call_args -> args)
  - Fix cargo-generate underscore/hyphen directory normalization

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@gitguardian
Copy link
Copy Markdown

gitguardian bot commented Mar 26, 2026

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secret in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
29216592 Triggered Generic Password 5be9983 scripts/test-templates.sh View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the development and testing workflow for Tari templates by introducing a comprehensive test automation script and updating all existing templates to be compatible with the latest tari_template_lib changes. The updates include dependency version bumps, API adjustments for resource creation and amount handling, and build configuration improvements for optimized WASM binaries. These changes ensure the templates remain functional and aligned with the evolving Tari ecosystem, facilitating easier development and maintenance.

Highlights

  • Test Automation: Introduced a new shell script (scripts/test-templates.sh) to automate testing of all templates, including options for --no-bail, --template, --no-clean, and --output-dir.
  • Dependency Updates: Updated Cargo.lock files across various examples and templates to align with newer versions of tari_ootle_common_types, tari_ootle_transaction, tari_template_lib_types, ootle_byte_type, tari_engine_types, tari_hashing, tari_template_abi, tari_template_lib, and tari_template_macros.
  • API Modernization: Refactored template code to use ResourceBuilder::public_fungible() instead of ResourceBuilder::fungible() for creating public fungible resources, aligning with updated API.
  • Build Optimization: Standardized release profile strip settings in Cargo.toml files across all templates to strip = true for smaller WASM binaries.
  • Type Handling Consistency: Adjusted Amount type handling in several templates and tests, explicitly using u64.into() or u64 literals where Amount values are passed to ensure type consistency.
  • Import Path Refinements: Updated import paths for ComponentAddress, NonFungibleAddress, ResourceAddress, and ToByteType in various test and source files to reflect changes in tari_template_lib structure (e.g., from models to types).
  • Test Macro Alignment: Modified test API calls in the fungible template from call_args! to the args! macro for consistency.
  • Template Generation Fix: Fixed cargo-generate directory normalization in the new test script to correctly locate generated template directories.
  • No-std Template Enhancements: Enabled the alloc feature for tari_template_lib in the no_std template's Cargo.toml and uncommented the constructor implementation in src/lib.rs.
  • Swap Template Refactoring: Updated lp_resource type from ResourceAddress to ResourceManager in the swap template and adjusted related logic for LP token management.
  • Dependency Cleanup: Removed the tari_bor dependency from wasm_templates/stable_coin/Cargo.toml.
  • Access Rule Simplification: Simplified AccessRule creation in the stable_coin template using the rule! macro.
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/ci.yml
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request primarily updates dependency versions across various Cargo.lock files, including tari_ootle_*, tari_template_lib_types, tari_engine_types, tari_template_abi, tari_template_lib, and other related crates. It also includes significant refactoring and API updates within the WASM templates, such as migrating types from tari_template_lib::models to tari_template_lib::types, utilizing ResourceBuilder::public_fungible(), and updating args! macro usage with explicit u64 type annotations. Additionally, a new test-templates.sh script has been introduced to automate testing of WASM templates and examples. Review feedback suggests improving the new bash script by using more idiomatic patterns for array membership checks.

sdbondi and others added 4 commits March 26, 2026 14:01
- Use bash regex pattern for array membership instead of loops
- Strip trailing slash from TMPDIR to prevent double slashes
- Use Amount::new() in fungible test

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
… types

- Use assert_reject_reason() helper instead of manual match/contains
- Remove unused imports and prefix unused variables
- Fix Amount type inference in swap (use Amount::from explicitly)
- Fix Amount Sub<u64> ambiguity in meme_coin test

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
…Cargo.lock files

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@sdbondi sdbondi merged commit dd665b1 into main Mar 26, 2026
1 of 2 checks passed
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.

1 participant