Skip to content

Commit

Permalink
chore(prt-rollups): move rollups tests to prt/test/rollups
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenctw committed Dec 9, 2024
1 parent 5820fd1 commit 96639e0
Show file tree
Hide file tree
Showing 16 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions prt/tests/compute/blockchain/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion prt/tests/compute/prt_compute.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Original file line number Diff line number Diff line change
Expand Up @@ -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 ../../../
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
@@ -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"
Expand Down

0 comments on commit 96639e0

Please sign in to comment.