Skip to content

Commit

Permalink
Prepare for erc20
Browse files Browse the repository at this point in the history
  • Loading branch information
virgil-serbanuta committed Oct 17, 2024
1 parent 1956d71 commit c03367d
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 7 deletions.
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,12 @@ $(UKM_WITH_CONTRACT_TESTING_OUTPUT_DIR)/%.run.executed.kore: \
mkdir -p $(UKM_WITH_CONTRACT_TESTING_OUTPUT_DIR)

echo "<(<" > $@.in.tmp
echo "::address" >> $@.in.tmp
echo "<|>" >> $@.in.tmp
cat $(UKM_CONTRACTS_TESTING_INPUT_DIR)/address.rs >> $@.in.tmp
echo ">)>" >> $@.in.tmp

echo "<(<" >> $@.in.tmp
echo "::bytes_hooks" >> $@.in.tmp
echo "<|>" >> $@.in.tmp
cat $(UKM_CONTRACTS_TESTING_INPUT_DIR)/bytes_hooks.rs >> $@.in.tmp
Expand Down
9 changes: 4 additions & 5 deletions rust-semantics/helpers.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,10 @@ module RUST-HELPERS
syntax Bool ::= isSignedInt(Type) [function, total]
rule isSignedInt(_) => false [owise]
rule isSignedInt(u8) => true
rule isSignedInt(u16) => true
rule isSignedInt(u32) => true
rule isSignedInt(u64) => true
rule isSignedInt(u128) => true
rule isSignedInt(i8) => true
rule isSignedInt(i16) => true
rule isSignedInt(i32) => true
rule isSignedInt(i64) => true
rule isSignedInt(&T => T)
rule concatNonEmptyStatements(.NonEmptyStatements, S:NonEmptyStatements) => S
Expand Down
1 change: 1 addition & 0 deletions rust-semantics/test/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module RUST-EXECUTION-TEST-CONFIGURATION
<rust-test>
<test-stack> .List </test-stack>
<mocks> .Map </mocks>
<mock-list> .List </mock-list>
</rust-test>
endmodule
Expand Down
17 changes: 15 additions & 2 deletions rust-semantics/test/execution.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ module RUST-EXECUTION-TEST-PARSING-SYNTAX
| "check_eq" Expression [strict]
| "push" Expression [strict]
| "push_value" Expression [strict]
syntax KItem ::= mock(KItem, K)
syntax Mockable
syntax KItem ::= mock(Mockable, K)
| listMock(Mockable, K)
endmodule
module RUST-EXECUTION-TEST
Expand Down Expand Up @@ -101,7 +103,6 @@ module RUST-EXECUTION-TEST
<next-value-id> NVI:Int => NVI +Int 1 </next-value-id>
syntax KItem ::= wrappedK(K)
syntax Mockable
rule
<k> mock(Mocked:Mockable, Result:K) => .K ... </k>
Expand All @@ -111,6 +112,18 @@ module RUST-EXECUTION-TEST
<k> (Mocked:Mockable => Result) ...</k>
<mocks> Mocked |-> wrappedK(Result:K) ...</mocks>
[priority(10)]
rule
<k> listMock(Mocked:Mockable, Result:K) => .K ... </k>
<mock-list> L:List => L ListItem(listMock(Mocked, Result)) </mock-list>
rule
<k> (Mocked:Mockable => Result) ...</k>
<mock-list>
(ListItem(listMock(Mocked:Mockable, Result:K)) => .List)
...
</mock-list>
[priority(9)]
endmodule
```
2 changes: 2 additions & 0 deletions ukm-semantics/test/execution.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ module UKM-TEST-SYNTAX
syntax ExecutionItem ::= "mock" "CallData"
| "mock" "Caller"
| "mock" UkmHook UkmHookResult
| "list_mock" UkmHook UkmHookResult
| "call_contract" Int
| "output_to_arg"
| "push_status"
Expand Down Expand Up @@ -41,6 +42,7 @@ module UKM-TEST-EXECUTION
</test-stack>
rule mock Hook:UkmHook Result:UkmHookResult => mock(Hook, Result)
rule list_mock Hook:UkmHook Result:UkmHookResult => listMock(Hook, Result)
rule call_contract Account => ukmExecute(Account, 100)
Expand Down

0 comments on commit c03367d

Please sign in to comment.