Skip to content

Commit

Permalink
refine log to use debug for conflict detail
Browse files Browse the repository at this point in the history
  • Loading branch information
sunny2022da committed Aug 14, 2024
1 parent 0854a98 commit 2c4f45f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion core/parallel_state_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ func (p *ParallelStateProcessor) toConfirmTxIndex(targetTxIndex int, isStage2 bo
func (p *ParallelStateProcessor) toConfirmTxIndexResult(txResult *ParallelTxResult, isStage2 bool) bool {
txReq := txResult.txReq
if p.hasConflict(txResult, isStage2) {
log.Warn(fmt.Sprintf("HasConflict!! block: %d, txIndex: %d\n", txResult.txReq.block.NumberU64(), txResult.txReq.txIndex))
log.Info(fmt.Sprintf("HasConflict!! block: %d, txIndex: %d\n", txResult.txReq.block.NumberU64(), txResult.txReq.txIndex))
return false
}
if isStage2 { // not its turn
Expand Down
20 changes: 10 additions & 10 deletions core/state/parallel_statedb.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func hasKvConflict(slotDB *ParallelStateDB, addr common.Address, key common.Hash
}
if valUnconfirm, ok := slotDB.getKVFromUnconfirmedDB(addr, key); ok {
if !bytes.Equal(val.Bytes(), valUnconfirm.Bytes()) {
log.Warn("IsSlotDBReadsValid KV read is invalid in unconfirmed", "addr", addr,
log.Debug("IsSlotDBReadsValid KV read is invalid in unconfirmed", "addr", addr,
"valSlot", val, "valUnconfirm", valUnconfirm,
"SlotIndex", slotDB.parallel.SlotIndex,
"txIndex", slotDB.txIndex, "baseTxIndex", slotDB.parallel.baseTxIndex)
Expand All @@ -57,7 +57,7 @@ func hasKvConflict(slotDB *ParallelStateDB, addr common.Address, key common.Hash
valMain := mainDB.GetStateNoUpdate(addr, key)

if !bytes.Equal(val.Bytes(), valMain.Bytes()) {
log.Warn("hasKvConflict is invalid", "addr", addr,
log.Debug("hasKvConflict is invalid", "addr", addr,
"key", key, "valSlot", val,
"valMain", valMain, "SlotIndex", slotDB.parallel.SlotIndex,
"txIndex", slotDB.txIndex, "baseTxIndex", slotDB.parallel.baseTxIndex,
Expand Down Expand Up @@ -1288,7 +1288,7 @@ func (slotDB *ParallelStateDB) IsParallelReadsValid(isStage2 bool) bool {
}
if nonceUnconfirm, ok := slotDB.getNonceFromUnconfirmedDB(addr); ok {
if nonceSlot != nonceUnconfirm {
log.Warn("IsSlotDBReadsValid nonce read is invalid in unconfirmed", "addr", addr,
log.Debug("IsSlotDBReadsValid nonce read is invalid in unconfirmed", "addr", addr,
"nonceSlot", nonceSlot, "nonceUnconfirm", nonceUnconfirm, "SlotIndex", slotDB.parallel.SlotIndex,
"txIndex", slotDB.txIndex, "baseTxIndex", slotDB.parallel.baseTxIndex)
return false
Expand All @@ -1301,7 +1301,7 @@ func (slotDB *ParallelStateDB) IsParallelReadsValid(isStage2 bool) bool {
nonceMain = mainObj.Nonce()
}
if nonceSlot != nonceMain {
log.Warn("IsSlotDBReadsValid nonce read is invalid", "addr", addr,
log.Debug("IsSlotDBReadsValid nonce read is invalid", "addr", addr,
"nonceSlot", nonceSlot, "nonceMain", nonceMain, "SlotIndex", slotDB.parallel.SlotIndex,
"txIndex", slotDB.txIndex, "baseTxIndex", slotDB.parallel.baseTxIndex,
"mainIndex", mainDB.txIndex)
Expand Down Expand Up @@ -1331,7 +1331,7 @@ func (slotDB *ParallelStateDB) IsParallelReadsValid(isStage2 bool) bool {
}

if balanceSlot.Cmp(balanceMain) != 0 {
log.Warn("IsSlotDBReadsValid balance read is invalid", "addr", addr,
log.Debug("IsSlotDBReadsValid balance read is invalid", "addr", addr,
"balanceSlot", balanceSlot, "balanceMain", balanceMain, "SlotIndex", slotDB.parallel.SlotIndex,
"txIndex", slotDB.txIndex, "baseTxIndex", slotDB.parallel.baseTxIndex,
"mainIndex", mainDB.txIndex)
Expand Down Expand Up @@ -1422,7 +1422,7 @@ func (slotDB *ParallelStateDB) IsParallelReadsValid(isStage2 bool) bool {
codeMain = object.Code()
}
if !bytes.Equal(codeSlot, codeMain) {
log.Warn("IsSlotDBReadsValid code read is invalid", "addr", addr,
log.Debug("IsSlotDBReadsValid code read is invalid", "addr", addr,
"len codeSlot", len(codeSlot), "len codeMain", len(codeMain), "SlotIndex", slotDB.parallel.SlotIndex,
"txIndex", slotDB.txIndex, "baseTxIndex", slotDB.parallel.baseTxIndex,
"mainIndex", mainDB.txIndex)
Expand All @@ -1437,7 +1437,7 @@ func (slotDB *ParallelStateDB) IsParallelReadsValid(isStage2 bool) bool {
codeHashMain = common.BytesToHash(object.CodeHash())
}
if !bytes.Equal(codeHashSlot.Bytes(), codeHashMain.Bytes()) {
log.Warn("IsSlotDBReadsValid codehash read is invalid", "addr", addr,
log.Debug("IsSlotDBReadsValid codehash read is invalid", "addr", addr,
"codeHashSlot", codeHashSlot, "codeHashMain", codeHashMain, "SlotIndex", slotDB.parallel.SlotIndex,
"txIndex", slotDB.txIndex, "baseTxIndex", slotDB.parallel.baseTxIndex, "mainIndex", mainDB.txIndex)
return false
Expand All @@ -1450,7 +1450,7 @@ func (slotDB *ParallelStateDB) IsParallelReadsValid(isStage2 bool) bool {
stateMain = true // addr exist in main DB
}
if stateSlot != stateMain {
log.Warn("IsSlotDBReadsValid addrState read invalid(true: exist, false: not exist)",
log.Debug("IsSlotDBReadsValid addrState read invalid(true: exist, false: not exist)",
"addr", addr, "stateSlot", stateSlot, "stateMain", stateMain,
"SlotIndex", slotDB.parallel.SlotIndex,
"txIndex", slotDB.txIndex, "baseTxIndex", slotDB.parallel.baseTxIndex, "mainIndex", mainDB.txIndex)
Expand All @@ -1461,7 +1461,7 @@ func (slotDB *ParallelStateDB) IsParallelReadsValid(isStage2 bool) bool {
for addr, destructRead := range slotDB.parallel.addrSnapDestructsReadsInSlot {
mainObj := mainDB.getDeletedStateObjectNoUpdate(addr)
if mainObj == nil {
log.Warn("IsSlotDBReadsValid snapshot destructs read invalid, address should exist",
log.Debug("IsSlotDBReadsValid snapshot destructs read invalid, address should exist",
"addr", addr, "destruct", destructRead,
"SlotIndex", slotDB.parallel.SlotIndex,
"txIndex", slotDB.txIndex, "baseTxIndex", slotDB.parallel.baseTxIndex)
Expand All @@ -1471,7 +1471,7 @@ func (slotDB *ParallelStateDB) IsParallelReadsValid(isStage2 bool) bool {
_, destructMain := mainDB.snapDestructs[addr] // addr not exist
slotDB.snapParallelLock.RUnlock()
if destructRead != destructMain && addr.Hex() != "0x0000000000000000000000000000000000000001" {
log.Warn("IsSlotDBReadsValid snapshot destructs read invalid",
log.Debug("IsSlotDBReadsValid snapshot destructs read invalid",
"addr", addr, "destructRead", destructRead, "destructMain", destructMain,
"SlotIndex", slotDB.parallel.SlotIndex,
"txIndex", slotDB.txIndex, "baseTxIndex", slotDB.parallel.baseTxIndex,
Expand Down

0 comments on commit 2c4f45f

Please sign in to comment.