Skip to content

Commit

Permalink
chore: use common cs for zero when inactive
Browse files Browse the repository at this point in the history
  • Loading branch information
ivokub committed Oct 10, 2024
1 parent 8bb7dfd commit 0fdbd2e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 17 deletions.
6 changes: 4 additions & 2 deletions prover/zkevm/prover/ecdsa/adress.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,10 @@ func newAddress(comp *wizard.CompiledIOP, size int, ecRec *EcRecover, ac *antich
commoncs.MustBeBinary(comp, addr.isAddress)
commoncs.MustBeBinary(comp, addr.isAddressFromEcRec)
commoncs.MustBeBinary(comp, addr.isAddressFromTxnData)
isZeroWhenInactive(comp, addr.isAddress, ac.IsActive)
isZeroWhenInactive(comp, addr.hashNum, ac.IsActive)
commoncs.MustZeroWhenInactive(comp, ac.IsActive,
addr.isAddress,
addr.hashNum,
)

// check the trimming of hashHi to the addressHi
addr.csAddressTrimming(comp)
Expand Down
20 changes: 5 additions & 15 deletions prover/zkevm/prover/ecdsa/antichamber_constraints.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,11 @@ func (ac *antichamber) csIsActive(comp *wizard.CompiledIOP) {
}

func (ac *antichamber) csZeroWhenInactive(comp *wizard.CompiledIOP) {
for _, c := range ac.cols(false) {
isZeroWhenInactive(comp, c, ac.IsActive)
}
for _, c := range ac.EcRecover.cols() {
isZeroWhenInactive(comp, c, ac.IsActive)
}
for _, c := range ac.Addresses.cols() {
isZeroWhenInactive(comp, c, ac.IsActive)
}
for _, c := range ac.txSignature.cols() {
isZeroWhenInactive(comp, c, ac.IsActive)
}
for _, c := range ac.UnalignedGnarkData.cols() {
isZeroWhenInactive(comp, c, ac.IsActive)
}
commoncs.MustZeroWhenInactive(comp, ac.IsActive, ac.cols(false)...)
commoncs.MustZeroWhenInactive(comp, ac.IsActive, ac.EcRecover.cols()...)
commoncs.MustZeroWhenInactive(comp, ac.IsActive, ac.Addresses.cols()...)
commoncs.MustZeroWhenInactive(comp, ac.IsActive, ac.txSignature.cols()...)
commoncs.MustZeroWhenInactive(comp, ac.IsActive, ac.UnalignedGnarkData.cols()...)
}

func (ac *antichamber) csConsistentPushingFetching(comp *wizard.CompiledIOP) {
Expand Down

0 comments on commit 0fdbd2e

Please sign in to comment.