contract

package
v0.17.1 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: Apache-2.0 Imports: 7 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package contract hand-decodes the Starknet core L1 contract events juno consumes. It exists to remove the abigen + go-ethereum dependency from the L1 sync path. Only the event(s) juno actually subscribes to are implemented; calls into contract methods are not supported because juno doesn't make any.

Index

Constants

This section is empty.

Variables

View Source
var ErrWrongTopic = errors.New("log topic is not LogStateUpdate")
View Source
var LogStateUpdateSigHash = eth.HashFromString(
	"0xd342ddf7a308dec111745b00315c14b7efb2bdae570a6856e088ed0c65a3576c",
)

LogStateUpdateSigHash is keccak256("LogStateUpdate(uint256,int256,uint256)").

Functions

func LogStateUpdateFilter

func LogStateUpdateFilter(contract eth.Address) client.FilterQuery

LogStateUpdateFilter omits the block range: callers add one for eth_getLogs, or leave it unset for a live eth_subscribe subscription.

Types

type LogClient

type LogClient interface {
	FilterLogs(ctx context.Context, q client.FilterQuery) ([]eth.Log, error)
}

LogClient lets tests swap in a fake without dialling a real endpoint.

type LogStateUpdate

type LogStateUpdate struct {
	GlobalRoot  felt.Felt
	BlockNumber uint64
	BlockHash   felt.Felt

	// Raw log envelope, preserving the emitting L1 block number and the reorg Removed flag.
	Raw eth.Log
}

func Decode

func Decode(log *eth.Log) (*LogStateUpdate, error)

Decode re-checks the sig hash defensively; callers are expected to prefilter by topic and contract address.

func FilterLogStateUpdate

func FilterLogStateUpdate(
	ctx context.Context,
	c LogClient,
	contract eth.Address,
	from uint64,
	to uint64,
) ([]*LogStateUpdate, error)

FilterLogStateUpdate treats [from, to] as inclusive on both ends.

Jump to

Keyboard shortcuts

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