Skip to content

Commit

Permalink
Shorten execution time of E2E tests (#1360)
Browse files Browse the repository at this point in the history
* Provide epoch size to consensus tests

* Fix failing tests

* Rename tests

* Fix comment

* Rely on epoch sizes in TestE2E_Bridge_ChangeVotingPower

* Move getCheckpointBlockNumber to helpers_test

* Introduce waitForRootchainEpoch helper fn

* Consolidate deposit and withdrawal erc20 with multiple commitments per epoch tests

* Consolidate deposit and withdrawals transactions and multiple commitments into single test

* Minor improvements to documentation

* Rootchain fund command minor change

* Try to stabilize ERC 20 deposit and withdrawal test

* Test hardening cont.

* Consolidate basic consensus and sync tests into the one

* Stop timer and create single ticker instance for recurrent checking
  • Loading branch information
Stefan-Ethernal committed Apr 10, 2023
1 parent f23eb43 commit f6cc66a
Show file tree
Hide file tree
Showing 11 changed files with 307 additions and 269 deletions.
3 changes: 1 addition & 2 deletions command/rootchain/fund/fund.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package fund

import (
"fmt"
"math/big"

"github.com/spf13/cobra"
"github.com/umbracle/ethgo"
Expand Down Expand Up @@ -105,7 +104,7 @@ func runCommand(cmd *cobra.Command, _ []string) {
fundAddr := ethgo.Address(validatorAcc)
txn := &ethgo.Transaction{
To: &fundAddr,
Value: big.NewInt(1000000000000000000),
Value: ethgo.Ether(100),
}

receipt, err := txRelayer.SendTransactionLocal(txn)
Expand Down
25 changes: 15 additions & 10 deletions consensus/polybft/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,17 @@ It has native support for running bridge, which enables running cross-chain tran
5. Deploy and initialize rootchain contracts - this command deploys rootchain smart contracts and initializes them. It also updates manifest configuration with rootchain contract addresses and rootchain default sender address.

```bash
polygon-edge rootchain init-contracts
--data-dir <local_storage_secrets_path> | [--config <cloud_secrets_manager_config_path>]
[--manifest ./manifest.json]
[--json-rpc http://127.0.0.1:8545]
polygon-edge rootchain init-contracts \
--deployer-key <hex_encoded_rootchain_account_private_key> \
[--manifest ./manifest.json] \
[--json-rpc http://127.0.0.1:8545] \
[--test]
```

6. Create chain configuration - this command creates chain configuration, which is needed to run a blockchain

```bash
polygon-edge genesis --block-gas-limit 10000000 --epoch-size 10
polygon-edge genesis --block-gas-limit 10000000 --epoch-size 10 \
[--consensus polybft] [--bridge-json-rpc <rootchain_ip_address>] [--manifest ./manifest.json]
```

Expand All @@ -75,18 +75,23 @@ It has native support for running bridge, which enables running cross-chain tran
8. Run (child chain) cluster, consisting of 4 Edge clients in this particular example

```bash
polygon-edge server --data-dir ./test-chain-1 --chain genesis.json --grpc-address :5001 --libp2p :30301 --jsonrpc :9545 --seal --log-level DEBUG
polygon-edge server --data-dir ./test-chain-1 --chain genesis.json --grpc-address :5001 --libp2p :30301 --jsonrpc :9545 \
--seal --log-level DEBUG

polygon-edge server --data-dir ./test-chain-2 --chain genesis.json --grpc-address :5002 --libp2p :30302 --jsonrpc :10002 --seal --log-level DEBUG
polygon-edge server --data-dir ./test-chain-2 --chain genesis.json --grpc-address :5002 --libp2p :30302 --jsonrpc :10002 \
--seal --log-level DEBUG

polygon-edge server --data-dir ./test-chain-3 --chain genesis.json --grpc-address :5003 --libp2p :30303 --jsonrpc :10003 --seal --log-level DEBUG
polygon-edge server --data-dir ./test-chain-3 --chain genesis.json --grpc-address :5003 --libp2p :30303 --jsonrpc :10003 \
--seal --log-level DEBUG

polygon-edge server --data-dir ./test-chain-4 --chain genesis.json --grpc-address :5004 --libp2p :30304 --jsonrpc :10004 --seal --log-level DEBUG
polygon-edge server --data-dir ./test-chain-4 --chain genesis.json --grpc-address :5004 --libp2p :30304 --jsonrpc :10004 \
--seal --log-level DEBUG
```

It is possible to run child chain nodes in "relayer" mode. It allows automatic execution of deposit events on behalf of users.
In order to start node in relayer mode, it is necessary to supply `--relayer` flag:

```bash
polygon-edge server --data-dir ./test-chain-1 --chain genesis.json --grpc-address :5001 --libp2p :30301 --jsonrpc :9545 --seal --log-level DEBUG --relayer
polygon-edge server --data-dir ./test-chain-1 --chain genesis.json --grpc-address :5001 --libp2p :30301 --jsonrpc :9545 \
--seal --log-level DEBUG --relayer
```
1 change: 1 addition & 0 deletions consensus/polybft/contractsapi/bindings-gen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ func main() {
"RootERC20",
gensc.RootERC20,
[]string{
"balanceOf",
"approve",
"mint",
},
Expand Down
16 changes: 16 additions & 0 deletions consensus/polybft/contractsapi/contractsapi.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions consensus/polybft/contractsapi/gen_sc_data.go

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions e2e-polybft/e2e/allowlist_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ contract Sample {
}
*/

func TestAllowList_ContractDeployment(t *testing.T) {
func TestE2E_AllowList_ContractDeployment(t *testing.T) {
// create two accounts, one for an admin sender and a second
// one for a non-enabled account that will switch on-off between
// both enabled and non-enabled roles.
Expand Down Expand Up @@ -139,7 +139,7 @@ func TestAllowList_ContractDeployment(t *testing.T) {
}
}

func TestAllowList_Transactions(t *testing.T) {
func TestE2E_AllowList_Transactions(t *testing.T) {
// create two accounts, one for an admin sender and a second
// one for a non-enabled account that will switch on-off between
// both enabled and non-enabled roles.
Expand Down
Loading

0 comments on commit f6cc66a

Please sign in to comment.