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

chore: chopsticks #650

Open
wants to merge 19 commits into
base: develop
Choose a base branch
from
Open

chore: chopsticks #650

wants to merge 19 commits into from

Conversation

Ad96el
Copy link
Member

@Ad96el Ad96el commented May 31, 2024

fixes #3252

Bye-bye flaky tests 👋

I am still not super happy with the typing of the tests. Any feedback would be great.

I also added a README.md where adding a new test case is briefly explained.

Additional tests against the develop state are also introduced. Any change to the current XCM configuration should be tested against the currently open channels.

The current design should be generic enough to test the XCM configuration against any chains. Additionally, any XCM version can be easily tested by adding a new test suite case.

@Ad96el Ad96el changed the title Ag chopsticks design chore: chopsticks Jun 3, 2024
@Ad96el Ad96el marked this pull request as ready for review June 21, 2024 12:21
@Ad96el Ad96el requested a review from ntn-x2 June 21, 2024 12:21
@Ad96el
Copy link
Member Author

Ad96el commented Jun 25, 2024

It might happen that that still errors are thrown by some concurrence issues regarding SQLite. We could either ignore those errors, since they are not part of the testing logic, or run the test not in parallel, which would result into a slower CI (currently 10 to maybe 15 mins).

Resolving those issues seems challenging since they come directly from chopsticks.

Ignoring the errors could result in some unforeseen side effects, which could give false positive tests.

Manually rerunning the tests is also an option.

@Ad96el Ad96el mentioned this pull request Jul 12, 2024
2 tasks
Copy link
Member

@ntn-x2 ntn-x2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will definitely give it another review once the comments are addressed and the conflicts with develop are resolved. In general, I think the new approach is viable, as long as it is not too much focused on our current set of tests but could be expanded with relatively little effort, which is the main goal of this PR, besides improving test reliability. Hence I would suggest to make all the different components more generic. I have not gone into the test logic itself yet, and I'll keep that for my new review!

@@ -68,16 +68,20 @@ integration-tests:
image: paritytech/ci-unified:bullseye-1.70.0
stage: test
variables:
CI: "true"
SPIRITNET_BLOCK_NUMBER: 6390611
Copy link
Member

@ntn-x2 ntn-x2 Sep 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move these to the relevant part of our new GH workflow (when merging conflicts with develop).

SPIRITNET_BLOCK_NUMBER: 6390611
HYDRADX_BLOCK_NUMBER: 5235787
POLKADOT_BLOCK_NUMBER: 21010819
SPIRITNET_WASM_OVERRIDE: "../../target/debug/wbuild/spiritnet-runtime/spiritnet_runtime.compact.compressed.wasm"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No compact WASM is generated anymore, so this should refer to the regular, uncompressed, uncompacted one.

},
"scripts": {
"ts-check": "tsc --noEmit",
"lint": "eslint src && prettier --check src",
"lint:fix": "eslint --fix src && prettier --write src",
"clean": "rm -rf ./db",
"test": "LOG_LEVEL=error vitest",
"test:CI": "vitest --bail 0 --no-file-parallelism"
"test": "LOG_LEVEL=error vitest"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely lower priority, but we should investigate how to make the tests run faster without them throw errors. Our new GH pipeline currently takes almost 1h, but I have no idea if this refactoring will make tests go faster or slower.

# e2e Chopsticks tests

This project is a set of end-to-end tests for the KILT protocol against other parachains.
Other functionalities such as a creation of DID can be easy inserted.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Other functionalities such as a creation of DID can be easy inserted.
Other functionalities such as a creation of DID can be easily added.

POLKADOT_PORT=
SPIRITNET_WS=
SPIRITNET_PORT=
# Those env variables are mandatory for the tests to work.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Those env variables are mandatory for the tests to work.
# These env variables are mandatory for the tests to work.

@@ -37,12 +44,13 @@ export function assignKiltTokensToAccounts(addr: string[], balance: bigint = ini
}
}

// Sibling Sovereign Account
export const siblingSovereignAccount = '5Eg2fntQqFi3EvFWAf71G66Ecjjah26bmFzoANAeHFgj9Lia'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would also be better to group "required" info for each parachain, such as its sibling account and para ID into its own object with its own defined type. Everything else is extra, which can extend the basic object, kinda like you did for the tests setup.

/*
* Object with all the chain configurations.
*/
export const all: ChainConfigs = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this really needed?

/*
* Get an environment variable and throw an error if it is not set.
*/
function getEnvVariable(name: string): string {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then I would rename this function to:

Suggested change
function getEnvVariable(name: string): string {
function getRequiredEnvVariable(name: string): string {

*/
export async function setupNetwork(
relayChain: SetupOption,
sender: SetupOption,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This as well could involve configuring more than a single receiver chain, so it should probably be generalized.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you need to treat the realy chain differently because of a different function name, then I would simply have the relay chain argument and a list of chains to all connect horizontally with each other and vertically with the relaychain. As far as I can see, you don't need to know who the sender is here.

@@ -28,11 +37,7 @@ export function setGovernance(addr: string[]) {

/// Spiritnet ParaId
export const paraId = 2086
export const KILT = { Concrete: { parents: 0, interior: 'Here' } }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The naming of this could be improved. What this is, is the Here location within the context of the chain itself. So perhaps just call it HERE?

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