Skip to content

Commit

Permalink
Problem: no command to start a sandbox environment (#191)
Browse files Browse the repository at this point in the history
  • Loading branch information
farazsth98 authored Jan 6, 2023
1 parent 3aaf9c9 commit 51b1f00
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 6 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,6 @@ e2e_validator_out: e2e_clean_slate
e2e_transaction_stress: e2e_clean_slate
integration_tests/integration_tests.test -test.failfast -test.v -test.run IntegrationTestSuite -testify.m TestTransactionStress || make -s fail

e2e_sandbox: e2e_clean_slate
integration_tests/integration_tests.test -test.failfast -test.v -test.run IntegrationTestSuite -testify.m TestSandbox || make -s fail

19 changes: 19 additions & 0 deletions integration_tests/sandbox_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package integration_tests

import "fmt"

func (s *IntegrationTestSuite) TestSandbox() {
s.Run("Bring up chain and see what happens", func() {
// Write whatever code you need here. You can refer to happy_path_test.go
// Alternatively, wait for the chain to start and use this validator's
// private key to perform ethereum / cosmos operations.
//
// The JSON-RPC server is hosted at 0.0.0.0:8545
fmt.Printf("Validator 0 information: %+v", s.chain.validators[0].ethereumKey)

s.T().Log("Chain will now keep running. Press enter to exit at any time")

fmt.Scanln()

})
}
35 changes: 29 additions & 6 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,23 +68,46 @@ Currently on every commit we send hundreds of transactions, dozens of validator

Because the tests build absolutely everything in this repository they do take a significant amount of time to run. You may wish to simply push to a branch and have Github CI take care of the actual running of the tests.

To run the test simply have docker installed and run.
### Building the images

`bash tests/all-up-test.sh`
To run the tests, you'll need to have docker installed. First, run the following to build the `gravity`, `orchestrator`, and `ethereum` containers:

There are optional tests for specific features
`make e2e_build_images`

### Running the chains as a playground

There is a "sandbox" style test, which simply brings up the chain and allows you as the developer to perform whatever operations you want.

To interact with the ethereum side of the chain, use the JSON-RPC server located at `http://localhost:8545`. You may choose to use `foundry` or `hardhat` to make this easier.

To interact with the gravity module itself, you'll want to build the `gravity` module locally by running the following command.

`
cd module
make build
`

You can then use the binary in the build directory to interact with the Cosmos side of the chain. Check out the Cosmos documentation for more information on this.

### Other tests

To run all the integration tests (except the sandbox test above), use the following command.

`make e2e_slow_loris`

There are optional tests for specific features. Check out the `Makefile` for a list of all of them.

Valset stress changes the validating power randomly 25 times, in an attempt to break validator set syncing

`bash tests/all-up-test.sh VALSET_STRESS`
`make e2e_valset_stress`

Batch stress sends 300 transactions over the bridge and then 3 batches back to Ethereum. This code can do up to 10k transactions but Github Actions does not have the horsepower.

`bash tests/all-up-test.sh BATCH_STRESS`
`make e2e_batch_stress`

Validator out tests a validator that is not running the mandatory Ethereum node. This validator will be slashed and the bridge will remain functioning.

`bash tests/all-up-test.sh VALIDATOR_OUT`
`make e2e_validator_out`

# Developer guide

Expand Down

0 comments on commit 51b1f00

Please sign in to comment.