Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat (libzkp-v0.9.8): recordStorageDetail even when LogConfig.DisableStorage == true #564

Merged
merged 8 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions core/trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ func CreateTraceEnv(chainConfig *params.ChainConfig, chainContext ChainContext,
env := CreateTraceEnvHelper(
chainConfig,
&vm.LogConfig{
DisableStorage: true,
EnableMemory: false,
EnableReturnData: true,
},
Expand Down
22 changes: 11 additions & 11 deletions core/vm/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,24 +234,24 @@ func (l *StructLogger) CaptureState(pc uint64, op OpCode, gas, cost uint64, scop
storageKey common.Hash
storageValue common.Hash
)
if !l.cfg.DisableStorage {
if op == SLOAD && stack.len() >= 1 {
recordStorageDetail = true
storageKey = stack.data[stack.len()-1].Bytes32()
storageValue = l.env.StateDB.GetState(contract.Address(), storageKey)
} else if op == SSTORE && stack.len() >= 2 {
recordStorageDetail = true
storageKey = stack.data[stack.len()-1].Bytes32()
storageValue = stack.data[stack.len()-2].Bytes32()
}
if op == SLOAD && stack.len() >= 1 {
recordStorageDetail = true
storageKey = stack.data[stack.len()-1].Bytes32()
storageValue = l.env.StateDB.GetState(contract.Address(), storageKey)
} else if op == SSTORE && stack.len() >= 2 {
recordStorageDetail = true
storageKey = stack.data[stack.len()-1].Bytes32()
storageValue = stack.data[stack.len()-2].Bytes32()
}
if recordStorageDetail {
contractAddress := contract.Address()
if l.storage[contractAddress] == nil {
l.storage[contractAddress] = make(Storage)
}
l.storage[contractAddress][storageKey] = storageValue
structLog.Storage = l.storage[contractAddress].Copy()
if !l.cfg.DisableStorage {
structLog.Storage = l.storage[contractAddress].Copy()
}

if err := traceStorage(l, scope, structLog.getOrInitExtraData()); err != nil {
log.Error("Failed to trace data", "opcode", op.String(), "err", err)
Expand Down
2 changes: 1 addition & 1 deletion params/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
const (
VersionMajor = 5 // Major version component of the current release
VersionMinor = 1 // Minor version component of the current release
VersionPatch = 4 // Patch version component of the current release
VersionPatch = 5 // Patch version component of the current release
VersionMeta = "mainnet" // Version metadata to append to the version string
)

Expand Down
22 changes: 11 additions & 11 deletions rollup/circuitcapacitychecker/libzkp/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion rollup/circuitcapacitychecker/libzkp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ maingate = { git = "https://github.com/scroll-tech/halo2wrong", branch = "halo2-
halo2curves = { git = "https://github.com/scroll-tech/halo2curves.git", branch = "0.3.1-derive-serde" }

[dependencies]
prover = { git = "https://github.com/scroll-tech/zkevm-circuits.git", tag = "v0.9.7", default-features = false, features = ["parallel_syn", "scroll", "shanghai"] }
prover = { git = "https://github.com/scroll-tech/zkevm-circuits.git", tag = "v0.9.8", default-features = false, features = ["parallel_syn", "scroll", "shanghai", "strict-ccc"] }

anyhow = "1.0"
log = "0.4"
Expand Down
Loading