-
Notifications
You must be signed in to change notification settings - Fork 283
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Clean up data configuration (#9973)
This PR changes the following related to data storage configuration - `PXE_DATA_DIRECTORY` has been removed. The PXE uses `DATA_DIRECTORY` along with everything else. - `DATA_DIRECTORY` is deemed to be the root of all state directories. This was already partly implemented. Each component stores it's state in one or more sub-directories of this root. - `DATA_STORE_MAP_SIZE_KB` is a new environment variable and represented the `mmap` size provided to all environments of LMDB. - `WS_DATA_DIRECTORY` is a new optional environment variable. If provided, represents an alternative root directory for the world state only. - `WS_DB_MAP_SIZE_KB` is a new optional environment variable. If provided, represent the `mmap` size provided to all LMDB environment used in the world state. --------- Co-authored-by: ludamad <adam.domurad@gmail.com>
- Loading branch information
1 parent
1acf4cf
commit b660739
Showing
37 changed files
with
218 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { l1ContractAddressesMapping } from '@aztec/ethereum'; | ||
import { type ConfigMappingsType, getConfigFromMappings, numberConfigHelper } from '@aztec/foundation/config'; | ||
import { type EthAddress } from '@aztec/foundation/eth-address'; | ||
|
||
export type DataStoreConfig = { | ||
dataDirectory: string | undefined; | ||
dataStoreMapSizeKB: number; | ||
l1Contracts: { rollupAddress: EthAddress }; | ||
}; | ||
|
||
export const dataConfigMappings: ConfigMappingsType<DataStoreConfig> = { | ||
dataDirectory: { | ||
env: 'DATA_DIRECTORY', | ||
description: 'Optional dir to store data. If omitted will store in memory.', | ||
}, | ||
dataStoreMapSizeKB: { | ||
env: 'DATA_STORE_MAP_SIZE_KB', | ||
description: 'DB mapping size to be applied to all key/value stores', | ||
...numberConfigHelper(128 * 1_024 * 1_024), // Defaulted to 128 GB | ||
}, | ||
l1Contracts: { | ||
description: 'The deployed L1 contract addresses', | ||
defaultValue: l1ContractAddressesMapping, | ||
}, | ||
}; | ||
|
||
/** | ||
* Returns the archiver configuration from the environment variables. | ||
* Note: If an environment variable is not set, the default value is used. | ||
* @returns The archiver configuration. | ||
*/ | ||
export function getDataConfigFromEnv(): DataStoreConfig { | ||
return getConfigFromMappings<DataStoreConfig>(dataConfigMappings); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.