Skip to content

Conversation

@thedarkjester
Copy link
Contributor

@thedarkjester thedarkjester commented Dec 16, 2025

Description

Fixes # (issue)

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How has this been tested?

  • Test A
  • Test B

How has this been benchmarked?

  • Benchmark A, on Macbook pro M1, 32GB RAM
  • Benchmark B, on x86 Intel xxx, 16GB RAM

Checklist:

  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • I did not modify files generated from templates
  • golangci-lint does not output errors locally
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Note

Adds MiMC-hashed dynamic chain configuration to the Plonk verifier template and makes PlonkVerifier implement IPlonkVerifier.

  • Verifier (Solidity template) in backend/plonk/bn254/solidity.go:
    • Implements IPlonkVerifier; adds imports for Mimc and IPlonkVerifier.
    • Dynamic chain configuration:
      • Introduces immutable CHAIN_CONFIGURATION with constructor accepting ChainConfigurationParameter[] and validation.
      • Computes chain config hash via Mimc.hash in _computeChainConfigurationHash(...) and emits ChainConfigurationSet.
      • Adds getChainConfiguration() view getter.

Written by Cursor Bugbot for commit 1cb8a20. This will update automatically on new commits. Configure here.

}
mimcPayload = bytes.concat(mimcPayload, most, least);
}
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Hash function allows collisions between different configurations

The _computeChainConfigurationHash function has a collision vulnerability. When a value has its first bit set, it's split into most and least parts (each 32 bytes with upper bits zeroed). Since these split parts always have their first bits as zero, they would encode directly without splitting. This means a single-element config with first bit = 1 produces the same hash as a two-element config where elements equal the most and least parts, allowing different chain configurations to produce identical hashes.

Fix in Cursor Fix in Web

@ivokub ivokub added dep: linea Issues affecting Linea downstream priority: P2-medium Issue priority: medium feat: solidity labels Dec 17, 2025
@ivokub ivokub self-assigned this Dec 17, 2025
@ivokub
Copy link
Collaborator

ivokub commented Dec 17, 2025

The plan to integrate the configuration is as follows:

  • add Solidity export options:
    • Withlmport -- multiple options. Every line goes to separate row
    • WithInheretance -- can allow multiple. In this case have to format accordingly
    • WithConstants -- additional constants to whatever is defined in the template
    • WithFunctions -- aditionnal functions which can be included in the template
      And then we replace during contract generation. On Linea side we then provide the corresponding parameters for different cases (test case generation).

Timeline-wise -- can do after new year's.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dep: linea Issues affecting Linea downstream feat: solidity priority: P2-medium Issue priority: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants