mirror of
https://github.com/luxfi/precompile.git
synced 2026-09-24 00:26:21 +00:00
P0 consensus-critical:
- FHE: deterministic keygen from SHA-256("LUX_FHE_KEYGEN_v1"), StateDB
ciphertext storage (replaces ephemeral in-memory ctStore), remove
crypto/rand fallback
- time.Now() eliminated from 20 state-modifying paths across bridge (12),
dex (7), attestation (5) — all now use blockTimestamp parameter
- WebSocket: 1024-client semaphore, 64KB read limit, 60s deadline, pong
handler, origin check on chain/dag/evm indexer subscribers
P1 correctness:
- I-Chain indexer: identity.Health → identity.getLatestBlock
- Graph pagination: min(limit, 1000) cap across 25 resolver files
- Error sentinels: 31 packages unified to contract.ErrInvalidInput
P2 standardization:
- 14 packages migrated from manual gas checks to contract.DeductGas()
- Gas naming: {Name}Gas → Gas{Name} in secp256r1, ed25519, math, quasar
- Registry address format comment clarified (PCII vs legacy ranges)
37/37 precompile tests pass.
Dead Precompile (LP-0150)
Address: Multiple (0x0, 0xdead, 0xdEaD...)
Gas Cost: 10,000 base
Status: Implemented
Overview
The Dead Precompile intercepts transfers to "dead" addresses (commonly used for token burns) and routes them to a 50/50 split between:
- Actual Burn (50%) - Value is permanently destroyed (deflationary)
- DAO Treasury (50%) - Value goes to Protocol-Owned Liquidity (POL)
This creates sustainable protocol revenue from burn activities instead of purely destroying value.
Registered Addresses
| Address | Description | ConfigKey |
|---|---|---|
0x0000000000000000000000000000000000000000 |
Zero address | deadZeroConfig |
0x000000000000000000000000000000000000dEaD |
Common dead address | deadConfig |
0xdEaD000000000000000000000000000000000000 |
Full dead prefix | deadFullConfig |
DAO Treasury
Funds are routed to: 0x9011E888251AB053B7bD1cdB598Db4f9DEd94714
This address is on X-Chain and accumulates protocol-owned liquidity.
Split Ratio
| Component | Percentage | BPS |
|---|---|---|
| Burn | 50% | 5000 |
| Treasury | 50% | 5000 |
When values cannot be split evenly (odd wei amounts), the treasury receives the extra wei.
Usage
Direct Interaction
The precompile is automatically invoked when calling or transferring to any registered dead address:
// Solidity - transfer to dead address triggers precompile
address payable dead = payable(0x000000000000000000000000000000000000dEaD);
dead.transfer(1 ether);
// Result: 0.5 ETH burned, 0.5 ETH to treasury
Programmatic Access
package main
import (
"github.com/luxfi/precompile/dead"
"math/big"
)
func main() {
value := big.NewInt(1e18) // 1 ETH
// Check if address is a dead address
if dead.IsDeadAddress(addr) {
burn, treasury := dead.CalculateSplit(value)
// burn = 0.5 ETH
// treasury = 0.5 ETH
}
}
Mechanics
When a transaction targets a dead address:
- EVM recognizes the address as a precompile
DeadPrecompile.Run()is invoked- The
value(ETH sent) is split 50/50 - 50% is left at the dead address (effectively burned)
- 50% is transferred to DAO treasury
- Transaction stats are recorded via event
Events
event DeadReceived(
address indexed sender,
address indexed deadAddress,
uint256 totalValue,
uint256 burnedAmount,
uint256 treasuryAmount
);
Gas Costs
| Operation | Gas |
|---|---|
| Base cost | 10,000 |
| With balance transfer | +21,000 (standard transfer) |
Security Considerations
- Deterministic Split: Split ratio is hardcoded (not configurable) to prevent manipulation
- DAO Treasury: Uses a fixed address, governance changes require contract upgrade
- Reentrancy: The precompile is stateless and doesn't call external contracts in a reentrant manner
- Value Conservation: Total value always equals burn + treasury (verified in tests)
Files
| File | Description |
|---|---|
contract.go |
Core precompile implementation |
contract_test.go |
Unit tests |
module.go |
Module registration |
README.md |
This documentation |