xtask

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidTaskManager = logex.Define("invalid task type: %v")
)
View Source
var SIMULATION_QUOTE = func() []byte {
	quoteString := "030002000000000009000e00939a7233f79c4ca9940a0db3957f0607ad04024c9dfb382baf51ca3e5d6cb6e6000000000c0c100fffff0100000000000000000000000000000000000000000000000000000000000000000000000000000000000500000000000000e700000000000000a60fe30c83d8ac9e14a537404e2cc4451dfd0c3286e131d640ec73af10a69af00000000000000000000000000000000000000000000000000000000000000000a3841d80fe88ad2e38039655f99430ffa3f874f897c1f7eea23deb3bf6781fc400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3fca1000008d2ac988eecd3c11bda72e9a47d23096087aad4d8a9af5b12b6ff9cd9647b314ea8ece53570edf553af2256ed487dd83eba640cfc63b4d89e6129a9078f8938aab8af342a611fb608193d9a47b8111654172adf2dabd2d428d28ebe094b9baa1f8f7e240b015af174d4f58a6b201946eee2097af02ed554909779ea2d9f3c1020c0c100fffff0100000000000000000000000000000000000000000000000000000000000000000000000000000000001500000000000000e700000000000000192aa50ce1c0cef03ccf89e7b5b16b0d7978f5c2b1edcf774d87702e8154d8bf00000000000000000000000000000000000000000000000000000000000000008c4f5775d796503e96137f77c68a829a0056ac8ded70140b081b094490c57bff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a82754acc7010b3c087c6425ccf47033f711fa44776c6df3cf744864a063657b0000000000000000000000000000000000000000000000000000000000000000f28eee79759dfb2454ebfc53634405fb9441ea07a78a5c739ce7f3121901049e589b352641775d9f2200016ef9c3abc9354de83393cbb998cf1da5d42f263fb72000000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f0500620e00002d2d2d2d2d424547494e2043455254494649434154452d2d2d2d2d0a4d494945386a4343424a6d674177494241674956414b7750766270377a6f7a50754144646b792b6f526e356f36704d754d416f4743437147534d343942414d430a4d484178496a416742674e5642414d4d47556c756447567349464e4857434251513073675547786864475a76636d306751304578476a415942674e5642416f4d0a45556c756447567349454e76636e4276636d4630615739754d5251774567594456515148444174545957353059534244624746795954454c4d416b47413155450a4341774351304578437a414a42674e5642415954416c56544d4234584454497a4d4467794e4449784d7a557a4d6c6f5844544d774d4467794e4449784d7a557a0a4d6c6f77634445694d434147413155454177775a535735305a5777675530645949464244537942445a584a3061575a70593246305a5445614d426747413155450a43677752535735305a577767513239796347397959585270623234784644415342674e564241634d43314e68626e526849454e7359584a684d517377435159440a5651514944414a445154454c4d416b474131554542684d4356564d775754415442676371686b6a4f5051494242676771686b6a4f50514d4242774e43414154450a764b6a754b66376969723832686d2b4d5a4151452b6847643349716d53396235634e63484a754b7a5a445970626f35496a344c7a7176704f503830706f4152730a59504233594e355537704d3777644936314b66716f344944446a434341776f77487759445652306a42426777466f41556c5739647a62306234656c4153636e550a3944504f4156634c336c5177617759445652306642475177596a42676f46366758495a616148523063484d364c79396863476b7564484a316333526c5a484e6c0a636e5a705932567a4c6d6c75644756734c6d4e766253397a5a3367765932567964476c6d61574e6864476c76626939324d7939775932746a636d772f593245390a6347786864475a76636d306d5a57356a62325270626d63395a4756794d4230474131556444675157424251695a7667373930317a3171554d3874534c754358580a6571314c6f54414f42674e56485138424166384542414d434273417744415944565230544151482f4241497741444343416a734743537147534962345451454e0a41515343416977776767496f4d42344743697147534962345451454e41514545454358343464705036434c5154772f785543575448306b776767466c42676f710a686b69472b453042445145434d4949425654415142677371686b69472b45304244514543415149424444415142677371686b69472b45304244514543416749420a4444415142677371686b69472b4530424451454341774942417a415142677371686b69472b4530424451454342414942417a415242677371686b69472b4530420a4451454342514943415038774551594c4b6f5a496876684e41513042416759434167442f4d42414743797147534962345451454e41514948416745424d4241470a43797147534962345451454e41514949416745414d42414743797147534962345451454e4151494a416745414d42414743797147534962345451454e4151494b0a416745414d42414743797147534962345451454e4151494c416745414d42414743797147534962345451454e4151494d416745414d42414743797147534962340a5451454e4151494e416745414d42414743797147534962345451454e4151494f416745414d42414743797147534962345451454e41514950416745414d4241470a43797147534962345451454e41514951416745414d42414743797147534962345451454e415149524167454e4d42384743797147534962345451454e415149530a4242414d44414d442f2f38424141414141414141414141414d42414743697147534962345451454e41514d45416741414d42514743697147534962345451454e0a4151514542674267616741414144415042676f71686b69472b45304244514546436745424d42344743697147534962345451454e4151594545424531784169510a72743945363234433159516b497034775241594b4b6f5a496876684e41513042427a41324d42414743797147534962345451454e415163424151482f4d4241470a43797147534962345451454e41516343415145414d42414743797147534962345451454e41516344415145414d416f4743437147534d343942414d43413063410a4d45514349445a6f63514c6478362b4f2b586d4f6b766f6b654133345a617261342b6539534e5877344b68396d5876574169415479695a6e495932474f3466670a4938673342666c4e434f56446e42505270507559377274484e77335470513d3d0a2d2d2d2d2d454e442043455254494649434154452d2d2d2d2d0a2d2d2d2d2d424547494e2043455254494649434154452d2d2d2d2d0a4d4949436c6a4343416a32674177494241674956414a567658633239472b487051456e4a3150517a7a674658433935554d416f4743437147534d343942414d430a4d476778476a415942674e5642414d4d45556c756447567349464e48574342536232393049454e424d526f77474159445651514b4442464a626e526c624342440a62334a7762334a6864476c76626a45554d424947413155454277774c553246756447456751327868636d4578437a414a42674e564241674d416b4e424d5173770a435159445651514745774a56557a4165467730784f4441314d6a45784d4455774d5442614677307a4d7a41314d6a45784d4455774d5442614d484178496a41670a42674e5642414d4d47556c756447567349464e4857434251513073675547786864475a76636d306751304578476a415942674e5642416f4d45556c75644756730a49454e76636e4276636d4630615739754d5251774567594456515148444174545957353059534244624746795954454c4d416b474131554543417743513045780a437a414a42674e5642415954416c56544d466b77457759484b6f5a497a6a3043415159494b6f5a497a6a304441516344516741454e53422f377432316c58534f0a3243757a7078773734654a423732457944476757357258437478327456544c7136684b6b367a2b5569525a436e71523770734f766771466553786c6d546c4a6c0a65546d693257597a33714f42757a43427544416642674e5648534d4547444157674251695a517a575770303069664f44744a5653763141624f536347724442530a42674e5648523845537a424a4d45656752614244686b466f64485277637a6f764c324e6c636e52705a6d6c6a5958526c63793530636e567a6447566b633256790a646d6c6a5a584d75615735305a577775593239744c306c756447567355306459556d397664454e424c6d526c636a416442674e5648513445466751556c5739640a7a62306234656c4153636e553944504f4156634c336c517744675944565230504151482f42415144416745474d42494741315564457745422f7751494d4159420a4166384341514177436759494b6f5a497a6a30454177494452774177524149675873566b6930772b6936565947573355462f32327561586530594a446a3155650a6e412b546a44316169356343494359623153416d4435786b66545670766f34556f79695359787244574c6d5552344349394e4b7966504e2b0a2d2d2d2d2d454e442043455254494649434154452d2d2d2d2d0a2d2d2d2d2d424547494e2043455254494649434154452d2d2d2d2d0a4d4949436a7a4343416a53674177494241674955496d554d316c71644e496e7a6737535655723951477a6b6e42717777436759494b6f5a497a6a3045417749770a614445614d4267474131554541777752535735305a5777675530645949464a766233516751304578476a415942674e5642416f4d45556c756447567349454e760a636e4276636d4630615739754d5251774567594456515148444174545957353059534244624746795954454c4d416b47413155454341774351304578437a414a0a42674e5642415954416c56544d423458445445344d4455794d5445774e4455784d466f58445451354d54497a4d54497a4e546b314f566f77614445614d4267470a4131554541777752535735305a5777675530645949464a766233516751304578476a415942674e5642416f4d45556c756447567349454e76636e4276636d46300a615739754d5251774567594456515148444174545957353059534244624746795954454c4d416b47413155454341774351304578437a414a42674e56424159540a416c56544d466b77457759484b6f5a497a6a3043415159494b6f5a497a6a3044415163445167414543366e45774d4449595a4f6a2f69505773437a61454b69370a314f694f534c52466857476a626e42564a66566e6b59347533496a6b4459594c304d784f346d717379596a6c42616c54565978465032734a424b357a6c4b4f420a757a43427544416642674e5648534d4547444157674251695a517a575770303069664f44744a5653763141624f5363477244425342674e5648523845537a424a0a4d45656752614244686b466f64485277637a6f764c324e6c636e52705a6d6c6a5958526c63793530636e567a6447566b63325679646d6c6a5a584d75615735300a5a577775593239744c306c756447567355306459556d397664454e424c6d526c636a416442674e564851344546675155496d554d316c71644e496e7a673753560a55723951477a6b6e4271777744675944565230504151482f42415144416745474d42494741315564457745422f7751494d4159424166384341514577436759490a4b6f5a497a6a3045417749445351417752674968414f572f35516b522b533943695344634e6f6f774c7550524c735747662f59693747535839344267775477670a41694541344a306c72486f4d732b586f356f2f7358364f39515778485241765a55474f6452513763767152586171493d0a2d2d2d2d2d454e442043455254494649434154452d2d2d2d2d0a00"
	quote, err := hex.DecodeString(quoteString)
	if err != nil {
		panic(err)
	}
	return quote
}()
View Source
var ScrollABI = func() abi.ABI {
	ty := `[{"inputs":[{"internalType":"uint8","name":"_version","type":"uint8"},{"internalType":"bytes","name":"_parentBatchHeader","type":"bytes"},{"internalType":"bytes[]","name":"_chunks","type":"bytes[]"},{"internalType":"bytes","name":"_skippedL1MessageBitmap","type":"bytes"}],"name":"commitBatch","outputs":[],"stateMutability":"nonpayable","type":"function"}]`
	result, err := abi.JSON(bytes.NewReader([]byte(ty)))
	if err != nil {
		panic(err)
	}
	return result
}()

Functions

func GetQuorumNames added in v0.3.0

func GetQuorumNames() map[sdkTypes.QuorumNum]string

Types

type LineaContext added in v0.3.0

type LineaContext struct {
	Hash      common.Hash     `json:"hash"`
	Interning json.RawMessage `json:"interning"`
	Pob       json.RawMessage `json:"pob"`
}

type LineaTaskExt added in v0.3.0

type LineaTaskExt struct {
	StartBlock              *hexutil.Big `json:"start_block"`
	EndBlock                *hexutil.Big `json:"end_block"`
	CommitTx                common.Hash  `json:"commit_tx"`
	PrevCommitTx            common.Hash  `json:"prev_commit_tx"`
	PrevBatchFinalStateRoot common.Hash  `json:"prev_batch_final_state_root"`
	FinalStateRoot          common.Hash  `json:"final_state_root"`
	ReferenceBlockNumber    uint64       `json:"reference_block_number"`
}

type LogHandlerWrapper added in v0.3.0

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

func (*LogHandlerWrapper) GetBlock added in v0.3.0

func (w *LogHandlerWrapper) GetBlock() (uint64, error)

func (*LogHandlerWrapper) OnNewLog added in v0.3.0

func (w *LogHandlerWrapper) OnNewLog(ctx context.Context, log *types.Log) error

func (*LogHandlerWrapper) SaveBlock added in v0.3.0

func (w *LogHandlerWrapper) SaveBlock(uint64) error

type Poe

type Poe struct {
	BatchHash      common.Hash   `json:"batch_hash"`
	StateHash      common.Hash   `json:"state_hash"`
	PrevStateRoot  common.Hash   `json:"prev_state_root"`
	NewStateRoot   common.Hash   `json:"new_state_root"`
	WithdrawalRoot common.Hash   `json:"withdrawal_root"`
	Signature      hexutil.Bytes `json:"signature"`
}

func (*Poe) Pack

func (p *Poe) Pack() []byte

type PoeResponse

type PoeResponse struct {
	NotReady     bool          `json:"not_ready"`
	BatchId      uint64        `json:"batch_id"`
	StartBlock   uint64        `json:"start_block"`
	EndBlock     uint64        `json:"end_block"`
	Poe          *Poe          `json:"poe"`
	PoeSignature hexutil.Bytes `json:"poe_signature"`
}

type ProveTaskParams

type ProveTaskParams struct {
	Batch    hexutil.Bytes  `json:"batch,omitempty"`
	PobHash  common.Hash    `json:"pob_hash"`
	From     common.Address `json:"from"`
	TaskType uint64         `json:"task_type,omitempty"`

	Start             uint64      `json:"start,omitempty"`
	End               uint64      `json:"end,omitempty"`
	StartingStateRoot common.Hash `json:"starting_state_root,omitempty"`
	FinalStateRoot    common.Hash `json:"final_state_root,omitempty"`
}

type ProverClient

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

func NewProverClient

func NewProverClient(url string) (*ProverClient, error)

func (*ProverClient) DaPutPob

func (p *ProverClient) DaPutPob(ctx context.Context, taskCtx *ScrollContext) error

func (*ProverClient) DaTryLock

func (p *ProverClient) DaTryLock(ctx context.Context, hash common.Hash) (string, error)

func (*ProverClient) GenerateAttestaionReport

func (p *ProverClient) GenerateAttestaionReport(ctx context.Context, pubkey hexutil.Bytes) (hexutil.Bytes, error)

func (*ProverClient) GenerateLineaContext added in v0.3.0

func (p *ProverClient) GenerateLineaContext(ctx context.Context, startBlock, endBlock int64, ty TaskType) (*ScrollContext, bool, error)

func (*ProverClient) GenerateScrollContext added in v0.3.0

func (p *ProverClient) GenerateScrollContext(ctx context.Context, startBlock, endBlock int64, ty TaskType) (*ScrollContext, bool, error)

func (*ProverClient) GetPoe

func (p *ProverClient) GetPoe(ctx context.Context, txHash common.Hash) (*PoeResponse, bool, error)

func (*ProverClient) GetPoeByPob

func (p *ProverClient) GetPoeByPob(ctx context.Context, from common.Address, batchData []byte, taskCtx *ScrollContext) (*PoeResponse, bool, error)

func (*ProverClient) Metadata

func (p *ProverClient) Metadata(ctx context.Context) (*ProverMetadata, error)

func (*ProverClient) ProveLinea added in v0.3.0

func (p *ProverClient) ProveLinea(ctx context.Context, from common.Address, ext *LineaTaskExt, taskCtx *ScrollContext) (*PoeResponse, bool, error)

type ProverMetadata

type ProverMetadata struct {
	WithContext     bool            `json:"with_context"`
	TaskWithContext map[uint64]bool `json:"task_with_context"`
	Version         string          `json:"version"`
}

func (*ProverMetadata) GetWithContext added in v0.3.0

func (md *ProverMetadata) GetWithContext(ty TaskType) bool

type ScrollContext

type ScrollContext struct {
	Hash      common.Hash     `json:"hash"`
	Interning json.RawMessage `json:"interning"`
	Pob       json.RawMessage `json:"pob"`
}

type ScrollTaskExt

type ScrollTaskExt struct {
	StartBlock           *hexutil.Big  `json:"start_block"`
	EndBlock             *hexutil.Big  `json:"end_block"`
	BatchData            hexutil.Bytes `json:"batch_data"`
	CommitTx             common.Hash   `json:"commit_tx"`
	ReferenceBlockNumber uint64        `json:"reference_block_number"`
}

type TaskContext

type TaskContext struct {
	Prover    *ProverClient
	EthClient *rpc.Client
}

type TaskInfo

type TaskInfo struct {
	Type    TaskType
	Context json.RawMessage
	TaskID  int64
	Ext     json.RawMessage
}

type TaskManager

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

func NewTaskManager

func NewTaskManager(collector *xmetric.AggregatorCollector, sampling int64, lineaMaxBlock int64, referenceClient eth.Client, tasks []*TaskManagerConfig) (*TaskManager, error)

func (*TaskManager) GetNextTask

func (t *TaskManager) GetNextTask(ctx context.Context, ty TaskType, withContext bool, prevTaskID int64, timeout time.Duration) (*TaskInfo, bool)

func (*TaskManager) OnNewLog

func (t *TaskManager) OnNewLog(ctx context.Context, id TaskType, log *types.Log) error

func (*TaskManager) Run

func (t *TaskManager) Run(ctx context.Context) error

type TaskManagerConfig

type TaskManagerConfig struct {
	Identifier TaskType

	Prover     string
	L2Endpoint string

	Endpoint  string
	Topics    [][]common.Hash
	Addresses []common.Address
	// OffsetFile       string
	PresetStartBlock uint64
	ScanIntervalSecs int64
}

type TaskManagerEthClient

type TaskManagerEthClient struct{}

type TaskManagerId

type TaskManagerId struct{}

type TaskManagerProverClient

type TaskManagerProverClient struct{}

type TaskTuple

type TaskTuple struct {
	Info     *TaskInfo
	Channels []chan struct{}
}

type TaskType

type TaskType int
const (
	MinTaskType TaskType = 0
	ScrollTask  TaskType = 1
	LineaTask   TaskType = 2
	MaxTaskType TaskType = 3
)

func NewTaskType added in v0.3.0

func NewTaskType(quorum byte) TaskType

func (TaskType) GetQuorum added in v0.3.0

func (t TaskType) GetQuorum() byte

func (TaskType) IsValid added in v0.3.0

func (t TaskType) IsValid() bool

func (TaskType) Value

func (t TaskType) Value() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳