From 06f91e4465966beec8fdb742db1afbef1ed17aeb Mon Sep 17 00:00:00 2001 From: Kevin Jue Date: Tue, 19 Dec 2023 13:00:22 -0800 Subject: [PATCH] fix for V-SCT-VUL-029 --- plonk/gates/exponentiation_gate.go | 14 ++++++++++++++ plonk/gates/random_access_gate.go | 14 ++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/plonk/gates/exponentiation_gate.go b/plonk/gates/exponentiation_gate.go index ccf02e6..eff38b4 100644 --- a/plonk/gates/exponentiation_gate.go +++ b/plonk/gates/exponentiation_gate.go @@ -23,6 +23,20 @@ func deserializeExponentiationGate(parameters map[string]string) Gate { panic("Invalid num_power_bits field in ExponentiationGate") } + base, hasBase := parameters["base"] + if !hasBase { + panic("Missing field base in ExponentiationGate") + } + + baseInt, err := strconv.Atoi(base) + if err != nil { + panic("Invalid base field in ExponentiationGate") + } + + if baseInt != gl.D { + panic("Expected base field in ExponentiationGate to equal gl.D") + } + return NewExponentiationGate(uint64(numPowerBitsInt)) } diff --git a/plonk/gates/random_access_gate.go b/plonk/gates/random_access_gate.go index 8c3c459..aba32d0 100644 --- a/plonk/gates/random_access_gate.go +++ b/plonk/gates/random_access_gate.go @@ -36,6 +36,20 @@ func deserializeRandomAccessGate(parameters map[string]string) Gate { panic("invalid numExtraConstants in RandomAccessGate") } + base, hasBase := parameters["base"] + if !hasBase { + panic("Missing field base in RandomAccessGate") + } + + baseInt, err := strconv.Atoi(base) + if err != nil { + panic("Invalid base field in RandomAccessGate") + } + + if baseInt != gl.D { + panic("Expected base field in RandomAccessGate to equal gl.D") + } + return NewRandomAccessGate(bitsInt, numCopiesInt, numExtraConstantsInt) }