mirror of
https://github.com/vacp2p/linea-monorepo.git
synced 2026-01-09 04:08:01 -05:00
* fix(execution): a few fixes in the wizard verifier * feat(dict): pass the dict path from config * fix: makeBw6Proof returns circuitID instead of -1 * fix(circuitID): make bw6Proof returns the circuitID * fix(config-testing) * feat(config): sepolia-full uses full aggregation * style(naming): renaming the rolling hash fields and documenting the checks in pi-interconnection * feat: flag for target number of constraints * fix refactoring oversight --------- Co-authored-by: Arya Tabaie <arya.pourtabatabaie@gmail.com>
56 lines
1.7 KiB
Go
56 lines
1.7 KiB
Go
package execution
|
|
|
|
import (
|
|
"testing"
|
|
|
|
public_input "github.com/consensys/linea-monorepo/prover/public-input"
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"github.com/consensys/gnark/frontend"
|
|
"github.com/consensys/gnark/std/hash/mimc"
|
|
snarkTestUtils "github.com/consensys/linea-monorepo/prover/circuits/internal/test_utils"
|
|
"github.com/consensys/linea-monorepo/prover/utils"
|
|
)
|
|
|
|
func TestPIConsistency(t *testing.T) {
|
|
pi := public_input.Execution{
|
|
L2MessageHashes: make([][32]byte, 2),
|
|
FinalBlockNumber: 4,
|
|
FinalBlockTimestamp: 5,
|
|
LastRollingHashUpdateNumber: 6,
|
|
InitialBlockNumber: 1,
|
|
InitialBlockTimestamp: 2,
|
|
FirstRollingHashUpdateNumber: 3,
|
|
ChainID: 7,
|
|
}
|
|
|
|
utils.FillRange(pi.DataChecksum[:], 10)
|
|
utils.FillRange(pi.L2MessageHashes[0][:], 50)
|
|
utils.FillRange(pi.L2MessageHashes[1][:], 90)
|
|
utils.FillRange(pi.InitialStateRootHash[:], 130)
|
|
utils.FillRange(pi.InitialRollingHashUpdate[:], 170)
|
|
utils.FillRange(pi.FinalStateRootHash[:], 210)
|
|
utils.FillRange(pi.LastRollingHashUpdate[:], 250)
|
|
utils.FillRange(pi.L2MessageServiceAddr[:], 40)
|
|
|
|
// state root hashes are field elements
|
|
pi.InitialStateRootHash[0] &= 0x0f
|
|
pi.FinalStateRootHash[0] &= 0x0f
|
|
|
|
snarkPi := FunctionalPublicInputSnark{
|
|
FunctionalPublicInputQSnark: FunctionalPublicInputQSnark{
|
|
L2MessageHashes: L2MessageHashes{Values: make([][32]frontend.Variable, 3)},
|
|
},
|
|
}
|
|
require.NoError(t, snarkPi.Assign(&pi))
|
|
piSum := pi.Sum(nil)
|
|
|
|
snarkTestUtils.SnarkFunctionTest(func(api frontend.API) []frontend.Variable {
|
|
hsh, err := mimc.NewMiMC(api)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return []frontend.Variable{snarkPi.Sum(api, &hsh)}
|
|
}, piSum)(t)
|
|
}
|