Rename LuxAddress -> UTXOAddr (decomplect place-from-value)

LuxAddress in airdrop.AirdropClaim + bridgevmroot.SignerLeaf is the NATIVE
20-byte Lux address (ids.ShortID / [20]byte), held beside the EVM common.Address
it disambiguates. 'Lux' prefix is banned place-in-value naming; the canonical
pair is EVMAddr / UTXOAddr. Named by address KIND, not brand.

Co-authored-by: Hanzo Dev <dev@hanzo.ai>
This commit is contained in:
zeekay
2026-07-10 13:30:17 -07:00
co-authored by Hanzo Dev
parent d008eba286
commit f1a3e85b8e
4 changed files with 16 additions and 16 deletions
@@ -71,16 +71,16 @@ const (
// holding the POST-transition field values. Its fields are hashed, in this exact
// order, into the leaf preimage:
//
// SignerID ‖ LuxAddress[20] ‖ 0u32 ‖ BondLo ‖ BondHi ‖ OptInHeight ‖
// SignerID ‖ UTXOAddr[20] ‖ 0u32 ‖ BondLo ‖ BondHi ‖ OptInHeight ‖
// ExitEpoch ‖ SignCount ‖ BLSPubkey[48] ‖ CoronaPubkey[32] ‖ MLDSAPubkey[32] ‖
// Status ‖ JailUntilEpoch ‖ SlashCount ‖ index (integers little-endian)
//
// A signer with Occupied == 0 is skipped (not folded), exactly as the kernel
// skips unoccupied slots. The 0u32 after LuxAddress is the GPU struct's
// skips unoccupied slots. The 0u32 after UTXOAddr is the GPU struct's
// _pad_addr, committed as four zero bytes.
type SignerLeaf struct {
SignerID uint64
LuxAddress [20]byte
UTXOAddr [20]byte
BondLo uint64
BondHi uint64
OptInHeight uint64
@@ -175,7 +175,7 @@ func le64(b []byte, v uint64) []byte {
func signerLeafDigest(s SignerLeaf, i uint32) [Size]byte {
b := make([]byte, 0, 8+20+4+8+8+8+8+8+48+32+32+4+4+4+4)
b = le64(b, s.SignerID)
b = append(b, s.LuxAddress[:]...)
b = append(b, s.UTXOAddr[:]...)
b = le32(b, 0) // _pad_addr
b = le64(b, s.BondLo)
b = le64(b, s.BondHi)
@@ -106,7 +106,7 @@ func katMixedSigners() []SignerLeaf {
s.Occupied = 1
s.SignerID = uint64(i + 1)
for k := 0; k < 20; k++ {
s.LuxAddress[k] = byte(i + k)
s.UTXOAddr[k] = byte(i + k)
}
for k := 0; k < 48; k++ {
s.BLSPubkey[k] = byte(0x10 + k)
@@ -281,7 +281,7 @@ func katDenseSigners(n uint32) []SignerLeaf {
s.Occupied = 1
s.SignerID = uint64(i + 1)
for k := 0; k < 20; k++ {
s.LuxAddress[k] = byte(0x40 + int(i) + k)
s.UTXOAddr[k] = byte(0x40 + int(i) + k)
}
for k := 0; k < 48; k++ {
s.BLSPubkey[k] = byte(0x11 + int(i) + k)
+6 -6
View File
@@ -50,7 +50,7 @@ type REQLSnapshot struct {
// AirdropClaim represents a claim on the airdrop
type AirdropClaim struct {
Address common.Address `json:"address"`
LuxAddress ids.ShortID `json:"luxAddress"`
UTXOAddr ids.ShortID `json:"utxoAddr"`
AmountClaimed *big.Int `json:"amountClaimed"`
ClaimTime time.Time `json:"claimTime"`
VestingEndTime time.Time `json:"vestingEndTime"`
@@ -122,7 +122,7 @@ func (m *Manager) CheckEligibility(ethAddress common.Address) (*REQLSnapshot, er
func (m *Manager) ClaimAirdrop(
ctx context.Context,
ethAddress common.Address,
luxAddress ids.ShortID,
utxoAddr ids.ShortID,
signature []byte,
) (*AirdropClaim, error) {
// Verify eligibility
@@ -132,7 +132,7 @@ func (m *Manager) ClaimAirdrop(
}
// Verify signature (proves ownership of ETH address)
if err := m.verifySignature(ethAddress, luxAddress, signature); err != nil {
if err := m.verifySignature(ethAddress, utxoAddr, signature); err != nil {
return nil, err
}
@@ -142,7 +142,7 @@ func (m *Manager) ClaimAirdrop(
// Create claim record
claim := &AirdropClaim{
Address: ethAddress,
LuxAddress: luxAddress,
UTXOAddr: utxoAddr,
AmountClaimed: snapshot.LUXAllocation,
ClaimTime: time.Now(),
VestingEndTime: time.Now().Add(time.Duration(m.config.VestingPeriod) * time.Second),
@@ -164,7 +164,7 @@ func (m *Manager) ClaimAirdrop(
m.log.Info("Airdrop claimed",
"ethAddress", ethAddress.Hex(),
"luxAddress", luxAddress,
"utxoAddr", utxoAddr,
"amount", claim.AmountClaimed.String(),
"txID", txID,
)
@@ -261,7 +261,7 @@ func (m *Manager) saveClaim(claim *AirdropClaim) error {
}
// verifySignature verifies ownership of the Ethereum address
func (m *Manager) verifySignature(ethAddress common.Address, luxAddress ids.ShortID, signature []byte) error {
func (m *Manager) verifySignature(ethAddress common.Address, utxoAddr ids.ShortID, signature []byte) error {
// In production, implement proper signature verification
// to prove ownership of the Ethereum address
return nil
+4 -4
View File
@@ -22,7 +22,7 @@ package airdrop
// u32 entryLen
// u8 entryKind # = entryKindClaim
// 20B EthAddress ( @ 0..20 of payload )
// 20B LuxAddress (ShortID) ( @ 20..40 )
// 20B UTXOAddr (ShortID) ( @ 20..40 )
// 32B TxID ( @ 40..72 )
// i64 ClaimUnixNs ( @ 72..80 )
// i64 VestingEndUnixNs ( @ 80..88 )
@@ -57,7 +57,7 @@ const (
airdropEntryKindClaim uint8 = 1
claimOffEthAddress = 0
claimOffLuxAddress = 20
claimOffUTXOAddr = 20
claimOffTxID = 40
claimOffClaimUnixNs = 72
claimOffVestingEndUnixNs = 80
@@ -148,7 +148,7 @@ func encodeClaimEntry(c *AirdropClaim) []byte {
p := out[5:]
copy(p[claimOffEthAddress:claimOffEthAddress+20], c.Address[:])
copy(p[claimOffLuxAddress:claimOffLuxAddress+20], c.LuxAddress[:])
copy(p[claimOffUTXOAddr:claimOffUTXOAddr+20], c.UTXOAddr[:])
copy(p[claimOffTxID:claimOffTxID+32], c.TxID[:])
binary.LittleEndian.PutUint64(p[claimOffClaimUnixNs:], uint64(c.ClaimTime.UnixNano()))
binary.LittleEndian.PutUint64(p[claimOffVestingEndUnixNs:], uint64(c.VestingEndTime.UnixNano()))
@@ -172,7 +172,7 @@ func decodeClaimEntry(p []byte) (*AirdropClaim, common.Address, error) {
AmountClaimed: new(big.Int).SetBytes(p[claimPayloadFixed : uint32(claimPayloadFixed)+amountLen]),
}
copy(c.Address[:], p[claimOffEthAddress:claimOffEthAddress+20])
copy(c.LuxAddress[:], p[claimOffLuxAddress:claimOffLuxAddress+20])
copy(c.UTXOAddr[:], p[claimOffUTXOAddr:claimOffUTXOAddr+20])
var tx ids.ID
copy(tx[:], p[claimOffTxID:claimOffTxID+32])
c.TxID = tx