DOC-44 Add smart contract gas optimization guide #845 FIXED - #922
Merged
anumukul merged 1 commit intoSep 4, 2026
Conversation
|
@veloura-dev 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! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & Why
Fixes the address-formatting issue across the ETH ↔ Stellar bridge. ETH addresses were stored and queried verbatim in whatever casing the caller sent, so a
GET /orders/history?address=…for the EIP-55 form of an address silently returned zero rows when the order had been announced with the lowercase form (and vice versa); whitespace-padded addresses were rejected instead of trimmed; malformed ETH token addresses in the SDK silently mapped to XLM (false asset match); and the frontend hardcoded a USDC contract address that is not the Sepolia USDC deployment.This PR introduces one strict canonicalization layer and enforces it at every edge:
addressesmodule): normalize + validate + compare ETH (EIP-55) and Stellar (G + 55 base32) addresses; strict canonicalization wired into the assets module so malformed ETH token addresses can no longer false-match XLM.POST /api/orders/announceandGET /api/orders/historynow validate + canonicalize (trim, EIP-55 check, Stellar format check), store lowercase canonical ETH addresses, and reject malformed input with explicit400errors (invalid_addresswith the expected checksum,order_validation_errorwith the precise reason) instead of storing/garbling it.0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238— Ethereum L1 Sepolia, per Circle docs), canonical-case display in the token selector.node:sqliteload is now lazy with a clear "requires Node >= 22.5" error; DB test suites skip cleanly on older runtimes (repo.nvmrcpins 24.2.0), so the suite is green on both Node 20 and Node ≥ 22.5.Closesthe address-formatting issue.Touched surface
Tick every layer this PR changes:
frontend/— React + Vite bridge UIpackages/sdk/— shared TypeScript SDKcoordinator/— order book + REST/WS serviceresolver/— community resolver runnerrelayer/— legacy v1 listener / watchdog (changes here need extra scrutiny)contracts/— Solidity v2 (HTLCEscrow,ResolverRegistry)soroban/— Stellar Soroban contracts (oversync-htlc,oversync-resolver-registry)docs/— documentation only.github/workflows/,docker,env.example)Settlement & refund semantics
Critical for SCF / investor review. If any box is checked, the PR must also update
docs/REVIEW_RESPONSE.mdand link the updated section in the PR description.Changed logic is API-edge validation + canonical storage/lookup of address strings only; claim/refund/timelock/hashlock state-machine code is untouched.
docs/REVIEW_RESPONSE.md§10 documents this and was updated in this PR.Tests run
Tick the matches your change and paste the outcome below. Commands mirror the matrix in
CONTRIBUTING.md.pnpm --filter @oversync/sdk build && pnpm --filter @oversync/sdk exec tsc --noEmitpnpm --filter @oversync/sdk testpnpm --filter @oversync/coordinator exec tsc --noEmit && pnpm --filter @oversync/coordinator testpnpm --filter @oversync/resolver exec tsc --noEmit && pnpm --filter @oversync/resolver testpnpm --filter @oversync/frontend exec tsc --noEmit && pnpm --filter @oversync/frontend testpnpm --filter @oversync/contracts compile && pnpm --filter @oversync/contracts exec hardhat test test/v2/HTLCEscrow.test.ts test/v2/ResolverRegistry.test.tscd soroban && stellar contract build && cargo test --release— not run,soroban/untouched(cd contracts && forge test --match-path "test/foundry/*" -v)— not run, Solidity untouchedpnpm test:e2e(cross-chain differential harness) — run as thee2epackage underpnpm testnode scripts/verify-addresses.mjs— required if addresses, configs, orenv.examplechangenode scripts/check-evidence-links.mjs— advisory; required if docs links changeFree-form outcome:
UI / evidence artefacts
Required if the PR changes the frontend, observability, dashboards, or any docs that claim status, metrics, or addresses. Otherwise write
n/a.— no screenshot produced from this environment; the only visible change is canonical-case address rendering (
frontend/src/components/TokenSelector.tsx) and the corrected Sepolia USDC constant (frontend/src/config/networks.ts).curlsnippet + JSON response sample pasted belowCaptured live from this branch's coordinator (Node 22.14, real SQLite, port 3999):
Secrets, logging, and PII risk
.envcontent, wallet mnemonics, or preimages added to the repoconsole.*/logger.*line that prints secrets, preimages, signed payloads, or PIIVITE_*andesbuild.droppolicy still holds)Validation error bodies echo only the public canonical form of the public address the caller itself submitted (e.g. the expected EIP-55 checksum); no preimages, keys, or signed payloads are ever logged or returned.
Public proof links (SCF / investor evidence)
Only required for SCF tranche PRs or investor evidence packs. Otherwise write
n/a.n/a
Breaking change & rollback
Breaking change? Yes / No — describe caller impact, data migrations, revert safety:
Soft break at the API edge. Malformed addresses (mixed-case with a broken EIP-55 checksum, wrong hex length, lowercase Stellar IDs, untrimmable garbage) are now rejected with
400instead of being stored/queried verbatim. Callers sending all-lowercase or valid EIP-55 addresses are unaffected. No schema change, no migration, no new dependencies. ETH addresses are stored in lowercase canonical form and lookups canonicalize the query, so new and canonical data is always mutually reachable; the coordinator DB is documented as a rebuildable cache of on-chain state, so any pre-existing mixed-case rows (none in this pre-launch testnet deployment) can be lowercased with a one-liner or rebuilt from chain events.Migration or feature flag required? Yes / No — describe the path:
No. Rollback is a single
git revertof the branch: the coordinator returns to verbatim storage/lookup (pre-PR behavior) with no data migration in either direction.Reviewer checklist (for the PR author to self-verify)
git revertrestores prior stateFiles in this branch (30: 3 created / 27 modified)
Notes for reviewers
pnpm buildbeforepnpm test: the coordinator tests import the SDK's builtdist/, and the repo's test scripts don't build it first (pre-existing quirk; CI builds before testing and is unaffected).tscdoes not copycoordinator/src/persistence/schema.sqlintodist/, sonode dist/index.jswith SQLite needs a copy step added to the build.CLOSE #845