mirror of
https://github.com/luxfi/coreth.git
synced 2026-10-30 17:00:51 +00:00
- 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
36 lines
1.2 KiB
Plaintext
36 lines
1.2 KiB
Plaintext
// Copyright (C) 2019-2025, Lux Industries, Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
package allowlist
|
|
|
|
import (
|
|
"math/big"
|
|
|
|
"github.com/luxfi/geth/precompile/contract"
|
|
"github.com/luxfi/geth/common"
|
|
)
|
|
|
|
const (
|
|
// AllowListEventGasCost is the gas cost of a call to the AllowList contract's event.
|
|
// It is the base gas cost + the gas cost of the topics (signature, role, account, caller)
|
|
// and the gas cost of the non-indexed data (oldRole).
|
|
AllowListEventGasCost = contract.LogGas + contract.LogTopicGas*4 + contract.LogDataGas*common.HashLength
|
|
)
|
|
|
|
// PackRoleSetEvent packs the event into the appropriate arguments for RoleSet.
|
|
// It returns topic hashes and the encoded non-indexed data.
|
|
func PackRoleSetEvent(role Role, account common.Address, caller common.Address, oldRole Role) ([]common.Hash, []byte, error) {
|
|
return AllowListABI.PackEvent("RoleSet", role.Big(), account, caller, oldRole.Big())
|
|
}
|
|
|
|
// UnpackRoleSetEventData attempts to unpack non-indexed [dataBytes].
|
|
func UnpackRoleSetEventData(dataBytes []byte) (Role, error) {
|
|
eventData := struct {
|
|
OldRole *big.Int
|
|
}{}
|
|
err := AllowListABI.UnpackIntoInterface(&eventData, "RoleSet", dataBytes)
|
|
if err != nil {
|
|
return Role{}, err
|
|
}
|
|
return FromBig(eventData.OldRole)
|
|
} |