From 51180406bf1104e3fec53bcd3702beffc54ab5a3 Mon Sep 17 00:00:00 2001 From: Eduardo Bart Date: Thu, 5 Oct 2023 13:42:33 -0300 Subject: [PATCH 1/7] refactor: remove lua md5 dependency by using keccak instead --- Dockerfile | 1 - README.md | 3 --- src/tests/machine-test.lua | 5 ++--- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3b493bf81..4bf4b6788 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,7 +21,6 @@ RUN luarocks install --lua-version=5.4 luasocket && \ luarocks install --lua-version=5.4 luasec && \ luarocks install --lua-version=5.4 luaposix && \ luarocks install --lua-version=5.4 lpeg && \ - luarocks install --lua-version=5.4 md5 && \ luarocks install --lua-version=5.4 dkjson && \ luarocks install --lua-version=5.4 luacheck && \ cargo install stylua@0.18.1 --features lua54 diff --git a/README.md b/README.md index 2739b4b3b..1f3d683a3 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,6 @@ sudo luarocks install --lua-version=5.4 dkjson sudo luarocks install --lua-version=5.4 luasocket sudo luarocks install --lua-version=5.4 luasec sudo luarocks install --lua-version=5.4 luaposix -sudo luarocks install --lua-version=5.4 md5 ``` #### MacOS @@ -58,7 +57,6 @@ sudo luarocks install --lua-version=5.4 dkjson sudo luarocks install --lua-version=5.4 luasocket sudo luarocks install --lua-version=5.4 luasec sudo luarocks install --lua-version=5.4 luaposix -sudo luarocks install --lua-version=5.4 md5 ``` ##### Homebrew @@ -69,7 +67,6 @@ luarocks --lua-dir=$(brew --prefix)/opt/lua@5.4 install dkjson luarocks --lua-dir=$(brew --prefix)/opt/lua@5.4 install luasocket luarocks --lua-dir=$(brew --prefix)/opt/lua@5.4 install luasec luarocks --lua-dir=$(brew --prefix)/opt/lua@5.4 install luaposix -luarocks --lua-dir=$(brew --prefix)/opt/lua@5.4 install md5 ``` For emulator scripts to work it is expected that `lua5.4` binary is available in the system PATH. If operating system/package manager that you are using provides only `lua` or lua binary named in a different way (e.g. on `Homebrew`), please create symbolic link or alias `lua5.4`. diff --git a/src/tests/machine-test.lua b/src/tests/machine-test.lua index dfe2f6eae..e47026f02 100755 --- a/src/tests/machine-test.lua +++ b/src/tests/machine-test.lua @@ -18,7 +18,6 @@ local cartesi = require("cartesi") local test_util = require("tests.util") -local md5 = require("md5") -- Note: for grpc machine test to work, remote-cartesi-machine must run on -- same computer and remote-cartesi-machine execution path must be provided @@ -244,11 +243,11 @@ do_test("dumped file hashes should match memory data hashes", function(machine) local data_region_size = tonumber(temp[2], 16) local dump = assert(io.open(file_name, "rb")) - local dump_hash = md5.sumhexa(dump:read("*all")) + local dump_hash = cartesi.keccak(dump:read("*all")) dump:close() local memory_read = machine:read_memory(data_region_start, data_region_size) - local memory_hash = md5.sumhexa(memory_read) + local memory_hash = cartesi.keccak(memory_read) assert(dump_hash == memory_hash, "hash does not match for dump file " .. file_name) end From 24b75cb2a88a5e8db28d555be9885755f40ed820 Mon Sep 17 00:00:00 2001 From: Eduardo Bart Date: Thu, 5 Oct 2023 13:54:08 -0300 Subject: [PATCH 2/7] feat: replace MTD drives with PMEM drives --- src/cartesi-machine.lua | 13 ++++--------- src/dtb.cpp | 11 ++++------- tools/benchmarks/run-benchmarks.lua | 4 +--- 3 files changed, 9 insertions(+), 19 deletions(-) diff --git a/src/cartesi-machine.lua b/src/cartesi-machine.lua index d07840464..210d300f8 100755 --- a/src/cartesi-machine.lua +++ b/src/cartesi-machine.lua @@ -89,7 +89,7 @@ where options are: --flash-drive=:[,:[,...]...] defines a new flash drive, or modify an existing flash drive definition - flash drives appear as /dev/mtdblock[1-7]. + flash drives appear as /dev/pmem[0-7]. : is one of label: