# Pessimism for better Optimism

By [Base Daily](https://paragraph.com/@baseecosystem) · 2023-09-21

---

**Key takeaways**
-----------------

*   **Pessimism** is an open-source monitoring system created by Coinbase to enhance security for the OP Stack and EVM-compatible chains, addressing protocol threats on the Base mainnet.
    
*   The system optimizes network performance and security by assessing response times, transaction processing speeds, and spotting security vulnerabilities.
    
*   It operates through an ETL subsystem for data processing, a Risk Engine for threat assessing, and an alerting mechanism
    

**Introduction**
----------------

Pessimism is a monitoring systems built to support the security of all OP Stack and EVN-compatible chain by detecting and countering protocol threats. It have been created by Coinbase team internally to monitor Base since mainnet.

At the time of writing, Base have open-sourced Pessimism, make it to be a free and permissionless software.

**Monitoring system and its importance**
----------------------------------------

The goal of monitoring is to ensure the network’s security and tracking fraud transaction. Monitoring is crucial on Base for the following reasons:

### **Performance Evaluation**

Network’s performance is assessed by:

*   **Response times:** The time between when we give the order and the time when the blockchain receive it
    
*   **Transaction processing speed:** How low it take from receiving transaction order to executing it
    
*   **Error rates:** Fail transactions over total transactions
    

### **Security**

*   Dentify and mitigate security threats and vulnerabilities
    
*   Detecting unauthorized access attempts, unusual behavior, and potential breaches.
    

**How Pessimism Works?**
------------------------

### **Subsystem Workflow**

Pessimism is structured around three main subsystems that **monitor, assess and alert**

![3 subsystems to operate Pessimism](https://storage.googleapis.com/papyrus_images/af014adc27a72d30463cf208b1e9c0f75e5d24e66267996c7833663435f0a673.png)

3 subsystems to operate Pessimism

*   **ETL (Monitor)**: The ETL standing for extract, transform and load. This subsystem is responsible for checking and transforming blockchain data into into formats that can be used by applications.
    
*   **Risk Engine (Assess)**: This subsystem examines heuristics using data from the ETL to determine potential alert scenarios.
    
*   **Alerting**: Propagating alerts to downstream dependency systems (i.e. Slack, Pagerduty).
    

> **REST API:** Pessimism also enables users to create, delete, and modify monitoring heuristics.

When an abnormal activity or event perceived as a security threat is detected, Pessimism alerts the team to swiftly address any potential risks.

### **Pessimism Use cases**

**OP Stack**

*   Withdrawal Safety:
    
    Due to many critical exploits happened on bridges, withdrawal safety is the first use case were built on Opstack. It prevents potential exploit by determines whether a proven OP Stack bridge withdrawal on L1 has a corresponding initiation event on the L2 chain.
    
*   Fraud Detection:
    
    The fault-detector acts as a verifier. When there's a shift of data from L2 to L1, represented by a unique code (output root), Pessimism double-checks its authenticity. It does this by making a similar code on its own and comparing them. This step is essential to make sure the data shift is genuine and the unique codes being provided are trustworthy.
    

**EVM Compatible**

*   Balance Enforcement:
    
    The balance-enforcement heuristic checks that the ETH balance in an address is either above or below certain limits set by the user. This is vital for keeping an eye on important accounts (like proposer or batcher) in the OP Stack system to ensure they don't run out of funds.
    
*   Smart contract events:
    
    The contract-event heuristics keeps an eye on activities related to smart contracts. It needs the address of the smart contract and specific event signatures to function. This is essential for identifying possible changes in access rights (like updating limits for a gnosis safe multisig) and unexpected actions by high-level users (like an OP Stack Guardian suddenly stopping the native bridge).
    

**Performance**
---------------

Pessimism boasts quick data processing times, with ETL processing in under 100 ms and overall processing in about 200 ms.

*   **Modularity and Testing**: The OP Stack's modular design allows for thorough end-to-end testing of each heuristic implementation using the op-e2e testing framework.
    
*   **Alert Routing**: Defines [global alerting policies](https://base-org.github.io/pessimism/alert-routing) and supports Slack and PagerDuty as alert destinations
    

**What’s Next?**
----------------

1.  **Comprehensive Bridge Coverage**: Plans to monitor all potential threats and failures of the native bridge that facilitates L2 to Ethereum fund transfers.
    
2.  **Emerging Threat Detections**: As the OP Stack continues to upgrade, Pessimism will introduce new features to cover the evolving threat landscape.
    

**Community Call**
------------------

Pessimism is community-driven and encourages users to submit feature requests and contribute to its development on [GitHub](https://github.com/base-org/pessimism/issues).

---

*Originally published on [Base Daily](https://paragraph.com/@baseecosystem/pessimism-for-better-optimism)*
