Skip to content

fix(hello-world): repair contract lib build after merged refactor (#884) - #886

Open
kaluuba-org wants to merge 1 commit into
Smartdevs17:mainfrom
kaluuba-org:fix/hello-world-build-repair
Open

fix(hello-world): repair contract lib build after merged refactor (#884)#886
kaluuba-org wants to merge 1 commit into
Smartdevs17:mainfrom
kaluuba-org:fix/hello-world-build-repair

Conversation

@kaluuba-org

@kaluuba-org kaluuba-org commented Aug 29, 2026

Copy link
Copy Markdown

Closes #720 #712


Summary

Upstream main (3b731f2, #884) left the hello-world contract library with 93 compile errors. This PR repairs the crate so cargo check -p hello-world passes cleanly.

What was broken and fixed

  • risk_params.rs — the merge mangled get_legacy_risk_params (body truncated mid-expression, leaving an unclosed delimiter) and left a duplicate get_risk_params definition. Restored the legacy getter body and removed the duplicate.
  • lib.rs — restored the dropped pub mod timelock; declaration (the crate routes timelock::* entrypoints at lib.rs:2452-2513, so the module was required); typed flags as u32; fixed gov_get_multisig_config return type; fixed the cross-asset and oracle entrypoint result mapping.
  • SDK 27 API driftenv.ledger().sequence_number().sequence() (flash_loan.rs); ReentrancyGuard::new_with_key(env, key, false); Address::zero() → XDR-constructed zero-contract-address check (private in SDK 27); Vec::remove now takes u32; iter().position closure pattern.
  • Enum/structural mismatches — added Paused/Emergency to CircuitBreakerStatus with exhaustive match arms; EmergencyTrigger::AdminEmergencyAdmin; abnormal_utilization_threshold_bpsabnormal_utilization_bps; completed CircuitBreakerState construction with tier/affected_pool/guardian_multisig/governance_vote_required; added RecoveryRequest.ready_at.
  • Error types — added missing GovernanceError variants (RecoveryNotReady, InvalidActionTypeDelay, EmergencyOverrideAlreadyApproved, InsufficientEmergencyApprovals), missing DebtTokenError conversion arms, and the missing From<EmergencyWithdrawalError> for LendingError.
  • Events — added to_shared_proposal_type / to_shared_vote_type / to_shared_emergency_trigger conversions for the shared-events schema.
  • Misc — missing Vec imports, borrow-after-move fix in mev_protection.rs, get_static_reserve_factorget_legacy_reserve_factor, reserve::get_reserve_balancetreasury::get_reserve_balance, and a type annotation in reputation.rs.

Verification

stellar-lend $ cargo check -p hello-world
warning: `hello-world` (lib) generated 26 warnings   # pre-existing, not new
Finished `dev` profile ... in 0.16s

Known remaining breakage (pre-existing, out of scope)

Chronicled for follow-up PRs; none are caused by this change:

  1. Test suite does not compilecargo test -p hello-world fails with ~647 errors across 52 stale test files. The tests target the pre-refactor contract API (e.g. client.get_utilization(), is_operation_paused, get_risk_config) which no longer exists on HelloContractClient. Porting them to the new API is a separate, sizable effort.
  2. WASM link failsstellarlend-common ships a full #[contract] UpgradeManager whose no_mangle exports collide when stellarlend-amm (a hello-world dependency) re-exports those methods: rust-lld: error: duplicate symbol: upgrade_rollback (etc.). Needs stellarlend-common's contract to be feature-gated or split out.
  3. Rust toolchain — the release wasm build requires stellar contract build (stellar-cli v25.2+) or the wasm32v1-none target; plain cargo build --target wasm32-unknown-unknown is unsupported by the Soroban Environment.

…artdevs17#884)

Upstream main (3b731f2) left the hello-world contract library with 93 compile
errors after the architectural refactor in Smartdevs17#884. This repairs the crate so
cargo check -p hello-world passes: restored the mangled get_legacy_risk_params
body and removed the duplicate get_risk_params in risk_params.rs, restored the
dropped timelock module declaration in lib.rs, and fixed SDK-27 API drift
(sequence(), ReentrancyGuard::new_with_key 3-arg form, is_zero_address via XDR,
Vec::remove(u32), typed flags), enum/structural mismatches (CircuitBreakerStatus
Paused/Emergency variants, RecoveryRequest.ready_at, CircuitBreakerState
construction), missing GovernanceError/DebtTokenError variants, the missing
From<EmergencyWithdrawalError> impl, and shared-events conversion helpers.
@vercel

vercel Bot commented Aug 29, 2026

Copy link
Copy Markdown

@kaluuba-org is attempting to deploy a commit to the smartdevs17's projects Team on Vercel.

A member of the Team first needs to authorize it.

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 gas golf competition leaderboard and optimization harness

1 participant