-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: make const policy an extern #1587
Conversation
This reverts commit fd93806.
Detected changes to the release files or to the check-files action |
Changes to the release files or the check-files action requires 2 approvals from CODEOWNERS |
Detected changes to the release files or to the check-files action |
Changes to the release files or the check-files action requires 2 approvals from CODEOWNERS |
Detected changes to the release files or to the check-files action |
Changes to the release files or the check-files action requires 2 approvals from CODEOWNERS |
Detected changes to the release files or to the check-files action |
Changes to the release files or the check-files action requires 2 approvals from CODEOWNERS |
@@ -8,7 +8,18 @@ namespace software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.in | |||
|
|||
public partial class InternalLegacyOverride | |||
{ | |||
|
|||
public software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._ILegacyPolicy _policy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have tried following before reaching to this as solution:
- Directly add a constant
_policy
in the class: This does not work because it should also be initialized with a constant in RHS andcreate_FORBID__LEGACY__ENCRYPT__FORBID__LEGACY__DECRYPT
is not a constant. - Add a default constructor: We could have added a
_policy
and initialize it in a default constructor but this will not work because dafny transpiles a default constructor into class InternalLegacyOverride and this will cause conflict.
So, the best solution here is to always return FORBID__LEGACY__ENCRYPT__FORBID__LEGACY__DECRYPT
from the getter. This is the only place, this variable is going to be used. However, technically this variable is never used because config.internalLegacyOverride.Some?
is always false for .NET (and Rust) because they don't support legacy
Issue #, if available:
Description of changes:
Dafny does not support transpiling a constant inside an extern for Go. So, this PR adds a
{:extern}
into the constantpolicy
. This will need an update to the extern because dafny will no longer generate code forpolicy
but we need to write it as it is an extern. This is not a breaking change because we are only writing code in extern instead of dafny generating the code and no customer facing changes are expected.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.