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: ⏫ upgrade to Polkadot SDK stable2409 #228

Merged
merged 67 commits into from
Oct 15, 2024
Merged
Changes from 1 commit
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
2eff08b
refactor: :art: moved runtime apis into their own file
TDemeco Sep 27, 2024
303feb3
fix: :arrow_up: fix upgrade to polkadot-sdk v1.10.0
TDemeco Sep 27, 2024
e5ba5bd
Merge branch 'main' into update/polkadot-sdk-1.10.0
TDemeco Sep 27, 2024
3e4328d
fix: :bug: add removed runtime api `get_worst_case_scenario_slashable…
TDemeco Sep 27, 2024
3605611
fix: :bug: add missing generic in storage providers runtime api
TDemeco Sep 27, 2024
3659377
chore: :label: run typegen
TDemeco Sep 27, 2024
c1219f1
style: :rotating_light: run cargo fmt
TDemeco Sep 27, 2024
5ac0258
fix: :art: fix cargo clippy
TDemeco Sep 28, 2024
e82a113
Merge branch 'main' into update/polkadot-sdk-1.10.0
TDemeco Sep 28, 2024
91ae601
fix: :ambulance: fix mocked relay chain randomness
TDemeco Sep 28, 2024
97c0b64
style: :rotating_light: run cargo fmt
TDemeco Sep 28, 2024
787d1df
chore: :rotating_light: temporary remove unused import (until v1.13.0)
TDemeco Sep 28, 2024
9653a4e
Merge branch 'main' into update/polkadot-sdk-1.10.0
TDemeco Sep 28, 2024
6fb8bd4
fix: :adhesive_bandage: update `query_earliest_file_volunteer_tick` r…
TDemeco Sep 28, 2024
cde6b90
fix: :ambulance: fix issues with merge from main
TDemeco Sep 28, 2024
570e548
style: :rotating_light: run cargo fmt
TDemeco Sep 28, 2024
9bb33cc
feat: :package: initial update to polkadot sdk v1.11.0
TDemeco Sep 30, 2024
e28f09b
feat: :arrow_up: finish upgrade to polkadot sdk v1.11.0
TDemeco Sep 30, 2024
2947b01
Merge branch 'main' into update/polkadot-sdk-1.10.0
TDemeco Sep 30, 2024
5c07140
chore: :label: run typegen
TDemeco Sep 30, 2024
f86f2c1
Merge branch 'update/polkadot-sdk-1.10.0' into update/polkadot-sdk-1.…
TDemeco Sep 30, 2024
f4964fc
chore: :label: run typegen
TDemeco Sep 30, 2024
f85735d
fix: :white_check_mark: fix node tests after rebenchmark of balances …
TDemeco Oct 1, 2024
b7090b5
feat: :arrow_up: update to Polkadot SDK v1.12.0
TDemeco Oct 3, 2024
889fa3c
feat: :arrow_up: update to Polkadot SDK v1.13.0
TDemeco Oct 4, 2024
9587713
fix: :arrow_up: finish upgrading to Polkadot SDK v1.13.0
TDemeco Oct 4, 2024
5142fdd
Merge branch 'main' into update/polkadot-sdk-v1.13.0
TDemeco Oct 4, 2024
4eb7f24
fix: :bug: add missing imports (and run typegen)
TDemeco Oct 4, 2024
73a343f
fix: :arrow_down: rollback polkadotjs api dependencies
TDemeco Oct 4, 2024
090bfa6
chore: :label: rerun pnpm typegen
TDemeco Oct 4, 2024
ff67efb
feat: :construction: start upgrade to Polkadot SDK 1.14.0
TDemeco Oct 7, 2024
b857c6d
fix: :rotating_light: format and lint
TDemeco Oct 7, 2024
c6157a0
fix: :rotating_light: remove trailing whitespace
TDemeco Oct 7, 2024
91d7b73
Merge branch 'update/polkadot-sdk-v1.13.0' into update/polkadot-sdk-v…
TDemeco Oct 7, 2024
550ccd0
feat: :arrow_up: upgrade to Polkadot SDK v1.14.0
TDemeco Oct 7, 2024
d2b13b2
Merge branch 'main' into update/polkadot-sdk-v1.14.0
TDemeco Oct 7, 2024
830357a
Merge branch 'main' into update/polkadot-sdk-v1.14.0
TDemeco Oct 7, 2024
3ff32ca
chore: :label: run typegen
TDemeco Oct 7, 2024
79435a7
fix: :rotating_light: run cargo fmt
TDemeco Oct 7, 2024
9c320c8
docs: :fire: remove wrong license docs
TDemeco Oct 7, 2024
a9e2dc9
feat: :arrow_up: update Polkadot SDK to stable2407
TDemeco Oct 7, 2024
a6fc3b1
Merge branch 'main' into update/polkadot-sdk-stable2407
TDemeco Oct 7, 2024
5c6a849
chore: :label: run typegen
TDemeco Oct 7, 2024
23ad7e9
Merge branch 'main' into update/polkadot-sdk-stable2407
TDemeco Oct 8, 2024
7b55ca3
chore: :label: run typegen
TDemeco Oct 8, 2024
db2fb69
fix: :white_check_mark: fix bsp-threshold test
TDemeco Oct 8, 2024
b59cf44
fix: :green_heart: try to fix tests in CI
TDemeco Oct 8, 2024
39439f7
fix: :white_check_mark: try again to fix the integration tests in the CI
TDemeco Oct 8, 2024
be86ef7
test: :test_tube: fix batch file confirm storing test
TDemeco Oct 9, 2024
d099669
fix: :white_check_mark: remove unused imports from volunteer test
TDemeco Oct 9, 2024
3224437
fix: :white_check_mark: add wait for file in file storage success and…
TDemeco Oct 9, 2024
70dde30
fix: :white_check_mark: wait more time for bsp volunteering
TDemeco Oct 9, 2024
c9744a3
test: :test_tube: fix a few issues
TDemeco Oct 9, 2024
e2d8a3f
fix: :white_check_mark: maybe (hopefully) finish fixing tests
TDemeco Oct 9, 2024
cc9d406
fix: :white_check_mark: fix new bsps not catching up to the tip of th…
TDemeco Oct 9, 2024
ad40421
test: :white_check_mark: disconnect api
TDemeco Oct 9, 2024
a225b39
test: :bug: fix timeout bug
TDemeco Oct 10, 2024
77b8978
test: :white_check_mark: add initialization wait + fix single bsp ini…
TDemeco Oct 10, 2024
31bed63
chore: :rotating_light: removed unused variables
TDemeco Oct 10, 2024
fb316e5
test: :bug: initialised bsp net now correctly waits for bsp to store …
TDemeco Oct 10, 2024
200cf20
test: :bug: add missing wait for chain tip sync on test
TDemeco Oct 10, 2024
be63330
fix: :adhesive_bandage: Remove sleeps from single tests, in favour of…
ffarall Oct 10, 2024
068144f
feat: :construction: start update to stable2409
TDemeco Oct 10, 2024
21c8482
Merge branch 'main' into update/polkadot-sdk-stable2409
TDemeco Oct 14, 2024
d3409cc
feat: :arrow_up: update to Polkadot SDK stable2409
TDemeco Oct 14, 2024
cb512a5
Merge branch 'main' into update/polkadot-sdk-stable2409
TDemeco Oct 14, 2024
f8c8536
chore: :label: run typegen
TDemeco Oct 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
test: 🐛 fix timeout bug
TDemeco committed Oct 10, 2024
commit a225b39cc8dcf11ce19b2fb0ee859e9a13dcffe9
16 changes: 10 additions & 6 deletions test/util/bspNet/waits.ts
Original file line number Diff line number Diff line change
@@ -30,7 +30,8 @@ export const waitForBspVolunteer = async (api: ApiPromise, checkQuantity?: numbe
const matches = await assertExtrinsicPresent(api, {
module: "fileSystem",
method: "bspVolunteer",
checkTxPool: true
checkTxPool: true,
timeout: 100
});
if (checkQuantity) {
invariant(
@@ -68,8 +69,8 @@ export const waitForBspVolunteerWithoutSealing = async (
api: ApiPromise,
checkQuantity?: number
) => {
const iterations = 41;
const delay = 50;
const iterations = 100;
const delay = 100;

// To allow node time to react on chain events
for (let i = 0; i < iterations; i++) {
@@ -78,7 +79,8 @@ export const waitForBspVolunteerWithoutSealing = async (
const matches = await assertExtrinsicPresent(api, {
module: "fileSystem",
method: "bspVolunteer",
checkTxPool: true
checkTxPool: true,
timeout: 100
});
if (checkQuantity) {
invariant(
@@ -120,7 +122,8 @@ export const waitForBspStored = async (api: ApiPromise, checkQuantity?: number)
const matches = await assertExtrinsicPresent(api, {
module: "fileSystem",
method: "bspConfirmStoring",
checkTxPool: true
checkTxPool: true,
timeout: 100
});
if (checkQuantity) {
invariant(
@@ -163,7 +166,8 @@ export const waitForBspStoredWithoutSealing = async (api: ApiPromise, checkQuant
const matches = await assertExtrinsicPresent(api, {
module: "fileSystem",
method: "bspConfirmStoring",
checkTxPool: true
checkTxPool: true,
timeout: 100
});
if (checkQuantity) {
invariant(

Unchanged files with check annotations Beta

}};
// Handle boolean type
($condition:expr, $error_msg:expr, $error_type:path, bool) => {{
if !$condition {

Check warning on line 71 in pallets/file-system/src/utils.rs

GitHub Actions / Check lint with clippy

the use of negated comparison operators on partially ordered types produces code that is hard to read and refactor, please consider using the `partial_cmp` method instead, to make it clear that the two values could be incomparable

Check warning on line 71 in pallets/file-system/src/utils.rs

GitHub Actions / Check lint with clippy

the use of negated comparison operators on partially ordered types produces code that is hard to read and refactor, please consider using the `partial_cmp` method instead, to make it clear that the two values could be incomparable
#[cfg(test)]
unreachable!($error_msg);
// Iterates and tries to send file to peer.
// Breaks loop after first successful attempt since all peer ids belong to the same provider.
for peer_id in peer_ids {

Check warning on line 194 in node/src/tasks/user_sends_file.rs

GitHub Actions / Check lint with clippy

this loop never actually loops
debug!(target: LOG_TARGET, "Attempting to send chunks of file key {:?} to peer {:?}", file_key, peer_id);
for chunk_id in 0..chunk_count {
await api.wait.bspVolunteer();
// Wait for the bsp to send the first confirm storing extrinsic
await api.wait.bspStoredInTxPool();

Check failure on line 19 in test/suites/integration/bsp/automatic-tipping.test.ts

GitHub Actions / Run BSPNet Tests (1)

Confirm storing failure results in increased tip

Error [ERR_TEST_FAILURE]: Invariant failed: Failed to detect BSP storage confirmation extrinsic in txPool after 5s at async Promise.all (index 0) { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: Error: Invariant failed: Failed to detect BSP storage confirmation extrinsic in txPool after 5s at invariant (file:///home/runner/work/storage-hub/storage-hub/node_modules/.pnpm/tiny-invariant@1.3.3/node_modules/tiny-invariant/dist/esm/tiny-invariant.js:12:11) at Module.waitForBspStoredWithoutSealing (/home/runner/work/storage-hub/storage-hub/test/util/bspNet/waits.ts:180:7) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async TestContext.<anonymous> (/home/runner/work/storage-hub/storage-hub/test/suites/integration/bsp/automatic-tipping.test.ts:19:7) at async Test.run (node:internal/test_runner/test:931:9) at async Promise.all (index 0) at async Suite.run (node:internal/test_runner/test:1295:7) at async startSubtestAfterBootstrap (node:internal/test_runner/harness:289:3) }
// Wait for the bsp to send all the confirm retries
await sleep(6000);
const lastTickResult = await userApi.call.proofsDealerApi.getLastTickProviderSubmittedProof(
userApi.shConsts.DUMMY_BSP_ID
);
assert(lastTickResult.isOk);

Check failure on line 31 in test/suites/integration/bsp/challenge-cycle.test.ts

GitHub Actions / Run BSPNet Tests (3)

BSP is challenged and correctly submits proof

[Error [ERR_TEST_FAILURE]: The expression evaluated to a falsy value: it("BSP is challenged and correctly submits proof", async () => { console.log(userApi.consts.system.version.specName.toString()); // Calculate the next challenge tick for the BSP. // We first get the last tick for which the BSP submitted a proof. const lastTickResult = await userApi.call.proofsDealerApi.getLastTickProviderSubmittedProof( userApi.shConsts.DUMMY_BSP_ID ); assert(lastTickResult.isOk); const lastTickBspSubmittedProof = lastTickResult.asOk.toNumber(); // Then we get the challenge period for the BSP. const challengePeriodResult = await userApi.call.proofsDealerApi.getChallengePeriod( userApi.shConsts.DUMMY_BSP_ID ); assert(challengePeriodResult.isOk); const challengePeriod = challengePeriodResult.asOk.toNumber(); // Then we calculate the next challenge tick. const nextChallengeTick = lastTickBspSubmittedProof + challengePeriod; // Calculate how many blocks to advance until next challenge tick. const currentBlockNumber = (await userApi.query.system.number()).toNumber(); const blocksToAdvance = nextChallengeTick - currentBlockNumber; // Advance blocksToAdvance blocks. for (let i = 0; i < blocksToAdvance; i++) { await userApi.sealBlock(); } // Wait for task to execute and seal one more block. // In this block, the BSP should have submitted a proof. await sleep(500); await userApi.sealBlock(); // Assert for the the event of the proof successfully submitted and verified. await userApi.assert.eventPresent("proofsDealer", "ProofAccepted"); }) ] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value: it("BSP is challenged and correctly submits proof", async () => { console.log(userApi.consts.system.version.specName.toString()); // Calculate the next challenge tick for the BSP. // We first get the last tick for which the BSP submitted a proof. const lastTickResult = await userApi.call.proofsDealerApi.getLastTickProviderSubmittedProof( userApi.shConsts.DUMMY_BSP_ID ); assert(lastTickResult.isOk); const lastTickBspSubmittedProof = lastTickResult.asOk.toNumber(); // Then we get the challenge period for the BSP. const challengePeriodResult = await userApi.call.proofsDealerApi.getChallengePeriod( userApi.shConsts.DUMMY_BSP_ID ); assert(challengePeriodResult.isOk); const challengePeriod = challengePeriodResult.asOk.toNumber(); // Then we calculate the next challenge tick. const nextChallengeTick = lastTickBspSubmittedProof + challengePeriod; // Calculate how many blocks to advance until next challenge tick. const currentBlockNumber = (await userApi.query.system.number()).toNumber(); const blocksToAdvance = nextChallengeTick - currentBlockNumber; // Advance blocksToAdvance blocks. for (let i = 0; i < blocksToAdvance; i++) { await userApi.sealBlock(); } // Wait for task to execute and seal one more block. // In this block, the BSP should have submitted a proof. await sleep(500); await userApi.sealBlock(); // Assert for the the event of the proof successfully submitted and verified. await userApi.assert.eventPresent("proofsDealer", "ProofAccepted"); }) at TestContext.<anonymous> (/home/runner/work/storage-hub/storage-hub/test/suites/integration/bsp/challenge-cycle.test.ts:31:7) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async Test.run (node:internal/test_runner/test:931:9) at async Suite.processPendingSubtests (node:internal/test_runner/test:629:7) { generatedMessage: true, code: 'ERR_ASSERTION', actual: false, expected: true, operator: '==' } }
const lastTickBspSubmittedProof = lastTickResult.asOk.toNumber();
// Then we get the challenge period for the BSP.
const challengePeriodResult = await userApi.call.proofsDealerApi.getChallengePeriod(
const lastTickResult = await userApi.call.proofsDealerApi.getLastTickProviderSubmittedProof(
userApi.shConsts.DUMMY_BSP_ID
);
assert(lastTickResult.isOk);

Check failure on line 71 in test/suites/integration/bsp/challenge-cycle.test.ts

GitHub Actions / Run BSPNet Tests (3)

BSP fails to submit proof and is marked as slashable

[Error [ERR_TEST_FAILURE]: The expression evaluated to a falsy value: it("BSP is challenged and correctly submits proof", async () => { console.log(userApi.consts.system.version.specName.toString()); // Calculate the next challenge tick for the BSP. // We first get the last tick for which the BSP submitted a proof. const lastTickResult = await userApi.call.proofsDealerApi.getLastTickProviderSubmittedProof( userApi.shConsts.DUMMY_BSP_ID ); assert(lastTickResult.isOk); const lastTickBspSubmittedProof = lastTickResult.asOk.toNumber(); // Then we get the challenge period for the BSP. const challengePeriodResult = await userApi.call.proofsDealerApi.getChallengePeriod( userApi.shConsts.DUMMY_BSP_ID ); assert(challengePeriodResult.isOk); const challengePeriod = challengePeriodResult.asOk.toNumber(); // Then we calculate the next challenge tick. const nextChallengeTick = lastTickBspSubmittedProof + challengePeriod; // Calculate how many blocks to advance until next challenge tick. const currentBlockNumber = (await userApi.query.system.number()).toNumber(); const blocksToAdvance = nextChallengeTick - currentBlockNumber; // Advance blocksToAdvance blocks. for (let i = 0; i < blocksToAdvance; i++) { await userApi.sealBlock(); } // Wait for task to execute and seal one more block. // In this block, the BSP should have submitted a proof. await sleep(500); await userApi.sealBlock(); // Assert for the the event of the proof successfully submitted and verified. await userApi.assert.eventPresent("proofsDealer", "ProofAccepted"); }) ] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value: it("BSP is challenged and correctly submits proof", async () => { console.log(userApi.consts.system.version.specName.toString()); // Calculate the next challenge tick for the BSP. // We first get the last tick for which the BSP submitted a proof. const lastTickResult = await userApi.call.proofsDealerApi.getLastTickProviderSubmittedProof( userApi.shConsts.DUMMY_BSP_ID ); assert(lastTickResult.isOk); const lastTickBspSubmittedProof = lastTickResult.asOk.toNumber(); // Then we get the challenge period for the BSP. const challengePeriodResult = await userApi.call.proofsDealerApi.getChallengePeriod( userApi.shConsts.DUMMY_BSP_ID ); assert(challengePeriodResult.isOk); const challengePeriod = challengePeriodResult.asOk.toNumber(); // Then we calculate the next challenge tick. const nextChallengeTick = lastTickBspSubmittedProof + challengePeriod; // Calculate how many blocks to advance until next challenge tick. const currentBlockNumber = (await userApi.query.system.number()).toNumber(); const blocksToAdvance = nextChallengeTick - currentBlockNumber; // Advance blocksToAdvance blocks. for (let i = 0; i < blocksToAdvance; i++) { await userApi.sealBlock(); } // Wait for task to execute and seal one more block. // In this block, the BSP should have submitted a proof. await sleep(500); await userApi.sealBlock(); // Assert for the the event of the proof successfully submitted and verified. await userApi.assert.eventPresent("proofsDealer", "ProofAccepted"); }) at TestContext.<anonymous> (/home/runner/work/storage-hub/storage-hub/test/suites/integration/bsp/challenge-cycle.test.ts:71:7) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async Test.run (node:internal/test_runner/test:931:9) at async Suite.processPendingSubtests (node:internal/test_runner/test:629:7) { generatedMessage: true, code: 'ERR_ASSERTION', actual: false, expected: true, operator: '==' } }
const lastTickBspSubmittedProof = lastTickResult.asOk.toNumber();
// Then we get the challenge period for the BSP.
const challengePeriodResult = await userApi.call.proofsDealerApi.getChallengePeriod(
"fileSystem",
"SpStopStoringInsolventUser"
);
strictEqual(

Check failure on line 710 in test/suites/integration/bsp/debt-collection.test.ts

GitHub Actions / Run BSPNet Tests (4)

BSP correctly deletes all files from an insolvent user

[Error [ERR_TEST_FAILURE]: There should be three stop storing for insolvent user events] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: AssertionError [ERR_ASSERTION]: There should be three stop storing for insolvent user events at TestContext.<anonymous> (/home/runner/work/storage-hub/storage-hub/test/suites/integration/bsp/debt-collection.test.ts:710:9) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async Test.run (node:internal/test_runner/test:931:9) at async Suite.processPendingSubtests (node:internal/test_runner/test:629:7) { generatedMessage: false, code: 'ERR_ASSERTION', actual: 2, expected: 3, operator: 'strictEqual' } }
spStopStoringForInsolventUserEvents.length,
3,
"There should be three stop storing for insolvent user events"