util

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: 25 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

Index

Constants

View Source
const (
	// MICRO_ASM_LAYER represents the micro assembly layer which is typically
	// vectorised and field specific.
	MICRO_ASM_LAYER = 1
	// NANO_ASM_LAYER represents the micro assembly layer after register
	// splitting.
	NANO_ASM_LAYER = 2
	// MIR_LAYER represents Mid-level Intermediate Representation (MIR) which is
	// a true collection of constraints and assignments.  However, it retains a
	// more high-level perspective.
	MIR_LAYER = 3
	// AIR_LAYER represents the Arithmetic Intermediate Representation (AIR)
	// which is the bottom layer in the system, and is the representation passed
	// to the prover.
	AIR_LAYER = 4
)

Variables

View Source
var BIG_WORD = field.Config{Name: "BigWord", BandWidth: math.MaxUint, RegisterWidth: math.MaxUint}

BIG_WORD is a pretend field configuration matching word.BigEndian.

Functions

func BigWordMapping

func BigWordMapping(ltf lt.TraceFile) module.LimbsMap

BigWordMapping constructs a limbs map for word.BigEndian values.

func CompileSourceFiles

func CompileSourceFiles(config corset.CompilationConfig, asmConfig asm.LoweringConfig,
	filenames []string) binfile.BinaryFile

CompileSourceFiles accepts a set of source files and compiles them into a single schema. This can result, for example, in a syntax error, etc. This can be done with (or without) including the standard library, and also with (or without) debug constraints.

func ReadBinaryFile

func ReadBinaryFile(filename string) binfile.BinaryFile

ReadBinaryFile reads a binfile which includes the metadata bytes, along with the schema, and any included attributes.

Types

type SchemaStack

type SchemaStack[F field.Element[F]] struct {
	// contains filtered or unexported fields
}

SchemaStack is an abstraction for working with a stack of schemas, where each is layer is a refinement of its parent. For example, the micro assembly layer is a refinement of the macro assembly layer. Likewise, the Arithmetic Intermediate Representation is a refinement of the Mid-level Intermediate Representation, etc.

func (*SchemaStack[F]) AbstractSchemas

func (p *SchemaStack[F]) AbstractSchemas() []schema.AnySchema[word.BigEndian]

AbstractSchemas returns the stack of abstract schemas according to the selected layers, where higher-level layers come first.

func (*SchemaStack[F]) BinaryFile

func (p *SchemaStack[F]) BinaryFile() *binfile.BinaryFile

BinaryFile returns the binary file representing the top of this stack.

func (*SchemaStack[F]) ConcreteIrName

func (p *SchemaStack[F]) ConcreteIrName() string

ConcreteIrName returns a human-readable anacronym of the IR used to generate the corresponding SCHEMA.

func (*SchemaStack[F]) ConcreteSchema

func (p *SchemaStack[F]) ConcreteSchema() schema.AnySchema[F]

ConcreteSchema returns the stack of concrete schemas according to the selected layers, where higher-level layers come first.

func (*SchemaStack[F]) ConcreteSchemaOf

func (p *SchemaStack[F]) ConcreteSchemaOf(ir string) schema.AnySchema[F]

ConcreteSchemaOf returns the schema associated with the given IR representation. If there is no match, this will panic.

func (*SchemaStack[F]) HasConcreteSchema

func (p *SchemaStack[F]) HasConcreteSchema() bool

HasConcreteSchema returns true if there is at least one concrete schema..

func (*SchemaStack[F]) RegisterMapping

func (p *SchemaStack[F]) RegisterMapping() module.LimbsMap

RegisterMapping returns the register mapping used to split registers according to the given field configuration.

func (*SchemaStack[F]) TraceBuilder

func (p *SchemaStack[F]) TraceBuilder() ir.TraceBuilder[F]

TraceBuilder returns a configured trace builder.

type SchemaStacker

type SchemaStacker[F field.Element[F]] struct {
	// contains filtered or unexported fields
}

SchemaStacker is an abstraction for building a schema stacks. It allows us to configure which schemas should be in the resulting stack, to configure the trace builder, etc.

func NewSchemaStack

func NewSchemaStack[F field.Element[F]]() *SchemaStacker[F]

NewSchemaStack constructs a new, but empty stack of schemas.

func (SchemaStacker[F]) BinaryFile

func (p SchemaStacker[F]) BinaryFile() *binfile.BinaryFile

BinaryFile returns the binary file representing the top of this stack.

func (SchemaStacker[F]) Build

func (p SchemaStacker[F]) Build() SchemaStack[F]

Build a fresh SchemaStack from this stacker.

func (SchemaStacker[F]) Field

func (p SchemaStacker[F]) Field() field.Config

Field returns the field configuration used within this schema stack.

func (SchemaStacker[F]) HasBinaryFile

func (p SchemaStacker[F]) HasBinaryFile() bool

HasBinaryFile determines whether or not a binary file is available

func (SchemaStacker[F]) Read

func (p SchemaStacker[F]) Read(filenames ...string) SchemaStacker[F]

Read reads one or more constraints files into this stack.

func (SchemaStacker[F]) TraceBuilder

func (p SchemaStacker[F]) TraceBuilder() ir.TraceBuilder[F]

TraceBuilder returns a configured trace builder.

func (SchemaStacker[F]) WithAssemblyConfig

func (p SchemaStacker[F]) WithAssemblyConfig(config asm.LoweringConfig) SchemaStacker[F]

WithAssemblyConfig determines the ASM lowering configuration to use for this schema stack. This determines, amongst other things, the maximum register size.

func (SchemaStacker[F]) WithBinaryFile

func (p SchemaStacker[F]) WithBinaryFile(binf binfile.BinaryFile) SchemaStacker[F]

WithBinaryFile updates the binary file which forms the root of any constructed stacks.

func (SchemaStacker[F]) WithConstantDefinitions

func (p SchemaStacker[F]) WithConstantDefinitions(externs []string) SchemaStacker[F]

WithConstantDefinitions determines the externalised constant definitions to apply to the constructed binary file.

func (SchemaStacker[F]) WithCorsetConfig

func (p SchemaStacker[F]) WithCorsetConfig(config corset.CompilationConfig) SchemaStacker[F]

WithCorsetConfig determines the compilation configuration to use for Corset.

func (SchemaStacker[F]) WithLayer

func (p SchemaStacker[F]) WithLayer(layer uint) SchemaStacker[F]

WithLayer identifies that the given layer should be included in the schema stack.

func (SchemaStacker[F]) WithOptimisationConfig

func (p SchemaStacker[F]) WithOptimisationConfig(config mir.OptimisationConfig) SchemaStacker[F]

WithOptimisationConfig determines the optimisation level to apply at the MIR layer.

func (SchemaStacker[F]) WithTraceBuilder

func (p SchemaStacker[F]) WithTraceBuilder(builder ir.TraceBuilder[F]) SchemaStacker[F]

WithTraceBuilder determines the settings to use for trace expansion, such as whether to use parallelisation, etc.

Jump to

Keyboard shortcuts

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