-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rebase, rebuild tests on WormholeOverride, add missing NoQuorum test
- Loading branch information
1 parent
0750963
commit d8adcea
Showing
21 changed files
with
895 additions
and
796 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#the chain that will be forked for testing | ||
TEST_FORK = Mainnet Ethereum | ||
|
||
.DEFAULT_GOAL = build | ||
.PHONY: build test clean | ||
|
||
build: | ||
@$(MAKE) -C gen build | ||
forge build | ||
|
||
#include (and build if necessary) env/testing.env if we're running tests | ||
ifneq (,$(filter test, $(MAKECMDGOALS))) | ||
#hacky: | ||
_ := $(shell $(MAKE) -C gen testing.env "TEST_FORK=$(strip $(TEST_FORK))") | ||
include gen/testing.env | ||
export | ||
unexport TEST_FORK | ||
endif | ||
test: build | ||
forge test | ||
|
||
clean: | ||
@$(MAKE) -C gen clean | ||
forge clean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
node_modules | ||
node_modules | ||
.package-lock.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,49 @@ | ||
GENEREATORS = chains cctpDomains | ||
chains_TARGET = ../src/constants/Chains.sol | ||
cctpDomains_TARGET = ../src/constants/CCTPDomains.sol | ||
GENERATORS = chains cctpDomains | ||
chains_TARGET = constants/Chains.sol | ||
cctpDomains_TARGET = constants/CCTPDomains.sol | ||
|
||
TEST_WRAPPERS = BytesParsing | ||
BytesParsing_BASE_PATH = libraries | ||
fnGeneratorTarget = ../src/$($(1)_TARGET) | ||
GENERATOR_TARGETS = $(foreach generator,$(GENERATORS),$(call fnGeneratorTarget,$(generator))) | ||
|
||
TEST_WRAPPERS = BytesParsing QueryResponse | ||
|
||
fnTestWrapperTarget = ../test/generated/$(1)TestWrapper.sol | ||
TEST_WRAPPER_TARGETS =\ | ||
$(foreach wrapper, $(TEST_WRAPPERS), $(call fnTestWrapperTarget,$(wrapper))) | ||
$(foreach wrapper,$(TEST_WRAPPERS),$(call fnTestWrapperTarget,$(wrapper))) | ||
|
||
.DEFAULT_GOAL = build | ||
.PHONY: build clean FORCE | ||
|
||
.PHONY: generate $(GENEREATORS) | ||
build: $(GENERATOR_TARGETS) $(TEST_WRAPPER_TARGETS) | ||
|
||
build: $(GENEREATORS) $(TEST_WRAPPER_TARGETS) | ||
clean: | ||
rm -rf node_modules fork_changed testing.env | ||
|
||
$(GENEREATORS): node_modules | ||
npx ts-node $@.ts > $($@_TARGET) | ||
FORCE: | ||
|
||
node_modules: package-lock.json | ||
npm ci | ||
|
||
define ruleGenerator | ||
$(call fnGeneratorTarget,$(1)): node_modules $(1).ts | ||
npx ts-node $(1).ts > $$@ | ||
endef | ||
$(foreach generator,$(GENERATORS),$(eval $(call ruleGenerator,$(generator)))) | ||
|
||
define ruleTestWrapper | ||
$(call fnTestWrapperTarget,$(1)): ../src/$($(1)_BASE_PATH)/$(1).sol | ||
npx ts-node libraryTestWrapper.ts $($(1)_BASE_PATH)/$(1) > $(call fnTestWrapperTarget,$(1)) | ||
$(call fnTestWrapperTarget,$(1)): ../src/libraries/$(1).sol libraryTestWrapper.ts | ||
npx ts-node libraryTestWrapper.ts libraries/$(1) > $$@ | ||
endef | ||
$(foreach wrapper,$(TEST_WRAPPERS),$(eval $(call ruleTestWrapper,$(wrapper)))) | ||
|
||
ifneq ($(TEST_FORK), $(shell cat fork_changed 2>/dev/null)) | ||
#if a different chain/network for testing was supplied last time then force an update | ||
fork_changed: FORCE | ||
endif | ||
|
||
testing.env: node_modules fork_changed testingEnv.ts | ||
@echo "Generating testing.env for $(TEST_FORK)" | ||
npx ts-node testingEnv.ts $(TEST_FORK) > $@ | ||
|
||
fork_changed: | ||
@echo $(TEST_FORK) > fork_changed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Mainnet Ethereum |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.