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

support upgrade #85

Merged
merged 5 commits into from
Dec 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 11 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,17 @@
"sourceMaps": true,
"cwd": "${workspaceRoot}",
"protocol": "inspector"
},
{
"type": "node",
"request": "launch",
"name": "Debug Current Test File",
"autoAttachChildProcesses": true,
"skipFiles": ["<node_internals>/**", "**/node_modules/**"],
"program": "${workspaceRoot}/node_modules/vitest/vitest.mjs",
"args": ["run", "${relativeFile}"],
"smartStep": true,
"console": "integratedTerminal"
}
]
}
6 changes: 3 additions & 3 deletions e2e/__snapshots__/author.test.ts.snap

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion e2e/__snapshots__/chain.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ exports[`chain rpc > getXXX 12`] = `
"block": {
"extrinsics": [
"0x280401000b207230268401",
"0x352c04a000e902d94d2e18b4a8a88d9b21cb03bbe4df4431a93718c2c602c13043d595e8b8735a3e910b0021c0ecb97a4c7cc86aa22eeb2db02b60829551cf67bdc490f0948ac009f6c0801257ffee8b177dab50e7b537ccbd2d1ffcd8a0068a08d57a92ce367e4e0f52e1080661757261209aa0470800000000056175726101013aefb1326d057c6d6d174f1565404a8b1a6ab45c941fa89bd8a56ac401226d1b0d96a6e436d7021dd097d316f07fe554fc35c92e1966e8a9b6ebc4de15e57886901e070049416764844ff0d8bad851e8abe686dff9dd2de78621180ef8e9f99bb7a480f10000500050c45e414cb008e0e61e46722aa60abdd67280bd82018ee510cf360e1a460326ef53dde570b25b9e835fc045551ffe4e88fe08c85e77dfdb8adb10f78f10a5df8742c5458401df75b8601e1b21393fc7772afc0788aa25e88713977d61495fabb2550af5c835c45ee678799d3eff024253b90e84927cc6807ed4bd40e4853d40a1fd44e7128aa75ded4660543dc48918f507ac56fbef7d9745035f04b49d95320d9021994c850f25b8e385f902000030000080000008000000000010000000100005000000050000000a0000000a000000000050000000100000e8764817000000040000000400000000000000000000000000000000000000000000000000000000000000000000000800000000200000040000000400000000001000b0040000000000000000000014000000040000000400000000000000010100000000060000006400000002000000c8000000020000001900000000000000020000000200000000c817a804000000150180001480451c10fa62e420ae9678ed9e9f7f19e3e39be3a38ed4e3fe314234f3e6fed31780d3dac5ff6c2ce4154f56c20524e2dd095001f40b34d7c8afca34011128bc86201501800110800641aad9b51d5b63bd72bc66e847b8b6b6506b467a5a2cbf21d34ca91182cf72800ebe650369ce0e3ce85b22816181f598cc6ecf7a3b22314357ab4181b9ccb867150180011080ace5323aee784b03389c0e2cc68d81973f8fa26d395f333ecad7399271c781e1808e5db75be813c05205986cbd6fdede707a4d26816063a41eb42ebc262c734fad1d028004648086a9239b72237f5bf119e2a880c32f5866460632700509cb874c60f67fe815ea80f6f6801e4b41e2e6d8ec194dba122bfb9eb33feb2545ef5144cea79551f7cc5280c629a7e712d763fe83b35d2a082430af6737a89f23219c0eb3051c83bc5af5ad80fed5ecd6097308a6540f8cf31aeaad186e6898d2ecc0e623767c521c70e399531501800804809f3ada68c357b5e0a3ebb39ef181acfa9943af4725c244330a4b2c60837612e88082ad3fbdf392429afeacc70177704b760bb145547c1f152e1fcf651916b43820dc8008208042793f557c1d003b647e2eda79c2b5088c7d8cab2e82c1dcc87f4343cca91ae4485ead6eef5c4b1c68eaa71ea17a02d9de0400a102801017806ad8bda250a43737b26933c1b7bebe6f4fe689b2888ff5ab4833d7394853350f8038f5c136db5bdb74d6a62722e6ea23af4fe820eb7fe28dee3a5f76d637dd3376803419c1ea3c5c7873325866f82a3d4bd7d3f222733227fcf3af1423fed4781c998065a1214a991ac85d93f38385d6f52af7b4ddcf56e589fcb92c8d9e8f27291c92805c5a7c2cdb53c4196aff4e5ce6da4b8d22a62c80db5ef5d0940ae4c1a4322b55990180210280de38445d825563f8e218255a417c16971afa85b4f2ef18fbe08fbc5b976dc0d6801a2ff24096295cfccf1adda80b8dfffe380b9f3b54d7a3cdb67864a4655e62968022a699b2cc90a6654c84163d2a498506b192afe7cd9777227e5288e8ff069c0f150180400180ebebd1a1cd0bbc6714b7fb0ac854cca5a4c4e34e69485da48be3c8087b56e09b80128645c79ca6581c248a412fd7b8bc532a187600e6e1cc20c915538ba4df6a79450780ffbe80d9302a505e2b1ac931f539aed33bf791d1982906ae64c7197324044f191e9bca80972cd2f703f9c94fd516e14b7013c6f1545095855b6c4b36f21d89dad30aa54d80b2495ce4d07001927bb0857611f8d3a1449e791d0b010e3861c32dec0c44179680f5929c8ef9b0ac6ec8a529c91348d8cd6c169920dd37d055544a6c31c53b11e380402a0bf7ff07cee790d9cc065fc138ff6afa7db016d898d65b2b716af354c6f68042aef1dafffd1d9debbb8e6c4eb48b5c141ddf0aad2b0f3f4ddf53e6b38e65c080b31fa0392c1abdce1aa29d1544c94634ecab87ecaba6409db33aaa7621992a8280b1f4de7c3ac5665016d561a60659cd2d8f2d3e0a97e2ea9749279bd8e35eb1f180816ac87a2893694016b21768137a76ea459190ea0fc3c645d85e1a3d4eb194fe802e563b43e7334454c841953424be8c2b7a1c3295dbc391045cb6b88388ad5e7080b1ed3b02e5989b7d134ca056c778f1f5b6ffd377b2d8064483da6e94b82b0e40800cb3299c44a5db8fdcb4932e1b6ab0385d6ef1c9f8d85e0a75b787b6f4fd6c3c805a44c30e2676dc2d4c17451f51d9502e85064387999f366e6f3d404509a7780f80d6788ca71c6aabe421c352027acdb9532563dc5f1b25e6154b721f431e9990edf1019d0da05ca59913bc38a8630590f2627c154080834dda0ba5adf00d798e981a28a13e728cf83e35aefc87318440a61869f724474c5f0a351b6a99a5b21324516e668bb86a570400505f0e7b9012096b41c4eb3aaf947f6ea4290800007c7700e67da63472835bb0b737093a19ad4c63f5a4efb16ffa83d00700000400ec9e207f03cfdce586301014700e2c25931040505f0e7b9012096b41c4eb3aaf947f6ea4290800004c5f0ec2d17a76153ff51817f12d9cfc3c7f040085049e710b30bd2eab0352ddcc26417aa1945fc180699a53b51a9709a3a86039c49b5ef278e9fc244dae27e1a0380c91bff5b0488580c0d4096d94e724b8e86f952e5456c7253776de04c405582d2c350ee172d3eaa77c77081e0bfde17b36573208a06cb5cfba6b63f5a4efb16ffa83d00700000402803d0ae0b8f6832e8fabf0ec62521c2487c58b69eb97060faa8059b00ff6b7262d505f0e7b9012096b41c4eb3aaf947f6ea4290800004c5f03c716fb8fff3de61a883bb76adb34a20400806c8122e0f7f786071d6a51b330d612eccdcbe8d8f79936accabd640506dffdf380a6abfb72ed49b586829cca4ce631c092d45a017ab0d68288d308873025cfe5d280521b868fc212b25f021984cf02ced547cd45952b88360766839dfde7d4683e61f9049eb6f36e027abb2091cfb5110ab5087ff96c685f06155b3cd9a8c9e5e9a23fd5dc13a5ed2037418f1000000000685f08316cbf8fa0da822a20ac1c55bf1be3208212000000000000505f0e7b9012096b41c4eb3aaf947f6ea42908000080e63c6175a901b4879d3c394e46980fb04e78755f0835d3bbf7c5f414cba07df280a75b29e0e24889a69c6b8c37a437692b76ca9aa52ab78997098b79da5c34a31a80740bfbe51a080a46d5c79a4b185680b175abb3ccdb602dbdba7552f7172ed8c1800f52715d71fe1c37787c148742c2476aadc24f49210fbc78bc78548c1a9544b6808f85bb9e09b1dc3958541a079dedea1ebb40e90bb6128b956104ed2447a777bf80546f9de70a2056a16cff4eddf15b5b5ca69a495225f8e8be67c90184fdd1af38685f090e2fbf2d792cb324bffa9427fe1f0e202a1e07008e1e070021019ede3d8a54d27e44a9d5ce189618f22d1008505f0e7b9012096b41c4eb3aaf947f6ea42908010080c74756edffa217dfb07ab596d82753deff985ac215e5cc2997d29afe1d397c161d019ef78c98723ddc9073523ef3beefda0c1004505f0e7b9012096b41c4eb3aaf947f6ea4290800007c77095dac46c07a40d91506e7637ec4ba5763f5a4efb16ffa83d007000004000000",
"0xa91704a000e902d94d2e18b4a8a88d9b21cb03bbe4df4431a93718c2c602c13043d595e8b8735a3e910b0021c0ecb97a4c7cc86aa22eeb2db02b60829551cf67bdc490f0948ac009f6c0801257ffee8b177dab50e7b537ccbd2d1ffcd8a0068a08d57a92ce367e4e0f52e1080661757261209aa0470800000000056175726101013aefb1326d057c6d6d174f1565404a8b1a6ab45c941fa89bd8a56ac401226d1b0d96a6e436d7021dd097d316f07fe554fc35c92e1966e8a9b6ebc4de15e57886901e07009c325649c4ebff345980ea29b5fb7b60a9af1f8cb26e5d9403418e89aee6d5c80000500034c45e414cb008e0e61e46722aa60abdd67280bd82018ee510cf360e1a460326ef53dde570b25b9e835fc045551ffe4e88fe08c45ee678799d3eff024253b90e84927cc6807ed4bd40e4853d40a1fd44e7128aa75ded4660543dc48918f507ac56fbef7d97cc5f0077dfdb8adb10f78f10a5df8742c5458401df75b8601e1b21393fc7772afc0788aa25e88713977d61495fabb2550af5c83545035f04b49d95320d9021994c850f25b8e385f902000030000080000008000000000010000000100005000000050000000a0000000a000000000050000000100000e8764817000000040000000400000000000000000000000000000000000000000000000000000000000000000000000800000000200000040000000400000000001000b0040000000000000000000014000000040000000400000000000000010100000000060000006400000002000000c8000000020000001900000000000000020000000200000000c817a804000000150180001480451c10fa62e420ae9678ed9e9f7f19e3e39be3a38ed4e3fe314234f3e6fed31780d3dac5ff6c2ce4154f56c20524e2dd095001f40b34d7c8afca34011128bc86201501800804809f3ada68c357b5e0a3ebb39ef181acfa9943af4725c244330a4b2c60837612e88097425c486ee3f57ab095f94c7dc030d79c63147ff57c50c90a577e2ad727d2e2a10280439080216c4ed723e0a878bd96314428b2b7cb9727481f149f84011c0405423bb94e26805bd412b85f2239198146f1fe278f482ed1e54fff8aab83ff5278486f27553e5180118f288193e4da2abce3289ebcfe1b730737e817b189512053eb437b1211c9f6807a4cfe27b7daddf656ec94d5b0d02fa22183c8bcdadf8364f236cbe956cc8f9e80c3485bf9a1e0e78ac17578cca0d0b0cd5f632bd925284c5f54decc00e6f44aae6d019e0da05ca59913bc38a8630590f2627c14404c5f0a351b6a99a5b21324516e668bb86a570400505f0e7b9012096b41c4eb3aaf947f6ea4290800007c7700e67da63472835bb0b737093a19ad4c63f5a4efb16ffa83d007000004001d019ef78c98723ddc9073523ef3beefda0c1004505f0e7b9012096b41c4eb3aaf947f6ea4290800007c77095dac46c07a40d91506e7637ec4ba5763f5a4efb16ffa83d00700000400f09f05207f03cfdce586301014700e2c25931040505f0e7b9012096b41c4eb3aaf947f6ea4290800004c5f0ec2d17a76153ff51817f12d9cfc3c7f040025019f06de3d8a54d27e44a9d5ce189618f22d1008505f0e7b9012096b41c4eb3aaf947f6ea42908010080c74756edffa217dfb07ab596d82753deff985ac215e5cc2997d29afe1d397c16ed029f0cb6f36e027abb2091cfb5110ab5087f9960685f06155b3cd9a8c9e5e9a23fd5dc13a5ed2037418f1000000000685f08316cbf8fa0da822a20ac1c55bf1be3208212000000000000505f0e7b9012096b41c4eb3aaf947f6ea42908000080740bfbe51a080a46d5c79a4b185680b175abb3ccdb602dbdba7552f7172ed8c180fddafc590530ce9037825fac38ceee0615edf7def5fd0af0bacb16f7d47f9859685f090e2fbf2d792cb324bffa9427fe1f0e202a1e07008e1e0700c1019f0d710b30bd2eab0352ddcc26417aa19454807c77081e0bfde17b36573208a06cb5cfba6b63f5a4efb16ffa83d00700000402505f0e7b9012096b41c4eb3aaf947f6ea4290800004c5f03c716fb8fff3de61a883bb76adb34a204004c5f0dad6eef5c4b1c68eaa71ea17a02d9de04000000",
],
"header": {
"digest": {
Expand Down
35 changes: 35 additions & 0 deletions e2e/upgrade.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { blake2AsHex } from '@polkadot/util-crypto'
import { describe, expect, it } from 'vitest'
import { readFileSync } from 'node:fs'
import path from 'node:path'

import { api, chain, dev, setupApi, testingPairs } from './helper'

setupApi({
endpoint: 'wss://acala-rpc-1.aca-api.network',
blockHash: '0x663c25dc86521f4b7f74dcbc26224bb0fac40e316e6b0bcf6a51de373f37afac',
})

describe('upgrade', () => {
const { alice } = testingPairs()
it('setCode works', async () => {
await dev.setStorages({
Sudo: {
Key: alice.address,
},
System: {
Account: [[[alice.address], { data: { free: 1000 * 1e12 } }]],
},
})

const runtime = String(readFileSync(path.join(__dirname, './blobs/acala-runtime-2101.txt'))).trim()

expect(await chain.head.runtimeVersion).toContain({ specVersion: 2096 })
await api.tx.sudo.sudo(api.tx.parachainSystem.authorizeUpgrade(blake2AsHex(runtime))).signAndSend(alice)
await dev.newBlock()
await api.tx.sudo.sudoUncheckedWeight(api.tx.system.setCode(runtime), '0').signAndSend(alice)
await dev.newBlock()
await dev.newBlock()
expect(await chain.head.runtimeVersion).toContain({ specVersion: 2101 })
})
})
Loading