Skip to content

Commit 4836f81

Browse files
Decision tree optimization #2 (#265)
* esdt `<instrs> .K </instrs>` * add `<instrs>` pattern to esdt rules * Set Version: 0.1.58 * config.md: add `<instrs> (#waitCommands ~> _) #Or .K </instrs>` --------- Co-authored-by: devops <[email protected]>
1 parent 3a44a2e commit 4836f81

File tree

4 files changed

+60
-27
lines changed

4 files changed

+60
-27
lines changed

kmultiversx/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
44

55
[tool.poetry]
66
name = "kmultiversx"
7-
version = "0.1.57"
7+
version = "0.1.58"
88
description = "Python tools for Elrond semantics"
99
authors = [
1010
"Runtime Verification, Inc. <[email protected]>",

kmultiversx/src/kmultiversx/kdist/mx-semantics/elrond-config.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,7 @@ TODO: Implement [reserved keys and read-only runtimes](https://github.com/Elrond
463463
<address> ADDR </address>
464464
...
465465
</account>
466+
<instrs> (#waitCommands ~> _) #Or .K </instrs>
466467
// <logging> S => S +String " -- initAccount duplicate " +String Bytes2String(ADDR) </logging>
467468
[priority(60)]
468469
@@ -477,6 +478,7 @@ TODO: Implement [reserved keys and read-only runtimes](https://github.com/Elrond
477478
)
478479
...
479480
</accounts>
481+
<instrs> (#waitCommands ~> _) #Or .K </instrs>
480482
// <logging> S => S +String " -- initAccount new " +String Bytes2String(ADDR) </logging>
481483
[priority(61)]
482484
@@ -495,6 +497,7 @@ TODO: Implement [reserved keys and read-only runtimes](https://github.com/Elrond
495497
<storage> _ => STORAGE </storage>
496498
...
497499
</account>
500+
<instrs> (#waitCommands ~> _) #Or .K </instrs>
498501
[priority(60)]
499502
500503
rule [setAccountCode]:
@@ -504,6 +507,7 @@ TODO: Implement [reserved keys and read-only runtimes](https://github.com/Elrond
504507
<code> _ => CODE </code>
505508
...
506509
</account>
510+
<instrs> (#waitCommands ~> _) #Or .K </instrs>
507511
[priority(60)]
508512
509513
rule <commands> setAccountOwner(ADDR, OWNER) => .K ... </commands>
@@ -512,6 +516,7 @@ TODO: Implement [reserved keys and read-only runtimes](https://github.com/Elrond
512516
<ownerAddress> _ => OWNER </ownerAddress>
513517
...
514518
</account>
519+
<instrs> (#waitCommands ~> _) #Or .K </instrs>
515520
[priority(60)]
516521
```
517522

@@ -532,6 +537,7 @@ TODO: Implement [reserved keys and read-only runtimes](https://github.com/Elrond
532537
~> transferFundsH(A, B, V)
533538
...
534539
</commands>
540+
<instrs> (#waitCommands ~> _) #Or .K </instrs>
535541
[priority(60)]
536542
537543
rule [transferFundsH-self]:
@@ -544,6 +550,7 @@ TODO: Implement [reserved keys and read-only runtimes](https://github.com/Elrond
544550
<balance> ORIGFROM </balance>
545551
...
546552
</account>
553+
<instrs> (#waitCommands ~> _) #Or .K </instrs>
547554
requires VALUE <=Int ORIGFROM
548555
[priority(60)]
549556
@@ -562,6 +569,7 @@ TODO: Implement [reserved keys and read-only runtimes](https://github.com/Elrond
562569
<balance> ORIGTO => ORIGTO +Int VALUE </balance>
563570
...
564571
</account>
572+
<instrs> (#waitCommands ~> _) #Or .K </instrs>
565573
requires ACCTFROM =/=K ACCTTO andBool VALUE <=Int ORIGFROM
566574
[priority(60), preserves-definedness]
567575
// Preserving definedness:
@@ -575,6 +583,7 @@ TODO: Implement [reserved keys and read-only runtimes](https://github.com/Elrond
575583
<balance> ORIGFROM </balance>
576584
...
577585
</account>
586+
<instrs> (#waitCommands ~> _) #Or .K </instrs>
578587
requires VALUE >Int ORIGFROM
579588
[priority(60)]
580589
@@ -589,6 +598,7 @@ TODO: Implement [reserved keys and read-only runtimes](https://github.com/Elrond
589598
rule <commands> callContract(TO, FUNCNAME:String, VMINPUT)
590599
=> callContract(TO, #quoteUnparseWasmString(FUNCNAME), VMINPUT) ...
591600
</commands>
601+
<instrs> (#waitCommands ~> _) #Or .K </instrs>
592602
[priority(60)]
593603
594604
rule [callContract]:
@@ -617,6 +627,7 @@ TODO: Implement [reserved keys and read-only runtimes](https://github.com/Elrond
617627
</account>
618628
<vmOutput> _ => .VMOutput </vmOutput>
619629
<logging> S => S +String " -- callContract " +String #parseWasmString(FUNCNAME) </logging>
630+
<instrs> (#waitCommands ~> _) #Or .K </instrs>
620631
requires notBool(isBuiltin(FUNCNAME))
621632
andBool #token("\"callBack\"", "WasmStringToken") =/=K FUNCNAME
622633
[priority(60)]
@@ -640,13 +651,15 @@ TODO: Implement [reserved keys and read-only runtimes](https://github.com/Elrond
640651
</commands>
641652
<vmOutput> _ => .VMOutput </vmOutput>
642653
<logging> S => S +String " -- callContract " +String #parseWasmString(FUNC) </logging>
654+
<instrs> (#waitCommands ~> _) #Or .K </instrs>
643655
requires isBuiltin(FUNC)
644656
[priority(60)]
645657
646658
rule [callContract-err-callback]:
647659
<commands> callContract(_, FUNCNAME:WasmString, _)
648660
=> #throwExceptionBs(ExecutionFailed, b"invalid function (calling callBack() directly is forbidden)") ...
649661
</commands>
662+
<instrs> (#waitCommands ~> _) #Or .K </instrs>
650663
requires #token("\"callBack\"", "WasmStringToken") ==K FUNCNAME
651664
[priority(60)]
652665
@@ -659,12 +672,14 @@ TODO: Implement [reserved keys and read-only runtimes](https://github.com/Elrond
659672
<code> .Code </code>
660673
...
661674
</account>
675+
<instrs> (#waitCommands ~> _) #Or .K </instrs>
662676
[priority(61)]
663677
664678
rule [callContract-not-found]:
665679
<commands> callContract(TO, _:WasmString, _)
666680
=> #throwExceptionBs(ExecutionFailed, b"account not found: " +Bytes TO) ...
667681
</commands>
682+
<instrs> (#waitCommands ~> _) #Or .K </instrs>
668683
[priority(62)]
669684
```
670685

@@ -675,6 +690,7 @@ Every contract call runs in its own Wasm instance initialized with the contract'
675690
// --------------------------------------------------------------------------------------------------
676691
rule [newWasmInstance]:
677692
<commands> newWasmInstance(ADDR, CODE) => newWasmInstanceAux(ADDR, CODE) ... </commands>
693+
<instrs> .K </instrs>
678694
679695
rule [newWasmInstanceAux]:
680696
<commands> newWasmInstanceAux(_, CODE) => #waitWasm ~> setContractModIdx ... </commands>

0 commit comments

Comments
 (0)