Skip to content

Commit f1f8047

Browse files
authored
Anvil fork (#1366)
fork testing examples
1 parent 1363f80 commit f1f8047

File tree

27 files changed

+3494
-9
lines changed

27 files changed

+3494
-9
lines changed

book/src/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
- [NodeSet with Capabilities](./framework/nodeset_capabilities.md)
1111
- [NodeSet (Local Docker builds)](./framework/nodeset_docker_rebuild.md)
1212
- [NodeSet Compat Environment](./framework/nodeset_compatibility.md)
13+
- [Fork Testing](./framework/fork.md)
1314
- [NodeSet with External Blockchain]()
1415
- [CLI](./framework/cli.md)
1516
- [Configuration](./framework/configuration.md)

book/src/framework/fork.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Fork Testing
2+
3+
We verify our on-chain and off-chain changes using forks of various networks.
4+
5+
Go to example project [dir](https://github.com/smartcontractkit/chainlink-testing-framework/tree/main/framework/examples/myproject) to try the examples yourself.
6+
7+
## On-chain Only
8+
In this [example](https://github.com/smartcontractkit/chainlink-testing-framework/blob/main/framework/examples/myproject/fork_test.go), we:
9+
10+
- Create two `anvil` networks, each targeting the desired network (change [URLs](https://github.com/smartcontractkit/chainlink-testing-framework/blob/main/framework/examples/myproject/fork.toml) and `anvil` settings as required, see [full anvil](https://book.getfoundry.sh/reference/anvil/) reference).
11+
- Connect two clients to the respective networks.
12+
- Deploy two test contracts.
13+
- Interact with the deployed contracts.
14+
- Demonstrate interactions using the `anvil` RPC client (more client methods examples are [here](https://github.com/smartcontractkit/chainlink-testing-framework/blob/main/framework/rpc/rpc_test.go))
15+
16+
Run it
17+
```
18+
CTF_CONFIGS=fork.toml go test -v -run TestFork
19+
```
20+
21+
## On-chain + Off-chain
22+
23+
The chain setup remains the same as in the previous example, but now we have 5 `Chainlink` nodes [connected with 2 networks](https://github.com/smartcontractkit/chainlink-testing-framework/blob/main/framework/examples/myproject/fork_plus_offchain_test.go).
24+
25+
Run it
26+
```
27+
CTF_CONFIGS=fork_plus_offchain.toml go test -v -run TestOffChainAndFork
28+
```
29+
30+
<div class="warning">
31+
32+
Be mindful of RPC rate limits, as your provider may enforce restrictions. Use `docker_cmd_params` field to configure appropriate rate limiting and retries with the following parameters:
33+
```
34+
--compute-units-per-second <CUPS>
35+
--fork-retry-backoff <BACKOFF>
36+
--retries <retries>
37+
--timeout <timeout>
38+
```
39+
If the network imposes limits, the container will panic, triggering messages indicating that the container health check has failed.
40+
41+
</div>
42+

framework/.changeset/v0.2.8.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
- Fund nodes method added to `NodeSet`
2+
- Add on-chain fork test example
3+
- Add on-chain + off-chain fork test example

framework/cmd/observability/blockscout/services/backend.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version: '3.9'
22

33
services:
44
backend:
5-
image: blockscout/${DOCKER_REPO:-blockscout}:${DOCKER_TAG:-latest}
5+
image: blockscout/blockscout:6.9.0.commit.4100e959
66
pull_policy: always
77
restart: always
88
stop_grace_period: 5m

framework/cmd/observability/blockscout/services/frontend.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version: '3.9'
22

33
services:
44
frontend:
5-
image: ghcr.io/blockscout/frontend:${FRONTEND_DOCKER_TAG:-latest}
5+
image: ghcr.io/blockscout/frontend:v1.36.2
66
pull_policy: always
77
platform: linux/amd64
88
restart: always

framework/cmd/observability/blockscout/services/sig-provider.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version: '3.9'
22

33
services:
44
sig-provider:
5-
image: ghcr.io/blockscout/sig-provider:${SIG_PROVIDER_DOCKER_TAG:-latest}
5+
image: ghcr.io/blockscout/sig-provider:v1.1.1
66
pull_policy: always
77
platform: linux/amd64
88
restart: always

framework/cmd/observability/blockscout/services/smart-contract-verifier.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version: '3.9'
22

33
services:
44
smart-contract-verifier:
5-
image: ghcr.io/blockscout/smart-contract-verifier:${SMART_CONTRACT_VERIFIER_DOCKER_TAG:-latest}
5+
image: ghcr.io/blockscout/smart-contract-verifier:v1.9.2
66
pull_policy: always
77
platform: linux/amd64
88
restart: always

framework/cmd/observability/blockscout/services/stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ services:
3535
start_period: 10s
3636

3737
stats:
38-
image: ghcr.io/blockscout/stats:${STATS_DOCKER_TAG:-latest}
38+
image: ghcr.io/blockscout/stats:v2.2.3
3939
pull_policy: always
4040
platform: linux/amd64
4141
restart: always

framework/cmd/observability/blockscout/services/user-ops-indexer.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version: '3.9'
22

33
services:
44
user-ops-indexer:
5-
image: ghcr.io/blockscout/user-ops-indexer:${USER_OPS_INDEXER_DOCKER_TAG:-latest}
5+
image: ghcr.io/blockscout/user-ops-indexer:v1.3.0
66
pull_policy: always
77
platform: linux/amd64
88
restart: always

framework/cmd/observability/blockscout/services/visualizer.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version: '3.9'
22

33
services:
44
visualizer:
5-
image: ghcr.io/blockscout/visualizer:${VISUALIZER_DOCKER_TAG:-latest}
5+
image: ghcr.io/blockscout/visualizer:v0.2.1
66
pull_policy: always
77
platform: linux/amd64
88
restart: always

0 commit comments

Comments
 (0)