 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Index ¶
- Constants
- Variables
- func PackGetBlockchainID() ([]byte, error)
- func PackGetBlockchainIDOutput(blockchainID common.Hash) ([]byte, error)
- func PackGetVerifiedWarpBlockHash(index uint32) ([]byte, error)
- func PackGetVerifiedWarpBlockHashOutput(outputStruct GetVerifiedWarpBlockHashOutput) ([]byte, error)
- func PackGetVerifiedWarpMessage(index uint32) ([]byte, error)
- func PackGetVerifiedWarpMessageOutput(outputStruct GetVerifiedWarpMessageOutput) ([]byte, error)
- func PackSendWarpMessage(payloadData []byte) ([]byte, error)
- func PackSendWarpMessageEvent(sourceAddress common.Address, unsignedMessageID common.Hash, ...) ([]common.Hash, []byte, error)
- func PackSendWarpMessageOutput(messageID common.Hash) ([]byte, error)
- func UnpackGetVerifiedWarpBlockHashInput(input []byte) (uint32, error)
- func UnpackGetVerifiedWarpMessageInput(input []byte) (uint32, error)
- func UnpackSendWarpEventDataToMessage(data []byte) (*warp.UnsignedMessage, error)
- func UnpackSendWarpMessageInput(input []byte) ([]byte, error)
- func UnpackSendWarpMessageOutput(output []byte) (common.Hash, error)
- type Config
- func (*Config) Accept(acceptCtx *precompileconfig.AcceptContext, blockHash common.Hash, ...) error
- func (c *Config) Equal(s precompileconfig.Config) bool
- func (*Config) Key() string
- func (*Config) PredicateGas(pred predicate.Predicate, rules precompileconfig.Rules) (uint64, error)
- func (c *Config) Verify(chainConfig precompileconfig.ChainConfig) error
- func (c *Config) VerifyPredicate(predicateContext *precompileconfig.PredicateContext, pred predicate.Predicate) error
 
- type GasConfig
- type GetVerifiedWarpBlockHashOutput
- type GetVerifiedWarpMessageOutput
- type SendWarpMessageEventData
- type WarpBlockHash
- type WarpMessage
Constants ¶
const ( WarpDefaultQuorumNumerator uint64 = 67 WarpQuorumNumeratorMinimum uint64 = 33 WarpQuorumDenominator uint64 = 100 )
const ConfigKey = "warpConfig"
    ConfigKey is the key used in json config files to specify this precompile config. must be unique across all precompiles.
Variables ¶
var ( // WarpRawABI contains the raw ABI of Warp contract. //go:embed contract.abi WarpRawABI string WarpABI = contract.ParseABI(WarpRawABI) WarpPrecompile = createWarpPrecompile() )
Singleton StatefulPrecompiledContract and signatures.
var ContractAddress = common.HexToAddress("0x0200000000000000000000000000000000000005")
    ContractAddress is the address of the warp precompile contract
var Module = modules.Module{ ConfigKey: ConfigKey, Address: ContractAddress, Contract: WarpPrecompile, Configurator: &configurator{}, }
Module is the precompile module. It is used to register the precompile contract.
Functions ¶
func PackGetBlockchainID ¶
PackGetBlockchainID packs the include selector (first 4 func signature bytes). This function is mostly used for tests.
func PackGetBlockchainIDOutput ¶
PackGetBlockchainIDOutput attempts to pack given blockchainID of type common.Hash to conform the ABI outputs.
func PackGetVerifiedWarpBlockHash ¶
PackGetVerifiedWarpBlockHash packs [index] of type uint32 into the appropriate arguments for getVerifiedWarpBlockHash. the packed bytes include selector (first 4 func signature bytes). This function is mostly used for tests.
func PackGetVerifiedWarpBlockHashOutput ¶
func PackGetVerifiedWarpBlockHashOutput(outputStruct GetVerifiedWarpBlockHashOutput) ([]byte, error)
PackGetVerifiedWarpBlockHashOutput attempts to pack given [outputStruct] of type GetVerifiedWarpBlockHashOutput to conform the ABI outputs.
func PackGetVerifiedWarpMessage ¶
PackGetVerifiedWarpMessage packs [index] of type uint32 into the appropriate arguments for getVerifiedWarpMessage. the packed bytes include selector (first 4 func signature bytes). This function is mostly used for tests.
func PackGetVerifiedWarpMessageOutput ¶
func PackGetVerifiedWarpMessageOutput(outputStruct GetVerifiedWarpMessageOutput) ([]byte, error)
PackGetVerifiedWarpMessageOutput attempts to pack given [outputStruct] of type GetVerifiedWarpMessageOutput to conform the ABI outputs.
func PackSendWarpMessage ¶
PackSendWarpMessage packs [inputStruct] of type []byte into the appropriate arguments for sendWarpMessage.
func PackSendWarpMessageEvent ¶
func PackSendWarpMessageEvent(sourceAddress common.Address, unsignedMessageID common.Hash, unsignedMessageBytes []byte) ([]common.Hash, []byte, error)
PackSendWarpMessageEvent packs the given arguments into SendWarpMessage events including topics and data.
func PackSendWarpMessageOutput ¶
PackSendWarpMessageOutput attempts to pack given messageID of type common.Hash to conform the ABI outputs.
func UnpackGetVerifiedWarpBlockHashInput ¶
UnpackGetVerifiedWarpBlockHashInput attempts to unpack [input] into the uint32 type argument assumes that [input] does not include selector (omits first 4 func signature bytes)
func UnpackGetVerifiedWarpMessageInput ¶
UnpackGetVerifiedWarpMessageInput attempts to unpack [input] into the uint32 type argument assumes that [input] does not include selector (omits first 4 func signature bytes)
func UnpackSendWarpEventDataToMessage ¶
func UnpackSendWarpEventDataToMessage(data []byte) (*warp.UnsignedMessage, error)
UnpackSendWarpEventDataToMessage attempts to unpack event [data] as warp.UnsignedMessage.
func UnpackSendWarpMessageInput ¶
UnpackSendWarpMessageInput attempts to unpack [input] as []byte assumes that [input] does not include selector (omits first 4 func signature bytes)
Types ¶
type Config ¶
type Config struct {
	precompileconfig.Upgrade
	QuorumNumerator              uint64 `json:"quorumNumerator"`
	RequirePrimaryNetworkSigners bool   `json:"requirePrimaryNetworkSigners"`
}
    Config implements the precompileconfig.Config interface and adds specific configuration for Warp.
func NewConfig ¶
func NewConfig(blockTimestamp *uint64, quorumNumerator uint64, requirePrimaryNetworkSigners bool) *Config
NewConfig returns a config for a network upgrade at [blockTimestamp] that enables Warp with the given quorum numerator.
func NewDefaultConfig ¶
NewDefaultConfig returns a config for a network upgrade at [blockTimestamp] that enables Warp with the default quorum numerator (0 denotes using the default).
func NewDisableConfig ¶
NewDisableConfig returns config for a network upgrade at [blockTimestamp] that disables Warp.
func (*Config) Equal ¶
func (c *Config) Equal(s precompileconfig.Config) bool
Equal returns true if [s] is a *Config and it has been configured identical to [c].
func (*Config) Key ¶
Key returns the key for the Warp precompileconfig. This should be the same key as used in the precompile module.
func (*Config) PredicateGas ¶
PredicateGas returns the amount of gas necessary to verify the predicate PredicateGas charges for: 1. Base cost of the message 2. Size of the message 3. Number of signers 4. TODO: Lookup of the validator set
If the payload of the warp message fails parsing, return a non-nil error invalidating the transaction.
func (*Config) Verify ¶
func (c *Config) Verify(chainConfig precompileconfig.ChainConfig) error
Verify tries to verify Config and returns an error accordingly.
func (*Config) VerifyPredicate ¶
func (c *Config) VerifyPredicate(predicateContext *precompileconfig.PredicateContext, pred predicate.Predicate) error
VerifyPredicate returns whether the predicate described by [predicateBytes] passes verification.
type GasConfig ¶
type GasConfig struct {
	// Cost to call getBlockchainID
	GetBlockchainID uint64
	// Base cost of entering getVerifiedWarpMessage
	GetVerifiedWarpMessageBase uint64
	// Gas cost per warp signer in the validator set
	PerWarpSigner uint64
	// Gas cost per chunk of the warp message (each chunk is 32 bytes)
	PerWarpMessageChunk uint64
	// Gas cost to verify a BLS signature
	VerifyPredicateBase uint64
	// Base cost of entering sendWarpMessage
	SendWarpMessageBase uint64
	// PerWarpMessageByte cost accounts for producing a message of a given size
	PerWarpMessageByte uint64
}
    func CurrentGasConfig ¶
func CurrentGasConfig(rules precompileconfig.Rules) GasConfig
type GetVerifiedWarpBlockHashOutput ¶
type GetVerifiedWarpBlockHashOutput struct {
	WarpBlockHash WarpBlockHash
	Valid         bool
}
    func UnpackGetVerifiedWarpBlockHashOutput ¶
func UnpackGetVerifiedWarpBlockHashOutput(output []byte) (GetVerifiedWarpBlockHashOutput, error)
UnpackGetVerifiedWarpBlockHashOutput attempts to unpack [output] as GetVerifiedWarpBlockHashOutput assumes that [output] does not include selector (omits first 4 func signature bytes)
type GetVerifiedWarpMessageOutput ¶
type GetVerifiedWarpMessageOutput struct {
	Message WarpMessage
	Valid   bool
}
    func UnpackGetVerifiedWarpMessageOutput ¶
func UnpackGetVerifiedWarpMessageOutput(output []byte) (GetVerifiedWarpMessageOutput, error)
UnpackGetVerifiedWarpMessageOutput attempts to unpack [output] as GetVerifiedWarpMessageOutput assumes that [output] does not include selector (omits first 4 func signature bytes)
type SendWarpMessageEventData ¶
type SendWarpMessageEventData struct {
	Message []byte
}
    type WarpBlockHash ¶
WarpBlockHash is an auto generated low-level Go binding around an user-defined struct.