Because you can't always be optimistic
Pessimism is a public good monitoring service that allows for Op-Stack and EVM compatible blockchains to be continously assessed for real-time threats using customly defined user invariant rulesets. To learn about Pessimism's architecture, please advise the documentation.
Warning: Pessimism is currently experimental and very much in development. It means Pessimism is currently unstable, so code will change and builds can break over the coming months. If you come across problems, it would help greatly to open issues so that we can fix them as quickly as possible.
To use the template, run the following the command(s):
-
Create local config file (
config.env
) to store all necessary environmental variables. There's already an exampleconfig.env.template
in the repo that stores default env vars. -
Download or upgrade to
golang 1.19
. -
Install all project golang dependencies by running
go mod download
.
-
Compile pessimism to machine binary by running the following project level command(s):
- Using Make:
make build-app
- Using Make:
-
To run the compiled binary, you can use the following project level command(s):
- Using Make:
make run-app
- Direct Call:
./bin/pessimism
- Using Make:
golangci-lint is used to perform code linting. Configurations are defined in .golangci.yml It can be ran using the following project level command(s):
- Using Make:
make lint
- Direct Call:
golangci-lint run
Unit tests are written using the native go test library with test mocks generated using the golang native mock library.
Unit tests can ran using the following project level command(s):
- Using Make:
make test
- Direct Call:
go test ./...
TBD
The following curl command can be used to spawn a balance_enforcement
invariant session on the layer1
network. The invariant will check the balance of the address 0xfC0157aA4F5DB7177830ACddB3D5a9BB5BE9cc5e
every 10 blocks and alert to slack if the balance is ever less than 1 or greater than 2.
curl --location --request POST 'http://localhost:8080/v0/invariant' \
--header 'Content-Type: text/plain' \
--data-raw '{
"method": "run",
"params": {
"network": "layer1",
"pipeline_type": "live",
"type": "balance_enforcement",
"start_height": null,
"alert_destination": "slack",
"invariant_params": {
"address": "0xfC0157aA4F5DB7177830ACddB3D5a9BB5BE9cc5e",
"lower": 1,
"upper": 2
}
}
}'
Which should return something like:
{
"status_code" : 202,
"status" : "OK",
"result" : {
"suuid" : "layer1:live:balance_enforcement::1631991901901231381836998",
},
}