diff --git a/prover/config/config-mainnet-full.toml b/prover/config/config-mainnet-full.toml index fdc5ec9e..a549cc12 100644 --- a/prover/config/config-mainnet-full.toml +++ b/prover/config/config-mainnet-full.toml @@ -37,21 +37,21 @@ chain_id = 59144 message_service_contract = "0x508Ca82Df566dCD1B0DE8296e70a96332cD644ec" [traces_limits] -ADD = 524288 +ADD = 262144 BIN = 262144 BLAKE_MODEXP_DATA = 16384 BLOCK_DATA = 4096 BLOCK_HASH = 2048 -EC_DATA = 262144 +EC_DATA = 65536 EUC = 65536 -EXP = 8192 -EXT = 1048576 +EXP = 65536 +EXT = 524288 GAS = 65536 HUB = 2097152 LOG_DATA = 65536 LOG_INFO = 4096 -MMIO = 4194304 -MMU = 4194304 +MMIO = 2097152 +MMU = 1048576 MOD = 131072 MUL = 65536 MXP = 524288 @@ -59,19 +59,19 @@ OOB = 262144 RLP_ADDR = 4096 RLP_TXN = 131072 RLP_TXN_RCPT = 65536 -ROM = 4194304 +ROM = 8388608 ROM_LEX = 1024 -SHAKIRA_DATA = 32768 -SHF = 65536 +SHAKIRA_DATA = 65536 +SHF = 262144 STP = 16384 TRM = 32768 TXN_DATA = 8192 WCP = 262144 PRECOMPILE_ECRECOVER_EFFECTIVE_CALLS = 128 -PRECOMPILE_SHA2_BLOCKS = 671 +PRECOMPILE_SHA2_BLOCKS = 200 PRECOMPILE_RIPEMD_BLOCKS = 0 -PRECOMPILE_MODEXP_EFFECTIVE_CALLS = 4 -PRECOMPILE_ECADD_EFFECTIVE_CALLS = 16384 +PRECOMPILE_MODEXP_EFFECTIVE_CALLS = 32 +PRECOMPILE_ECADD_EFFECTIVE_CALLS = 1024 PRECOMPILE_ECMUL_EFFECTIVE_CALLS = 32 PRECOMPILE_ECPAIRING_FINAL_EXPONENTIATIONS = 16 PRECOMPILE_ECPAIRING_MILLER_LOOPS = 64 @@ -81,27 +81,27 @@ PRECOMPILE_BLAKE_ROUNDS = 0 BLOCK_KECCAK = 8192 BLOCK_L1_SIZE = 1000000 BLOCK_L2_L1_LOGS = 16 -BLOCK_TRANSACTIONS = 200 +BLOCK_TRANSACTIONS = 300 BIN_REFERENCE_TABLE = 262144 SHF_REFERENCE_TABLE = 4096 INSTRUCTION_DECODER = 512 [traces_limits_large] -ADD = 1048576 +ADD = 524288 BIN = 524288 BLAKE_MODEXP_DATA = 32768 BLOCK_DATA = 8192 BLOCK_HASH = 4096 -EC_DATA = 524288 +EC_DATA = 131072 EUC = 131072 -EXP = 16384 -EXT = 2097152 +EXP = 131072 +EXT = 1048576 GAS = 131072 HUB = 4194304 LOG_DATA = 131072 LOG_INFO = 8192 -MMIO = 8388608 -MMU = 8388608 +MMIO = 4194304 +MMU = 2097152 MOD = 262144 MUL = 131072 MXP = 1048576 @@ -112,15 +112,15 @@ RLP_TXN_RCPT = 131072 ROM = 8388608 ROM_LEX = 2048 SHAKIRA_DATA = 65536 -SHF = 131072 +SHF = 524288 STP = 32768 TRM = 65536 TXN_DATA = 16384 WCP = 524288 PRECOMPILE_ECRECOVER_EFFECTIVE_CALLS = 256 -PRECOMPILE_SHA2_BLOCKS = 671 +PRECOMPILE_SHA2_BLOCKS = 400 PRECOMPILE_RIPEMD_BLOCKS = 0 -PRECOMPILE_MODEXP_EFFECTIVE_CALLS = 8 +PRECOMPILE_MODEXP_EFFECTIVE_CALLS = 64 PRECOMPILE_ECADD_EFFECTIVE_CALLS = 32768 PRECOMPILE_ECMUL_EFFECTIVE_CALLS = 64 PRECOMPILE_ECPAIRING_FINAL_EXPONENTIATIONS = 32 @@ -131,7 +131,7 @@ PRECOMPILE_BLAKE_ROUNDS = 0 BLOCK_KECCAK = 8192 BLOCK_L1_SIZE = 1000000 BLOCK_L2_L1_LOGS = 16 -BLOCK_TRANSACTIONS = 200 +BLOCK_TRANSACTIONS = 300 BIN_REFERENCE_TABLE = 262144 SHF_REFERENCE_TABLE = 4096 INSTRUCTION_DECODER = 512 diff --git a/prover/config/config-sepolia-full.toml b/prover/config/config-sepolia-full.toml index 494c07e4..ddeef770 100644 --- a/prover/config/config-sepolia-full.toml +++ b/prover/config/config-sepolia-full.toml @@ -37,21 +37,21 @@ chain_id = 59141 message_service_contract = "0x971e727e956690b9957be6d51Ec16E73AcAC83A7" [traces_limits] -ADD = 524288 +ADD = 262144 BIN = 262144 BLAKE_MODEXP_DATA = 16384 BLOCK_DATA = 4096 BLOCK_HASH = 2048 -EC_DATA = 262144 +EC_DATA = 65536 EUC = 65536 -EXP = 8192 -EXT = 1048576 +EXP = 65536 +EXT = 524288 GAS = 65536 HUB = 2097152 LOG_DATA = 65536 LOG_INFO = 4096 -MMIO = 4194304 -MMU = 4194304 +MMIO = 2097152 +MMU = 1048576 MOD = 131072 MUL = 65536 MXP = 524288 @@ -59,20 +59,20 @@ OOB = 262144 RLP_ADDR = 4096 RLP_TXN = 131072 RLP_TXN_RCPT = 65536 -ROM = 4194304 +ROM = 8388608 ROM_LEX = 1024 -SHAKIRA_DATA = 32768 -SHF = 65536 +SHAKIRA_DATA = 65536 +SHF = 262144 STP = 16384 TRM = 32768 TXN_DATA = 8192 WCP = 262144 PRECOMPILE_ECRECOVER_EFFECTIVE_CALLS = 128 -PRECOMPILE_SHA2_BLOCKS = 671 +PRECOMPILE_SHA2_BLOCKS = 200 PRECOMPILE_RIPEMD_BLOCKS = 0 -PRECOMPILE_MODEXP_EFFECTIVE_CALLS = 4 -PRECOMPILE_ECADD_EFFECTIVE_CALLS = 16384 -PRECOMPILE_ECMUL_EFFECTIVE_CALLS = 32 +PRECOMPILE_MODEXP_EFFECTIVE_CALLS = 32 +PRECOMPILE_ECADD_EFFECTIVE_CALLS = 1024 +PRECOMPILE_ECMUL_EFFECTIVE_CALLS = 40 PRECOMPILE_ECPAIRING_FINAL_EXPONENTIATIONS = 16 PRECOMPILE_ECPAIRING_MILLER_LOOPS = 64 PRECOMPILE_ECPAIRING_G2_MEMBERSHIP_CALLS = 64 @@ -81,27 +81,27 @@ PRECOMPILE_BLAKE_ROUNDS = 0 BLOCK_KECCAK = 8192 BLOCK_L1_SIZE = 1000000 BLOCK_L2_L1_LOGS = 16 -BLOCK_TRANSACTIONS = 200 +BLOCK_TRANSACTIONS = 300 BIN_REFERENCE_TABLE = 262144 SHF_REFERENCE_TABLE = 4096 INSTRUCTION_DECODER = 512 [traces_limits_large] -ADD = 1048576 +ADD = 524288 BIN = 524288 BLAKE_MODEXP_DATA = 32768 BLOCK_DATA = 8192 BLOCK_HASH = 4096 -EC_DATA = 524288 +EC_DATA = 131072 EUC = 131072 -EXP = 16384 -EXT = 2097152 +EXP = 131072 +EXT = 1048576 GAS = 131072 HUB = 4194304 LOG_DATA = 131072 LOG_INFO = 8192 -MMIO = 8388608 -MMU = 8388608 +MMIO = 4194304 +MMU = 2097152 MOD = 262144 MUL = 131072 MXP = 1048576 @@ -112,17 +112,17 @@ RLP_TXN_RCPT = 131072 ROM = 8388608 ROM_LEX = 2048 SHAKIRA_DATA = 65536 -SHF = 131072 +SHF = 524288 STP = 32768 TRM = 65536 TXN_DATA = 16384 WCP = 524288 PRECOMPILE_ECRECOVER_EFFECTIVE_CALLS = 256 -PRECOMPILE_SHA2_BLOCKS = 671 +PRECOMPILE_SHA2_BLOCKS = 400 PRECOMPILE_RIPEMD_BLOCKS = 0 -PRECOMPILE_MODEXP_EFFECTIVE_CALLS = 8 +PRECOMPILE_MODEXP_EFFECTIVE_CALLS = 64 PRECOMPILE_ECADD_EFFECTIVE_CALLS = 32768 -PRECOMPILE_ECMUL_EFFECTIVE_CALLS = 64 +PRECOMPILE_ECMUL_EFFECTIVE_CALLS = 80 PRECOMPILE_ECPAIRING_FINAL_EXPONENTIATIONS = 32 PRECOMPILE_ECPAIRING_MILLER_LOOPS = 128 PRECOMPILE_ECPAIRING_G2_MEMBERSHIP_CALLS = 128 @@ -131,7 +131,7 @@ PRECOMPILE_BLAKE_ROUNDS = 0 BLOCK_KECCAK = 8192 BLOCK_L1_SIZE = 1000000 BLOCK_L2_L1_LOGS = 16 -BLOCK_TRANSACTIONS = 200 +BLOCK_TRANSACTIONS = 300 BIN_REFERENCE_TABLE = 262144 SHF_REFERENCE_TABLE = 4096 INSTRUCTION_DECODER = 512 diff --git a/prover/config/config.go b/prover/config/config.go index 6732751c..4734710e 100644 --- a/prover/config/config.go +++ b/prover/config/config.go @@ -19,6 +19,17 @@ import ( // NewConfigFromFile reads the configuration from the given file path and returns a new Config. // It also sets default value and validate the configuration. func NewConfigFromFile(path string) (*Config, error) { + return newConfigFromFile(path, true) +} + +// NewConfigFromFileUnchecked reads the configuration and skips the validation. +func NewConfigFromFileUnchecked(path string) (*Config, error) { + return newConfigFromFile(path, false) +} + +// NewConfigFromFile reads the configuration from the given file path and returns a new Config. +// It also sets default value and validate the configuration. +func newConfigFromFile(path string, withValidation bool) (*Config, error) { viper.SetConfigFile(path) // Parse the config @@ -38,23 +49,25 @@ func NewConfigFromFile(path string) (*Config, error) { return nil, err } - // Validate the config - validate := validator.New(validator.WithRequiredStructEnabled()) - if err = validate.RegisterValidation("power_of_2", validateIsPowerOfTwo); err != nil { - return nil, err - } + if withValidation { + // Validate the config + validate := validator.New(validator.WithRequiredStructEnabled()) + if err = validate.RegisterValidation("power_of_2", validateIsPowerOfTwo); err != nil { + return nil, err + } - if err = validate.Struct(cfg); err != nil { - return nil, err + if err = validate.Struct(cfg); err != nil { + return nil, err + } } // Ensure cmdTmpl and cmdLargeTmpl are parsed cfg.Controller.WorkerCmdTmpl, err = template.New("worker_cmd").Parse(cfg.Controller.WorkerCmd) - if err != nil { + if withValidation && err != nil { return nil, fmt.Errorf("failed to parse worker_cmd template: %w", err) } cfg.Controller.WorkerCmdLargeTmpl, err = template.New("worker_cmd_large").Parse(cfg.Controller.WorkerCmdLarge) - if err != nil { + if withValidation && err != nil { return nil, fmt.Errorf("failed to parse worker_cmd_large template: %w", err) } @@ -63,14 +76,14 @@ func NewConfigFromFile(path string) (*Config, error) { // Extract the Layer2.MsgSvcContract address from the string addr, err := common.NewMixedcaseAddressFromString(cfg.Layer2.MsgSvcContractStr) - if err != nil { + if withValidation && err != nil { return nil, fmt.Errorf("failed to extract Layer2.MsgSvcContract address: %w", err) } cfg.Layer2.MsgSvcContract = addr.Address() // ensure that asset dir / kzgsrs exists using os.Stat srsDir := cfg.PathForSRS() - if _, err := os.Stat(srsDir); os.IsNotExist(err) { + if _, err := os.Stat(srsDir); withValidation && os.IsNotExist(err) { return nil, fmt.Errorf("kzgsrs directory (%s) does not exist: %w", srsDir, err) } @@ -106,7 +119,7 @@ type Config struct { // AssetsDir stores the root of the directory where the assets are stored (setup) or // accessed (prover). The file structure is described in TODO @gbotrel. - AssetsDir string `mapstructure:"assets_dir" validate:"required,dir"` + AssetsDir string `mapstructure:"assets_dir"` Controller Controller Execution Execution