Files
zeekay 1d7cae0355 Add post-quantum cryptography precompiles and update crypto dependency
- Add post-quantum signature verification precompiles:
  - ML-DSA (FIPS 204) at address 0x0f
  - SLH-DSA (FIPS 205) at address 0x10
  - Falcon at address 0x11
  - ML-KEM key encapsulation at address 0x12

- Add api_lux.go with Lux-specific API extensions

- Add precompile infrastructure from SubnetEVM:
  - allowlist module
  - contract interfaces
  - precompile config and modules

- Update crypto dependency to v1.17.9 (with VerifySignature API)
- Remove local replace directives for CI compatibility
- Update import paths across 230+ files to use luxfi/crypto
2025-12-11 02:36:17 +00:00

42 lines
1.2 KiB
Go

// Copyright (C) 2019-2025, Lux Industries, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package precompileconfig
// Upgrade contains the timestamp for the upgrade along with
// a boolean [Disable]. If [Disable] is set, the upgrade deactivates
// the precompile and clears its storage.
type Upgrade struct {
BlockTimestamp *uint64 `json:"blockTimestamp"`
Disable bool `json:"disable,omitempty"`
}
// Timestamp returns the timestamp this network upgrade goes into effect.
func (u *Upgrade) Timestamp() *uint64 {
return u.BlockTimestamp
}
// IsDisabled returns true if the network upgrade deactivates the precompile.
func (u *Upgrade) IsDisabled() bool {
return u.Disable
}
// Equal returns true iff [other] has the same blockTimestamp and has the
// same on value for the Disable flag.
func (u *Upgrade) Equal(other *Upgrade) bool {
if other == nil {
return false
}
return u.Disable == other.Disable && Uint64PtrEqual(u.BlockTimestamp, other.BlockTimestamp)
}
// Uint64PtrEqual returns true if both pointers are nil or both are non-nil and point to the same value
func Uint64PtrEqual(a, b *uint64) bool {
if a == nil && b == nil {
return true
}
if a == nil || b == nil {
return false
}
return *a == *b
}