Skip to content

Commit

Permalink
Fixed style issues for PR and fixed edge case of no args for commitme…
Browse files Browse the repository at this point in the history
…nt protocol
  • Loading branch information
adityanathan committed Sep 22, 2024
1 parent 415e91b commit dbb7419
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 16 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
cmake-build-*/

# IntelliJ
.idea/
out/

# mpeltonen/sbt-idea plugin
Expand Down
16 changes: 0 additions & 16 deletions .idea/misc.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,16 @@ class CommitmentCircuitCodeGenerator(context: CodeGeneratorContext) : AbstractCo
}

override fun import(protocol: Protocol, arguments: List<Argument>): Pair<CodeBlock, List<CodeBlock>> {
if (arguments.isEmpty()) {
return Pair(CodeBlock.of(""), emptyList())
}
throw UnsupportedCommunicationException(arguments.first().protocol, protocol, arguments.first().sourceLocation)
}

override fun export(protocol: Protocol, arguments: List<Argument>): Pair<CodeBlock, List<CodeBlock>> {
if (arguments.isEmpty()) {
return Pair(CodeBlock.of(""), emptyList())
}
throw UnsupportedCommunicationException(arguments.first().protocol, protocol, arguments.first().sourceLocation)
}
}
20 changes: 20 additions & 0 deletions compiler/tests/should-pass/circuit/cleartext/Commitment3.circuit
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
host alice
host bob
host chuck
host david

circuit fun <> move@Local(host = alice)(a: int[]) -> b: int[] {
return a
}

circuit fun <> move2@Replication(hosts = {bob, david})(a: int[]) -> b: int[] {
return a
}

fun <> main() -> {
val a@Local(host = alice) = alice.input<int[]>()
val c@Commitment(sender = alice, receivers = {bob, chuck}) = move<>(a)
val d@Replication(hosts = {bob, david}) = move2<>(c)
val = david.output<int[]>(d)
return
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
host alice
host bob
host chuck

circuit fun <> move@Commitment(sender = alice, receivers = {bob, chuck})() -> {return}

fun <> main() -> {
val = move<>()
return
}
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.

0 comments on commit dbb7419

Please sign in to comment.