Skip to content

Commit 54198bb

Browse files
authored
chore: Remove Dafny warnings (#875)
* chore: Remove Dafny warnings Remove all Dafny warnings and set warnings to error. By removing all the errors, --allow-warnings can be removed from verification. This means that any verification warning will now fail the build. This is especially relevant if {:only} is ever committed. See #517. This would now cause CI verification to fail.
1 parent 8979fdd commit 54198bb

File tree

6 files changed

+18
-18
lines changed

6 files changed

+18
-18
lines changed

AwsCryptographicMaterialProviders/dafny/AwsCryptographicMaterialProviders/src/Keyrings/AwsKms/AwsKmsUtils.dfy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ module AwsKmsUtils {
114114
&& getPublicKeyResponse.KeyUsage.value == KMS.KeyUsageType.KEY_AGREEMENT
115115
&& getPublicKeyResponse.PublicKey.Some?
116116
&& var publicKey := getPublicKeyResponse.PublicKey.value;
117-
&& KMS.IsValid_PublicKeyType(publicKey);
117+
&& KMS.IsValid_PublicKeyType(publicKey)
118118
{
119119
var getPublicKeyRequest := KMS.GetPublicKeyRequest(
120120
KeyId := awsKmsKey,

AwsCryptographicMaterialProviders/dafny/AwsCryptographicMaterialProviders/src/Keyrings/AwsKms/Constants.dfy

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,16 +68,16 @@ module Constants {
6868
s
6969

7070
// UTF-8 Encoded "aws-kms-ecdh"
71-
const KMS_ECDH_PROVIDER_ID: UTF8.ValidUTF8Bytes := UTF8.EncodeAscii("aws-kms-ecdh");
71+
const KMS_ECDH_PROVIDER_ID: UTF8.ValidUTF8Bytes := UTF8.EncodeAscii("aws-kms-ecdh")
7272

7373
// UTF-8 Encoded "raw-ecdh"
74-
const RAW_ECDH_PROVIDER_ID: UTF8.ValidUTF8Bytes := UTF8.EncodeAscii("raw-ecdh");
74+
const RAW_ECDH_PROVIDER_ID: UTF8.ValidUTF8Bytes := UTF8.EncodeAscii("raw-ecdh")
7575

7676
// UTF-8 Encoded "HMAC_SHA384"
77-
const ECDH_KDF_PRF_NAME: UTF8.ValidUTF8Bytes := UTF8.EncodeAscii("HMAC_SHA384");
77+
const ECDH_KDF_PRF_NAME: UTF8.ValidUTF8Bytes := UTF8.EncodeAscii("HMAC_SHA384")
7878

7979
// UTF-8 Encoded "ecdh-key-derivation"
80-
const ECDH_KDF_UTF8: UTF8.ValidUTF8Bytes := UTF8.EncodeAscii("ecdh-key-derivation");
80+
const ECDH_KDF_UTF8: UTF8.ValidUTF8Bytes := UTF8.EncodeAscii("ecdh-key-derivation")
8181

8282
type AwsKmsEncryptedDataKey = edk: Types.EncryptedDataKey |
8383
&& edk.keyProviderId == PROVIDER_ID

AwsCryptographicMaterialProviders/dafny/AwsCryptographicMaterialProviders/test/TestEcdhCalculation.dfy

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ module TestEcdhCalculation {
2020
import Base64
2121

2222
// ECC Curve P256 Keys
23-
const senderKmsKey := "arn:aws:kms:us-west-2:370957321024:key/eabdf483-6be2-4d2d-8ee4-8c2583d416e9";
24-
const recipientKmsKey := "arn:aws:kms:us-west-2:370957321024:key/0265c8e9-5b6a-4055-8f70-63719e09fda5";
25-
const senderArns := [TestUtils.KMS_ECC_256_KEY_ARN_S, TestUtils.KMS_ECC_384_KEY_ARN_S, TestUtils.KMS_ECC_521_KEY_ARN_S];
26-
const senderArnPublicKeys := [TestUtils.KMS_ECC_256_PUBLIC_KEY_S, TestUtils.KMS_ECC_384_PUBLIC_KEY_S, TestUtils.KMS_ECC_521_PUBLIC_KEY_S];
27-
const privateKeyReceivers := [TestUtils.ECC_P256_PRIVATE, TestUtils.ECC_P384_PRIVATE, TestUtils.ECC_P521_PRIVATE];
28-
const publicKeyReceivers := [TestUtils.ECC_P256_PUBLIC, TestUtils.ECC_P384_PUBLIC, TestUtils.ECC_P521_PUBLIC];
29-
const curveSpecs := [PrimitiveTypes.ECC_NIST_P256, PrimitiveTypes.ECC_NIST_P384, PrimitiveTypes.ECC_NIST_P521];
23+
const senderKmsKey := "arn:aws:kms:us-west-2:370957321024:key/eabdf483-6be2-4d2d-8ee4-8c2583d416e9"
24+
const recipientKmsKey := "arn:aws:kms:us-west-2:370957321024:key/0265c8e9-5b6a-4055-8f70-63719e09fda5"
25+
const senderArns := [TestUtils.KMS_ECC_256_KEY_ARN_S, TestUtils.KMS_ECC_384_KEY_ARN_S, TestUtils.KMS_ECC_521_KEY_ARN_S]
26+
const senderArnPublicKeys := [TestUtils.KMS_ECC_256_PUBLIC_KEY_S, TestUtils.KMS_ECC_384_PUBLIC_KEY_S, TestUtils.KMS_ECC_521_PUBLIC_KEY_S]
27+
const privateKeyReceivers := [TestUtils.ECC_P256_PRIVATE, TestUtils.ECC_P384_PRIVATE, TestUtils.ECC_P521_PRIVATE]
28+
const publicKeyReceivers := [TestUtils.ECC_P256_PUBLIC, TestUtils.ECC_P384_PUBLIC, TestUtils.ECC_P521_PUBLIC]
29+
const curveSpecs := [PrimitiveTypes.ECC_NIST_P256, PrimitiveTypes.ECC_NIST_P384, PrimitiveTypes.ECC_NIST_P521]
3030

3131
method {:test} TestKmsDeriveSharedSecretOfflineCalculation() {
3232
var kmsClient :- expect Kms.KMSClient();

AwsCryptographyPrimitives/test/TestRSA.dfy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ module {:options "-functionSyntax:4"} TestAwsCryptographyPrimitivesRSA {
117117
}
118118

119119
method {:test} TestingPemParsingInRSAEncryptionForRSAKeyPairStoredInPEM() {
120-
var allPadding := set p: AtomicPrimitives.Types.RSAPaddingMode | true :: p;
120+
var allPadding := set p: AtomicPrimitives.Types.RSAPaddingMode {:nowarn} | true :: p;
121121

122122
var PublicKeyFromGenerateRSAKeyPairPemBytes :- expect UTF8.Encode(StaticPublicKeyFromGenerateRSAKeyPair());
123123
var PrivateKeyFromGenerateRSAKeyPairPemBytes :- expect UTF8.Encode(StaticPrivateKeyFromGenerateRSAKeyPair());
@@ -150,7 +150,7 @@ module {:options "-functionSyntax:4"} TestAwsCryptographyPrimitivesRSA {
150150
}
151151

152152
method {:test} TestingPemParsingInRSAEncryptionForOnlyRSAPrivateKeyStoredInPEM() {
153-
var allPadding := set p: AtomicPrimitives.Types.RSAPaddingMode | true :: p;
153+
var allPadding := set p: AtomicPrimitives.Types.RSAPaddingMode {:nowarn} | true :: p;
154154

155155
var PublicKeyFromTestVectorsPemBytes :- expect UTF8.Encode(StaticPublicKeyFromTestVectors());
156156
var PrivateKeyFromTestVectorsPemBytes :- expect UTF8.Encode(StaticPrivateKeyFromTestVectors());

SharedMakefileV2.mk

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ GRADLEW := ./runtimes/java/gradlew
1111

1212
include $(SMITHY_DAFNY_ROOT)/SmithyDafnyMakefile.mk
1313

14-
verify:DAFNY_OPTIONS=--allow-warnings --allow-external-contracts
15-
verify_single:DAFNY_OPTIONS=--allow-warnings --allow-external-contracts
16-
verify_service:DAFNY_OPTIONS=--allow-warnings --allow-external-contracts
14+
verify:DAFNY_OPTIONS=--allow-deprecation --allow-external-contracts
15+
verify_single:DAFNY_OPTIONS=--allow-deprecation --allow-external-contracts
16+
verify_service:DAFNY_OPTIONS=--allow-deprecation --allow-external-contracts
1717

1818
transpile_implementation_net: DAFNY_OPTIONS=--allow-warnings --compile-suffix --legacy-module-names --allow-external-contracts
1919
transpile_test_net: DAFNY_OPTIONS=--allow-warnings --include-test-runner --compile-suffix --legacy-module-names --allow-external-contracts

0 commit comments

Comments
 (0)