Skip to content

Commit 5604983

Browse files
ShubhamChaturvedi7josecorellalucasmcdonald3rishav-karanjitimabhichow
authored
fix(Go): adds high unicode char Test Vectors (#762)
Co-authored-by: Jose Corella <[email protected]> Co-authored-by: Lucas McDonald <[email protected]> Co-authored-by: Rishav karanjit <[email protected]> Co-authored-by: Darwin Chowdary <[email protected]> Co-authored-by: José Corella <[email protected]> Co-authored-by: Shubham Chaturvedi <[email protected]>
1 parent fc17427 commit 5604983

File tree

93 files changed

+22638
-607
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+22638
-607
lines changed

.github/workflows/dafny_interop_test_net.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ jobs:
5757
dotnet-version: "6.0.x"
5858

5959
- name: Setup MPL Dafny
60-
uses: dafny-lang/[email protected]
60+
uses: ./mpl/.github/actions/setup_dafny
6161
with:
6262
dafny-version: ${{ inputs.mpl-dafny }}
6363

@@ -91,7 +91,7 @@ jobs:
9191
make transpile_net CORES=$CORES
9292
9393
- name: Setup ESDK Dafny
94-
uses: dafny-lang/[email protected]
94+
uses: ./mpl/.github/actions/setup_dafny
9595
with:
9696
dafny-version: ${{ inputs.esdk-dafny}}
9797

.github/workflows/dafny_interop_test_vector_net.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
dotnet-version: "6.0.x"
5757

5858
- name: Setup MPL Dafny
59-
uses: dafny-lang/[email protected]
59+
uses: ./mpl/.github/actions/setup_dafny
6060
with:
6161
dafny-version: ${{ inputs.mpl-dafny }}
6262

@@ -90,7 +90,7 @@ jobs:
9090
make transpile_net CORES=$CORES
9191
9292
- name: Setup ESDK Dafny
93-
uses: dafny-lang/[email protected]
93+
uses: ./mpl/.github/actions/setup_dafny
9494
with:
9595
dafny-version: ${{ inputs.esdk-dafny}}
9696

@@ -163,7 +163,7 @@ jobs:
163163
dotnet-version: "6.0.x"
164164

165165
- name: Setup MPL Dafny
166-
uses: dafny-lang/[email protected]
166+
uses: ./mpl/.github/actions/setup_dafny
167167
with:
168168
dafny-version: ${{ inputs.mpl-dafny }}
169169

@@ -197,7 +197,7 @@ jobs:
197197
make transpile_net CORES=$CORES
198198
199199
- name: Setup ESDK Dafny
200-
uses: dafny-lang/[email protected]
200+
uses: ./mpl/.github/actions/setup_dafny
201201
with:
202202
dafny-version: ${{ inputs.esdk-dafny}}
203203

.github/workflows/library_codegen.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
# and to translate version strings such as "nightly-latest"
4242
# to an actual DAFNY_VERSION.
4343
- name: Setup Dafny
44-
uses: dafny-lang/[email protected]
44+
uses: ./mpl/.github/actions/setup_dafny
4545
with:
4646
dafny-version: ${{ inputs.dafny }}
4747

.github/workflows/library_dafny_verification.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
dotnet-version: "6.0.x"
4444

4545
- name: Setup Dafny
46-
uses: dafny-lang/[email protected]
46+
uses: ./mpl/.github/actions/setup_dafny
4747
with:
4848
dafny-version: ${{ inputs.dafny }}
4949

.github/workflows/library_format.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
submodules: recursive
3838

3939
- name: Setup Dafny
40-
uses: dafny-lang/[email protected]
40+
uses: ./mpl/.github/actions/setup_dafny
4141
with:
4242
dafny-version: ${{ inputs.dafny }}
4343

.github/workflows/library_go_tests.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ jobs:
2525
# Sed script doesn't work properly on windows
2626
# windows-latest,
2727
ubuntu-22.04,
28-
macos-13,
28+
# TODO: Re-enable macOS after https://t.corp.amazon.com/P205755286
29+
# macos-13,
2930
]
3031
runs-on: ${{ matrix.os }}
3132
permissions:
@@ -50,7 +51,7 @@ jobs:
5051
role-session-name: GoTests
5152

5253
- name: Setup Dafny
53-
uses: dafny-lang/[email protected]
54+
uses: ./mpl/.github/actions/setup_dafny
5455
with:
5556
dafny-version: ${{ inputs.dafny }}
5657

.github/workflows/library_interop_test_vectors.yml renamed to .github/workflows/library_interop_keyring_test_vectors.yml

Lines changed: 70 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,29 @@ on:
1414
default: false
1515
type: boolean
1616

17+
# These interop tests are strictly only for Dafny based languages
18+
# or Dafny integrated languages (ESDK-Java, ESDK-Python).
19+
# Additionally, these tests produce the latest version of
20+
# test vector manifests V5. These have the ability to state how to
21+
# build negative test vectors and OnDecrypt constructions.
1722
jobs:
18-
generateEncryptVectors:
23+
generateKeyringEncryptVectors:
1924
strategy:
25+
fail-fast: false
2026
matrix:
2127
library: [TestVectors]
2228
os: [
2329
# https://taskei.amazon.dev/tasks/CrypTool-5283
2430
# windows-latest,
2531
ubuntu-22.04,
26-
macos-13,
2732
]
28-
language: [java, net, rust, go]
33+
language: [java, net, rust, python, go]
2934
# https://taskei.amazon.dev/tasks/CrypTool-5284
3035
dotnet-version: ["6.0.x"]
3136
runs-on: ${{ matrix.os }}
3237
permissions:
3338
id-token: write
3439
contents: read
35-
3640
steps:
3741
- name: Support longpaths on Git checkout
3842
run: |
@@ -45,12 +49,11 @@ jobs:
4549
aws-region: us-west-2
4650
role-to-assume: arn:aws:iam::370957321024:role/GitHub-CI-Public-ESDK-Dafny-Role-us-west-2
4751
role-session-name: InterOpTests
52+
role-duration-seconds: 3600
4853

49-
- uses: actions/checkout@v3
50-
# Not all submodules are needed.
51-
# We manually pull the submodule we DO need.
52-
- run: git submodule update --init libraries
53-
- run: git submodule update --init --recursive mpl
54+
- uses: actions/checkout@v4
55+
with:
56+
submodules: "recursive"
5457

5558
# Set up runtimes
5659
- name: Setup .NET Core SDK ${{ matrix.dotnet-version }}
@@ -67,6 +70,17 @@ jobs:
6770
distribution: "corretto"
6871
java-version: 17
6972

73+
- name: Setup Python for running tests
74+
if: matrix.language == 'python'
75+
uses: actions/setup-python@v4
76+
with:
77+
python-version: 3.11
78+
architecture: x64
79+
- run: |
80+
python -m pip install --upgrade pip
81+
pip install --upgrade tox
82+
pip install poetry
83+
7084
- name: Setup Rust Toolchain for GitHub CI
7185
if: matrix.language == 'rust'
7286
uses: actions-rust-lang/[email protected]
@@ -88,13 +102,13 @@ jobs:
88102

89103
- name: Setup Dafny Rust
90104
if: matrix.language == 'rust'
91-
uses: dafny-lang/[email protected]
105+
uses: ./mpl/.github/actions/setup_dafny
92106
with:
93107
dafny-version: nightly-2025-01-30-7db1e5f
94108

95109
- name: Setup Dafny Not Rust
96110
if: matrix.language != 'rust'
97-
uses: dafny-lang/[email protected]
111+
uses: ./mpl/.github/actions/setup_dafny
98112
with:
99113
dafny-version: ${{ inputs.dafny }}
100114

@@ -144,6 +158,15 @@ jobs:
144158
CORES=$(node -e 'console.log(os.cpus().length)')
145159
make transpile_rust CORES=$CORES
146160
161+
- name: Build ${{ matrix.library }} implementation in Python
162+
if: matrix.language == 'python'
163+
shell: bash
164+
working-directory: ./${{ matrix.library }}
165+
run: |
166+
# This works because `node` is installed by default on GHA runners
167+
CORES=$(node -e 'console.log(os.cpus().length)')
168+
make transpile_python CORES=$CORES
169+
147170
- name: Build ${{ matrix.library }} implementation in Go
148171
if: matrix.language == 'go'
149172
shell: bash
@@ -162,20 +185,22 @@ jobs:
162185
make purge_polymorph_code
163186
164187
- name: Setup gradle
165-
if: matrix.language == 'java'
188+
if: matrix.language == 'java_mkp' || matrix.language == 'java'
166189
uses: gradle/gradle-build-action@v2
167190
with:
168191
gradle-version: 7.2
169192

170-
- name: Create Manifests
193+
- name: Create Keyring Manifests
171194
working-directory: ./${{ matrix.library }}
172-
run: make test_generate_vectors_${{ matrix.language }}
195+
# Only MKP manifests will be written in the legacy format
196+
run: |
197+
make test_generate_vectors_${{ matrix.language }}
173198
174-
- name: Create Encrypt Manifests
199+
- name: Create Keyring Encrypt Manifests
175200
working-directory: ./${{ matrix.library }}
176201
run: make test_encrypt_vectors_${{ matrix.language }}
177202

178-
- name: Upload Encrypt Manifest and keys.json files
203+
- name: Upload Keyring Encrypt Manifest and keys.json files
179204
uses: actions/upload-artifact@v4
180205
with:
181206
name: ${{matrix.os}}_vector_artifact_${{matrix.language}}_${{github.sha}}
@@ -185,18 +210,18 @@ jobs:
185210
./${{matrix.library}}/runtimes/${{matrix.language}}/ciphertexts
186211
187212
testInteroperablity:
188-
needs: generateEncryptVectors
213+
needs: generateKeyringEncryptVectors
189214
strategy:
215+
fail-fast: false
190216
matrix:
191217
library: [TestVectors]
192218
os: [
193219
# https://taskei.amazon.dev/tasks/CrypTool-5283
194220
# windows-latest,
195221
ubuntu-22.04,
196-
macos-13,
197222
]
198-
encrypting_language: [java, net, rust, go]
199-
decrypting_language: [java, net, rust, go]
223+
encrypting_language: [java, net, rust, python, go]
224+
decrypting_language: [java, net, rust, python, go]
200225
# https://taskei.amazon.dev/tasks/CrypTool-5284
201226
dotnet-version: ["6.0.x"]
202227
runs-on: ${{ matrix.os }}
@@ -216,12 +241,11 @@ jobs:
216241
aws-region: us-west-2
217242
role-to-assume: arn:aws:iam::370957321024:role/GitHub-CI-Public-ESDK-Dafny-Role-us-west-2
218243
role-session-name: InterOpTests
244+
role-duration-seconds: 3600
219245

220-
- uses: actions/checkout@v3
221-
# Not all submodules are needed.
222-
# We manually pull the submodule we DO need.
223-
- run: git submodule update --init libraries
224-
- run: git submodule update --init --recursive mpl
246+
- uses: actions/checkout@v4
247+
with:
248+
submodules: "recursive"
225249

226250
# Set up runtimes
227251
- name: Setup .NET Core SDK ${{ matrix.dotnet-version }}
@@ -238,6 +262,17 @@ jobs:
238262
distribution: "corretto"
239263
java-version: 17
240264

265+
- name: Setup Python for running tests
266+
if: matrix.decrypting_language == 'python'
267+
uses: actions/setup-python@v4
268+
with:
269+
python-version: 3.11
270+
architecture: x64
271+
- run: |
272+
python -m pip install --upgrade pip
273+
pip install --upgrade tox
274+
pip install poetry
275+
241276
- name: Setup Rust Toolchain for GitHub CI
242277
if: matrix.decrypting_language == 'rust'
243278
uses: actions-rust-lang/[email protected]
@@ -259,13 +294,13 @@ jobs:
259294

260295
- name: Setup Dafny Rust
261296
if: matrix.decrypting_language == 'rust'
262-
uses: dafny-lang/[email protected]
297+
uses: ./mpl/.github/actions/setup_dafny
263298
with:
264299
dafny-version: nightly-2025-01-30-7db1e5f
265300

266301
- name: Setup Dafny Not Rust
267302
if: matrix.decrypting_language != 'rust'
268-
uses: dafny-lang/[email protected]
303+
uses: ./mpl/.github/actions/setup_dafny
269304
with:
270305
dafny-version: ${{ inputs.dafny }}
271306

@@ -332,6 +367,14 @@ jobs:
332367
run: |
333368
make purge_polymorph_code
334369
370+
- name: Build ${{ matrix.library }} implementation in Python
371+
if: matrix.decrypting_language == 'python'
372+
shell: bash
373+
working-directory: ./${{ matrix.library }}
374+
run: |
375+
CORES=$(node -e 'console.log(os.cpus().length)')
376+
make transpile_python CORES=$CORES
377+
335378
- name: Download Encrypt Manifest Artifact
336379
uses: actions/download-artifact@v4
337380
with:

0 commit comments

Comments
 (0)