Merge pull request #1335 from maticnetwork/1.4.0-candidate

1.4.1 candidate
This commit is contained in:
Jerry 2024-09-18 08:49:25 -07:00 committed by GitHub
commit 0b28bb5e2f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 48 additions and 27 deletions

File diff suppressed because one or more lines are too long

View file

@ -329,10 +329,13 @@ func MVRead[T any](s *StateDB, k blockstm.Key, defaultV T, readStorage func(s *S
return defaultV return defaultV
} }
// TODO: I assume we don't want to overwrite an existing read because this could - for example - change a storage if prevRd, ok := s.readMap[k]; !ok {
// read to map if the same value is read multiple times.
if _, ok := s.readMap[k]; !ok {
s.readMap[k] = rd s.readMap[k] = rd
} else {
if prevRd.Kind != rd.Kind || prevRd.V.TxnIndex != rd.V.TxnIndex || prevRd.V.Incarnation != rd.V.Incarnation {
s.dep = rd.V.TxnIndex
panic("Read conflict detected")
}
} }
return return

View file

@ -785,7 +785,7 @@ func TestMVHashMapOverwrite(t *testing.T) {
states := []*StateDB{s} states := []*StateDB{s}
// Create copies of the original state for each transition // Create copies of the original state for each transition
for i := 1; i <= 4; i++ { for i := 1; i <= 5; i++ {
sCopy := s.Copy() sCopy := s.Copy()
sCopy.txIndex = i sCopy.txIndex = i
states = append(states, sCopy) states = append(states, sCopy)
@ -828,9 +828,9 @@ func TestMVHashMapOverwrite(t *testing.T) {
states[1].writeMap = nil states[1].writeMap = nil
} }
// Tx2 read should get Tx0's value // Tx3 read should get Tx0's value
v = states[2].GetState(addr, key) v = states[3].GetState(addr, key)
b = states[2].GetBalance(addr) b = states[3].GetBalance(addr)
assert.Equal(t, val1, v) assert.Equal(t, val1, v)
assert.Equal(t, balance1, b) assert.Equal(t, balance1, b)
@ -849,9 +849,9 @@ func TestMVHashMapOverwrite(t *testing.T) {
states[0].writeMap = nil states[0].writeMap = nil
} }
// Tx2 read again should get default vals // Tx4 read again should get default vals
v = states[2].GetState(addr, key) v = states[4].GetState(addr, key)
b = states[2].GetBalance(addr) b = states[4].GetBalance(addr)
assert.Equal(t, common.Hash{}, v) assert.Equal(t, common.Hash{}, v)
assert.Equal(t, common.Big0, b) assert.Equal(t, common.Big0, b)
@ -867,7 +867,7 @@ func TestMVHashMapWriteNoConflict(t *testing.T) {
states := []*StateDB{s} states := []*StateDB{s}
// Create copies of the original state for each transition // Create copies of the original state for each transition
for i := 1; i <= 4; i++ { for i := 1; i <= 6; i++ {
sCopy := s.Copy() sCopy := s.Copy()
sCopy.txIndex = i sCopy.txIndex = i
states = append(states, sCopy) states = append(states, sCopy)
@ -918,17 +918,17 @@ func TestMVHashMapWriteNoConflict(t *testing.T) {
states[2].writeMap = nil states[2].writeMap = nil
} }
assert.Equal(t, val1, states[3].GetState(addr, key1)) assert.Equal(t, val1, states[4].GetState(addr, key1))
assert.Equal(t, balance1, states[3].GetBalance(addr)) assert.Equal(t, balance1, states[4].GetBalance(addr))
assert.Equal(t, common.Hash{}, states[3].GetState(addr, key2)) assert.Equal(t, common.Hash{}, states[4].GetState(addr, key2))
// Tx1 revert // Tx1 revert
states[1].RevertToSnapshot(tx1Snapshot) states[1].RevertToSnapshot(tx1Snapshot)
states[1].FlushMVWriteSet() states[1].FlushMVWriteSet()
assert.Equal(t, common.Hash{}, states[3].GetState(addr, key1)) assert.Equal(t, common.Hash{}, states[5].GetState(addr, key1))
assert.Equal(t, common.Hash{}, states[3].GetState(addr, key2)) assert.Equal(t, common.Hash{}, states[5].GetState(addr, key2))
assert.Equal(t, common.Big0, states[3].GetBalance(addr)) assert.Equal(t, common.Big0, states[5].GetBalance(addr))
// Tx1 delete // Tx1 delete
for _, v := range states[1].writeMap { for _, v := range states[1].writeMap {
@ -937,9 +937,9 @@ func TestMVHashMapWriteNoConflict(t *testing.T) {
states[1].writeMap = nil states[1].writeMap = nil
} }
assert.Equal(t, common.Hash{}, states[3].GetState(addr, key1)) assert.Equal(t, common.Hash{}, states[6].GetState(addr, key1))
assert.Equal(t, common.Hash{}, states[3].GetState(addr, key2)) assert.Equal(t, common.Hash{}, states[6].GetState(addr, key2))
assert.Equal(t, common.Big0, states[3].GetBalance(addr)) assert.Equal(t, common.Big0, states[6].GetBalance(addr))
} }
func TestApplyMVWriteSet(t *testing.T) { func TestApplyMVWriteSet(t *testing.T) {

File diff suppressed because one or more lines are too long

View file

@ -1,5 +1,5 @@
Source: bor Source: bor
Version: 1.4.0 Version: 1.4.1
Section: develop Section: develop
Priority: standard Priority: standard
Maintainer: Polygon <release-team@polygon.technology> Maintainer: Polygon <release-team@polygon.technology>

View file

@ -1,5 +1,5 @@
Source: bor Source: bor
Version: 1.4.0 Version: 1.4.1
Section: develop Section: develop
Priority: standard Priority: standard
Maintainer: Polygon <release-team@polygon.technology> Maintainer: Polygon <release-team@polygon.technology>

View file

@ -1,5 +1,5 @@
Source: bor-profile Source: bor-profile
Version: 1.4.0 Version: 1.4.1
Section: develop Section: develop
Priority: standard Priority: standard
Maintainer: Polygon <release-team@polygon.technology> Maintainer: Polygon <release-team@polygon.technology>

View file

@ -1,5 +1,5 @@
Source: bor-profile Source: bor-profile
Version: 1.4.0 Version: 1.4.1
Section: develop Section: develop
Priority: standard Priority: standard
Maintainer: Polygon <release-team@polygon.technology> Maintainer: Polygon <release-team@polygon.technology>

View file

@ -1,5 +1,5 @@
Source: bor-profile Source: bor-profile
Version: 1.4.0 Version: 1.4.1
Section: develop Section: develop
Priority: standard Priority: standard
Maintainer: Polygon <release-team@polygon.technology> Maintainer: Polygon <release-team@polygon.technology>

View file

@ -1,5 +1,5 @@
Source: bor-profile Source: bor-profile
Version: 1.4.0 Version: 1.4.1
Section: develop Section: develop
Priority: standard Priority: standard
Maintainer: Polygon <release-team@polygon.technology> Maintainer: Polygon <release-team@polygon.technology>

File diff suppressed because one or more lines are too long

View file

@ -23,7 +23,7 @@ import (
const ( const (
VersionMajor = 1 // Major version component of the current release VersionMajor = 1 // Major version component of the current release
VersionMinor = 4 // Minor version component of the current release VersionMinor = 4 // Minor version component of the current release
VersionPatch = 0 // Patch version component of the current release VersionPatch = 1 // Patch version component of the current release
VersionMeta = "" // Version metadata to append to the version string VersionMeta = "" // Version metadata to append to the version string
) )