Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: gw_mainnet_v1 regression testing workflow #153

Merged
merged 2 commits into from
Jul 18, 2022

Conversation

ShookLyngs
Copy link
Contributor

@ShookLyngs ShookLyngs commented Jul 18, 2022

Overview

Description

The PR provides a mainnet_v1 regression testing workflow that can be triggered manually on GitHub.

Provide changes:

  • Add a regression testing workflow
  • Add root hooks to check total capacity spent of the run (for each account)
  • Add util functions to check networks, most test cases are disabled when running gw_mainnet_v1

Supported test cases

  • TestStatus
  • BlockInfo
  • sUDT-ERC20-Proxy

Details

New secrets

The PR provides a new GitHub workflow, which requires some new secrets:

  • GW_MAINNET_V1_PK1
  • GW_MAINNET_V1_PK2

Network identity

We used to identify current networking by checking network's chainId, but I think it's better to use enum and network.name.

Based on that idea, the PR provides a set of util functions (and enum values) to check the identity of current network by its name.

The new set of util functions is not perfect, if you think there's better way to do it, please let me know.

Right now, this is how we check the identity of current networking:

// check with predefined enum
if (isNetwork(Networks.GwMainnet_v1)) {
  return;
}

// check with specific check-function
if (isGwMainnetV1()) {
  return;
}

Total spent of the run

The PR provides a new test case to replace the network test case, which will print logs when all tests are done:

Total capacity changed in the test run:
0x966B30e576A4d6731996748B48Dd67C94eF29067 spent -1115.871750000000013888 pCKB (-1115871750000000013888 capacity)
0x4fEF21F1d42E0D23d72100aEFe84d555781c31BB spent -15.49854 pCKB (-15498540000000000000 capacity)
0x0C1EfCCa2Bcb65A532274f3eF24c044EF4ab6D73 spent +0.0 pCKB (0 capacity)

The logs above give us a clear view of how much capacity is spent in current run.

Although it may not perfectly reflect the actual cost in every situation (if we run the same test with the same set of accounts at the same time, the calculated info must be wrong), but I think logging it is better than doing nothing.

@ShookLyngs ShookLyngs changed the title feat: provide gw_mainnet_v1 regression testing workflow feat: gw_mainnet_v1 regression testing workflow Jul 18, 2022
contracts/utils/network.js Outdated Show resolved Hide resolved
contracts/utils/network.js Outdated Show resolved Hide resolved
contracts/test/sUDT-ERC20-Proxy.js Outdated Show resolved Hide resolved
@ShookLyngs ShookLyngs requested a review from Flouse July 18, 2022 06:17
@Flouse Flouse merged commit 837c6e8 into godwokenrises:develop Jul 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants