builder

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParallelTraceExpansion

func ParallelTraceExpansion[F field.Element[F]](batchsize uint, schema sc.AnySchema[F], trace *tr.ArrayTrace[F]) error

ParallelTraceExpansion performs trace expansion using concurrently executing jobs. The chosen algorithm operates in waves, rather than using an continuous approach. This is for two reasons: firstly, the latter would require locks that would slow down evaluation performance; secondly, the vast majority of jobs are run in the very first wave.

func ParallelTraceValidation

func ParallelTraceValidation[F field.Element[F]](schema sc.AnySchema[F], trace tr.Trace[F]) []error

ParallelTraceValidation validates that values held in trace columns match the expected type. This is really a sanity check that the trace is not malformed.

func SequentialTraceExpansion

func SequentialTraceExpansion[F field.Element[F]](schema sc.AnySchema[F], trace *trace.ArrayTrace[F]) error

SequentialTraceExpansion expands a given trace according to a given schema. More specifically, that means computing the actual values for any assignments. This is done using a straightforward sequential algorithm.

func SequentialTraceValidation

func SequentialTraceValidation[F field.Element[F]](schema sc.AnySchema[F], tr trace.Trace[F]) []error

SequentialTraceValidation validates that values held in trace columns match the expected type. This is really a sanity check that the trace is not malformed.

func TraceExpansion

func TraceExpansion[F field.Element[F]](parallel bool, batchsize uint, schema sc.AnySchema[F],
	trace *tr.ArrayTrace[F]) error

TraceExpansion expands a given trace according to a given schema. More specifically, that means computing the actual values for any assignments. This is done using a straightforward sequential algorithm.

func TraceLowering

func TraceLowering[F field.Element[F]](parallel bool, tf lt.TraceFile) (array.Builder[F], []lt.Module[F])

TraceLowering simply converts columns from their current big endian word representation into the appropriate field representation without performing any splitting. This is only required for traces which are "pre-expanded". Such traces typically arise in testing, etc.

func TraceSplitting

func TraceSplitting[F field.Element[F]](parallel bool, tf lt.TraceFile, mapping module.LimbsMap) (array.Builder[F],
	[]lt.Module[F], []error)

TraceSplitting splits a given set of raw columns according to a given register mapping or, otherwise, simply lowers them.

func TraceValidation

func TraceValidation[F field.Element[F]](parallel bool, schema sc.AnySchema[F], tr tr.Trace[F]) []error

TraceValidation validates that values held in trace columns match the expected type. This is really a sanity check that the trace is not malformed.

Types

type Expander

type Expander[F any] struct {
	// contains filtered or unexported fields
}

Expander encapsulates key state required in order to expand traces safely (whether or not this is done sequentially or in parallel). The intuition behind this algorithm is that each assignment will only be run exactly once. However, some assignments must be run before others. For example, if one assignment depends upon a column which is computed by another, then the latter must go first.

func NewExpander

func NewExpander[F any](width uint, assignments iter.Iterator[sc.Assignment[F]]) Expander[F]

NewExpander constructs a new trace expander for a given set of assignments.

func (*Expander[F]) Count

func (p *Expander[F]) Count() uint

Count returns the number of assignments remaining to be processed.

func (*Expander[F]) Done

func (p *Expander[F]) Done() bool

Done indicates whether all assignments have been processed, or not.

func (*Expander[F]) Next

func (p *Expander[F]) Next(n uint) []sc.Assignment[F]

Next returns at most n assignments which are ready for execution. An assignment is ready for execution if all of the columns on which it depends have been processed already. Observe that all assignments returned here are removed from the worklist and will not be returned again. Specifically, they are assumed to have been processed before any subsequent call is made to this method.

Jump to

Keyboard shortcuts

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