---
# System prepended metadata

title: Test web3signer - cpu consmumptio

---

# Test web3signer - cpu consmumption

- Apparently importing more than 30 keystores in a single import reaches timeout error on signer, probably because of the decryption
- Importing process is a high **cpu** and **memory** intensive process, probably because of the decryption.
- Restarting web3signer making signer to reload keystores is NOT cpu intensive but memory high intensive process. Why? using other tooling for decryption
- Importing process looks like an algoritmic cpu usage, importing aroung 30 may take up to the 40% of a powerfull machine
- Importing more validators apparently does not increases the memory usage by the web3signer container BUT, when restarting the web3gsigner it uses more memory than before. Does it have to do with the way of the decrypt method used at start time and why it does not have cpu intensive task on startup

- Screenshot with cpu being increased when importing, each time with more validator within the import
![Screenshot 2024-01-29 at 19.44.46](https://hackmd.io/_uploads/rJyNG_Hqp.png)

- Screenshot that shows memory peaks 
![Screenshot 2024-01-29 at 19.45.52](https://hackmd.io/_uploads/SJmdz_B9T.png)

# Test web3signer - cors policy

- [ ] Install production web3signer + consensus client + execution client

    - Pablo -> prater, holesky
    - Diego -> gnosis
    - Mark -> lukso
    - Mateu -> mainnet

- [ ] Upload 1 or more keystores
- [ ] Fetch signer api from browser, it should be a success response
    - [ ] Access an http website such as http://icanhazip.com
    - [ ] Get into the deverloper tools and run the following command, it should be a 200 response
    ```js 
    fetch("http://web3signer.web3signer-<network>.dappnode:9000/eth/v1/keystores").then(r => r.text().then(r => console.log(r)))
    ```
- [ ] Update web3signer
    - prater https://github.com/dappnode/DAppNodePackage-web3signer-prater/releases/tag/v0.1.27
    - holesky https://github.com/dappnode/DAppNodePackage-web3signer-holesky/releases/tag/v0.1.2
    - gnosis https://github.com/dappnode/DAppNodePackage-web3signer-gnosis/releases/tag/v1.0.9
    - mainnet https://github.com/dappnode/DAppNodePackage-web3signer/releases/tag/v2.0.6
    - lukso https://github.com/dappnode/DAppNodePackage-web3signer-lukso/releases/tag/v0.1.2

- [ ] Check that browser cannot communicate with signer api
    - [ ] Access an http website such as http://icanhazip.com
    - [ ] Get into the developer tools and run the command 
    ```js 
    fetch("http://web3signer.web3signer-<network>.dappnode:9000/eth/v1/keystores").then(r => r.text().then(r => console.log(r)))
    ```
    The response should look something like
    ```
    [Error] Origin http://icanhazip.com is not allowed by Access-Control-Allow-Origin. Status code: 403
    [Error] Fetch API cannot load http://web3signer.web3signer-prater.dappnode:9000/ due to access control checks.
    [Error] Failed to load resource: Origin http://icanhazip.com is not allowed by Access-Control-Allow-Origin. Status code: 403 (web3signer.web3signer-prater.dappnode, line 0)
    ```
    You may also see this error message in the signer container
    ```bash
    2024-01-29 17:23:37.825+00:00 | vert.x-eventloop-thread-0 | ERROR | RoutingContext | Unhandled exception in router
    java.lang.IllegalStateException: CORS Rejected - Invalid origin
    ```

- [ ] Check that validator client can communicates with signer api
- [ ] Check that the brain UI service can communicate with signer api


# Test web3signer - Smooth Integration

- [ ] Install new web3signer (prater) + consensus client + execution client. web3signer prater hash: https://github.com/dappnode/DAppNodePackage-web3signer-prater/releases/tag/v0.1.27

## Smooth column
- [ ] Upload 1 or more keystores to web3signer.
- [ ] Go to http://brain.web3signer-prater.dappnode/ and check that there is 1 new column: "Smooth".
- [ ] Check that the Smooth status shown of your validators matches their real Smooth status. Hover the mouse on each Smooth icon to see more info.
    - [ ] If not subscribed and FR != Smooth, "X" should appear 
    - [ ] If not subscribed and FR == Smooth, a hourglass should appear, hover to see more info
    - [ ] If subscribed and FR == Smooth, a green check should appear
    - [ ] If subscribed and FR != Smooth, a red alert should appear
    - [ ] etc

- [ ] Play a little bit with possible Smooth statuses for your validators (if necessary, you can subscribe your goerli validator here https://smooth-goerli.dappnode.io/, logging with your withdrawal address). Try to have some different states at the same time

![Screenshot_20240130_101253](https://hackmd.io/_uploads/By7oTN8ca.png)

- [ ] Add a new keystore with tag != "solo", a "-" should always be rendered for Smooth column (you can change any existing keystore with a random pubkey for this)
- [ ] Shut down your consensus client. Since withdrawal address & index cant be fetched from it now, the "Smooth" column should have "?" warning in each validator. Hover mouse over it to see more info.

It is possible that oracle spends a few seconds syncing during your test. If this happens, you should see a "?" warning again, because Smooth subscription status cant be fetched during Oracle's sync process.

## Smooth FR changes

Like Smooth's column of last section, this has a lot of different edge cases, I recommend everybody spends 5m playing with FR changes and "hunt" for any bugs
- [ ] During the whole test, check that brain's UI (more specifically, your validators table) does not reload automatically. It only reloads when changing a fee recipient or any validator.
- [ ] In case you didnt, check that your exec/consensus clients are up and running.
- [ ] Change the fee recipient to Smooth of one validator with ETH1 withdrawal address:
    - [ ] Press the "Set Smooth Fee Recipient" switch of the "Edit Fee recipient" dialog. Check that a stepper appears and click on "apply changes"
    - [ ] Check that the second step of smooth subscription offers you to register manually to earn rewards right now. Check that the button "take me to smooth website" does what it says
    - [ ] When clicking "close", the FR should have been changed to Smooth

- [ ] Try to add Smooth FR to a validator with FR format != ETH1 (bls). A red warning alert should appear, preventing you to change it.
- [ ] Shut down your consensus client and try to change any FR to Smooth. A red warning should appear, saying that withdrawal addres could not be checked. Restart your consensus client and check that you can change it again.
- [ ] Change the FR back to an old one of a validator that had FR == Smooth. A warning should appear, letting you know of the consequences of changing FR while being subscribed to Smooth
- [ ] Do all of the above but changing multiple FR of differnt validators at the same time. Check that all the Smooth alerts/info/warning messages make sense. 

## No-Smooth networks

Install a web3signer of a network where smooth does not exist and check that everything "Smooth related" is not rendered (smooth column + smooth FR changes) and no errors are shown. You can also check the network tab of your browser, and see that no calls to any oracle are made, even when keystores are loaded 


- holesky https://github.com/dappnode/DAppNodePackage-web3signer-holesky/releases/tag/v0.1.2
- gnosis https://github.com/dappnode/DAppNodePackage-web3signer-gnosis/releases/tag/v1.0.9
- lukso https://github.com/dappnode/DAppNodePackage-web3signer-lukso/releases/tag/v0.1.2