datahaven/test
2025-05-08 20:32:55 -03:00
..
cli fix: 🧑‍💻 Fix and improve bun cli logging and functionalities (#60) 2025-05-08 09:42:45 -03:00
configs fix: 🧑‍💻 Fix and improve bun cli logging and functionalities (#60) 2025-05-08 09:42:45 -03:00
contract-bindings test: 🧙 Generate Type Bindings for Contracts (#58) 2025-05-01 11:14:19 +01:00
resources fix: 🧑‍💻 Fix and improve bun cli logging and functionalities (#60) 2025-05-08 09:42:45 -03:00
scripts fix: 🧑‍💻 Fix and improve bun cli logging and functionalities (#60) 2025-05-08 09:42:45 -03:00
suites/e2e test: 🧙 Generate Type Bindings for Contracts (#58) 2025-05-01 11:14:19 +01:00
utils fix: 🧑‍💻 Fix and improve bun cli logging and functionalities (#60) 2025-05-08 09:42:45 -03:00
.gitignore test: ⚙️ Add Kurtosis Launch Script (#34) 2025-04-08 15:42:45 +00:00
biome.json test: ⚙️ Parse & Generate Relayer Configs (#54) 2025-04-29 13:24:00 +01:00
bun.lock test: ️ CI Refactor (#59) 2025-05-06 20:20:02 +00:00
bunfig.toml test: 🧙 Generate Type Bindings for Contracts (#58) 2025-05-01 11:14:19 +01:00
package.json ci: 🐳 Start Publishing Docker Images (#64) 2025-05-08 20:32:55 -03:00
README.md test: 🧙 Generate Type Bindings for Contracts (#58) 2025-05-01 11:14:19 +01:00
TODO.md test: ⚙️ Parse & Generate Relayer Configs (#54) 2025-04-29 13:24:00 +01:00
tsconfig.json test: 🧙 Generate Type Bindings for Contracts (#58) 2025-05-01 11:14:19 +01:00
wagmi.config.ts test: 🧙 Generate Type Bindings for Contracts (#58) 2025-05-01 11:14:19 +01:00

End-to-End Test Environment

Contents

.
├── README.md
├── configs                 # Configurations for test networks
└── scripts                 # Helper scripts for interacting with the network

Pre-requisites

  • Kurtosis: For launching test networks
  • Bun: TypeScript runtime and package manager
  • Docker: For container management

QuickStart

Run: bun start:e2e:minimal

Manual Deployment

Follow these steps to set up and interact with your test environment:

  1. Deploy a minimal test environment

    bun start:e2e:minimal
    

    This script will:

    1. Start a Kurtosis network with (among other things):
      • 2 x Ethereum Execution Layer clients (reth)
      • 2 x Ethereum Consensus Layer clients (lighthouse)
      • 1 x Blockscout frontend
      • 1 x Blockscout backend
    2. Send a test transaction to the network using the send-txn.ts script.
    3. Deploy all DataHaven smart contracts needed for a local deployment, using the DeployLocal.s.sol script.

    NOTE

    If you want to also have the contracts verified on blockscout, you can run bun start:e2e:verified instead. This will do all the previous steps, but also verify the contracts on blockscout. However, note that this takes some time to complete.

  2. Explore the network

    • Block Explorer: http://127.0.0.1:3000.
    • Kurtosis Dashboard: Run kurtosis web to access. From it you can see all the services running in the network, as well as their ports, status and logs.

Network Management

  • Stop the test environment

    bun stop:e2e
    
  • Stop the Kurtosis engine completely

    bun stop:kurtosis-engine
    

Blockscout

Can be accessed at: http://127.0.0.1:3000.

You can also access the backend via REST API, documented here: http://127.0.0.1:3000/api-docs

API DOCS

Testing

E2E Tests

Tip

Remember to run the network with bun start:e2e:minimal before running the tests.

bun test:e2e

Note

You can increase the logging level by setting LOG_LEVEL=debug before running the tests.

Wagmi Bindings Generation

To ensure contract bindings are up-to-date, run the following command after modifying smart contracts or updating ABIs:

bun generate:wagmi

This command generates TypeScript bindings for interacting with the deployed smart contracts using Wagmi.

Troubleshooting

E2E Network Launch doesn't work

Script halts unexpectedly

When running start:e2e:minimal the script appears to halt after the following:

## Setting up 1 EVM.

==========================

Chain 3151908

Estimated gas price: 2.75 gwei

Estimated total gas used for script: 71556274

Estimated amount required: 0.1967797535 ETH

==========================

This is due to how forge streams output to stdout, but is infact still deploying contracts to the chain. You should be able to see in blockscout the deploy script is indeed still working.

Errors with deploying forge scripts on kurtosis network

Try running forge clean to clear any spurious build artefacts, and running forge build again. Also try deploying manually to the still running kurtosis network.

Blockscout is empty

If you look at the browser console, if you see the following:

Content-Security-Policy: The pages settings blocked the loading of a resource (connect-src) at http://127.0.0.1:3000/node-api/proxy/api/v2/stats because it violates the following directive: “connect-src ' ...

this is a result of CORS and CSP errors due to running this as a local docker network.

Make sure you are connected directly to http://127.0.0.1:3000 (not localhost).

Alternatively, you can try installing a browser addon such as anti-CORS / anti-CSP to circumvent this problem.

Weird forge Errors

In the /contracts directory, you can try to run forge clean and forge build to see if it fixes the issue.

Linux: See if disabling ipV6 helps

I have found that ipV6 on Arch Linux does not play very nicely with Kurtosis networks. Disabling it completely fixed the issue for me.

macOS: Verify Docker networking settings

Docker Network Settings

If using Docker Desktop, make sure settings have permissive networking enabled.

Further Information

  • Kurtosis: Used for launching a full Ethereum network
  • Zombienet: Used for launching a Polkadot-SDK based network
  • Bun: TypeScript runtime and ecosystem tooling