Skip to content

Commit 1117bfc

Browse files
committed
port from v0.2.2
Signed-off-by: Jim Zhang <jim.zhang@kaleido.io>
1 parent 6dfd36b commit 1117bfc

32 files changed

+597
-84
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: 'Free Up Disk Space'
2+
description: 'Removes large, pre-installed toolsets like .NET, Android, and Swift to free up disk space.'
3+
runs:
4+
using: 'composite'
5+
steps:
6+
- name: Free up disk space
7+
shell: bash
8+
run: |
9+
echo "--- Disk Usage Before Cleanup ---"
10+
df -h
11+
echo "Removing large pre-installed toolsets..."
12+
sudo rm -rf /usr/share/dotnet
13+
sudo rm -rf /usr/local/lib/android
14+
sudo rm -rf /usr/share/swift
15+
sudo rm -rf /opt/ghc
16+
echo "--- Disk Usage After Cleanup ---"
17+
df -h

.github/workflows/e2e-deps.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,20 @@ on:
44
workflow_call:
55
outputs:
66
artifacts-name:
7-
description: "the name of the artifacts containing ZK circuit assemblies and proving keys"
7+
description: 'the name of the artifacts containing ZK circuit assemblies and proving keys'
88
value: ${{ jobs.integration-test-prerequisites.outputs.artifacts-name }}
99
jobs:
1010
integration-test-prerequisites:
1111
runs-on: ubuntu-latest
1212
outputs:
1313
artifacts-name: ${{ steps.artifacts-name.outputs.artifacts-name }}
1414
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
18+
- name: Free up disk space on runner
19+
uses: ./.github/actions/free-up-disk-space
20+
1521
- name: Install circom
1622
uses: supplypike/setup-bin@v4
1723
with:

.github/workflows/e2e.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ jobs:
3434
ports:
3535
- 5432:5432
3636
steps:
37+
- name: Checkout
38+
uses: actions/checkout@v4
39+
40+
- name: Free up disk space on runner
41+
uses: ./.github/actions/free-up-disk-space
42+
3743
- name: Set up Go
3844
uses: actions/setup-go@v5
3945
with:
@@ -42,7 +48,7 @@ jobs:
4248
- name: Setup node.js
4349
uses: actions/setup-node@v4
4450
with:
45-
node-version: 20
51+
node-version: 22
4652

4753
- name: Checkout Zeto
4854
uses: actions/checkout@v4

.github/workflows/release.yaml

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ env:
1010
ZETO_VER: ${{ github.ref_name }}
1111

1212
jobs:
13+
setup-prerequisites:
14+
uses: ./.github/workflows/e2e-deps.yaml
1315
build:
16+
needs: setup-prerequisites
1417
runs-on: ubuntu-latest
1518
steps:
1619
- name: Checkout
@@ -37,19 +40,18 @@ jobs:
3740
with:
3841
fetch-depth: 0
3942

43+
- name: Free up disk space on runner
44+
uses: ./.github/actions/free-up-disk-space
45+
4046
- name: Setup temp dir for the artifacts
4147
run: |
4248
mkdir -p ${{ runner.temp }}/zeto-artifacts
4349
44-
- name: Build circuits
45-
env:
46-
CIRCUITS_ROOT: ${{ runner.temp }}/zeto-artifacts
47-
PROVING_KEYS_ROOT: ${{ runner.temp }}/zeto-artifacts
48-
PTAU_DOWNLOAD_PATH: ${{ runner.temp }}/zeto-artifacts
49-
working-directory: zkp/circuits
50-
run: |
51-
npm install
52-
npm run gen
50+
- name: Download zeto artifacts
51+
uses: actions/download-artifact@v4
52+
with:
53+
name: ${{ needs.setup-prerequisites.outputs.artifacts-name }}
54+
path: ${{ runner.temp }}/zeto-artifacts
5355

5456
- name: Build contracts
5557
working-directory: solidity
@@ -65,7 +67,7 @@ jobs:
6567
tar -czvf zeto-wasm-$ZETO_VER.tar.gz **/*.wasm
6668
tar --exclude='*qurrency*' -czvf zeto-test-proving-keys-$ZETO_VER.tar.gz *.zkey *-vkey.json
6769
tar -czvf zeto-qurrency-test-proving-keys-$ZETO_VER.tar.gz *qurrency*.zkey *qurrency*-vkey.json
68-
70+
6971
- name: Create prover archives
7072
working-directory: ${{ runner.temp }}/zeto-artifacts
7173
run: |
@@ -79,14 +81,14 @@ jobs:
7981
ARTIFACTS_ROOT: ${{ runner.temp }}/zeto-artifacts
8082
run: |
8183
tar -czvf $ARTIFACTS_ROOT/zeto-contracts-$ZETO_VER.tar.gz artifacts/contracts artifacts/@iden3
82-
84+
8385
- name: Create contract archives
8486
working-directory: solidity
8587
env:
8688
ARTIFACTS_ROOT: ${{ runner.temp }}/zeto-artifacts
8789
run: |
8890
tar -czvf $ARTIFACTS_ROOT/zeto-contracts.tar.gz artifacts/contracts artifacts/@iden3
89-
91+
9092
- name: Publish Release Artifact
9193
uses: actions/upload-artifact@v4
9294
with:
@@ -114,4 +116,4 @@ jobs:
114116
allowUpdates: 'true'
115117
artifacts: zeto-wasm-and-proving-keys/*.tar.gz
116118
tag: ${{ env.ZETO_VER }}
117-
token: ${{ secrets.PAT }}
119+
token: ${{ secrets.PAT }}

go-sdk/go.mod

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@ module github.com/hyperledger-labs/zeto/go-sdk
33
go 1.24.4
44

55
require (
6-
github.com/ethereum/go-ethereum v1.16.7
6+
github.com/ethereum/go-ethereum v1.16.8
77
github.com/iden3/go-rapidsnark/witness/wasmer v0.0.0-20251113130218-15cc9f587b90
8-
github.com/sirupsen/logrus v1.9.3
8+
github.com/sirupsen/logrus v1.9.4
99
github.com/stretchr/testify v1.11.1
1010
github.com/x-cray/logrus-prefixed-formatter v0.5.2
1111
)
1212

1313
require (
1414
github.com/Microsoft/go-winio v0.6.2 // indirect
15-
github.com/ProjectZKM/Ziren/crates/go-runtime/zkvm_runtime v0.0.0-20251208031133-be43a854e4be // indirect
15+
github.com/ProjectZKM/Ziren/crates/go-runtime/zkvm_runtime v0.0.0-20260127004537-287a9d08ff86 // indirect
1616
github.com/aidarkhanov/nanoid v1.0.8 // indirect
1717
github.com/bits-and-blooms/bitset v1.24.4 // indirect
1818
github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
@@ -39,7 +39,7 @@ require (
3939
github.com/jinzhu/now v1.1.5 // indirect
4040
github.com/mattn/go-colorable v0.1.14 // indirect
4141
github.com/mattn/go-isatty v0.0.20 // indirect
42-
github.com/mattn/go-sqlite3 v1.14.32 // indirect
42+
github.com/mattn/go-sqlite3 v1.14.33 // indirect
4343
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect
4444
github.com/pkg/errors v0.9.1 // indirect
4545
github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 // indirect
@@ -49,8 +49,8 @@ require (
4949
github.com/tklauser/numcpus v0.11.0 // indirect
5050
github.com/yusufpapurcu/wmi v1.2.4 // indirect
5151
golang.org/x/sync v0.19.0 // indirect
52-
golang.org/x/term v0.38.0 // indirect
53-
golang.org/x/text v0.32.0 // indirect
52+
golang.org/x/term v0.39.0 // indirect
53+
golang.org/x/text v0.33.0 // indirect
5454
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
5555
)
5656

@@ -64,8 +64,8 @@ require (
6464
github.com/iden3/go-rapidsnark/types v0.0.3
6565
github.com/iden3/go-rapidsnark/witness/v2 v2.0.0
6666
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
67-
golang.org/x/crypto v0.46.0
68-
golang.org/x/sys v0.39.0 // indirect
67+
golang.org/x/crypto v0.47.0
68+
golang.org/x/sys v0.40.0 // indirect
6969
gopkg.in/yaml.v3 v3.0.1 // indirect
7070
gorm.io/driver/postgres v1.5.9
7171
gorm.io/driver/sqlite v1.6.0

go-sdk/go.sum

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ github.com/DataDog/zstd v1.4.5 h1:EndNeuB0l9syBZhut0wns3gV1hL8zX8LIu6ZiVHWLIQ=
22
github.com/DataDog/zstd v1.4.5/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo=
33
github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY=
44
github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU=
5-
github.com/ProjectZKM/Ziren/crates/go-runtime/zkvm_runtime v0.0.0-20251208031133-be43a854e4be h1:1LtMLkGIqE5IQZ7Vdh4zv8A6LECInKF86/fTVxKxYLE=
6-
github.com/ProjectZKM/Ziren/crates/go-runtime/zkvm_runtime v0.0.0-20251208031133-be43a854e4be/go.mod h1:ioLG6R+5bUSO1oeGSDxOV3FADARuMoytZCSX6MEMQkI=
5+
github.com/ProjectZKM/Ziren/crates/go-runtime/zkvm_runtime v0.0.0-20260127004537-287a9d08ff86 h1:tsmFIxYj1mSmIvJfdVHlfyBHuFwVuCXbijoLwJ2XldQ=
6+
github.com/ProjectZKM/Ziren/crates/go-runtime/zkvm_runtime v0.0.0-20260127004537-287a9d08ff86/go.mod h1:ioLG6R+5bUSO1oeGSDxOV3FADARuMoytZCSX6MEMQkI=
77
github.com/VictoriaMetrics/fastcache v1.13.0 h1:AW4mheMR5Vd9FkAPUv+NH6Nhw+fmbTMGMsNAoA/+4G0=
88
github.com/VictoriaMetrics/fastcache v1.13.0/go.mod h1:hHXhl4DA2fTL2HTZDJFXWgW0LNjo6B+4aj2Wmng3TjU=
99
github.com/aidarkhanov/nanoid v1.0.8 h1:yxyJkgsEDFXP7+97vc6JevMcjyb03Zw+/9fqhlVXBXA=
@@ -43,7 +43,6 @@ github.com/crate-crypto/go-eth-kzg v1.4.0/go.mod h1:J9/u5sWfznSObptgfa92Jq8rTswn
4343
github.com/crate-crypto/go-ipa v0.0.0-20240724233137-53bbb0ceb27a h1:W8mUrRp6NOVl3J+MYp5kPMoUZPp7aOYHtaua31lwRHg=
4444
github.com/crate-crypto/go-ipa v0.0.0-20240724233137-53bbb0ceb27a/go.mod h1:sTwzHBvIzm2RfVCGNEBZgRyjwK40bVoun3ZnGOCafNM=
4545
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
46-
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
4746
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
4847
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
4948
github.com/dchest/blake512 v1.0.0 h1:oDFEQFIqFSeuA34xLtXZ/rWxCXdSjirjzPhey5EUvmA=
@@ -66,8 +65,8 @@ github.com/ethereum/c-kzg-4844/v2 v2.1.5 h1:aVtoLK5xwJ6c5RiqO8g8ptJ5KU+2Hdquf6G3
6665
github.com/ethereum/c-kzg-4844/v2 v2.1.5/go.mod h1:u59hRTTah4Co6i9fDWtiCjTrblJv0UwsqZKCc0GfgUs=
6766
github.com/ethereum/go-bigmodexpfix v0.0.0-20250911101455-f9e208c548ab h1:rvv6MJhy07IMfEKuARQ9TKojGqLVNxQajaXEp/BoqSk=
6867
github.com/ethereum/go-bigmodexpfix v0.0.0-20250911101455-f9e208c548ab/go.mod h1:IuLm4IsPipXKF7CW5Lzf68PIbZ5yl7FFd74l/E0o9A8=
69-
github.com/ethereum/go-ethereum v1.16.7 h1:qeM4TvbrWK0UC0tgkZ7NiRsmBGwsjqc64BHo20U59UQ=
70-
github.com/ethereum/go-ethereum v1.16.7/go.mod h1:Fs6QebQbavneQTYcA39PEKv2+zIjX7rPUZ14DER46wk=
68+
github.com/ethereum/go-ethereum v1.16.8 h1:LLLfkZWijhR5m6yrAXbdlTeXoqontH+Ga2f9igY7law=
69+
github.com/ethereum/go-ethereum v1.16.8/go.mod h1:Fs6QebQbavneQTYcA39PEKv2+zIjX7rPUZ14DER46wk=
7170
github.com/ethereum/go-verkle v0.2.2 h1:I2W0WjnrFUIzzVPwm8ykY+7pL2d4VhlsePn4j7cnFk8=
7271
github.com/ethereum/go-verkle v0.2.2/go.mod h1:M3b90YRnzqKyyzBEWJGqj8Qff4IDeXnzFw0P9bFw3uk=
7372
github.com/ferranbt/fastssz v0.1.4 h1:OCDB+dYDEQDvAgtAGnTSidK1Pe2tW3nFV40XyMkTeDY=
@@ -181,8 +180,8 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE
181180
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
182181
github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU=
183182
github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
184-
github.com/mattn/go-sqlite3 v1.14.32 h1:JD12Ag3oLy1zQA+BNn74xRgaBbdhbNIDYvQUEuuErjs=
185-
github.com/mattn/go-sqlite3 v1.14.32/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
183+
github.com/mattn/go-sqlite3 v1.14.33 h1:A5blZ5ulQo2AtayQ9/limgHEkFreKj1Dv226a1K73s0=
184+
github.com/mattn/go-sqlite3 v1.14.33/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
186185
github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo=
187186
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 h1:jWpvCLoY8Z/e3VKvlsiIGKtc+UG6U5vzxaoagmhXfyg=
188187
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0/go.mod h1:QUyp042oQthUoa9bqDv0ER0wrtXnBruoNd7aNjkbP+k=
@@ -256,8 +255,8 @@ github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 h1:lZUw3E0/J3roVtGQ+SCrUrg3ON6Ng
256255
github.com/santhosh-tekuri/jsonschema/v5 v5.3.1/go.mod h1:uToXkOrWAZ6/Oc07xWQrPOhJotwFIyu2bBVN41fcDUY=
257256
github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKlUeu/erjjvaPEYiI=
258257
github.com/shirou/gopsutil v3.21.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
259-
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
260-
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
258+
github.com/sirupsen/logrus v1.9.4 h1:TsZE7l11zFCLZnZ+teH4Umoq5BhEIfIzfRDZ1Uzql2w=
259+
github.com/sirupsen/logrus v1.9.4/go.mod h1:ftWc9WdOfJ0a92nsE2jF5u5ZwH8Bv2zdeOC42RjbV2g=
261260
github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo=
262261
github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0=
263262
github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8=
@@ -297,24 +296,23 @@ gitlab.com/hfuss/mux-prometheus v0.0.5 h1:Kcqyiekx8W2dO1EHg+6wOL1F0cFNgRO1uCK18V
297296
gitlab.com/hfuss/mux-prometheus v0.0.5/go.mod h1:xcedy8rVGr9TFgRu2urfGuh99B4NdfYdpE4aUMQ0dxA=
298297
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
299298
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
300-
golang.org/x/crypto v0.46.0 h1:cKRW/pmt1pKAfetfu+RCEvjvZkA9RimPbh7bhFjGVBU=
301-
golang.org/x/crypto v0.46.0/go.mod h1:Evb/oLKmMraqjZ2iQTwDwvCtJkczlDuTmdJXoZVzqU0=
299+
golang.org/x/crypto v0.47.0 h1:V6e3FRj+n4dbpw86FJ8Fv7XVOql7TEwpHapKoMJ/GO8=
300+
golang.org/x/crypto v0.47.0/go.mod h1:ff3Y9VzzKbwSSEzWqJsJVBnWmRwRSHt/6Op5n9bQc4A=
302301
golang.org/x/exp v0.0.0-20240110193028-0dcbfd608b1e h1:723BNChdd0c2Wk6WOE320qGBiPtYx0F0Bbm1kriShfE=
303302
golang.org/x/exp v0.0.0-20240110193028-0dcbfd608b1e/go.mod h1:iRJReGqOEeBhDZGkGbynYwcHlctCvnjTYIamk7uXpHI=
304-
golang.org/x/net v0.47.0 h1:Mx+4dIFzqraBXUugkia1OOvlD6LemFo1ALMHjrXDOhY=
305-
golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU=
303+
golang.org/x/net v0.48.0 h1:zyQRTTrjc33Lhh0fBgT/H3oZq9WuvRR5gPC70xpDiQU=
304+
golang.org/x/net v0.48.0/go.mod h1:+ndRgGjkh8FGtu1w1FGbEC31if4VrNVMuKTgcAAnQRY=
306305
golang.org/x/sync v0.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4=
307306
golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
308307
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
309-
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
310308
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
311309
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
312-
golang.org/x/sys v0.39.0 h1:CvCKL8MeisomCi6qNZ+wbb0DN9E5AATixKsvNtMoMFk=
313-
golang.org/x/sys v0.39.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
314-
golang.org/x/term v0.38.0 h1:PQ5pkm/rLO6HnxFR7N2lJHOZX6Kez5Y1gDSJla6jo7Q=
315-
golang.org/x/term v0.38.0/go.mod h1:bSEAKrOT1W+VSu9TSCMtoGEOUcKxOKgl3LE5QEF/xVg=
316-
golang.org/x/text v0.32.0 h1:ZD01bjUt1FQ9WJ0ClOL5vxgxOI/sVCNgX1YtKwcY0mU=
317-
golang.org/x/text v0.32.0/go.mod h1:o/rUWzghvpD5TXrTIBuJU77MTaN0ljMWE47kxGJQ7jY=
310+
golang.org/x/sys v0.40.0 h1:DBZZqJ2Rkml6QMQsZywtnjnnGvHza6BTfYFWY9kjEWQ=
311+
golang.org/x/sys v0.40.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
312+
golang.org/x/term v0.39.0 h1:RclSuaJf32jOqZz74CkPA9qFuVTX7vhLlpfj/IGWlqY=
313+
golang.org/x/term v0.39.0/go.mod h1:yxzUCTP/U+FzoxfdKmLaA0RV1WgE0VY7hXBwKtY/4ww=
314+
golang.org/x/text v0.33.0 h1:B3njUFyqtHDUI5jMn1YIr5B0IE2U0qck04r6d4KPAxE=
315+
golang.org/x/text v0.33.0/go.mod h1:LuMebE6+rBincTi9+xWTY8TztLzKHc/9C1uBCG27+q8=
318316
golang.org/x/time v0.9.0 h1:EsRrnYcQiGH+5FfbgvV4AP7qEZstoyrHB0DzarOQ4ZY=
319317
golang.org/x/time v0.9.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
320318
google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg=

go-sdk/internal/crypto/encryption.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,12 @@ func PoseidonDecrypt(cipherText []*big.Int, key []*big.Int, nonce *big.Int, leng
151151
// If length > 3, check if the last (3 - (l mod 3)) elements of the message are 0
152152
// this is a safty check because the message would have been padded with 0s
153153
if length > 3 {
154-
if length%3 == 2 {
154+
switch length % 3 {
155+
case 2:
155156
if message[len(message)-1].Cmp(big.NewInt(0)) != 0 {
156157
return nil, fmt.Errorf("the last element of the decrypted text must be 0")
157158
}
158-
} else if length%3 == 1 {
159+
case 1:
159160
if message[len(message)-2].Cmp(big.NewInt(0)) != 0 || message[len(message)-1].Cmp(big.NewInt(0)) != 0 {
160161
return nil, fmt.Errorf("the last two elements of the decrypted text must be 0")
161162
}

go-sdk/internal/sparse-merkle-tree/storage/sql_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func TestSqliteStorage(t *testing.T) {
4545
dbfile, err := os.CreateTemp("", "gorm.db")
4646
assert.NoError(t, err)
4747
defer func() {
48-
os.Remove(dbfile.Name())
48+
_ = os.Remove(dbfile.Name())
4949
}()
5050
db, err := gorm.Open(sqlite.Open(dbfile.Name()), &gorm.Config{})
5151
assert.NoError(t, err)
@@ -106,7 +106,7 @@ func TestSqliteStorageFail_NoRootTable(t *testing.T) {
106106
dbfile, err := os.CreateTemp("", "gorm.db")
107107
assert.NoError(t, err)
108108
defer func() {
109-
os.Remove(dbfile.Name())
109+
_ = os.Remove(dbfile.Name())
110110
}()
111111
db, err := gorm.Open(sqlite.Open(dbfile.Name()), &gorm.Config{})
112112
assert.NoError(t, err)
@@ -129,7 +129,7 @@ func TestSqliteStorageFail_NoNodeTable(t *testing.T) {
129129
dbfile, err := os.CreateTemp("", "gorm.db")
130130
assert.NoError(t, err)
131131
defer func() {
132-
os.Remove(dbfile.Name())
132+
_ = os.Remove(dbfile.Name())
133133
}()
134134
db, err := gorm.Open(sqlite.Open(dbfile.Name()), &gorm.Config{})
135135
assert.NoError(t, err)
@@ -154,7 +154,7 @@ func TestSqliteStorageFail_BadNodeIndex(t *testing.T) {
154154
dbfile, err := os.CreateTemp("", "gorm.db")
155155
assert.NoError(t, err)
156156
defer func() {
157-
os.Remove(dbfile.Name())
157+
_ = os.Remove(dbfile.Name())
158158
}()
159159
db, err := gorm.Open(sqlite.Open(dbfile.Name()), &gorm.Config{})
160160
assert.NoError(t, err)

0 commit comments

Comments
 (0)