From f2e976e5a17af8dc509a3962599ed0a238b3daab Mon Sep 17 00:00:00 2001 From: Haneen Khalifa Date: Tue, 22 Oct 2024 18:37:16 +0300 Subject: [PATCH 1/3] refac: Update sedge's data directory --- configs/messages.go | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/configs/messages.go b/configs/messages.go index d4b9be4f6..e89317713 100644 --- a/configs/messages.go +++ b/configs/messages.go @@ -17,8 +17,11 @@ package configs import ( "fmt" - "os" "path/filepath" + + "github.com/spf13/afero" + "github.com/NethermindEth/sedge/internal/locker" + "github.com/NethermindEth/sedge/internal/monitoring/data" ) // All the strings that are needed for debugging and info logging, and constant strings. @@ -120,10 +123,17 @@ Happy Staking! var DefaultAbsSedgeDataPath string func init() { - cwd, err := os.Getwd() - if err != nil { - // notest + // Set filesystem + // fs := afero.NewMemMapFs() // Uncomment this line if you want to use the in-memory filesystem + // fs := afero.NewBasePathFs(afero.NewOsFs(), "/tmp") // Uncomment this line if you want to use the real filesystem with a base path + fs := afero.NewOsFs() // Uncomment this line if you want to use the real filesystem + + // Set locker + locker := locker.NewFLock() + dataDir, err := data.NewDataDirDefault(fs, locker) + if err != nil{ fmt.Println(err) } - DefaultAbsSedgeDataPath = filepath.Join(cwd, DefaultSedgeDataFolderName) + + DefaultAbsSedgeDataPath = filepath.Join(dataDir.Path(), DefaultSedgeDataFolderName) } From f4922fb626bbddb1f4df72648726406d1809f9b8 Mon Sep 17 00:00:00 2001 From: Haneen Khalifa Date: Mon, 28 Oct 2024 19:38:09 +0300 Subject: [PATCH 2/3] docs: Update sedge-data directory --- docs/docs/commands/generate.mdx | 14 +++++++------- docs/docs/commands/importKey.mdx | 4 ++-- docs/docs/commands/keys.mdx | 2 +- docs/docs/commands/logs.mdx | 2 +- docs/docs/commands/run.mdx | 2 +- docs/docs/commands/show.mdx | 2 +- docs/docs/commands/slashingExport.mdx | 2 +- docs/docs/commands/slashingImport.mdx | 2 +- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/docs/docs/commands/generate.mdx b/docs/docs/commands/generate.mdx index 3187ea43f..59eadb77a 100644 --- a/docs/docs/commands/generate.mdx +++ b/docs/docs/commands/generate.mdx @@ -42,7 +42,7 @@ Flags: --lido generate Lido CSM node --logging string Docker logging driver used by all the services. Set 'none' to use the default docker logging driver. Possible values: [none json] (default "json") -n, --network string Target network. e.g. mainnet, sepolia, holesky, gnosis, chiado, etc. (default "mainnet") - -p, --path string generation path for sedge data. Default is sedge-data (default "/path/to/sedge-data") + -p, --path string generation path for sedge data. Default is sedge-data (default "[HOME_DIR]/.local/share/.sedge/sedge-data") Global Flags: --log-level string Set Log Level, e.g panic, fatal, error, warn, warning, info, debug, trace (default "info") @@ -119,7 +119,7 @@ Global Flags: --log-level string Set Log Level, e.g panic, fatal, error, warn, warning, info, debug, trace (default "info") --logging string Docker logging driver used by all the services. Set 'none' to use the default docker logging driver. Possible values: [none json] (default "json") -n, --network string Target network. e.g. mainnet,sepolia, holesky, gnosis, chiado, etc. (default "mainnet") - -p, --path string generation path for sedge data. Default is sedge-data (default "/path/to/sedge/sedge-data") + -p, --path string generation path for sedge data. Default is sedge-data (default "[HOME_DIR]/.local/share/.sedge/sedge-data") ``` #### Op-Full-Node @@ -170,7 +170,7 @@ Global Flags: --log-level string Set Log Level, e.g panic, fatal, error, warn, warning, info, debug, trace (default "info") --logging string Docker logging driver used by all the services. Set 'none' to use the default docker logging driver. Possible values: [json none] (default "json") -n, --network string Target network. e.g. mainnet,sepolia, holesky, gnosis, chiado, etc. (default "mainnet") - -p, --path string generation path for sedge data. Default is sedge-data (default "/path/to/sedge/sedge-data") + -p, --path string generation path for sedge data. Default is sedge-data (default "[HOME_DIR]/.local/share/.sedge/sedge-data") ``` :::note @@ -221,7 +221,7 @@ Global Flags: --log-level string Set Log Level, e.g panic, fatal, error, warn, warning, info, debug, trace (default "info") --logging string Docker logging driver used by all the services. Set 'none' to use the default docker logging driver. Possible values: [none json] (default "json") -n, --network string Target network. e.g. mainnet,sepolia, holesky, gnosis, chiado, etc. (default "mainnet") - -p, --path string generation path for sedge data. Default is sedge-data (default "/path/to/sedge/sedge-data") + -p, --path string generation path for sedge data. Default is sedge-data (default "[HOME_DIR]/.local/share/.sedge/sedge-data") ``` #### Execution @@ -252,7 +252,7 @@ Global Flags: --log-level string Set Log Level, e.g panic, fatal, error, warn, warning, info, debug, trace (default "info") --logging string Docker logging driver used by all the services. Set 'none' to use the default docker logging driver. Possible values: [none json] (default "json") -n, --network string Target network. e.g. mainnet,sepolia, holesky, gnosis, chiado, etc. (default "mainnet") - -p, --path string generation path for sedge data. Default is sedge-data (default "/path/to/sedge/sedge-data") + -p, --path string generation path for sedge data. Default is sedge-data (default "[HOME_DIR]/.local/share/.sedge/sedge-data") ``` #### Validator @@ -297,7 +297,7 @@ Global Flags: --log-level string Set Log Level, e.g panic, fatal, error, warn, warning, info, debug, trace (default "info") --logging string Docker logging driver used by all the services. Set 'none' to use the default docker logging driver. Possible values: [none json] (default "json") -n, --network string Target network. e.g. mainnet,sepolia, holesky, gnosis, chiado, etc. (default "mainnet") - -p, --path string generation path for sedge data. Default is sedge-data (default "/path/to/sedge/sedge-data") + -p, --path string generation path for sedge data. Default is sedge-data (default "[HOME_DIR]/.local/share/.sedge/sedge-data") ``` #### MevBoost @@ -321,5 +321,5 @@ Global Flags: --lido generate Lido CSM node --log-level string Set Log Level, e.g panic, fatal, error, warn, warning, info, debug, trace (default "info") --logging string Docker logging driver used by all the services. Set 'none' to use the default docker logging driver. Possible values: [none json] (default "json") - -p, --path string generation path for sedge data. Default is sedge-data (default "/path/to/sedge/sedge-data") + -p, --path string generation path for sedge data. Default is sedge-data (default "[HOME_DIR]/.local/share/.sedge/sedge-data") ``` \ No newline at end of file diff --git a/docs/docs/commands/importKey.mdx b/docs/docs/commands/importKey.mdx index 1cba1f4c9..49d2ff02f 100644 --- a/docs/docs/commands/importKey.mdx +++ b/docs/docs/commands/importKey.mdx @@ -40,10 +40,10 @@ Flags: --custom-config string file path or url to use as custom network config. --custom-deploy-block string custom network deploy block. --custom-genesis string file path or url to use as custom network genesis. - --from string path to the validator keys, must follow the EIP-2335: BLS12-381 Keystore standard (default "[WORK_DIR]/sedge-data/keystore") + --from string path to the validator keys, must follow the EIP-2335: BLS12-381 Keystore standard (default "[HOME_DIR]/.local/share/.sedge/sedge-data") -h, --help help for import-key -n, --network string network (default "mainnet") - -p, --path string path to the generation directory (default "[WORK_DIR]/sedge-data") + -p, --path string path to the generation directory (default "[HOME_DIR]/.local/share/.sedge/sedge-data") --start-validator starts the validator client after import, regardless of the state the validator was in before --stop-validator stops the validator client after import, regardless of the state the validator was in before diff --git a/docs/docs/commands/keys.mdx b/docs/docs/commands/keys.mdx index 848b13865..90fc55ce5 100644 --- a/docs/docs/commands/keys.mdx +++ b/docs/docs/commands/keys.mdx @@ -32,7 +32,7 @@ Flags: -n, --network string Target network. e.g. mainnet,sepolia, holesky, gnosis, chiado etc. (default "mainnet") --num-validators int Number of validators to generate. This number will be used in addition to the existing flag as the end index for the generated keystores. (default -1) --passphrase-path string Path to file with a keystores passphrase to use. - -p, --path string Absolute path to keystore folder. e.g. /home/user/keystore (default "/path/to/sedge-data") + -p, --path string Absolute path to keystore folder. e.g. /home/user/keystore (default "[HOME_DIR]/.local/share/.sedge/sedge-data") --random-passphrase Usa a randomly generated passphrase to encrypt keystores. Global Flags: diff --git a/docs/docs/commands/logs.mdx b/docs/docs/commands/logs.mdx index 66cb25367..2be85d6ef 100644 --- a/docs/docs/commands/logs.mdx +++ b/docs/docs/commands/logs.mdx @@ -20,7 +20,7 @@ Usage: Flags: -h, --help help for logs - -p, --path string generation path for sedge data (default "/path/to/sedge-data") + -p, --path string generation path for sedge data (default "[HOME_DIR]/.local/share/.sedge/sedge-data") -t, --tail int Tail the number of desired logs. If not set, or set to 0, logs are followed. Global Flags: diff --git a/docs/docs/commands/run.mdx b/docs/docs/commands/run.mdx index 1c6b5dd46..60ee30912 100644 --- a/docs/docs/commands/run.mdx +++ b/docs/docs/commands/run.mdx @@ -29,7 +29,7 @@ Usage: Flags: -h, --help help for run - -p, --path string generation path for sedge data (default "/path/to/sedge-data") + -p, --path string generation path for sedge data (default "[HOME_DIR]/.local/share/.sedge/sedge-data") --services strings List of services to run. If this flag is not provided, all services will run. --skip-pull Avoid pulling images before running containers. If the images are not available locally, this flag could cause an error. diff --git a/docs/docs/commands/show.mdx b/docs/docs/commands/show.mdx index d3ff0c00f..ffb09cd2e 100644 --- a/docs/docs/commands/show.mdx +++ b/docs/docs/commands/show.mdx @@ -18,7 +18,7 @@ Usage: Flags: -h, --help help for show - -p, --path string generation path for sedge data (default "/path/to/sedge-data") + -p, --path string generation path for sedge data (default "[HOME_DIR]/.local/share/.sedge/sedge-data") Global Flags: --log-level string Set Log Level, e.g panic, fatal, error, warn, warning, info, debug, trace (default "info") diff --git a/docs/docs/commands/slashingExport.mdx b/docs/docs/commands/slashingExport.mdx index d00569870..55b1b8aa3 100644 --- a/docs/docs/commands/slashingExport.mdx +++ b/docs/docs/commands/slashingExport.mdx @@ -43,7 +43,7 @@ Flags: -h, --help help for slashing-export -n, --network string network (default "mainnet") -o, --out string path to write slashing protection data (default "[GENERATION_PATH]/slashing_protection.json") - -p, --path string path to the generation directory (default "/path/to/sedge-data") + -p, --path string path to the generation directory (default "[HOME_DIR]/.local/share/.sedge/sedge-data") --start-validator starts the validator client after export, regardless of the state the validator was in before --stop-validator stops the validator client after export, regardless of the state the validator was in before diff --git a/docs/docs/commands/slashingImport.mdx b/docs/docs/commands/slashingImport.mdx index 6bbe23966..c5741621a 100644 --- a/docs/docs/commands/slashingImport.mdx +++ b/docs/docs/commands/slashingImport.mdx @@ -41,7 +41,7 @@ Flags: -f, --from string path to the JSON file in the EIP-3076 format with the slashing protection data to import (default: /slashing_protection.json) -h, --help help for slashing-import -n, --network string network (default "mainnet") - -p, --path string path to the generation directory (default "/path/to/sedge-data") + -p, --path string path to the generation directory (default "[HOME_DIR]/.local/share/.sedge/sedge-data") --start-validator starts the validator client after import, regardless of the state the validator was in before --stop-validator stops the validator client after import, regardless of the state the validator was in before From 766754a4d1052659cf465c18fa02f0e2d5ea51c0 Mon Sep 17 00:00:00 2001 From: Haneen Khalifa Date: Tue, 29 Oct 2024 19:52:32 +0300 Subject: [PATCH 3/3] chore: Update changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a04eae355..dfe5c1b8d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added +- Update "sedge-data" default directory from "[WORK_DIR]/sedge-data" to "[HOME_DIR]/.local/share/.sedge/sedge-data". + ## [v1.7.0] - 2024-10-24 ### Added