diff --git a/erigon-lib/state/domain_shared.go b/erigon-lib/state/domain_shared.go index 1cd19c6e065..70da8a43af9 100644 --- a/erigon-lib/state/domain_shared.go +++ b/erigon-lib/state/domain_shared.go @@ -1109,7 +1109,6 @@ func (sd *SharedDomains) Tx() kv.Tx { return sd.roTx } type SharedDomainsCommitmentContext struct { sharedDomains *SharedDomains - discard bool // could be replaced with using ModeDisabled branches map[string]cachedBranch keccak cryptozerocopy.KeccakState updates *commitment.Updates @@ -1126,7 +1125,6 @@ func (sdc *SharedDomainsCommitmentContext) SetLimitReadAsOfTxNum(txNum uint64) { func NewSharedDomainsCommitmentContext(sd *SharedDomains, mode commitment.Mode, trieVariant commitment.TrieVariant) *SharedDomainsCommitmentContext { ctx := &SharedDomainsCommitmentContext{ sharedDomains: sd, - discard: dbg.DiscardCommitment(), branches: make(map[string]cachedBranch), keccak: sha3.NewLegacyKeccak256().(cryptozerocopy.KeccakState), } @@ -1310,7 +1308,7 @@ func (sdc *SharedDomainsCommitmentContext) KeysCount() uint64 { // TouchPlainKey marks plainKey as updated and applies different fn for different key types // (different behaviour for Code, Account and Storage key modifications). func (sdc *SharedDomainsCommitmentContext) TouchKey(d kv.Domain, key string, val []byte) { - if sdc.discard { + if sdc.updates.Mode() == commitment.ModeDisabled { return } @@ -1328,10 +1326,6 @@ func (sdc *SharedDomainsCommitmentContext) TouchKey(d kv.Domain, key string, val // Evaluates commitment for processed state. func (sdc *SharedDomainsCommitmentContext) ComputeCommitment(ctx context.Context, saveState bool, blockNum uint64, logPrefix string) (rootHash []byte, err error) { - if dbg.DiscardCommitment() { - sdc.updates.Reset() - return nil, nil - } sdc.ResetBranchCache() defer sdc.ResetBranchCache() @@ -1434,9 +1428,6 @@ func _decodeTxBlockNums(v []byte) (txNum, blockNum uint64) { // LatestCommitmentState searches for last encoded state for CommitmentContext. // Found value does not become current state. func (sdc *SharedDomainsCommitmentContext) LatestCommitmentState() (blockNum, txNum uint64, state []byte, err error) { - if dbg.DiscardCommitment() { - return 0, 0, nil, nil - } if sdc.patriciaTrie.Variant() != commitment.VariantHexPatriciaTrie { return 0, 0, nil, fmt.Errorf("state storing is only supported hex patricia trie") }