Skip to content

fix(lanes): route MsgPrivilegedExecuteContract through the default lane - #43

Open
rozhlas-org-agent wants to merge 1 commit into
InjectiveFoundation:release/v1.20.xfrom
rozhlas-org-agent:fix/privileged-execute-default-lane
Open

fix(lanes): route MsgPrivilegedExecuteContract through the default lane#43
rozhlas-org-agent wants to merge 1 commit into
InjectiveFoundation:release/v1.20.xfrom
rozhlas-org-agent:fix/privileged-execute-default-lane

Conversation

@rozhlas-org-agent

@rozhlas-org-agent rozhlas-org-agent commented Aug 7, 2026

Copy link
Copy Markdown

Summary

MsgPrivilegedExecuteContract is currently matched by the exchange lane, which is built ahead of the default lane in every block. Because this message executes arbitrary CosmWasm logic (it is not an order placement/cancellation message), its placement in the exchange lane lets any contract call be sequenced ahead of default-lane transactions. This PR excludes it from the exchange-lane matcher so it is ordered in the default lane like any other contract execution.

Motivation

The exchange lane exists to sequence order-flow messages (x/exchange order placement, cancellation, batch updates) ahead of the default lane. MsgPrivilegedExecuteContract is a generic privileged contract-execution entrypoint — its intended use is privileged contract flows (e.g. registered vault / Mito-style contracts), not lane placement.

In practice it is being used to front-run ordinary default-lane transactions: an actor deploys a CosmWasm arbitrage contract and invokes it via MsgPrivilegedExecuteContract, which then inherits the exchange lane's position and is sequenced ahead of every default-lane MsgExecuteContract in the block. This ordering advantage comes purely from the lane classification — lanes are processed in a fixed order (exchange before default), independent of fees (Injective does not order transactions by fee).

Note that on mainnet code_upload_access is a fixed allow-list (AnyOfAddresses), so an actor holding one of those addresses can upload such a contract without a governance proposal, making the vector readily accessible.

On-chain evidence: block 177523207 — contract inj1tgp7e3559fm83xa7qqee4hhlvyj8e5fu83lzwn invoked via MsgPrivilegedExecuteContract in the exchange lane.

Change

Exclude MsgPrivilegedExecuteContract (v1beta1 + v2) from isExchangeMsg, so transactions carrying it are matched by the default lane instead.

Backwards compatibility

Legitimate privileged-execute flows are unaffected in behavior — the message still executes exactly as before; it is simply ordered in the default lane instead of ahead of it. No state, API, or message change.

Tests

Adds lane_test.go covering the matcher: an exchange order matches; MsgPrivilegedExecuteContract (including authz-wrapped) does not; a mixed tx does not.

@rozhlas-org-agent

Copy link
Copy Markdown
Author

cc @achilleas-kal @gorgos — small, self-contained change (16 LoC + tests) moving MsgPrivilegedExecuteContract out of the fee-prioritized exchange lane so it is ordered in the default lane like any other contract execution. No state/API change, fully backwards-compatible. Would appreciate a review when you get a chance — happy to retarget the branch or adjust the approach.

MsgPrivilegedExecuteContract executes arbitrary privileged CosmWasm logic
rather than placing or cancelling orders, so it does not belong in the
fee-prioritized exchange lane. Exclude it from the exchange lane matcher
so a transaction carrying it is ordered in the default lane like any other
contract execution. Covers both the v1beta1 and v2 message.

Signed-off-by: rozhlas-org-agent <rozhlas-org-agent@users.noreply.github.com>
@rozhlas-org-agent
rozhlas-org-agent force-pushed the fix/privileged-execute-default-lane branch from 452bdc1 to 8a84b18 Compare August 7, 2026 09:43
@gorgos

gorgos commented Aug 7, 2026

Copy link
Copy Markdown

@rozhlas-org-agent Thanks for the suggestion. MsgPrivilegedExecuteContract also are used for synthetic trades, i.e. exchange. So this is a known limitation for now. There are plans to not use synthetic trades in the future though, then we can also adjust the lane.

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.

2 participants