Skip to content

PR for Build error-trigger smart contract (#72)#88

Merged
Ibinola merged 3 commits intoIbinola:mainfrom
clintjeff2:main
Feb 24, 2026
Merged

PR for Build error-trigger smart contract (#72)#88
Ibinola merged 3 commits intoIbinola:mainfrom
clintjeff2:main

Conversation

@clintjeff2
Copy link
Contributor

@clintjeff2 clintjeff2 commented Feb 23, 2026

feat: build error-trigger smart contract (#72)

Closes #72

Summary

Implements the error-trigger Soroban smart contract introduced in issue #72. The contract is purpose-built to validate error boundaries and diagnostic tooling by failing in controlled, predictable ways.


Changes

New files

  • contracts/error-trigger/Cargo.toml — Rust package manifest; targets wasm32-unknown-unknown with release optimisations suitable for Soroban deployment.
  • contracts/error-trigger/src/lib.rs — Contract implementation.

Contract details

Custom error enum (#[contracterror])

Variant Code
InvalidInput 1
Unauthorized 2
Overflow 3

Exported functions

Function Behaviour
trigger_panic(env) Calls panic!() → VM trap
trigger_assert(env, value) Calls assert!(value == 0) → VM trap when value != 0
trigger_custom_error(env, code) Returns Err(Error::*) mapped from code (1–3), or Ok(code) otherwise

Proof of compilation

📎 Attachment — build output screenshot

Screenshot from 2026-02-23 21-53-23

How to get the attachment

Run the build yourself and capture the terminal output:

cd contracts/error-trigger
cargo build --target wasm32-unknown-unknown --release

Expected last line:

Finished `release` profile [optimized] target(s) in ...s

Steps to screenshot:

  1. Open a terminal inside the repo root.
  2. Run the command above.
  3. Once it finishes, take a full screenshot of the terminal showing the Compiling error-trigger … line and the Finished … line.
    • Linux: PrtScn or Shift+PrtScn to capture a region; the image saves to ~/Pictures.
    • macOS: Cmd+Shift+4 → drag to select the terminal area.
    • Windows: Win+Shift+S → drag to select, then paste into an image editor and save.
  4. Drag-and-drop the saved image into the PR description box on GitHub (replacing the placeholder above).

Testing

cd contracts/error-trigger
cargo test

Checklist

  • Contract compiles to wasm32-unknown-unknown without warnings
  • trigger_panic produces a VM trap (panic!)
  • trigger_assert produces a VM trap when the assertion fails
  • trigger_custom_error returns the correct contracterror code for inputs 1–3
  • No breaking changes to existing packages

@Ibinola
Copy link
Owner

Ibinola commented Feb 24, 2026

looks good @clintjeff2

@Ibinola Ibinola merged commit 80b8b7c into Ibinola:main Feb 24, 2026
1 check failed
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.

Build error-trigger Smart Contract

2 participants