Documentation
¶
Index ¶
- Constants
- Variables
- func GetAddress() common.Address
- func GetAddressV2() common.Address
- type Precompile
- func (Precompile) IsTransaction(method *abi.Method) bool
- func (p Precompile) RequiredGas(input []byte) uint64
- func (p Precompile) Run(evm *vm.EVM, contract *vm.Contract, readOnly bool) (bz []byte, err error)
- func (p Precompile) VerifyEd25519(method *abi.Method, args []interface{}) ([]byte, error)
- func (p Precompile) VerifyEd25519RawMessage(method *abi.Method, args []interface{}) ([]byte, error)
Constants ¶
const ( VerifyEd25519Method = "verifyEd25519" VerifyEd25519RawMessageMethod = "verifyEd25519RawMessage" )
const ( // Both addresses stay registered: 0x…CA is live on donut and dropping it // would unregister the precompile for contracts already calling it. USigVerifierPrecompileAddress = "0x00000000000000000000000000000000000000ca" USigVerifierPrecompileAddressV2 = "0xEC00000000000000000000000000000000000001" // VerifyEd25519Gas is the gas cost for verifying an Ed25519 signature over a // bytes32 digest. The verified message is always the 66-byte ASCII hex form // of that digest, so the work does not vary with the calldata — flat is the // honest price here. VerifyEd25519Gas uint64 = 4000 // VerifyEd25519RawMessageBaseGas is the fixed part of a raw-message // verification: the Ed25519 curve arithmetic, which dominates below ~8 KiB. VerifyEd25519RawMessageBaseGas uint64 = 4000 // VerifyEd25519RawMessagePerWordGas is charged for every 32-byte word of the // message on top of the base, so that the SHA-512 pass Ed25519 makes over the // whole message is paid for. Priced off the EVM SHA-256 precompile, which // charges 12 gas per 32-byte word for comparable hashing work. VerifyEd25519RawMessagePerWordGas uint64 = 12 // MaxEd25519MessageBytes hard-caps the message a raw-message verification // accepts (128 KiB, the same limit used for gateway payloads). This is a view // method, so a contract can hold one large message in memory and loop // STATICCALLs over it, paying the calldata only once; on that path a price // curve alone is not a defence, the size has to be bounded outright. MaxEd25519MessageBytes = 128 * 1024 )
Variables ¶
var ABI abi.ABI
Functions ¶
func GetAddressV2 ¶ added in v0.0.23
GetAddressV2 returns the new (0xEC..01) address of the precompile
Types ¶
type Precompile ¶
type Precompile struct {
cmn.Precompile
abi.ABI
}
Precompile defines the precompile
func NewPrecompile ¶
func NewPrecompile() (*Precompile, error)
func NewPrecompileV2 ¶ added in v0.0.23
func NewPrecompileV2() (*Precompile, error)
NewPrecompileV2 creates a new USigVerifier precompile at the new address (0xEC..01). It provides the same functionality as NewPrecompile but at the reserved address range.
func (Precompile) IsTransaction ¶
func (Precompile) IsTransaction(method *abi.Method) bool
IsTransaction checks if the given method name corresponds to a transaction or query.
func (Precompile) RequiredGas ¶
func (p Precompile) RequiredGas(input []byte) uint64
RequiredGas is charged before Run executes, so it runs on unvalidated, attacker-controlled calldata and must never panic.
func (Precompile) VerifyEd25519 ¶
func (p Precompile) VerifyEd25519( method *abi.Method, args []interface{}, ) ([]byte, error)
VerifyEd25519 verifies a signature over the ASCII bytes of "0x"+hex(msgDigest). This is the legacy / Solana-wallet-friendly form used by UEA_SVM.
func (Precompile) VerifyEd25519RawMessage ¶ added in v0.0.40
func (p Precompile) VerifyEd25519RawMessage( method *abi.Method, args []interface{}, ) ([]byte, error)
VerifyEd25519RawMessage verifies a signature over raw message bytes — standard Ed25519 semantics. Use this when the signer used the conventional ed25519.Sign(privKey, rawBytes) API. Messages larger than MaxEd25519MessageBytes are rejected.