Repository navigation
Improves/sub call check - #35
Open
hundredark wants to merge 4 commits into
Open
hundredark wants to merge 4 commits into
hundredark wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Cleanup validation can authorize unintended transfers, burns, or mints, while also rejecting valid SOL-dust cleanups and accepting mismatched token decimals.
4 open issues
What changed in this PR
This PR strengthens Solana subsystem-call validation and simplifies the store lookup used to detect unfinished prepare calls.
Changes:
- Validates prepare movements by asset, amount, source, and destination, and requires a prepare call when referenced assets exist.
- Separates transfers from burns during post-process and deposit validation.
- Replaces the unfinished-sub-call transaction with a single existence query.
| File | Description |
|---|---|
store/call.go |
Simplifies the pending prepare-call existence check. |
solana/system_call.go |
Adds movement-ledger validation for prepare, post-process, and deposit calls. |
solana/mvm.go |
Enforces required prepare calls and supplies validation context. |
apps/solana/common.go |
Adds typed extraction of initial transfers and burns. |
Review effort: Max
| if old.Amount.Cmp(amount) != 0 { | ||
| return fmt.Errorf("invalid user balance change: %s %s %s", address, amount.String(), old.Amount.String()) | ||
| } | ||
| actualTransfers, actualBurns := buildInitialAssetMovementMaps(tx, "", node.SolanaPayer().String()) |
Comment on lines
+890
to
894
| expectedValue := asset.Amount.Mul(decimal.New(1, int32(asset.Decimal))).BigInt() | ||
| movement := actual[address] | ||
| if movement == nil { | ||
| return fmt.Errorf("missing %s user balance change: %s", kind, address) | ||
| } |
Comment on lines
+905
to
+907
| if expected[address] == nil { | ||
| return fmt.Errorf("unexpected %s user balance change: %s %s", kind, address, amount.String()) | ||
| } |
| } | ||
| if actual.Cmp(expected) != 0 { | ||
| return fmt.Errorf("invalid deposit: %s %s %s %s %s", signature, key, expected.String(), actual.String(), tx.MustToBase64()) | ||
| if movement.Value.Cmp(expectedValue) != 0 { |
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.


No description provided.