refactor(inlines): deduplicate field types, add InlineSpec, typed advice#1371
Draft
0xAndoroid wants to merge 6 commits intomainfrom
Draft
refactor(inlines): deduplicate field types, add InlineSpec, typed advice#13710xAndoroid wants to merge 6 commits intomainfrom
0xAndoroid wants to merge 6 commits intomainfrom
Conversation
f188dfc to
439a4ab
Compare
…hared helpers - Generic Secp256k1Field<C> replaces duplicate Secp256k1Fq/Secp256k1Fr structs - Generic GrumpkinField<C> replaces duplicate GrumpkinFq/GrumpkinFr structs - ECField trait uses Add/Sub/Mul/Neg operator supertraits; remove method-based API - Add load/store range helpers to InstrAssemblerExt (load_u64_range, etc.) - Extract shared blake3_g() free function from duplicate g_function impls - Replace secp256k1_mulq_op! macro with explicit newtypes - Rename inline_sequence() to build() for consistency across all builders - Remove stale doc comment on Keccak256SequenceBuilder
…pec.rs - Add InlineSpec trait to jolt-inlines-sdk with verify() and proptest() helpers - Migrate all 5 exec.rs files to spec.rs with InlineSpec implementations: - Sha256CompressionSpec, Sha256CompressionInitialSpec - Keccak256PermutationSpec - Blake3CompressionSpec, Blake3Keyed64CompressionSpec - Blake2bCompressionSpec - BigintMul256Spec - Each spec has typed Input/Output and connects reference impl to test harness - Backward-compatible free functions preserved for sdk.rs host paths
- InlineOp now requires 'type Advice: InlineAdvice' (no default) - InlineAdvice trait with into_values() bridges typed advice to VecDeque<u64> - Hash inlines: type Advice = () (no advice needed) - Secp256k1/grumpkin inlines: type Advice = VecDeque<u64> - __submit_inline_op! macro wraps build_advice with .into_values() - build_advice return type matches Advice (removes Option wrapper)
…ruct - InlineSpec: InlineOp supertrait — no separate spec structs - Implement InlineSpec directly on InlineOp structs (Sha256Compression, etc.) - Remove free functions from spec modules; callers use Struct::reference() - Keep internal helpers (execute_keccak_f, g, round, etc.) as pub(crate)
439a4ab to
8bf1907
Compare
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
0xAndoroid
commented
Mar 26, 2026
- Default instruction() on InlineSpec using Self::OPCODE/FUNCT3/FUNCT7 from InlineOp, remove redundant overrides in all spec.rs files - Rename message_words to w in blake2 spec reference impl - Delete blake3 test_utils.rs, inline helpers into test modules
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Secp256k1Field<C>andGrumpkinField<C>eliminate ~550 lines of Fq/Fr duplicationInlineSpectrait connects reference implementations to test harness for formal verificationAdviceassociated type onInlineOpenforces advice contracts at compile timeStacked on #1343.
Changes
Field element deduplication (trait-based, no macros)
Secp256k1FieldConfigtrait + genericSecp256k1Field<C>replaces duplicate Fq/Fr structsGrumpkinFieldConfigtrait + genericGrumpkinField<C>same patternECFieldtrait usesAdd/Sub/Mul/Negoperator supertraits; method-based API removedsecp256k1_mulq_op!macro replaced with explicit newtypesShared helpers
load_u64_range,store_u64_range,load_u32_range,load_u32_range_paired,store_u32_range_pairedonInstrAssemblerExtblake3_g()free function deduplicates Blake3/Keyed64 G-functionsinline_sequence()renamed tobuild()across all buildersInlineSpec trait
InlineSpectrait injolt-inlines-sdkwithverify()andproptest()helpersexec.rsfiles replaced withspec.rsimplementingInlineSpecTyped advice
InlineOp::Adviceassociated type withInlineAdvicetraittype Advice = (); curve inlines:type Advice = VecDeque<u64>__submit_inline_op!macro bridges typed advice to erasedInlineRegistrationTesting
All 63 tests across 7 inline crates pass. Clippy clean in both
hostandhost,zkmodes.