Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
44ee820
Start with model
robin-aws Oct 18, 2024
4a83166
Merge branch 'robin-aws/smithy-init-example' of github.com:robin-aws/…
robin-aws Oct 18, 2024
609b3b8
m
robin-aws Oct 18, 2024
d2e3de2
Rename
robin-aws Oct 18, 2024
968c352
Add circular submodule - cause why not?
robin-aws Oct 18, 2024
7b4f326
Merge branch 'main-1.x' of github.com:smithy-lang/smithy-dafny into m…
robin-aws Nov 8, 2024
f68d74e
Merge branch 'main-1.x' of github.com:smithy-lang/smithy-dafny into m…
robin-aws Nov 12, 2024
aaa928e
Merge branch 'main-1.x' of github.com:smithy-lang/smithy-dafny into m…
robin-aws Nov 22, 2024
21ac4a9
Merge branch 'main-1.x' of github.com:smithy-lang/smithy-dafny into m…
robin-aws Feb 18, 2025
6f23d26
Recover and update *DataStream types
robin-aws Apr 2, 2025
b36d8ae
Add Read() (not yet verifying)
robin-aws Apr 7, 2025
0fad32d
SeqDataStream verifies
robin-aws Apr 8, 2025
c619d82
Progress
robin-aws Apr 9, 2025
de7408e
Fixed StreamedOf() definition
robin-aws Apr 9, 2025
f1699f3
All but one wrinkle when length == 0
robin-aws Apr 9, 2025
89ac6a7
Almost
robin-aws Apr 10, 2025
d07ab0f
Fixed
robin-aws Apr 10, 2025
6acf9c1
cleanup
robin-aws Apr 14, 2025
919ed23
Update streams.py
robin-aws Apr 14, 2025
8022fff
Renames in codegen
robin-aws Apr 14, 2025
dfe0282
Partial fixes
robin-aws Apr 14, 2025
7560255
Fix BinaryOf
robin-aws Apr 14, 2025
12fab4c
Partial work
robin-aws Apr 23, 2025
70b40cd
Mostly there
robin-aws Apr 25, 2025
c39d9ea
Progress
robin-aws Apr 25, 2025
ad09a16
More fixes
robin-aws Apr 25, 2025
bb27d83
PutObject worked!
robin-aws Apr 25, 2025
591d0ba
S3 works on Python again!
robin-aws Apr 26, 2025
0aa7806
Starting on Java
robin-aws Apr 26, 2025
6fde873
InputStream adaptors
robin-aws Apr 26, 2025
e746d2a
Add Java files
robin-aws Apr 26, 2025
7a08b81
Starting on Java async
robin-aws Apr 26, 2025
6e28c30
Fix other examples
robin-aws Apr 27, 2025
171230c
Comment
robin-aws Apr 27, 2025
0415185
Progress
robin-aws Apr 28, 2025
8e0d3c8
Patching smithy-generated for S3 in Java
robin-aws Apr 28, 2025
3a896e1
More fixing/hacking
robin-aws Apr 28, 2025
8d81c61
Java builds
robin-aws Apr 28, 2025
82af16f
Typos in python
robin-aws Apr 28, 2025
aea4258
Remove Object from S3 model for now
robin-aws Apr 28, 2025
7525210
Fix ProviderAsInputStream
robin-aws Apr 28, 2025
1b52f0e
Partially fix Streaming
robin-aws Apr 28, 2025
3724a56
Fix Java codegen
robin-aws Apr 29, 2025
6ae6eab
Update java after removing ListObjectsV2
robin-aws May 2, 2025
5ee063d
both test models working for Java and Python!
robin-aws May 2, 2025
4d61915
Better version of Fill
robin-aws May 3, 2025
8097e49
Improve java patch
robin-aws May 4, 2025
8f442c9
Generate Java files for Streaming
robin-aws May 20, 2025
43b8524
Merge branch 'main-1.x' of github.com:robin-aws/smithy-dafny into rob…
robin-aws Jun 21, 2025
bce55c3
Interface update
robin-aws Jun 21, 2025
11687ab
Enable Java in testing
robin-aws Jun 23, 2025
5292733
Merge branch 'main-1.x' of github.com:smithy-lang/smithy-dafny into r…
robin-aws Jun 23, 2025
df3feb3
Delete submodule
robin-aws Jun 23, 2025
7d5654c
Delete content
robin-aws Jun 23, 2025
44d63bf
m
robin-aws Jun 23, 2025
0897353
Add 4.10.0
robin-aws Jun 24, 2025
9fe3c8f
m
robin-aws Jun 25, 2025
c04b81e
m
robin-aws Jun 25, 2025
0e4fce6
m
robin-aws Jun 25, 2025
9eafed9
m
robin-aws Jun 25, 2025
073ea8d
m
robin-aws Jun 26, 2025
eb8bd46
m
robin-aws Jun 26, 2025
52e7cd6
Java working again
robin-aws Jun 26, 2025
4805d70
Fix python
robin-aws Jun 26, 2025
50f9596
s3 works for Python
robin-aws Jun 26, 2025
ab2f6d1
Patch Java codegen gaps
robin-aws Jun 26, 2025
076653e
Fix S3 Java
robin-aws Jun 26, 2025
0dbfea5
Test on Dafny 4.10 iff streaming
robin-aws Jun 26, 2025
9c4b46d
Move doo file to StreamingSupport, rename variable
robin-aws Jun 26, 2025
221ce1f
Revert smithy-build.json change
robin-aws Jun 26, 2025
85d293b
m
robin-aws Jun 26, 2025
cfcd919
More conditional code
robin-aws Jun 27, 2025
db46c44
Typos
robin-aws Jun 27, 2025
54c9628
m
robin-aws Jun 28, 2025
edc311b
Use compatible Dafny branch
robin-aws Jun 29, 2025
2e40179
Use prerelease
robin-aws Jun 30, 2025
2108f7f
Merge branch 'main-1.x' into robin-aws/use-dafny-master-for-standard-…
robin-aws Jul 11, 2025
d535c11
m
robin-aws Jul 11, 2025
17050c0
Formatting
robin-aws Jul 11, 2025
6b51bf1
Cleanup
robin-aws Jul 23, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ jobs:
steps:
- name: Populate Dafny versions list
id: populate-dafny-versions-list
run: echo "dafny-versions-list=['4.7.0','4.9.1']" >> $GITHUB_OUTPUT
run: echo "dafny-versions-list=['4.7.0','4.9.1','nightly-2025-06-29-f5ca47b']" >> $GITHUB_OUTPUT
- name: Populate Dafny versions list for "only new versions" languages (Python)
id: populate-only-new-dafny-versions-list
run: echo "only-new-dafny-versions-list=['4.9.1']" >> $GITHUB_OUTPUT
run: echo "only-new-dafny-versions-list=['4.9.1','nightly-2025-06-29-f5ca47b']" >> $GITHUB_OUTPUT
outputs:
dafny-version-list: ${{ steps.populate-dafny-versions-list.outputs.dafny-versions-list }}
only-new-dafny-version-list: ${{ steps.populate-only-new-dafny-versions-list.outputs.only-new-dafny-versions-list }}
Expand Down
1 change: 0 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@
[submodule "TestModels/dafny-dependencies/dafny"]
path = TestModels/dafny-dependencies/dafny
url = https://github.com/dafny-lang/dafny.git
branch = actions-and-streaming-stdlibs
28 changes: 18 additions & 10 deletions SmithyDafnyMakefile.mk
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
# of Model directories
# AWS_SDK_CMD -- the `--aws-sdk` command to generate AWS SDK style interfaces.
# STD_LIBRARY -- path from this file to the StandardLibrary Dafny project.
# STREAMING_SUPPORT -- path from this file to the StreamingSupport Dafny project.
# SMITHY_DEPS -- path from this file to smithy dependencies, such as custom traits.
# GRADLEW -- the gradlew to use when building Java runtimes.
# defaults to $(SMITHY_DAFNY_ROOT)/codegen/gradlew
Expand Down Expand Up @@ -98,7 +99,7 @@ verify:
--log-format csv \
--verification-time-limit $(VERIFY_TIMEOUT) \
--resource-limit $(MAX_RESOURCE_COUNT) \
$(if $(USE_DAFNY_STANDARD_LIBRARIES), --library:$(PROJECT_ROOT)/$(STD_LIBRARY)/bin/DafnyStandardLibraries-smithy-dafny-subset.doo, ) \
$(if $(USES_STREAMING), --library:$(PROJECT_ROOT)/$(STREAMING_SUPPORT)/bin/DafnyStandardLibraries-smithy-dafny-subset.doo, ) \
$(DAFNY_OPTIONS) \
%

Expand All @@ -115,7 +116,7 @@ verify_single:
--log-format text \
--verification-time-limit $(VERIFY_TIMEOUT) \
--resource-limit $(MAX_RESOURCE_COUNT) \
$(if $(USE_DAFNY_STANDARD_LIBRARIES), --library:$(PROJECT_ROOT)/$(STD_LIBRARY)/bin/DafnyStandardLibraries-smithy-dafny-subset.doo, ) \
$(if $(USES_STREAMING), --library:$(PROJECT_ROOT)/$(STREAMING_SUPPORT)/bin/DafnyStandardLibraries-smithy-dafny-subset.doo, ) \
$(DAFNY_OPTIONS) \
$(if ${PROC},-proc:*$(PROC)*,) \
$(FILE)
Expand Down Expand Up @@ -215,7 +216,7 @@ transpile_implementation:
$(DAFNY_OTHER_FILES) \
$(TRANSPILE_MODULE_NAME) \
$(if $(strip $(STD_LIBRARY)) , --library:$(PROJECT_ROOT)/$(STD_LIBRARY)/src/Index.dfy, ) \
$(if $(USE_DAFNY_STANDARD_LIBRARIES) , --library:$(PROJECT_ROOT)/$(STD_LIBRARY)/bin/DafnyStandardLibraries-smithy-dafny-subset.doo, ) \
$(if $(USES_STREAMING) , --library:$(PROJECT_ROOT)/$(STREAMING_SUPPORT)/bin/DafnyStandardLibraries-smithy-dafny-subset.doo, ) \
$(TRANSLATION_RECORD) \
$(TRANSPILE_DEPENDENCIES)

Expand Down Expand Up @@ -255,7 +256,7 @@ transpile_test:
$(DAFNY_OPTIONS) \
$(DAFNY_OTHER_FILES) \
$(if $(strip $(STD_LIBRARY)) , --library:$(PROJECT_ROOT)/$(STD_LIBRARY)/src/Index.dfy, ) \
$(if $(USE_DAFNY_STANDARD_LIBRARIES) , --library:$(PROJECT_ROOT)/$(STD_LIBRARY)/bin/DafnyStandardLibraries-smithy-dafny-subset.doo, ) \
$(if $(USES_STREAMING) , --library:$(PROJECT_ROOT)/$(STREAMING_SUPPORT)/bin/DafnyStandardLibraries-smithy-dafny-subset.doo, ) \
$(TRANSLATION_RECORD) \
$(SOURCE_TRANSLATION_RECORD) \
$(TRANSPILE_MODULE_NAME) \
Expand All @@ -264,7 +265,8 @@ transpile_test:
# If we are not the StandardLibrary, transpile the StandardLibrary.
# Transpile all other dependencies
transpile_dependencies:
$(if $(strip $(STD_LIBRARY)), $(MAKE) -C $(PROJECT_ROOT)/$(STD_LIBRARY) transpile_implementation_$(LANG) USE_DAFNY_STANDARD_LIBRARIES=$(USE_DAFNY_STANDARD_LIBRARIES), )
$(if $(strip $(STD_LIBRARY)), $(MAKE) -C $(PROJECT_ROOT)/$(STD_LIBRARY) transpile_implementation_$(LANG) USES_STREAMING=$(USES_STREAMING), )
$(if $(USES_STREAMING), $(MAKE) -C $(PROJECT_ROOT)/$(STREAMING_SUPPORT) transpile_implementation_$(LANG) USES_STREAMING=$(USES_STREAMING), )
$(patsubst %, $(MAKE) -C $(PROJECT_ROOT)/% transpile_implementation_$(LANG);, $(PROJECT_DEPENDENCIES))

transpile_dependencies_test:
Expand Down Expand Up @@ -337,7 +339,8 @@ _polymorph_wrapped:
$(POLYMORPH_OPTIONS)";

_polymorph_dependencies:
$(if $(strip $(STD_LIBRARY)), $(MAKE) -C $(PROJECT_ROOT)/$(STD_LIBRARY) polymorph_$(POLYMORPH_LANGUAGE_TARGET) LIBRARY_ROOT=$(PROJECT_ROOT)/$(STD_LIBRARY) USE_DAFNY_STANDARD_LIBRARIES=$(USE_DAFNY_STANDARD_LIBRARIES), )
$(if $(strip $(STD_LIBRARY)), $(MAKE) -C $(PROJECT_ROOT)/$(STD_LIBRARY) polymorph_$(POLYMORPH_LANGUAGE_TARGET) LIBRARY_ROOT=$(PROJECT_ROOT)/$(STD_LIBRARY) USES_STREAMING=$(USES_STREAMING), )
$(if $(USES_STREAMING), $(MAKE) -C $(PROJECT_ROOT)/$(STREAMING_SUPPORT) polymorph_$(POLYMORPH_LANGUAGE_TARGET) LIBRARY_ROOT=$(PROJECT_ROOT)/$(STREAMING_SUPPORT) USES_STREAMING=$(USES_STREAMING), )
@$(foreach dependency, \
$(PROJECT_DEPENDENCIES), \
$(MAKE) -C $(PROJECT_ROOT)/$(dependency) polymorph_$(POLYMORPH_LANGUAGE_TARGET); \
Expand All @@ -359,7 +362,8 @@ polymorph_code_gen:
_polymorph_code_gen: OUTPUT_DAFNY=\
--output-dafny $(if $(DIR_STRUCTURE_V2), $(LIBRARY_ROOT)/dafny/$(SERVICE)/Model, $(LIBRARY_ROOT)/Model)
_polymorph_code_gen: INPUT_DAFNY=\
--include-dafny $(PROJECT_ROOT)/$(STD_LIBRARY)/src/Index.dfy
--include-dafny $(PROJECT_ROOT)/$(STD_LIBRARY)/src/Index.dfy \
$(if $(USES_STREAMING), --include-dafny $(PROJECT_ROOT)/$(STREAMING_SUPPORT)/src/Index.dfy, )
_polymorph_code_gen: OUTPUT_DOTNET=\
$(if $(DIR_STRUCTURE_V2), --output-dotnet $(LIBRARY_ROOT)/runtimes/net/Generated/$(SERVICE)/, --output-dotnet $(LIBRARY_ROOT)/runtimes/net/Generated/)
_polymorph_code_gen: OUTPUT_JAVA=--output-java $(LIBRARY_ROOT)/runtimes/java/src/main/smithy-generated
Expand All @@ -386,7 +390,8 @@ polymorph_dafny:
_polymorph_dafny: OUTPUT_DAFNY=\
--output-dafny $(if $(DIR_STRUCTURE_V2), $(LIBRARY_ROOT)/dafny/$(SERVICE)/Model, $(LIBRARY_ROOT)/Model)
_polymorph_dafny: INPUT_DAFNY=\
--include-dafny $(PROJECT_ROOT)/$(STD_LIBRARY)/src/Index.dfy
--include-dafny $(PROJECT_ROOT)/$(STD_LIBRARY)/src/Index.dfy \
$(if $(USES_STREAMING), --include-dafny $(PROJECT_ROOT)/$(STREAMING_SUPPORT)/src/Index.dfy, )
_polymorph_dafny: _polymorph

dafny: polymorph_dafny verify
Expand All @@ -409,7 +414,8 @@ polymorph_dotnet:
_polymorph_dotnet: OUTPUT_DOTNET=\
$(if $(DIR_STRUCTURE_V2), --output-dotnet $(LIBRARY_ROOT)/runtimes/net/Generated/$(SERVICE)/, --output-dotnet $(LIBRARY_ROOT)/runtimes/net/Generated/)
_polymorph_dotnet: INPUT_DAFNY=\
--include-dafny $(PROJECT_ROOT)/$(STD_LIBRARY)/src/Index.dfy
--include-dafny $(PROJECT_ROOT)/$(STD_LIBRARY)/src/Index.dfy \
$(if $(USES_STREAMING), --include-dafny $(PROJECT_ROOT)/$(STREAMING_SUPPORT)/src/Index.dfy, )
_polymorph_dotnet: _polymorph

# Generates java code for all namespaces in this project
Expand All @@ -427,7 +433,8 @@ polymorph_java:
_polymorph_java: OUTPUT_JAVA=--output-java $(LIBRARY_ROOT)/runtimes/java/src/main/smithy-generated
_polymorph_java: OUTPUT_JAVA_TEST=--output-java-test $(LIBRARY_ROOT)/runtimes/java/src/test/smithy-generated
_polymorph_java: INPUT_DAFNY=\
--include-dafny $(PROJECT_ROOT)/$(STD_LIBRARY)/src/Index.dfy
--include-dafny $(PROJECT_ROOT)/$(STD_LIBRARY)/src/Index.dfy \
$(if $(USES_STREAMING), --include-dafny $(PROJECT_ROOT)/$(STREAMING_SUPPORT)/src/Index.dfy, )
_polymorph_java: _polymorph

# Generates python code for all namespaces in this project
Expand Down Expand Up @@ -593,6 +600,7 @@ transpile_dependencies_java: transpile_dependencies
# Locally deploy all other dependencies
mvn_local_deploy_dependencies:
$(if $(strip $(STD_LIBRARY)), $(MAKE) -C $(PROJECT_ROOT)/$(STD_LIBRARY) mvn_local_deploy, )
$(if $(USES_STREAMING), $(MAKE) -C $(PROJECT_ROOT)/$(STREAMING_SUPPORT) mvn_local_deploy, )
$(patsubst %, $(MAKE) -C $(PROJECT_ROOT)/% mvn_local_deploy;, $(PROJECT_DEPENDENCIES))

# The Java MUST all exist already through the transpile step.
Expand Down
16 changes: 11 additions & 5 deletions TestModels/SharedMakefile.mk
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
PROJECT_ROOT := $(abspath $(dir $(abspath $(lastword $(MAKEFILE_LIST)))))
SMITHY_DAFNY_ROOT := $(PROJECT_ROOT)/..
STD_LIBRARY := dafny-dependencies/StandardLibrary
STREAMING_SUPPORT := dafny-dependencies/StreamingSupport

include $(SMITHY_DAFNY_ROOT)/SmithyDafnyMakefile.mk

Expand All @@ -16,7 +17,8 @@ include $(SMITHY_DAFNY_ROOT)/SmithyDafnyMakefile.mk
_polymorph_code_gen: OUTPUT_DAFNY=\
--output-dafny $(if $(DIR_STRUCTURE_V2), $(LIBRARY_ROOT)/dafny/$(SERVICE)/Model, $(LIBRARY_ROOT)/Model)
_polymorph_code_gen: INPUT_DAFNY=\
--include-dafny $(PROJECT_ROOT)/$(STD_LIBRARY)/src/Index.dfy
--include-dafny $(PROJECT_ROOT)/$(STD_LIBRARY)/src/Index.dfy \
$(if $(USES_STREAMING), --include-dafny $(PROJECT_ROOT)/$(STREAMING_SUPPORT)/src/Index.dfy, )
_polymorph_code_gen: OUTPUT_DOTNET=\
$(if $(DIR_STRUCTURE_V2), --output-dotnet $(LIBRARY_ROOT)/runtimes/net/Generated/$(SERVICE)/, --output-dotnet $(LIBRARY_ROOT)/runtimes/net/Generated/)
_polymorph_code_gen: OUTPUT_JAVA=--output-java $(LIBRARY_ROOT)/runtimes/java/src/main/smithy-generated
Expand Down Expand Up @@ -45,7 +47,8 @@ polymorph_dafny:
_polymorph_dafny: OUTPUT_DAFNY=\
--output-dafny $(if $(DIR_STRUCTURE_V2), $(LIBRARY_ROOT)/dafny/$(SERVICE)/Model, $(LIBRARY_ROOT)/Model)
_polymorph_dafny: INPUT_DAFNY=\
--include-dafny $(PROJECT_ROOT)/$(STD_LIBRARY)/src/Index.dfy
--include-dafny $(PROJECT_ROOT)/$(STD_LIBRARY)/src/Index.dfy \
$(if $(USES_STREAMING), --include-dafny $(PROJECT_ROOT)/$(STREAMING_SUPPORT)/src/Index.dfy, )
_polymorph_dafny: _polymorph
_polymorph_dafny: OUTPUT_DAFNY_WRAPPED=\
--output-dafny $(if $(DIR_STRUCTURE_V2), $(LIBRARY_ROOT)/dafny/$(SERVICE)/Model, $(LIBRARY_ROOT)/Model) \
Expand All @@ -55,15 +58,17 @@ _polymorph_dafny: _polymorph_wrapped
_polymorph_java: OUTPUT_JAVA=--output-java $(LIBRARY_ROOT)/runtimes/java/src/main/smithy-generated
_polymorph_java: OUTPUT_JAVA_TEST=--output-java-test $(LIBRARY_ROOT)/runtimes/java/src/test/smithy-generated
_polymorph_java: INPUT_DAFNY=\
--include-dafny $(PROJECT_ROOT)/$(STD_LIBRARY)/src/Index.dfy
--include-dafny $(PROJECT_ROOT)/$(STD_LIBRARY)/src/Index.dfy \
$(if $(USES_STREAMING), --include-dafny $(PROJECT_ROOT)/$(STREAMING_SUPPORT)/src/Index.dfy, )
_polymorph_java: _polymorph
_polymorph_java: OUTPUT_JAVA_WRAPPED=--output-java $(LIBRARY_ROOT)/runtimes/java/src/main/smithy-generated
_polymorph_java: _polymorph_wrapped

_polymorph_dotnet: OUTPUT_DOTNET=\
$(if $(DIR_STRUCTURE_V2), --output-dotnet $(LIBRARY_ROOT)/runtimes/net/Generated/$(SERVICE)/, --output-dotnet $(LIBRARY_ROOT)/runtimes/net/Generated/)
_polymorph_dotnet: INPUT_DAFNY=\
--include-dafny $(PROJECT_ROOT)/$(STD_LIBRARY)/src/Index.dfy
--include-dafny $(PROJECT_ROOT)/$(STD_LIBRARY)/src/Index.dfy \
$(if $(USES_STREAMING), --include-dafny $(PROJECT_ROOT)/$(STREAMING_SUPPORT)/src/Index.dfy, )
_polymorph_dotnet: _polymorph
_polymorph_dotnet: OUTPUT_DOTNET_WRAPPED=\
$(if $(DIR_STRUCTURE_V2), --output-dotnet $(LIBRARY_ROOT)/runtimes/net/Generated/Wrapped/$(SERVICE)/, --output-dotnet $(LIBRARY_ROOT)/runtimes/net/Generated/Wrapped)
Expand All @@ -77,7 +82,8 @@ _polymorph_python: _polymorph_wrapped

_polymorph_rust: OUTPUT_RUST_WRAPPED=--output-rust $(LIBRARY_ROOT)/runtimes/rust
_polymorph_rust: INPUT_DAFNY=\
--include-dafny $(PROJECT_ROOT)/$(STD_LIBRARY)/src/Index.dfy
--include-dafny $(PROJECT_ROOT)/$(STD_LIBRARY)/src/Index.dfy \
$(if $(USES_STREAMING), --include-dafny $(PROJECT_ROOT)/$(STREAMING_SUPPORT)/src/Index.dfy, )
# For several TestModels we've just manually written the code generation target,
# So we just want to ensure we can transpile and pass the tests in CI.
# For those, make polymorph_rust should just be a no-op.
Expand Down
7 changes: 4 additions & 3 deletions TestModels/Streaming/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

CORES=2

USE_DAFNY_STANDARD_LIBRARIES=1
USES_STREAMING=1

ENABLE_EXTERN_PROCESSING=1

Expand All @@ -20,8 +20,9 @@ SERVICE_DEPS_SimpleStreaming :=

SMITHY_DEPS=dafny-dependencies/Model/traits.smithy

# This project has no dependencies
# DEPENDENT-MODELS:=
PROJECT_DEPENDENCIES :=

PROJECT_INDEX :=

# Python

Expand Down
49 changes: 12 additions & 37 deletions TestModels/Streaming/Model/SimpleStreamingTypes.dfy
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
// SPDX-License-Identifier: Apache-2.0
// Do not modify this file. This file is machine generated, and any changes to it will be overwritten.
include "../../dafny-dependencies/StandardLibrary/src/Index.dfy"
include "../../dafny-dependencies/StreamingSupport/src/Index.dfy"
module {:extern "simple.streaming.internaldafny.types" } SimpleStreamingTypes
{
import opened Wrappers
import opened StandardLibrary.UInt
import opened UTF8
import opened Std.Streams
import opened StandardLibrary.Streams
// Generic helpers for verification of mock/unit tests.
datatype DafnyCallEvent<I, O> = DafnyCallEvent(input: I, output: O)

Expand All @@ -17,17 +18,17 @@ module {:extern "simple.streaming.internaldafny.types" } SimpleStreamingTypes
nameonly number: int32
)
datatype BinaryOfOutput = | BinaryOfOutput (
nameonly binary: ByteStream
nameonly binary: DataStream<uint8, Error>
)
datatype ChunksInput = | ChunksInput (
nameonly bytesIn: ByteStream ,
nameonly bytesIn: DataStream<uint8, Error> ,
nameonly chunkSize: CountingInteger
)
datatype ChunksOutput = | ChunksOutput (
nameonly bytesOut: ByteStream
nameonly bytesOut: DataStream<uint8, Error>
)
datatype CountBitsInput = | CountBitsInput (
nameonly bits: ByteStream
nameonly bits: DataStream<uint8, Error>
)
datatype CountBitsOutput = | CountBitsOutput (
nameonly sum: int32
Expand Down Expand Up @@ -79,12 +80,8 @@ module {:extern "simple.streaming.internaldafny.types" } SimpleStreamingTypes
returns (output: Result<CountBitsOutput, Error>)
requires
&& ValidState()
// TODO: smithy-dafny isn't yet generating the `input.bits.Valid()` part.
requires
&& input.bits.Valid() && History !in input.bits.Repr
modifies Modifies - {History} ,
History`CountBits ,
input.bits.Repr
History`CountBits
// Dafny will skip type parameters when generating a default decreases clause.
decreases Modifies - {History}
ensures
Expand All @@ -106,8 +103,6 @@ module {:extern "simple.streaming.internaldafny.types" } SimpleStreamingTypes
&& ValidState()
ensures BinaryOfEnsuresPublicly(input, output)
ensures History.BinaryOf == old(History.BinaryOf) + [DafnyCallEvent(input, output)]
// TODO: smithy-dafny isn't yet generating this
ensures output.Success? ==> output.value.binary.Valid() && fresh(output.value.binary.Repr)

predicate ChunksEnsuresPublicly(input: ChunksInput , output: Result<ChunksOutput, Error>)
// The public method to be called by library consumers
Expand All @@ -123,14 +118,12 @@ module {:extern "simple.streaming.internaldafny.types" } SimpleStreamingTypes
&& ValidState()
ensures ChunksEnsuresPublicly(input, output)
ensures History.Chunks == old(History.Chunks) + [DafnyCallEvent(input, output)]
// TODO: smithy-dafny isn't yet generating this
ensures output.Success? ==> output.value.bytesOut.Valid() && fresh(output.value.bytesOut.Repr)

}
datatype SimpleStreamingConfig = | SimpleStreamingConfig (

)
type StreamingBlob = ByteStream
type StreamingBlob = DataStream<uint8, Error>
datatype Error =
// Local Error structures are listed here
| OverflowError (
Expand Down Expand Up @@ -180,7 +173,7 @@ abstract module AbstractSimpleStreamingService
import opened Wrappers
import opened StandardLibrary.UInt
import opened UTF8
import opened Std.Streams
import opened StandardLibrary.Streams
import opened Types = SimpleStreamingTypes
import Operations : AbstractSimpleStreamingOperations
function method DefaultSimpleStreamingConfig(): SimpleStreamingConfig
Expand Down Expand Up @@ -220,23 +213,15 @@ abstract module AbstractSimpleStreamingService
returns (output: Result<CountBitsOutput, Error>)
requires
&& ValidState()
// TODO: smithy-dafny isn't yet generating the `input.bits.Valid()` parts.
requires
&& input.bits.Valid() && History !in input.bits.Repr
modifies Modifies - {History} ,
History`CountBits ,
input.bits.Repr
History`CountBits
// Dafny will skip type parameters when generating a default decreases clause.
decreases Modifies - {History}
ensures
&& ValidState()
ensures CountBitsEnsuresPublicly(input, output)
ensures History.CountBits == old(History.CountBits) + [DafnyCallEvent(input, output)]
{
// TODO: It's not clear how to actually ensure this,
// since the internal config is not visible to the trait
// so it can't really be a precondition there.
assume {:axiom} Operations.ModifiesInternalConfig(config) !! input.bits.Repr;
output := Operations.CountBits(config, input);
History.CountBits := History.CountBits + [DafnyCallEvent(input, output)];
}
Expand All @@ -256,8 +241,6 @@ abstract module AbstractSimpleStreamingService
&& ValidState()
ensures BinaryOfEnsuresPublicly(input, output)
ensures History.BinaryOf == old(History.BinaryOf) + [DafnyCallEvent(input, output)]
// TODO: smithy-dafny isn't yet generating this
ensures output.Success? ==> output.value.binary.Valid() && fresh(output.value.binary.Repr)
{
output := Operations.BinaryOf(config, input);
History.BinaryOf := History.BinaryOf + [DafnyCallEvent(input, output)];
Expand Down Expand Up @@ -289,7 +272,7 @@ abstract module AbstractSimpleStreamingOperations {
import opened Wrappers
import opened StandardLibrary.UInt
import opened UTF8
import opened Std.Streams
import opened StandardLibrary.Streams
import opened Types = SimpleStreamingTypes
type InternalConfig
predicate ValidInternalConfig?(config: InternalConfig)
Expand All @@ -301,12 +284,8 @@ abstract module AbstractSimpleStreamingOperations {
method CountBits ( config: InternalConfig , input: CountBitsInput )
returns (output: Result<CountBitsOutput, Error>)
requires
// TODO: smithy-dafny isn't yet generating the `input.bits.Valid()` part.
&& ValidInternalConfig?(config)
&& input.bits.Valid()
&& ModifiesInternalConfig(config) !! input.bits.Repr
// TODO: smithy-dafny isn't yet generating the `input.bits.Repr` part.
modifies ModifiesInternalConfig(config), input.bits.Repr
modifies ModifiesInternalConfig(config)
// Dafny will skip type parameters when generating a default decreases clause.
decreases ModifiesInternalConfig(config)
ensures
Expand All @@ -328,8 +307,6 @@ abstract module AbstractSimpleStreamingOperations {
ensures
&& ValidInternalConfig?(config)
ensures BinaryOfEnsuresPublicly(input, output)
// TODO: smithy-dafny isn't yet generating this
ensures output.Success? ==> output.value.binary.Valid() && fresh(output.value.binary.Repr)


predicate ChunksEnsuresPublicly(input: ChunksInput , output: Result<ChunksOutput, Error>)
Expand All @@ -340,8 +317,6 @@ abstract module AbstractSimpleStreamingOperations {
returns (output: Result<ChunksOutput, Error>)
requires
&& ValidInternalConfig?(config)
// TODO: smithy-dafny isn't yet generating this
&& input.bytesIn.Valid()
modifies ModifiesInternalConfig(config)
// Dafny will skip type parameters when generating a default decreases clause.
decreases ModifiesInternalConfig(config)
Expand Down
Loading
Loading