mirror of
https://github.com/luxfi/evm.git
synced 2026-09-24 00:27:44 +00:00
GetPrecompileEnv() is on the SHARED external contract.AccessibleState interface, so the live Call surface (whose sub-call msg.sender is the asserting precompile's OWN address) is reachable by every external precompile that type-asserts the optional callableEnv capability. Bound that blast radius with defense-in-depth: - precompile/registry/bridge.go: callableEnvAllowlist keyed on the geth env's self-address (env.Addresses().Self), populated from the canonical dex.LXSettleAddress (0x9999) + dex.DEXPositionManagerAddress (0x9996) constants (one source of truth). Every other external precompile (PQ/ZK verifiers at 0x0122xx, future ones) gets a nil callable env and falls back to fail-secure refusal. No live behaviour change today (none assert callableEnv yet) — it prevents a FUTURE precompile silently acquiring sub-call power. Sits on top of each settlement Run's CALL-only guard. - core/precompile_overrider.go: GetPrecompileEnv comment corrected — the accessor is off the EVM-INTERNAL interface but IS on the shared external one; reach is bounded by the bridge gate + the settle CALL-only guard. - precompile/registry/bridge_precompileenv_test.go: recordingEnv carries a self; TestBridge_GetPrecompileEnv_NonSettlementSelf_Gated (0x012204 verifier -> nil, no Call) + _PositionManagerSelf_Allowed (0x9996 -> non-nil); WiredForwardsCall now models the 0x9999 self.