corset

package
v1.2.23 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: Apache-2.0 Imports: 57 Imported by: 0

Documentation

Overview

Copyright Consensys Software Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Copyright Consensys Software Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Copyright Consensys Software Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Copyright Consensys Software Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Copyright Consensys Software Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Copyright Consensys Software Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Copyright Consensys Software Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Copyright Consensys Software Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Copyright Consensys Software Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Copyright Consensys Software Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Index

Constants

View Source
const SCHEMA_DEFAULT_AIR = uint(2)

SCHEMA_DEFAULT_AIR indicates a schema must be indicated on the command line, and that the default is for the stack to be lowered to the AIR level.

View Source
const SCHEMA_DEFAULT_MIR = uint(1)

SCHEMA_DEFAULT_MIR indicates a schema must be indicated on the command line, and that the default is for the stack to be lowered to the MIR level.

View Source
const SCHEMA_OPTIONAL = uint(0)

SCHEMA_OPTIONAL indicates a schema is optional

Variables

View Source
var Version string

Version is filled when building with make, but *not* when installing via "go install".

Functions

func CheckTrace

func CheckTrace[F field.Element[F]](ir string, schema sc.AnySchema[F], tf lt.TraceFile, builder ir.TraceBuilder[F],
	cfg CheckConfig) bool

CheckTrace checks a given set of constraints against a given trace file using a configured trace builder and check configuration.

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func GetFlag

func GetFlag(cmd *cobra.Command, flag string) bool

GetFlag gets an expected flag, or panic if an error arises.

func GetInt

func GetInt(cmd *cobra.Command, flag string) int

GetInt gets an expectedsigned integer, or panic if an error arises.

func GetIntArray

func GetIntArray(cmd *cobra.Command, flag string) []int

GetIntArray gets an expected int array, or panic if an error arises.

func GetString

func GetString(cmd *cobra.Command, flag string) string

GetString gets an expected string, or panic if an error arises.

func GetStringArray

func GetStringArray(cmd *cobra.Command, flag string) []string

GetStringArray gets an expected string array, or panic if an error arises.

func GetUint

func GetUint(cmd *cobra.Command, flag string) uint

GetUint gets an expected unsigned integer, or panic if an error arises.

func InspectTrace added in v1.2.21

func InspectTrace[F field.Element[F]](mapping module.LimbsMap, trace tr.Trace[F],
	public func(tr.ModuleName) bool, limbs bool, cellWidth, titleWidth uint) []error

InspectTrace opens the given trace in the interactive inspector using the supplied register mapping, without requiring a corset source map. Columns are shown as computed (low-level) registers. This is intended for callers (e.g. the zkc toolchain) which generate a trace but have no source map available.

The optional "public" predicate determines which modules are publicly visible (shown by default); when nil, all modules are public. Callers use this to hide synthetic modules such as range-check tables.

func ReadBatchedTraceFile

func ReadBatchedTraceFile(filename string) []lt.TraceFile

ReadBatchedTraceFile reads a file containing zero or more traces expressed as JSON, where each trace is on a separate line.

func ReadTraceFile

func ReadTraceFile(filename string) lt.TraceFile

ReadTraceFile reads a trace file (either binary lt or json), and parses it into an array of raw columns. The determination of what kind of trace file (i.e. binary or json) is based on the extension.

func ReportFailures

func ReportFailures[F field.Element[F]](ir string, failures []sc.Failure, trace tr.Trace[F], mapping module.LimbsMap,
	cfg CheckConfig)

ReportFailures reports constraint failures, whilst providing contextual information (when requested).

func WriteBinaryFile

func WriteBinaryFile(binfile *binfile.BinaryFile, filename string)

WriteBinaryFile writes a binary file (e.g. zkevm.bin) to disk using the given binfile versioning defined in the binfile package.

Types

type CheckConfig

type CheckConfig struct {
	// Corset source mapping (maybe nil if non available).
	CorsetSourceMap *corset.SourceMap
	// Specifies whether to use Coverage testing and, if so, where to write the
	// Coverage data.
	Coverage util.Option[string]
	// Specifies how much front padding to add to each module.
	PaddingStrategy ir.PaddingStrategy
	// Specifies whether or not to Report details of the failure (e.g. for
	// debugging purposes).
	Report bool
	// Specifies the number of additional rows to show eitherside of the failing
	// area. This essentially allows more contextual information to be shown.
	ReportPadding uint
	// Specifies the width of a cell to show.
	ReportCellWidth uint
	// Specifies the width of a column title to show.
	ReportTitleWidth uint
	// Specifies whether or not to show raw limbs
	ReportLimbs bool
	// Specifies whether or not to show raw computed registers
	ReportComputed bool
	// Enable ansi escape codes in reports
	AnsiEscapes bool
}

CheckConfig encapsulates certain parameters to be used when checking traces.

type ColumnSummariser

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

ColumnSummariser abstracts the notion of a function which summarises the contents of a given column.

type FieldAgnosticCmd

type FieldAgnosticCmd struct {
	Field    field.Config
	Function func(*cobra.Command, []string)
}

FieldAgnosticCmd represents a command to be executed for a given field.

type ModuleSummariser

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

ModuleSummariser abstracts the notion of a function which summarises the contents of a given column.

type RawColumn

type RawColumn = lt.Column[word.BigEndian]

RawColumn provides a convenient alias

type TraceConfig

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

TraceConfig packages together useful things for the various supported options.

Directories

Path Synopsis
verify
picus/pcl
==================== Arithmetic Expr AST ====================
==================== Arithmetic Expr AST ====================

Jump to

Keyboard shortcuts

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