-
Notifications
You must be signed in to change notification settings - Fork 1
fix(kyber): bind recipient-credit checks to router-family semantics #91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
ac78a41
fix(kyber): resolve backtest trip as a deployment-arity bug, not an a…
makemake-kbo ab12763
test(kyber): pin backtest trip to constructor-arity revert; gate kybe…
makemake-kbo 85c9607
style(kyber): forge fmt bytecode assignments; clarify wrong-family co…
makemake-kbo d3afa0e
docs(kyber): restore sanitized ENG-3860 backtest replay record
makemake-kbo 7656c5d
docs(kyber): remove BACKTEST_TRIP_FINDINGS.md
makemake-kbo 82fc0ad
docs(kyber): clarify malformed constructor decoding
makemake-kbo 967ae66
docs(kyber): restore short constructor tail explanation
makemake-kbo 327b9b2
fix(kyber): bind assertion semantics to router families
makemake-kbo a061c8a
fix(kyber): classify partial fills by entry point
makemake-kbo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,26 +1,39 @@ | ||
| # KyberSwap examples | ||
|
|
||
| This example targets MetaAggregationRouterV2. Kyber has two deployed runtime families at the shared | ||
| router address, so deployments must explicitly select whether the original `swapGeneric` surface | ||
| is present. | ||
| This example targets MetaAggregationRouterV2. Kyber uses the same router address across chains but | ||
| has distinct verified runtime families, so the example exposes separate assertion artifacts: | ||
|
|
||
| - `KyberOriginalMetaAggregationRouterAssertion` includes `swapGeneric` and the original | ||
| partial-fill semantics. | ||
| - `KyberModernMetaAggregationRouterAssertion` omits `swapGeneric` and never interprets caller bit | ||
| zero as a partial-fill bypass. | ||
|
|
||
| The family is fixed by the selected bytecode artifact; there is no deployer-supplied family | ||
| boolean. | ||
|
|
||
| ```sh | ||
| FOUNDRY_PROFILE=kyber forge build | ||
| FOUNDRY_PROFILE=kyber pcl test | ||
| ``` | ||
|
|
||
| Only `assertReceiverGetsMinReturn` is registered. It checks standard ERC-20, non-partial output by | ||
| comparing the declared receiver's balance before and after the exact swap call. The live router | ||
| already performs the same balance-delta check, so this is a narrow redundant postcondition. Native | ||
| output and original-family partial fills remain outside it. The original-family partial-fill flag | ||
| is not applied to modern deployments. | ||
| Only `assertReceiverGetsMinReturn` is registered. It compares the declared receiver's balance | ||
| before and after the exact swap call. The live router already performs a receiver-delta check, so | ||
| this is a narrow redundant postcondition for a buggy or compromised settlement path, not a | ||
| universal protocol invariant. | ||
|
|
||
| The additive outer-call model excludes native output, same-token routes, and rebasing/reflection | ||
| tokens. On the original family, a partial-fill route is skipped only when native input or | ||
| `_SHOULD_CLAIM` can make the router recompute `spentAmount` below `desc.amount`; caller-controlled | ||
| bit zero alone does not disable the flat check. The modern artifact never applies partial-fill | ||
| semantics. | ||
|
|
||
| `assertNoThirdPartyAllowanceDrain` is retained as an unarmed diagnostic. A `Transfer` event does | ||
| not identify which spender used the allowance, so a route where an executor spends its own tokens | ||
| can be rejected merely because it has a stale router allowance. Approval events do not establish | ||
| causality either. The old approval behavior tests are therefore no longer part of the executable | ||
| semantic suite. | ||
|
|
||
| The configured router is bound to the adopter, but deployment operations must still pin the chain | ||
| and verified runtime family. The local route mocks are unit fixtures and do not reproduce every | ||
| live command encoding. | ||
| The configured router is bound to the adopter. Deployment operations must still pin the chain and | ||
| verified runtime family before choosing an artifact. The local model reproduces the accounting and | ||
| `swap` dispatch boundaries used by the semantic tests. Its `swapSimpleMode` cases are isolated | ||
| calldata/assertion-branch fixtures, not a reproduction of Kyber's full `SimpleSwapData` engine. |
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.