test: pre-test
	go test -v ./...

cannon-prestate:
	make -C .. cannon-prestate

# We depend on the absolute pre-state generated by cannon to deploy the dispute game contracts.
devnet-allocs: pre-test-cannon
	make -C .. devnet-allocs

pre-test: pre-test-cannon pre-test-allocs


pre-test-cannon:
	@if [ ! -e ../op-program/bin ]; then \
		make cannon-prestate; \
	fi

pre-test-allocs: 
	@if [ ! -e ../.devnet ]; then \
		make devnet-allocs; \
	fi

clean:
	rm -r ../.devnet
	rm -r ../op-program/bin

lint:
	golangci-lint run -E goimports,sqlclosecheck,bodyclose,asciicheck,misspell,errorlint -e "errors.As" -e "errors.Is"

.PHONY: \
	test \
	lint
