Skip to content
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

use #log to log events rather than a cell #29

Merged
merged 4 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,5 @@ test-aave:
test-regression: ${REGRESSION_TESTS}

%.out: %.sol %.txn %.ref $(SEMANTICS_FILE_NAME)-kompiled/timestamp
ulimit -s 65536 && bin/krun-sol $*.sol $*.txn > $*.out
ulimit -s 65536 && bin/krun-sol $*.sol $*.txn > $*.out 2>&1
diff -U3 -w $*.ref $*.out
1 change: 0 additions & 1 deletion src/solidity.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ module SOLIDITY-CONFIGURATION
<contract-storage> .Map </contract-storage>
</live-contract>
</live-contracts>
<events> .List </events>
<next-address> 2p160 </next-address>
</exec>
</solidity>
Expand Down
14 changes: 12 additions & 2 deletions src/statement.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
module SOLIDITY-STATEMENT
imports SOLIDITY-CONFIGURATION
imports private SOLIDITY-EXPRESSION
imports private STRING-BUFFER
imports private K-IO

// expression statement
rule _:TypedVal ; => .K
Expand Down Expand Up @@ -52,10 +54,18 @@ module SOLIDITY-STATEMENT
<store> S => S [ !I <- default(T) ] </store>

// emit statement
rule <k> emit X:Id ( ARGS ) ; => .K ...</k>
<events>... .List => ListItem(event(X, ARGS)) </events>
rule <k> emit X:Id ( ARGS ) ; => #log(Event2String(ARGS, ((.StringBuffer +String Id2String(X)) +String "("))) ...</k>
requires isKResult(ARGS)

syntax String ::= Event2String(CallArgumentList, StringBuffer) [function]
rule Event2String(.CallArgumentList, SB) => StringBuffer2String(SB +String ")")
rule Event2String(v(V:MInt{112}, _), SB) => Event2String(.CallArgumentList, SB +String Int2String(MInt2Unsigned(V)))
rule Event2String(v(V:MInt{160}, _), SB) => Event2String(.CallArgumentList, SB +String Int2String(MInt2Unsigned(V)))
rule Event2String(v(V:MInt{256}, _), SB) => Event2String(.CallArgumentList, SB +String Int2String(MInt2Unsigned(V)))
rule Event2String(v(V:MInt{112}, _), ARGS, SB) => Event2String(ARGS, (SB +String Int2String(MInt2Unsigned(V))) +String ", ") [owise]
rule Event2String(v(V:MInt{160}, _), ARGS, SB) => Event2String(ARGS, (SB +String Int2String(MInt2Unsigned(V))) +String ", ") [owise]
rule Event2String(v(V:MInt{256}, _), ARGS, SB) => Event2String(ARGS, (SB +String Int2String(MInt2Unsigned(V))) +String ", ") [owise]

// if statement
rule if ( v(true, bool ) ) S => S
rule if ( v(false, bool ) ) _ => .K
Expand Down
3 changes: 0 additions & 3 deletions test/regression/arithmetic.ref
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,6 @@
</contract-storage>
</live-contract>
</live-contracts>
<events>
.List
</events>
<next-address>
3p160
</next-address>
Expand Down
3 changes: 0 additions & 3 deletions test/regression/arraystestcontract.ref
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,6 @@
</contract-storage>
</live-contract>
</live-contracts>
<events>
.List
</events>
<next-address>
3p160
</next-address>
Expand Down
3 changes: 0 additions & 3 deletions test/regression/block.ref
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,6 @@
</contract-storage>
</live-contract>
</live-contracts>
<events>
.List
</events>
<next-address>
3p160
</next-address>
Expand Down
3 changes: 0 additions & 3 deletions test/regression/boolean.ref
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,6 @@
</contract-storage>
</live-contract>
</live-contracts>
<events>
.List
</events>
<next-address>
3p160
</next-address>
Expand Down
3 changes: 0 additions & 3 deletions test/regression/contract.ref
Original file line number Diff line number Diff line change
Expand Up @@ -365,9 +365,6 @@
</contract-storage>
</live-contract>
</live-contracts>
<events>
.List
</events>
<next-address>
3p160
</next-address>
Expand Down
4 changes: 1 addition & 3 deletions test/regression/emit.ref
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Approval(1, 0, 2)
<solidity>
<k>
.K
Expand Down Expand Up @@ -113,9 +114,6 @@
</contract-storage>
</live-contract>
</live-contracts>
<events>
ListItem ( event (... name: Approval , args: v ( 1p160 , address ) , v ( 0p160 , address ) , v ( 2p160 , address ) , .TypedVals ) )
</events>
<next-address>
3p160
</next-address>
Expand Down
3 changes: 0 additions & 3 deletions test/regression/eventtestcontract.ref
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,6 @@
</contract-storage>
</live-contract>
</live-contracts>
<events>
.List
</events>
<next-address>
3p160
</next-address>
Expand Down
3 changes: 0 additions & 3 deletions test/regression/for.ref
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,6 @@
</contract-storage>
</live-contract>
</live-contracts>
<events>
.List
</events>
<next-address>
3p160
</next-address>
Expand Down
3 changes: 0 additions & 3 deletions test/regression/function.ref
Original file line number Diff line number Diff line change
Expand Up @@ -2181,9 +2181,6 @@
</contract-storage>
</live-contract>
</live-contracts>
<events>
.List
</events>
<next-address>
11p160
</next-address>
Expand Down
3 changes: 0 additions & 3 deletions test/regression/if.ref
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,6 @@
</contract-storage>
</live-contract>
</live-contracts>
<events>
.List
</events>
<next-address>
3p160
</next-address>
Expand Down
3 changes: 0 additions & 3 deletions test/regression/increment.ref
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,6 @@
</contract-storage>
</live-contract>
</live-contracts>
<events>
.List
</events>
<next-address>
3p160
</next-address>
Expand Down
3 changes: 0 additions & 3 deletions test/regression/mapstestcontract.ref
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,6 @@
</contract-storage>
</live-contract>
</live-contracts>
<events>
.List
</events>
<next-address>
3p160
</next-address>
Expand Down
Loading