In this repository we provide a model of IELE in K.
<k>
cell.
iele-testing.md is also capable of executing tests of arbitrary IELE transactions (subject to the fact that this first release of IELE is still built on top of an ethereum-like network layer).
The test format is based off of, but slightly different from, the ethereum BlockchainTest json test format.See INSTALL.md.
Calling kiele help
and kiele version
will output the user guide and the KIELE version, respectively.
The assembler takes textual IELE and produces IELE bytecode.
For example, on the following file iele-examples/factorial.iele
:
contract Factorial {
define public @factorial(%n) {
%lt = cmp lt %n, 0
br %lt, throw
%result = 1
condition:
%cond = cmp le %n, 0
br %cond, after_loop
loop_body:
%result = mul %result, %n
%n = sub %n, 1
br condition
after_loop:
ret %result
throw:
call @iele.invalid()
}
define @init() {}
}
You can run:
kiele assemble iele-examples/factorial.iele
To produce output:
0000004C6303690009666163746F7269616C6800010001618001100042650003026101036600006180011200446500020466000102001B610101030040640000660002F6000103660003FE6700000000
NOTE: Right now, if you use the NixOS package, you must call iele-assemble
instead of kiele assemble
.
You can run a KIELE node, specifying the port to run on and use the KIELE test harness to run some transactions through it. To start the KIELE node, call (in one terminal):
kiele vm --port 9001
Then in a separate terminal, send a transaction through:
iele-test-vm tests/iele/danse/factorial/factorial_positive.iele.json 9001
You'll see the launched node record to the terminal a list of messages it sends and receives.
NOTE: The iele-test-vm
executable is only available in a from-source build of KIELE.
You can still launch and use the KIELE VM node without this executable.
Tests in the Ethereum Test Suite format can be run directly by the IELE interpreter.
For example, from this repository, you can run:
make assemble-iele-test -j4
To prepare the Ethereum test-suite. Then you can run an individual test, and see the post-state with:
kiele interpret tests/iele/danse/factorial/factorial_positive.iele.json.test-assembled
You may also run the interpreter with the Haskell backend instead (though it is significantly slower):
kiele interpret --backend haskell tests/iele/danse/factorial/factorial_positive.iele.json.test-assembled
NOTE: Printing the post-state will not work unless you are using a from-source build of KIELE.
Instead, you should inspect the exit code of kiele interpret
to see if the test passed or failed, by adding option --no-unparse
to skip printing the post-state.
The KIELE well-formedness checker will do some type-checking on the input IELE program, using exit code to indicate success/failure.
For example, we can type-check the ERC20 contract example iele-examples/erc20.iele
:
kiele check --schedule DANSE iele-examples/erc20.iele
NOTE: The KIELE well-formedness checker requires that (i) you are using a local build of KIELE, and (ii) you have installed K as well.
To reach us, you can either use our chat, or open issues against this repository: