Skip to content

Commit f113d49

Browse files
Prover limit update proposal for beta-2.0 (#936)
* chores(prover): updates the limits in the local files * fixup: update SHF for the large prover * increase ECMUL to 40
1 parent 7e306e2 commit f113d49

File tree

3 files changed

+73
-60
lines changed

3 files changed

+73
-60
lines changed

prover/config/config-mainnet-full.toml

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -37,41 +37,41 @@ chain_id = 59144
3737
message_service_contract = "0x508Ca82Df566dCD1B0DE8296e70a96332cD644ec"
3838

3939
[traces_limits]
40-
ADD = 524288
40+
ADD = 262144
4141
BIN = 262144
4242
BLAKE_MODEXP_DATA = 16384
4343
BLOCK_DATA = 4096
4444
BLOCK_HASH = 2048
45-
EC_DATA = 262144
45+
EC_DATA = 65536
4646
EUC = 65536
47-
EXP = 8192
48-
EXT = 1048576
47+
EXP = 65536
48+
EXT = 524288
4949
GAS = 65536
5050
HUB = 2097152
5151
LOG_DATA = 65536
5252
LOG_INFO = 4096
53-
MMIO = 4194304
54-
MMU = 4194304
53+
MMIO = 2097152
54+
MMU = 1048576
5555
MOD = 131072
5656
MUL = 65536
5757
MXP = 524288
5858
OOB = 262144
5959
RLP_ADDR = 4096
6060
RLP_TXN = 131072
6161
RLP_TXN_RCPT = 65536
62-
ROM = 4194304
62+
ROM = 8388608
6363
ROM_LEX = 1024
64-
SHAKIRA_DATA = 32768
65-
SHF = 65536
64+
SHAKIRA_DATA = 65536
65+
SHF = 262144
6666
STP = 16384
6767
TRM = 32768
6868
TXN_DATA = 8192
6969
WCP = 262144
7070
PRECOMPILE_ECRECOVER_EFFECTIVE_CALLS = 128
71-
PRECOMPILE_SHA2_BLOCKS = 671
71+
PRECOMPILE_SHA2_BLOCKS = 200
7272
PRECOMPILE_RIPEMD_BLOCKS = 0
73-
PRECOMPILE_MODEXP_EFFECTIVE_CALLS = 4
74-
PRECOMPILE_ECADD_EFFECTIVE_CALLS = 16384
73+
PRECOMPILE_MODEXP_EFFECTIVE_CALLS = 32
74+
PRECOMPILE_ECADD_EFFECTIVE_CALLS = 1024
7575
PRECOMPILE_ECMUL_EFFECTIVE_CALLS = 32
7676
PRECOMPILE_ECPAIRING_FINAL_EXPONENTIATIONS = 16
7777
PRECOMPILE_ECPAIRING_MILLER_LOOPS = 64
@@ -81,27 +81,27 @@ PRECOMPILE_BLAKE_ROUNDS = 0
8181
BLOCK_KECCAK = 8192
8282
BLOCK_L1_SIZE = 1000000
8383
BLOCK_L2_L1_LOGS = 16
84-
BLOCK_TRANSACTIONS = 200
84+
BLOCK_TRANSACTIONS = 300
8585
BIN_REFERENCE_TABLE = 262144
8686
SHF_REFERENCE_TABLE = 4096
8787
INSTRUCTION_DECODER = 512
8888

8989
[traces_limits_large]
90-
ADD = 1048576
90+
ADD = 524288
9191
BIN = 524288
9292
BLAKE_MODEXP_DATA = 32768
9393
BLOCK_DATA = 8192
9494
BLOCK_HASH = 4096
95-
EC_DATA = 524288
95+
EC_DATA = 131072
9696
EUC = 131072
97-
EXP = 16384
98-
EXT = 2097152
97+
EXP = 131072
98+
EXT = 1048576
9999
GAS = 131072
100100
HUB = 4194304
101101
LOG_DATA = 131072
102102
LOG_INFO = 8192
103-
MMIO = 8388608
104-
MMU = 8388608
103+
MMIO = 4194304
104+
MMU = 2097152
105105
MOD = 262144
106106
MUL = 131072
107107
MXP = 1048576
@@ -112,15 +112,15 @@ RLP_TXN_RCPT = 131072
112112
ROM = 8388608
113113
ROM_LEX = 2048
114114
SHAKIRA_DATA = 65536
115-
SHF = 131072
115+
SHF = 524288
116116
STP = 32768
117117
TRM = 65536
118118
TXN_DATA = 16384
119119
WCP = 524288
120120
PRECOMPILE_ECRECOVER_EFFECTIVE_CALLS = 256
121-
PRECOMPILE_SHA2_BLOCKS = 671
121+
PRECOMPILE_SHA2_BLOCKS = 400
122122
PRECOMPILE_RIPEMD_BLOCKS = 0
123-
PRECOMPILE_MODEXP_EFFECTIVE_CALLS = 8
123+
PRECOMPILE_MODEXP_EFFECTIVE_CALLS = 64
124124
PRECOMPILE_ECADD_EFFECTIVE_CALLS = 32768
125125
PRECOMPILE_ECMUL_EFFECTIVE_CALLS = 64
126126
PRECOMPILE_ECPAIRING_FINAL_EXPONENTIATIONS = 32
@@ -131,7 +131,7 @@ PRECOMPILE_BLAKE_ROUNDS = 0
131131
BLOCK_KECCAK = 8192
132132
BLOCK_L1_SIZE = 1000000
133133
BLOCK_L2_L1_LOGS = 16
134-
BLOCK_TRANSACTIONS = 200
134+
BLOCK_TRANSACTIONS = 300
135135
BIN_REFERENCE_TABLE = 262144
136136
SHF_REFERENCE_TABLE = 4096
137137
INSTRUCTION_DECODER = 512

prover/config/config-sepolia-full.toml

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -37,42 +37,42 @@ chain_id = 59141
3737
message_service_contract = "0x971e727e956690b9957be6d51Ec16E73AcAC83A7"
3838

3939
[traces_limits]
40-
ADD = 524288
40+
ADD = 262144
4141
BIN = 262144
4242
BLAKE_MODEXP_DATA = 16384
4343
BLOCK_DATA = 4096
4444
BLOCK_HASH = 2048
45-
EC_DATA = 262144
45+
EC_DATA = 65536
4646
EUC = 65536
47-
EXP = 8192
48-
EXT = 1048576
47+
EXP = 65536
48+
EXT = 524288
4949
GAS = 65536
5050
HUB = 2097152
5151
LOG_DATA = 65536
5252
LOG_INFO = 4096
53-
MMIO = 4194304
54-
MMU = 4194304
53+
MMIO = 2097152
54+
MMU = 1048576
5555
MOD = 131072
5656
MUL = 65536
5757
MXP = 524288
5858
OOB = 262144
5959
RLP_ADDR = 4096
6060
RLP_TXN = 131072
6161
RLP_TXN_RCPT = 65536
62-
ROM = 4194304
62+
ROM = 8388608
6363
ROM_LEX = 1024
64-
SHAKIRA_DATA = 32768
65-
SHF = 65536
64+
SHAKIRA_DATA = 65536
65+
SHF = 262144
6666
STP = 16384
6767
TRM = 32768
6868
TXN_DATA = 8192
6969
WCP = 262144
7070
PRECOMPILE_ECRECOVER_EFFECTIVE_CALLS = 128
71-
PRECOMPILE_SHA2_BLOCKS = 671
71+
PRECOMPILE_SHA2_BLOCKS = 200
7272
PRECOMPILE_RIPEMD_BLOCKS = 0
73-
PRECOMPILE_MODEXP_EFFECTIVE_CALLS = 4
74-
PRECOMPILE_ECADD_EFFECTIVE_CALLS = 16384
75-
PRECOMPILE_ECMUL_EFFECTIVE_CALLS = 32
73+
PRECOMPILE_MODEXP_EFFECTIVE_CALLS = 32
74+
PRECOMPILE_ECADD_EFFECTIVE_CALLS = 1024
75+
PRECOMPILE_ECMUL_EFFECTIVE_CALLS = 40
7676
PRECOMPILE_ECPAIRING_FINAL_EXPONENTIATIONS = 16
7777
PRECOMPILE_ECPAIRING_MILLER_LOOPS = 64
7878
PRECOMPILE_ECPAIRING_G2_MEMBERSHIP_CALLS = 64
@@ -81,27 +81,27 @@ PRECOMPILE_BLAKE_ROUNDS = 0
8181
BLOCK_KECCAK = 8192
8282
BLOCK_L1_SIZE = 1000000
8383
BLOCK_L2_L1_LOGS = 16
84-
BLOCK_TRANSACTIONS = 200
84+
BLOCK_TRANSACTIONS = 300
8585
BIN_REFERENCE_TABLE = 262144
8686
SHF_REFERENCE_TABLE = 4096
8787
INSTRUCTION_DECODER = 512
8888

8989
[traces_limits_large]
90-
ADD = 1048576
90+
ADD = 524288
9191
BIN = 524288
9292
BLAKE_MODEXP_DATA = 32768
9393
BLOCK_DATA = 8192
9494
BLOCK_HASH = 4096
95-
EC_DATA = 524288
95+
EC_DATA = 131072
9696
EUC = 131072
97-
EXP = 16384
98-
EXT = 2097152
97+
EXP = 131072
98+
EXT = 1048576
9999
GAS = 131072
100100
HUB = 4194304
101101
LOG_DATA = 131072
102102
LOG_INFO = 8192
103-
MMIO = 8388608
104-
MMU = 8388608
103+
MMIO = 4194304
104+
MMU = 2097152
105105
MOD = 262144
106106
MUL = 131072
107107
MXP = 1048576
@@ -112,17 +112,17 @@ RLP_TXN_RCPT = 131072
112112
ROM = 8388608
113113
ROM_LEX = 2048
114114
SHAKIRA_DATA = 65536
115-
SHF = 131072
115+
SHF = 524288
116116
STP = 32768
117117
TRM = 65536
118118
TXN_DATA = 16384
119119
WCP = 524288
120120
PRECOMPILE_ECRECOVER_EFFECTIVE_CALLS = 256
121-
PRECOMPILE_SHA2_BLOCKS = 671
121+
PRECOMPILE_SHA2_BLOCKS = 400
122122
PRECOMPILE_RIPEMD_BLOCKS = 0
123-
PRECOMPILE_MODEXP_EFFECTIVE_CALLS = 8
123+
PRECOMPILE_MODEXP_EFFECTIVE_CALLS = 64
124124
PRECOMPILE_ECADD_EFFECTIVE_CALLS = 32768
125-
PRECOMPILE_ECMUL_EFFECTIVE_CALLS = 64
125+
PRECOMPILE_ECMUL_EFFECTIVE_CALLS = 80
126126
PRECOMPILE_ECPAIRING_FINAL_EXPONENTIATIONS = 32
127127
PRECOMPILE_ECPAIRING_MILLER_LOOPS = 128
128128
PRECOMPILE_ECPAIRING_G2_MEMBERSHIP_CALLS = 128
@@ -131,7 +131,7 @@ PRECOMPILE_BLAKE_ROUNDS = 0
131131
BLOCK_KECCAK = 8192
132132
BLOCK_L1_SIZE = 1000000
133133
BLOCK_L2_L1_LOGS = 16
134-
BLOCK_TRANSACTIONS = 200
134+
BLOCK_TRANSACTIONS = 300
135135
BIN_REFERENCE_TABLE = 262144
136136
SHF_REFERENCE_TABLE = 4096
137137
INSTRUCTION_DECODER = 512

prover/config/config.go

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,17 @@ import (
1919
// NewConfigFromFile reads the configuration from the given file path and returns a new Config.
2020
// It also sets default value and validate the configuration.
2121
func NewConfigFromFile(path string) (*Config, error) {
22+
return newConfigFromFile(path, true)
23+
}
24+
25+
// NewConfigFromFileUnchecked reads the configuration and skips the validation.
26+
func NewConfigFromFileUnchecked(path string) (*Config, error) {
27+
return newConfigFromFile(path, false)
28+
}
29+
30+
// NewConfigFromFile reads the configuration from the given file path and returns a new Config.
31+
// It also sets default value and validate the configuration.
32+
func newConfigFromFile(path string, withValidation bool) (*Config, error) {
2233
viper.SetConfigFile(path)
2334

2435
// Parse the config
@@ -38,23 +49,25 @@ func NewConfigFromFile(path string) (*Config, error) {
3849
return nil, err
3950
}
4051

41-
// Validate the config
42-
validate := validator.New(validator.WithRequiredStructEnabled())
43-
if err = validate.RegisterValidation("power_of_2", validateIsPowerOfTwo); err != nil {
44-
return nil, err
45-
}
52+
if withValidation {
53+
// Validate the config
54+
validate := validator.New(validator.WithRequiredStructEnabled())
55+
if err = validate.RegisterValidation("power_of_2", validateIsPowerOfTwo); err != nil {
56+
return nil, err
57+
}
4658

47-
if err = validate.Struct(cfg); err != nil {
48-
return nil, err
59+
if err = validate.Struct(cfg); err != nil {
60+
return nil, err
61+
}
4962
}
5063

5164
// Ensure cmdTmpl and cmdLargeTmpl are parsed
5265
cfg.Controller.WorkerCmdTmpl, err = template.New("worker_cmd").Parse(cfg.Controller.WorkerCmd)
53-
if err != nil {
66+
if withValidation && err != nil {
5467
return nil, fmt.Errorf("failed to parse worker_cmd template: %w", err)
5568
}
5669
cfg.Controller.WorkerCmdLargeTmpl, err = template.New("worker_cmd_large").Parse(cfg.Controller.WorkerCmdLarge)
57-
if err != nil {
70+
if withValidation && err != nil {
5871
return nil, fmt.Errorf("failed to parse worker_cmd_large template: %w", err)
5972
}
6073

@@ -63,14 +76,14 @@ func NewConfigFromFile(path string) (*Config, error) {
6376

6477
// Extract the Layer2.MsgSvcContract address from the string
6578
addr, err := common.NewMixedcaseAddressFromString(cfg.Layer2.MsgSvcContractStr)
66-
if err != nil {
79+
if withValidation && err != nil {
6780
return nil, fmt.Errorf("failed to extract Layer2.MsgSvcContract address: %w", err)
6881
}
6982
cfg.Layer2.MsgSvcContract = addr.Address()
7083

7184
// ensure that asset dir / kzgsrs exists using os.Stat
7285
srsDir := cfg.PathForSRS()
73-
if _, err := os.Stat(srsDir); os.IsNotExist(err) {
86+
if _, err := os.Stat(srsDir); withValidation && os.IsNotExist(err) {
7487
return nil, fmt.Errorf("kzgsrs directory (%s) does not exist: %w", srsDir, err)
7588
}
7689

@@ -106,7 +119,7 @@ type Config struct {
106119

107120
// AssetsDir stores the root of the directory where the assets are stored (setup) or
108121
// accessed (prover). The file structure is described in TODO @gbotrel.
109-
AssetsDir string `mapstructure:"assets_dir" validate:"required,dir"`
122+
AssetsDir string `mapstructure:"assets_dir"`
110123

111124
Controller Controller
112125
Execution Execution

0 commit comments

Comments
 (0)