# Modify l2 substrateNode to allow our system continue working if need add new network
## Upgrade runtime(AckAdmins)
Assume current l2 have 2 AckAdmins. We add a new network named cantotestnet.
1. Use deployment branch `frank/removenetwork`
https://github.com/DelphinusLab/delphinus-deployment/pull/28
2. Add new network in `deployment/config/eth-config.ts`:
```
{
chainName: "cantotestnet",
mongodbUrl: "mongodb://localhost:27017",
syncEventsStep: 2000,
bufferBlocks: 0,
gasWarningAmount: "20",
nativeCurrency: {
name: "Test Canto",
symbol: "Canto", // 2-6 characters long
decimals: 18,
},
blockExplorer: "https://testnet.tuber.build/",
rpcSource: "https://canto-testnet.plexnode.wtf",
wsSource: "",
privateKey: secrets.accounts.deployer.priv,
monitorAccount: "REPLACE-WITH-CLIENT-MONITOR_ACCOUNT",
deviceId: "7701",
l2Account: "//Cindy//stash",
enabled: testnet,
isSnap: false,
}
```
Run `npx tsc` in `deployment`
3. In `deployment/config/substrate-account-config.json`:
3.1 Add `//Cindy//stash` to `secret_key_uri` and `pre_funded_seeds`.
3.2 Modify `sudo_account_seed` to `Smith`.
```
{
"secret_key_uri": [
"//Smith",
"//Frank",
"//Cindy//stash"
],
"authorities_seeds": [
"Eve//stash"
],
"pre_funded_seeds": [
"Smith",
"Frank",
"Cindy//stash"
],
"sudo_account_seed": "Smith"
}
```
4. Run `bash generate-config.sh` in `substrate-node`
5. Increment the `spec_version` to specify the new runtime version.
Modify `substrate-node/runtime/src/lib.rs`:

6. Run `DOCKER_BUILDKIT=1 docker build . -t delphinus-node -f packages/substrate-node/Dockerfile` in `zkcross-backend-lerna` folder again
7. Run `cargo +nightly-2023-01-24 build --locked --release` to generate new build artifacts `node_swap_runtime.compact.wasm`.

Here I use `nightly-2023-01-24` because latest rustup nightly have bugs.
Current l2's `substrate-node/Dockerfile`:
```
FROM docker.io/paritytech/ci-linux:production as builder
WORKDIR /delphinuslab
COPY . /delphinuslab
ENV CARGO_HOME /delphinuslab/.cargo-home
Run curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash -s -- -y && \
rustup toolchain install nightly-2023-01-24 --force && \
rustup target add wasm32-unknown-unknown --toolchain nightly-2023-01-24 && \
rustup default nightly-2023-01-24
RUN --mount=type=cache,target=/delphinuslab/.cargo-home \
--mount=type=cache,target=/delphinuslab/packages/substrate-node/target \
cargo +nightly-2023-01-24 build --manifest-path=/delphinuslab/packages/substrate-node/Cargo.toml --locked --release && install -Dt ./bin/ /delphinuslab/packages/substrate-node/target/release/node-swap
# This is the 2nd stage: a very small image where we copy the delphinuslab node binary."
FROM docker.io/library/ubuntu:20.04
LABEL description="Zhenxunge node"
COPY --from=builder /delphinuslab/bin/ /usr/local/bin/
RUN useradd -m -u 1000 -U -s /bin/sh -d /delphinuslab delphinuslab && \
mkdir -p /data /delphinuslab/.local/share && \
chown -R delphinuslab:delphinuslab /data /delphinuslab && \
ln -s /data /delphinuslab/.local/share/node-swap && \
# Sanity checks
/usr/local/bin/node-swap --version
USER delphinuslab
# Insert session key
RUN /usr/local/bin/node-swap key insert --chain dev --scheme Ed25519 --suri //Eve//stash --key-type gran && \
/usr/local/bin/node-swap key insert --chain dev --scheme Sr25519 --suri //Eve//stash --key-type aura
EXPOSE 30333 9933 9944 9615
VOLUME ["/data"]
ENTRYPOINT ["/usr/local/bin/node-swap"]
CMD ["--dev", "--ws-external"]
```
8. Visit https://polkadot.js.org/apps/ and switch to local node

8.1 Install https://polkadot.js.org/extension/ and create new accounts.
use `import account from pre-existing seed` option to add new account.
existing 12 or 24-word mnemonic seed:
`bottom drive obey lake curtain smoke basket hold race lonely fit walk`
Network:
`Allow use on any chain`
advanced/derivation path:
`//Smith`, `//Frank` and `//Cindy//stash`
A descriptive name for your account:
I suggest using `Smith` for `//Smith`, `Frank` for `//Frank`, etc.
8.2 Click **Developer** and select **Extrinsics** to submit a transaction for the runtime to use the new build artifact.
8.3 Select the administrative **Smith** account.
`Smith` is descriptive name for `//Smith`
8.4 Select the **sudo** pallet and the **sudoUncheckedWeight(call, weight)** function.
8.5 Select **system** and **setCode(code)** as the call to make using the `Smith` account.
8.6 Click **file upload**, then select or drag and drop the compact and compressed WebAssembly file—node_swap_runtime.compact.wasm—that you generated for the updated runtime.
For example, navigate to the ·target/release/wbuild/node-template-runtime· directory and select `node_swap_runtime.compact.wasm` as the file to upload.
8.7 Leave both of the weight parameters set to the default value of 0.
8.8 Click Submit Transaction.
8.9 Review the authorization, then click **Sign and Submit**.
After the transaction is included in a block, the node template version number indicates that the runtime version is now 101.

## Add balance to new l2Account
new l2Account need balance to setkey and addpool later.
1. In https://polkadot.js.org/apps/, click **Accounts** and select **Accounts**

You can see `//Cindy//stash`'s balance is 0
2. 
3. Click **Developer** and select **Extrinsics**
4. Select the administrative **Smith** account.
`Smith` is descriptive name for `//Smith`
5. Select the **sudo** pallet and the **sudo(call)** function.
6. Select **balances** and **setBalance(who, newFree, newReserved)** as the call to make using the `Smith` account.
`Cindy//stash` for `who: LookupSource`
newFree: Compact<Balance>: 1000000unit = 1munit
newReserved: Compact<Balance>: actually you can set it to zero
7. Click **Submit Transaction**.
8. Review the authorization, then click **Sign and Submit**.
After the transaction is included in a block, `Cindy//stash` has balance now.
## Operate on ui
Cantotestnet can work well:
