Prover: benchmark beta v1 (#3834)

* feat(bench): adds prover mode bench
* fixup: remove the prover-inner
* create a config for benchmark
* fix the CI tests
This commit is contained in:
AlexandreBelling
2024-09-05 19:33:08 +02:00
committed by GitHub
parent a1137446d3
commit 72539a4b53
7 changed files with 148 additions and 7 deletions

View File

@@ -154,6 +154,22 @@ func mustProveAndPass(
// TODO: implements the collection of the functional inputs from the prover response
return execution.MakeProof(setup, fullZkEvm.WizardIOP, proof, *w.FuncInp), setup.VerifyingKeyDigest()
case config.ProverModeBench:
// Run the full prover to obtain the intermediate proof
logrus.Info("Get Full IOP")
fullZkEvm := zkevm.FullZkEvm(traces)
// Generates the inner-proof and sanity-check it so that we ensure that
// the prover nevers outputs invalid proofs.
proof := fullZkEvm.ProveInner(w.ZkEVM)
logrus.Info("Sanity-checking the inner-proof")
if err := fullZkEvm.VerifyInner(proof); err != nil {
utils.Panic("The prover did not pass: %v", err)
}
return "", ""
default:
panic("not implemented")
}

View File

@@ -0,0 +1,124 @@
environment = "integration-full"
version = "3.0.0" # TODO @gbotrel hunt all version definitions.
assets_dir = "./prover-assets"
log_level = 1 # TODO @gbotrel will be refactored with new logger.
[controller]
retry_delays = [0, 1]
[execution]
prover_mode = "bench"
conflated_traces_dir = "./prover-v2/conflated"
[blob_decompression]
prover_mode = "dev"
[aggregation]
prover_mode = "full"
num_proofs = [10]
allowed_inputs = ["execution-dummy", "execution", "blob-decompression-dummy"]
verifier_id = 1
[layer2]
chain_id = 59144
message_service_contract = "0x508Ca82Df566dCD1B0DE8296e70a96332cD644ec"
[traces_limits]
ADD = 524288
BIN = 262144
BLAKE_MODEXP_DATA = 16384
BLOCK_DATA = 1024
BLOCK_HASH = 512
EC_DATA = 262144
EUC = 65536
EXP = 8192
EXT = 1048576
GAS = 65536
HUB = 2097152
LOG_DATA = 65536
LOG_INFO = 4096
MMIO = 4194304
MMU = 4194304
MOD = 131072
MUL = 65536
MXP = 524288
OOB = 262144
RLP_ADDR = 4096
RLP_TXN = 131072
RLP_TXN_RCPT = 65536
ROM = 4194304
ROM_LEX = 1024
SHAKIRA_DATA = 32768
SHF = 65536
STP = 16384
TRM = 32768
TXN_DATA = 8192
WCP = 262144
PRECOMPILE_ECRECOVER_EFFECTIVE_CALLS = 128
PRECOMPILE_SHA2_BLOCKS = 671
PRECOMPILE_RIPEMD_BLOCKS = 671
PRECOMPILE_MODEXP_EFFECTIVE_CALLS = 4
PRECOMPILE_ECADD_EFFECTIVE_CALLS = 16384
PRECOMPILE_ECMUL_EFFECTIVE_CALLS = 32
PRECOMPILE_ECPAIRING_FINAL_EXPONENTIATIONS = 16
PRECOMPILE_ECPAIRING_MILLER_LOOPS = 64
PRECOMPILE_ECPAIRING_G2_MEMBERSHIP_CALLS = 64
PRECOMPILE_BLAKE_EFFECTIVE_CALLS = 600
PRECOMPILE_BLAKE_ROUNDS = 600
BLOCK_KECCAK = 8192
BLOCK_L1_SIZE = 1000000
BLOCK_L2_L1_LOGS = 16
BLOCK_TRANSACTIONS = 200
BIN_REFERENCE_TABLE = 262144
SHF_REFERENCE_TABLE = 4096
INSTRUCTION_DECODER = 512
[traces_limits_large]
ADD = 1048576
BIN = 524288
BLAKE_MODEXP_DATA = 32768
BLOCK_DATA = 2048
BLOCK_HASH = 1024
EC_DATA = 524288
EUC = 131072
EXP = 16384
EXT = 2097152
GAS = 131072
HUB = 4194304
LOG_DATA = 131072
LOG_INFO = 8192
MMIO = 8388608
MMU = 8388608
MOD = 262144
MUL = 131072
MXP = 1048576
OOB = 524288
RLP_ADDR = 8192
RLP_TXN = 262144
RLP_TXN_RCPT = 131072
ROM = 8388608
ROM_LEX = 2048
SHAKIRA_DATA = 65536
SHF = 131072
STP = 32768
TRM = 65536
TXN_DATA = 16384
WCP = 524288
PRECOMPILE_ECRECOVER_EFFECTIVE_CALLS = 256
PRECOMPILE_SHA2_BLOCKS = 671
PRECOMPILE_RIPEMD_BLOCKS = 671
PRECOMPILE_MODEXP_EFFECTIVE_CALLS = 8
PRECOMPILE_ECADD_EFFECTIVE_CALLS = 32768
PRECOMPILE_ECMUL_EFFECTIVE_CALLS = 64
PRECOMPILE_ECPAIRING_FINAL_EXPONENTIATIONS = 32
PRECOMPILE_ECPAIRING_MILLER_LOOPS = 128
PRECOMPILE_ECPAIRING_G2_MEMBERSHIP_CALLS = 128
PRECOMPILE_BLAKE_EFFECTIVE_CALLS = 600
PRECOMPILE_BLAKE_ROUNDS = 600
BLOCK_KECCAK = 8192
BLOCK_L1_SIZE = 1000000
BLOCK_L2_L1_LOGS = 16
BLOCK_TRANSACTIONS = 200
BIN_REFERENCE_TABLE = 262144
SHF_REFERENCE_TABLE = 4096
INSTRUCTION_DECODER = 512

View File

@@ -8,7 +8,6 @@ retry_delays = [0, 1]
[execution]
prover_mode = "full"
conflated_traces_dir = "./prover-v2/conflated"
[blob_decompression]
prover_mode = "dev"

View File

@@ -198,7 +198,7 @@ type Execution struct {
WithRequestDir `mapstructure:",squash"`
// ProverMode stores the kind of prover to use.
ProverMode ProverMode `mapstructure:"prover_mode" validate:"required,oneof=dev partial full proofless"`
ProverMode ProverMode `mapstructure:"prover_mode" validate:"required,oneof=dev partial full proofless bench"`
// CanRunFullLarge indicates whether the prover is running on a large machine (and can run full large traces).
CanRunFullLarge bool `mapstructure:"can_run_full_large"`

View File

@@ -9,7 +9,7 @@ import (
"github.com/stretchr/testify/require"
)
func TestEnvironement(t *testing.T) {
func TestEnvironment(t *testing.T) {
assert := require.New(t)
// parse each config file and ensure environment is well set.

View File

@@ -22,4 +22,7 @@ const (
ProverModePartial ProverMode = "partial"
ProverModeFull ProverMode = "full"
ProverModeProofless ProverMode = "proofless"
// ProverModeBench is used to only run the inner-proof. This is convenient
// in a context where it is simpler to not have to deal with the setup.
ProverModeBench ProverMode = "bench"
)

View File

@@ -487,7 +487,7 @@ func TestExhaustive(t *testing.T) {
)
}
if tabCase.StratCondIncluding != nil {
if tabCase.StratCondIncluding != nil && tabCase.StratCondIncluding[frag] != nil {
condTable[frag] = b.InsertCommit(
0,
ifaces.ColIDf("TAB_%v_FRAG_%v_COND", tabID, frag),
@@ -516,7 +516,7 @@ func TestExhaustive(t *testing.T) {
}
var condInc ifaces.Column
if tabCase.StratCondIncluded != nil {
if tabCase.StratCondIncluded != nil && tabCase.StratCondIncluded[incID] != nil {
condInc = b.InsertCommit(
0,
ifaces.ColIDf("TAB_%v_SUB_%v_COND", tabID, incID),
@@ -526,8 +526,7 @@ func TestExhaustive(t *testing.T) {
b.SubProvers.AppendToInner(0, func(run *wizard.ProverRuntime) {
tabCase.StratIncluded[incID](run, included...)
if condInc != nil {
if tabCase.StratCondIncluded != nil && tabCase.StratCondIncluded[incID] != nil {
tabCase.StratCondIncluded[incID](run, condInc)
}
})