Skip to content

fix(lending): RepaymentEvent TryFromVal E0277 — drop conflicting PartialEq derive (#597) - #723

Merged
likableai merged 1 commit into
Pi-Defi-world:devfrom
albatrossxXx:fix/597-repayment-event-try-from-val
Sep 1, 2026
Merged

fix(lending): RepaymentEvent TryFromVal E0277 — drop conflicting PartialEq derive (#597)#723
likableai merged 1 commit into
Pi-Defi-world:devfrom
albatrossxXx:fix/597-repayment-event-try-from-val

Conversation

@albatrossxXx

@albatrossxXx albatrossxXx commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #597RepaymentEvent fails Val: TryFromVal (E0277), preventing the repayment event from being published.

Root cause

RepaymentEvent was decorated with both #[contracttype] and #[derive(PartialEq)]. The #[contracttype] proc-macro generates the TryFromVal<Env, Self> impl Soroban requires for env.events().publish(). Adding #[derive(PartialEq)] on a struct that contains an Address field in a #[no_std] context conflicts with the macro-generated code, causing the compiler to fail with:

error[E0277]: the trait bound `Val: TryFromVal<Env, RepaymentEvent>` is not satisfied
  --> acbu_lending_pool/src/lib.rs:619

Fix

Removed PartialEq from the #[derive(...)] on RepaymentEvent:

// Before
#[contracttype]
#[derive(Clone, Debug, PartialEq)]
pub struct RepaymentEvent { ... }

// After
#[contracttype]
#[derive(Clone, Debug)]
pub struct RepaymentEvent { ... }

This matches the established pattern for every other event struct containing an Address field in this contract (BorrowEvent, RepayEvent, LoanCreatedEvent, LoanRepaidEvent) and across the codebase (MintEvent, BurnEvent, etc. in shared/src/lib.rs).

Impact

  • No logic change — only the derive attribute is modified.
  • Tests in acbu_lending_pool/tests/test.rs are unaffected: they compare individual Address and i128 fields, not RepaymentEvent itself.

Acceptance criterion

acbu_lending_pool compiles without E0277. Repayment event publishes successfully.

closes #597

…Pi-Defi-world#597)

RepaymentEvent had #[derive(PartialEq)] alongside #[contracttype].
The contracttype proc-macro generates TryFromVal<Env, Self> for the
struct; adding a manual PartialEq derive on a struct containing an
Address field in a no_std context conflicts with that generated impl,
preventing the compiler from satisfying the Val: TryFromVal bound
required by env.events().publish() — E0277.

Fix: drop PartialEq from RepaymentEvent's derive list, matching every
other event struct in the contract that contains an Address field
(BorrowEvent, RepayEvent, LoanCreatedEvent, LoanRepaidEvent, etc.).

Tests in acbu_lending_pool/tests/test.rs are unaffected: they compare
individual Address and i128 fields, not RepaymentEvent itself.

Acceptance: acbu_lending_pool compiles without E0277.
@coderabbitai

coderabbitai Bot commented Sep 1, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Team

Run ID: 3eeb74e6-26db-449a-8b3b-49285527cf41


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@drips-wave

drips-wave Bot commented Sep 1, 2026

Copy link
Copy Markdown

@albatrossxXx Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@likableai
likableai merged commit 49f5833 into Pi-Defi-world:dev Sep 1, 2026
6 of 9 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.

W2-C-017 - RepaymentEvent fails Val: TryFromVal

2 participants