userop

package
v0.0.0-...-9980f8c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 29, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CondResetSignature

func CondResetSignature(publicKey *ecdsa.PublicKey, userOps []*model.UserOperation, hashes []common.Hash) error

CondResetSignature resets the signature of UserOperations if the signature is invalid.

func GenXHash

func GenXHash(opHashes []common.Hash) common.Hash

GenXHash computes the hash of multiple UserOperations' hashes. It concatenates the hashes, sorts them, and hashes the result. The result is the xChainHash.

func GenerateSignature

func GenerateSignature(messageHash common.Hash, privateKey *ecdsa.PrivateKey) ([]byte, error)

GenerateSignature signs the prefixed message hash with the private key.

func HasEVMSolution

func HasEVMSolution(op *model.UserOperation) bool

HasEVMSolution checks if the provided bytes likely represent valid EVM calldata through a number of heuristics.

func HasXDataInCallData

func HasXDataInCallData(op *model.UserOperation) bool

func HasXDataInSignature

func HasXDataInSignature(op *model.UserOperation) bool

func IsAggregate

func IsAggregate(op *model.UserOperation) bool

func RecoverSigner

func RecoverSigner(messageHash common.Hash, signature []byte) string

func SignUserOperations

func SignUserOperations(signer *signer.EOA, hashes []common.Hash, userOps []*model.UserOperation) error

SignUserOperations is a helper function to sign one or multiple UserOperations.

func VerifyHashSignature

func VerifyHashSignature(messageHash common.Hash, signature []byte, publicKey *ecdsa.PublicKey) bool

VerifyHashSignature verifies the signature against the message hash and public key.

func VerifySignature

func VerifySignature(publicKey *ecdsa.PublicKey, userOps []*model.UserOperation, hashes []common.Hash) (bool, error)

VerifySignature verifies the signature of one or multiple UserOperations. VerifySignature verifies the signature of one or multiple UserOperations.

Types

type ConsoleStyle

type ConsoleStyle struct {
	Color string
	Reset string
}

ConsoleStyle holds ANSI escape codes for console formatting

type DebugParseResult

type DebugParseResult struct {
	XDataInCallData  bool
	OpType           uint16
	IntentJSONLength int
	IntentJSON       []byte
	LeadingGarbage   []byte // Garbage bytes before IntentJSON
	TrailingGarbage  []byte // Garbage bytes after IntentJSON
	HashListLength   int
	HashList         []model.CrossChainHashListEntry
	Error            error
}

DebugParseResult contains the parsed cross-chain data along with debug information

func DebugParseCrossChainData

func DebugParseCrossChainData(data []byte, xDataInCallData bool) *DebugParseResult

DebugParseCrossChainData performs detailed parsing of cross-chain data with debugging information

func (*DebugParseResult) String

func (r *DebugParseResult) String() string

String implements the Stringer interface for pretty-printing debug results

type DebugParser

type DebugParser struct {
	// contains filtered or unexported fields
}

DebugParser provides methods for parsing and analyzing cross-chain data

func NewDebugParser

func NewDebugParser() *DebugParser

NewDebugParser creates a debug parser that can be used to analyze cross-chain data

func (*DebugParser) ParseAndDebug

func (p *DebugParser) ParseAndDebug(data []byte, xDataInCallData bool) (*model.CrossChainData, *DebugParseResult)

ParseAndDebug parses the provided data and returns both the parsed result and debug information

type State

type State int

State represents the state of a UserOperation

const (
	StateUnsigned State = iota
	StateConventional
	StateIntentUnsolved    // Intent JSON in callData, awaiting solution
	StateSolutionLess      // Intent with empty solution
	StateIntentSolved      // Intent with valid EVM solution
	StateXChainUnsolved    // XData in callData, awaiting solution
	StateXChainInSignature // XData appended to signature
	StateXChainSolved      // XData with valid EVM solution
	StateXChainAggregate   // Special case: Aggregate XChain operation
)

func DetermineState

func DetermineState(op *model.UserOperation) State

DetermineState analyzes a UserOperation to determine its current state

func (State) Color

func (s State) Color() string

Color returns ANSI color codes for pretty console printing

func (State) Format

func (s State) Format() string

Format returns a colored string representation of the state

func (State) FormatWithDetail

func (s State) FormatWithDetail(extraInfo string) string

FormatWithDetail returns a detailed colored status message

func (State) String

func (s State) String() string

String representation of State

type XDataExtractor

type XDataExtractor struct {
	// contains filtered or unexported fields
}

XDataExtractor provides methods to extract XData from UserOperation fields

func NewXDataExtractor

func NewXDataExtractor() *XDataExtractor

NewXDataExtractor creates a new XDataExtractor instance

func (*XDataExtractor) ExtractAndDebug

func (x *XDataExtractor) ExtractAndDebug(op *model.UserOperation) (debug *DebugParseResult, err error)

ExtractAndDebug attempts to find and parse XData from a UserOperation

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL