Skip to content

Commit e3351e7

Browse files
authored
Merge pull request #96 from semiotic-ai/suchapalaver/fix/integration-test
fix: integration test
2 parents feec6c5 + 4011c6e commit e3351e7

File tree

4 files changed

+60
-5
lines changed

4 files changed

+60
-5
lines changed

.github/workflows/test.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,40 @@ jobs:
3636
run: |
3737
forge test -vvv
3838
id: test
39+
40+
integration-tests:
41+
name: Integration Tests
42+
runs-on: ubuntu-latest
43+
needs: check
44+
steps:
45+
- uses: actions/checkout@v3
46+
with:
47+
submodules: recursive
48+
49+
- name: Install Foundry
50+
uses: foundry-rs/foundry-toolchain@v1
51+
with:
52+
version: nightly
53+
54+
- name: Setup Node.js and install nvm
55+
run: |
56+
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
57+
export NVM_DIR="$HOME/.nvm"
58+
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
59+
60+
# Install Node 16 and yarn for Graph contracts
61+
nvm install 16
62+
nvm use 16
63+
npm install -g yarn
64+
65+
# Install Node 18 and yarn for TAP contracts
66+
nvm install 18
67+
nvm use 18
68+
npm install -g yarn
69+
70+
- name: Run Integration Tests
71+
run: |
72+
export NVM_DIR="$HOME/.nvm"
73+
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
74+
chmod +x scripts/integration_tests.sh
75+
./scripts/integration_tests.sh --run-integration-tests

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
},
1414
"devDependencies": {
1515
"prettier": "^2.8.8",
16-
"prettier-plugin-solidity": "^1.1.3",
16+
"prettier-plugin-solidity": "^2.0.0",
1717
"solhint": "^3.4.0",
1818
"solhint-plugin-prettier": "^0.0.5"
1919
},

scripts/integration_tests.sh

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ deploy_graph_contracts() {
6262
# Hardhat requires an older version of node
6363
nvm install 16.0.0
6464
nvm use 16.0.0
65+
# Install yarn if not available
66+
if ! command -v yarn &> /dev/null; then
67+
echo "Installing yarn for Node 16.0.0..."
68+
npm install -g yarn
69+
fi
6570
yarn
6671
yes | yarn deploy-localhost --auto-mine
6772
export GRAPH_NODE_ADDRESS="$(jq '.["1337"].GraphToken.address' addresses.json | tr -d '"' || error_exit "Error obtaining Graph Node address")"
@@ -74,22 +79,33 @@ deploy_graph_contracts() {
7479
deploy_tap_contracts() {
7580
cd "$tap_contracts"
7681
echo "Starting deploy for TAP contracts located in $PWD"
82+
# Switch back to a newer Node version for TAP contracts
83+
nvm install 18
84+
nvm use 18
85+
# Install yarn if not available in Node 18
86+
if ! command -v yarn &> /dev/null; then
87+
echo "Installing yarn for Node 18..."
88+
npm install -g yarn
89+
fi
90+
7791
export WITHDRAW_ESCROW_FREEZE_PERIOD=800
7892
export REVOKE_SIGNER_FREEZE_PERIOD=800
93+
# Set dummy ETHERSCAN_API_KEY to avoid verification errors
94+
export ETHERSCAN_API_KEY="dummy_key_for_local_testing"
7995
yarn
8096
export ALLOCATION_TRACKER_ADDRESS=$(forge create \
8197
--unlocked --from $DEPLOYER \
82-
--rpc-url localhost:8545 src/AllocationIDTracker.sol:AllocationIDTracker --json \
98+
--rpc-url localhost:8545 src/AllocationIDTracker.sol:AllocationIDTracker --json --broadcast \
8399
| jq -Rr 'fromjson? | .deployedTo')
84100
export TAP_VERIFIER_ADDRESS=$(forge create \
85101
--unlocked --from $DEPLOYER \
86102
--rpc-url localhost:8545 src/TAPVerifier.sol:TAPVerifier \
87-
--constructor-args 'tapVerifier' '1.0' --json \
103+
--constructor-args 'tapVerifier' '1.0' --json --broadcast \
88104
| jq -Rr 'fromjson? | .deployedTo')
89105
export ESCROW_ADDRESS=$(forge create \
90106
--unlocked --from $DEPLOYER \
91107
--rpc-url localhost:8545 src/Escrow.sol:Escrow \
92-
--constructor-args $GRAPH_NODE_ADDRESS $STAKING_ADDRESS $TAP_VERIFIER_ADDRESS $ALLOCATION_TRACKER_ADDRESS $WITHDRAW_ESCROW_FREEZE_PERIOD $REVOKE_SIGNER_FREEZE_PERIOD --json \
108+
--constructor-args $GRAPH_NODE_ADDRESS $STAKING_ADDRESS $TAP_VERIFIER_ADDRESS $ALLOCATION_TRACKER_ADDRESS $WITHDRAW_ESCROW_FREEZE_PERIOD $REVOKE_SIGNER_FREEZE_PERIOD --json --broadcast \
93109
| jq -Rr 'fromjson? | .deployedTo')
94110
echo "TAP contracts deployed"
95111
cd -
@@ -105,6 +121,8 @@ main() {
105121

106122
if $RUN_INTEGRATION_TESTS; then
107123
echo "Running integration tests..."
124+
# Set ETHERSCAN_API_KEY for testing to avoid verification errors
125+
export ETHERSCAN_API_KEY="dummy_key_for_local_testing"
108126
#run integration tests...
109127
forge test --match-contract EscrowContractTest --rpc-url localhost:8545
110128
else

test/Escrow.t.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ contract EscrowContractTest is Test {
597597
vm.expectRevert(
598598
abi.encodeWithSignature(
599599
"SignerStillThawing(uint256,uint256)",
600-
block.number,
600+
block.timestamp,
601601
thawEndTimestamp
602602
)
603603
);

0 commit comments

Comments
 (0)