diff --git a/prt/tests/compute/blockchain/utils.lua b/prt/tests/compute/blockchain/utils.lua index dc0cc0be..508fba2f 100644 --- a/prt/tests/compute/blockchain/utils.lua +++ b/prt/tests/compute/blockchain/utils.lua @@ -19,9 +19,9 @@ local function advance_time(seconds, endpoint) end end -local deploy_cmd = [[sh -c "cd ../../contracts && ./deploy_anvil.sh"]] -local function deploy_contracts() - local reader = io.popen(deploy_cmd) +local deploy_cmd = [[sh -c "cd %s && ./deploy_anvil.sh"]] +local function deploy_contracts(contracts_path) + local reader = io.popen(string.format(deploy_cmd, contracts_path)) assert(reader, "Failed to open process for deploy command: " .. deploy_cmd) local output = reader:read("*a") local success = reader:close() diff --git a/prt/tests/compute/prt_compute.lua b/prt/tests/compute/prt_compute.lua index 00f1fd7b..2adf0f18 100755 --- a/prt/tests/compute/prt_compute.lua +++ b/prt/tests/compute/prt_compute.lua @@ -147,7 +147,7 @@ local root_tournament = blockchain_constants.root_tournament local blockchain_node = Blockchain:new() time.sleep(NODE_DELAY) -blockchain_utils.deploy_contracts() +blockchain_utils.deploy_contracts("../../contracts") time.sleep(NODE_DELAY) local player_coroutines = setup_players(use_lua_node, extra_data, root_tournament, machine_path) diff --git a/cartesi-rollups/tests/rollups/Dockerfile b/prt/tests/rollups/Dockerfile similarity index 92% rename from cartesi-rollups/tests/rollups/Dockerfile rename to prt/tests/rollups/Dockerfile index 6f33cffb..e006bb45 100644 --- a/cartesi-rollups/tests/rollups/Dockerfile +++ b/prt/tests/rollups/Dockerfile @@ -50,17 +50,17 @@ RUN curl -sSL https://github.com/foundry-rs/foundry/releases/download/${FOUNDRY_ # prepare echo machine WORKDIR /root/program/ -COPY ./cartesi-rollups/tests/rollups/program/echo/echo-program.tar.gz /root/program/ +COPY ./prt/tests/rollups/program/echo/echo-program.tar.gz /root/program/ RUN tar -zx -f /root/program/echo-program.tar.gz COPY ./machine/step /root/machine/step COPY ./prt /root/prt COPY ./cartesi-rollups /root/cartesi-rollups -COPY --from=builder /app/cartesi-rollups/node/target/release/dave-rollups /root/cartesi-rollups/tests/rollups/dave-rollups +COPY --from=builder /app/cartesi-rollups/node/target/release/dave-rollups /root/prt/tests/rollups/dave-rollups WORKDIR /root/cartesi-rollups/contracts RUN forge --version RUN forge build -WORKDIR /root/cartesi-rollups/tests/rollups +WORKDIR /root/prt/tests/rollups ENTRYPOINT ["./prt_rollups.lua"] diff --git a/cartesi-rollups/tests/rollups/Makefile b/prt/tests/rollups/Makefile similarity index 85% rename from cartesi-rollups/tests/rollups/Makefile rename to prt/tests/rollups/Makefile index bf1d6b9e..48bcb6e8 100644 --- a/cartesi-rollups/tests/rollups/Makefile +++ b/prt/tests/rollups/Makefile @@ -2,7 +2,7 @@ ECHO_MACHINE_PATH := "/root/program/echo-program" help: @echo ' create-image - create `prt-rollups:test` docker image' - @echo ' test-echo - run PRT echo test' + @echo ' test-echo - run PRT rollups echo test' create-image: @docker build -t cartesi/prt-rollups:test -f Dockerfile ../../../ diff --git a/cartesi-rollups/tests/rollups/README.md b/prt/tests/rollups/README.md similarity index 100% rename from cartesi-rollups/tests/rollups/README.md rename to prt/tests/rollups/README.md diff --git a/cartesi-rollups/tests/rollups/dave/node.lua b/prt/tests/rollups/dave/node.lua similarity index 100% rename from cartesi-rollups/tests/rollups/dave/node.lua rename to prt/tests/rollups/dave/node.lua diff --git a/cartesi-rollups/tests/rollups/dave/reader.lua b/prt/tests/rollups/dave/reader.lua similarity index 100% rename from cartesi-rollups/tests/rollups/dave/reader.lua rename to prt/tests/rollups/dave/reader.lua diff --git a/cartesi-rollups/tests/rollups/dave/sender.lua b/prt/tests/rollups/dave/sender.lua similarity index 100% rename from cartesi-rollups/tests/rollups/dave/sender.lua rename to prt/tests/rollups/dave/sender.lua diff --git a/cartesi-rollups/tests/rollups/program/.dockerignore b/prt/tests/rollups/program/.dockerignore similarity index 100% rename from cartesi-rollups/tests/rollups/program/.dockerignore rename to prt/tests/rollups/program/.dockerignore diff --git a/cartesi-rollups/tests/rollups/program/.gitignore b/prt/tests/rollups/program/.gitignore similarity index 100% rename from cartesi-rollups/tests/rollups/program/.gitignore rename to prt/tests/rollups/program/.gitignore diff --git a/cartesi-rollups/tests/rollups/program/echo/.gitignore b/prt/tests/rollups/program/echo/.gitignore similarity index 100% rename from cartesi-rollups/tests/rollups/program/echo/.gitignore rename to prt/tests/rollups/program/echo/.gitignore diff --git a/cartesi-rollups/tests/rollups/program/echo/Dockerfile b/prt/tests/rollups/program/echo/Dockerfile similarity index 100% rename from cartesi-rollups/tests/rollups/program/echo/Dockerfile rename to prt/tests/rollups/program/echo/Dockerfile diff --git a/cartesi-rollups/tests/rollups/program/echo/README.md b/prt/tests/rollups/program/echo/README.md similarity index 100% rename from cartesi-rollups/tests/rollups/program/echo/README.md rename to prt/tests/rollups/program/echo/README.md diff --git a/cartesi-rollups/tests/rollups/program/echo/gen_machine_echo.sh b/prt/tests/rollups/program/echo/gen_machine_echo.sh similarity index 100% rename from cartesi-rollups/tests/rollups/program/echo/gen_machine_echo.sh rename to prt/tests/rollups/program/echo/gen_machine_echo.sh diff --git a/cartesi-rollups/tests/rollups/prt_rollups.lua b/prt/tests/rollups/prt_rollups.lua similarity index 98% rename from cartesi-rollups/tests/rollups/prt_rollups.lua rename to prt/tests/rollups/prt_rollups.lua index 539c1d97..23579399 100755 --- a/cartesi-rollups/tests/rollups/prt_rollups.lua +++ b/prt/tests/rollups/prt_rollups.lua @@ -10,7 +10,7 @@ local EPOCH_TIME = 60 * 60 * 24 * 7 -- delay time for blockchain node to be ready local NODE_DELAY = 3 -- number of fake commitment to make -local FAKE_COMMITMENT_COUNT = 1 +local FAKE_COMMITMENT_COUNT = 2 -- number of idle players local IDLE_PLAYER_COUNT = 0 -- consensus contract address in anvil deployment @@ -188,7 +188,7 @@ local rollups_machine_path = os.getenv("MACHINE_PATH") local blockchain_node = Blockchain:new() time.sleep(NODE_DELAY) -blockchain_utils.deploy_contracts() +blockchain_utils.deploy_contracts("../../../cartesi-rollups/contracts") time.sleep(NODE_DELAY) local dave_node = Dave:new(rollups_machine_path) diff --git a/cartesi-rollups/tests/rollups/setup_path.lua b/prt/tests/rollups/setup_path.lua similarity index 58% rename from cartesi-rollups/tests/rollups/setup_path.lua rename to prt/tests/rollups/setup_path.lua index 7286bfaf..c736a82c 100644 --- a/cartesi-rollups/tests/rollups/setup_path.lua +++ b/prt/tests/rollups/setup_path.lua @@ -1,6 +1,6 @@ -- setup client-lua path -package.path = package.path .. ";../../../prt/client-lua/?.lua" -package.path = package.path .. ";../../../prt/tests/compute/?.lua" +package.path = package.path .. ";../compute/?.lua" +package.path = package.path .. ";../../client-lua/?.lua" -- setup cartesi machine path package.path = package.path .. ";/opt/cartesi/lib/lua/5.4/?.lua"