code: func (self *stateObject) updateTrie(db Database) Trie {
  	// Track the amount of time wasted on updating the storge trie
  	if metrics.EnabledExpensive {
  		defer func(start time.Time) { self.db.StorageUpdates += time.Since(start) }(time.Now())
  	}
  	// Update all the dirty slots in the trie
  	tr := self.getTrie(db)
  	for key, value := range self.dirtyStorage {
  		delete(self.dirtyStorage, key)
  
  		// Skip noop changes, persist actual changes
  		if value == self.originStorage[key] {
  			continue
  		}
  		self.originStorage[key] = value
  
  		if (value == common.Hash{}) {
  			self.setError(tr.TryDelete(key[:]))
  			continue
  		}
  		// Encoding []byte cannot fail, ok to ignore the error.
  		v, _ := rlp.EncodeToBytes(bytes.TrimLeft(value[:], "\x00"))
  		self.setError(tr.TryUpdate(key[:], v))
  	}
  	return tr
  }
docs: // updateTrie writes cached storage modifications into the object's storage trie.