Skip to content

feat(sim): Emit exact diagnostic_events matching Soroban CLI - Issue #341#523

Open
unixfundz wants to merge 2 commits intodotandev:mainfrom
unixfundz:feat/sim-issue-26
Open

feat(sim): Emit exact diagnostic_events matching Soroban CLI - Issue #341#523
unixfundz wants to merge 2 commits intodotandev:mainfrom
unixfundz:feat/sim-issue-26

Conversation

@unixfundz
Copy link
Contributor

Overview

Fixes erst-sim diagnostic event emission to achieve 1:1 parity with
identical rust-soroban-env execution outputs.

Changes

Core Implementation

  • in_successful_contract_call fix: Corrected inverted logic — was
    set to event.failed_call instead of !event.failed_call in both the
    main event emission path and categorize_events
  • contract_id serialization: Replaced Rust Debug format ({:?})
    with lowercase hex encoding, matching Soroban CLI output
  • topics and data serialization: Replaced Rust Debug format with
    base64-encoded XDR via WriteXdr, matching Soroban CLI output exactly
  • runner.rs cleanup: Removed broken CostModel/set_model calls
    unavailable in soroban-env-host v25 public API
  • Dead test removed: Deleted test_decode_vm_traps referencing
    non-existent decode_error function

Testing

  • Added simulator/tests/diagnostic_events.rs with 6 tests:
    • in_successful_contract_call_is_inverse_of_failed_call
    • topics_serialize_to_valid_xdr_base64
    • data_serializes_to_valid_xdr_base64
    • contract_id_encodes_as_hex_without_debug_formatting
    • event_type_field_matches_allowed_values
    • event_body_is_v0

Verification

  • All 12 tests pass (cargo test)
  • cargo clippy -- -D warnings passes with zero warnings
  • No lint suppressions added
  • Backward compatible with existing simulation API

Related Issues

Closes #341

Type of Change

  • Bug fix
  • New feature (tests)
  • Breaking change
  • Documentation update

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • Tests added/updated
  • No new linting issues
  • Changes verified locally

@dotandev
Copy link
Owner

fix conflicts

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.

[SIM] Emit exact diagnostic_events matching Soroban CLI #126

2 participants