diff --git a/core/state/statedb.go b/core/state/statedb.go index b907f9a3809b..8b6a8aee11fb 100644 --- a/core/state/statedb.go +++ b/core/state/statedb.go @@ -330,10 +330,13 @@ func MVRead[T any](s *StateDB, k blockstm.Key, defaultV T, readStorage func(s *S return defaultV } - // TODO: I assume we don't want to overwrite an existing read because this could - for example - change a storage - // read to map if the same value is read multiple times. - if _, ok := s.readMap[k]; !ok { + if prevRd, ok := s.readMap[k]; !ok { 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 diff --git a/core/state/statedb_test.go b/core/state/statedb_test.go index 7c3db0ccdcbc..b0ca21a2bd36 100644 --- a/core/state/statedb_test.go +++ b/core/state/statedb_test.go @@ -786,7 +786,7 @@ func TestMVHashMapOverwrite(t *testing.T) { states := []*StateDB{s} // 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.txIndex = i states = append(states, sCopy) @@ -829,9 +829,9 @@ func TestMVHashMapOverwrite(t *testing.T) { states[1].writeMap = nil } - // Tx2 read should get Tx0's value - v = states[2].GetState(addr, key) - b = states[2].GetBalance(addr) + // Tx3 read should get Tx0's value + v = states[3].GetState(addr, key) + b = states[3].GetBalance(addr) assert.Equal(t, val1, v) assert.Equal(t, balance1, b) @@ -850,9 +850,9 @@ func TestMVHashMapOverwrite(t *testing.T) { states[0].writeMap = nil } - // Tx2 read again should get default vals - v = states[2].GetState(addr, key) - b = states[2].GetBalance(addr) + // Tx4 read again should get default vals + v = states[4].GetState(addr, key) + b = states[4].GetBalance(addr) assert.Equal(t, common.Hash{}, v) assert.Equal(t, common.Big0, b) @@ -868,7 +868,7 @@ func TestMVHashMapWriteNoConflict(t *testing.T) { states := []*StateDB{s} // 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.txIndex = i states = append(states, sCopy) @@ -919,17 +919,17 @@ func TestMVHashMapWriteNoConflict(t *testing.T) { states[2].writeMap = nil } - assert.Equal(t, val1, states[3].GetState(addr, key1)) - assert.Equal(t, balance1, states[3].GetBalance(addr)) - assert.Equal(t, common.Hash{}, states[3].GetState(addr, key2)) + assert.Equal(t, val1, states[4].GetState(addr, key1)) + assert.Equal(t, balance1, states[4].GetBalance(addr)) + assert.Equal(t, common.Hash{}, states[4].GetState(addr, key2)) // Tx1 revert states[1].RevertToSnapshot(tx1Snapshot) states[1].FlushMVWriteSet() - assert.Equal(t, common.Hash{}, states[3].GetState(addr, key1)) - assert.Equal(t, common.Hash{}, states[3].GetState(addr, key2)) - assert.Equal(t, common.Big0, states[3].GetBalance(addr)) + assert.Equal(t, common.Hash{}, states[5].GetState(addr, key1)) + assert.Equal(t, common.Hash{}, states[5].GetState(addr, key2)) + assert.Equal(t, common.Big0, states[5].GetBalance(addr)) // Tx1 delete for _, v := range states[1].writeMap { @@ -938,9 +938,9 @@ func TestMVHashMapWriteNoConflict(t *testing.T) { states[1].writeMap = nil } - assert.Equal(t, common.Hash{}, states[3].GetState(addr, key1)) - assert.Equal(t, common.Hash{}, states[3].GetState(addr, key2)) - assert.Equal(t, common.Big0, states[3].GetBalance(addr)) + assert.Equal(t, common.Hash{}, states[6].GetState(addr, key1)) + assert.Equal(t, common.Hash{}, states[6].GetState(addr, key2)) + assert.Equal(t, common.Big0, states[6].GetBalance(addr)) } func TestApplyMVWriteSet(t *testing.T) { diff --git a/packaging/templates/package_scripts/control b/packaging/templates/package_scripts/control index 028124afa44c..b7c92d0a2091 100644 --- a/packaging/templates/package_scripts/control +++ b/packaging/templates/package_scripts/control @@ -1,5 +1,5 @@ Source: bor -Version: 1.4.0-beta2 +Version: 1.4.1 Section: develop Priority: standard Maintainer: Polygon diff --git a/packaging/templates/package_scripts/control.arm64 b/packaging/templates/package_scripts/control.arm64 index b89f23f1381a..040083b2e411 100644 --- a/packaging/templates/package_scripts/control.arm64 +++ b/packaging/templates/package_scripts/control.arm64 @@ -1,5 +1,5 @@ Source: bor -Version: 1.4.0-beta2 +Version: 1.4.1 Section: develop Priority: standard Maintainer: Polygon diff --git a/packaging/templates/package_scripts/control.profile.amd64 b/packaging/templates/package_scripts/control.profile.amd64 index f64b699ac3ca..2736d28102bb 100644 --- a/packaging/templates/package_scripts/control.profile.amd64 +++ b/packaging/templates/package_scripts/control.profile.amd64 @@ -1,5 +1,5 @@ Source: bor-profile -Version: 1.4.0-beta2 +Version: 1.4.1 Section: develop Priority: standard Maintainer: Polygon diff --git a/packaging/templates/package_scripts/control.profile.arm64 b/packaging/templates/package_scripts/control.profile.arm64 index cbccfc9e7b10..c568822a5a64 100644 --- a/packaging/templates/package_scripts/control.profile.arm64 +++ b/packaging/templates/package_scripts/control.profile.arm64 @@ -1,5 +1,5 @@ Source: bor-profile -Version: 1.4.0-beta2 +Version: 1.4.1 Section: develop Priority: standard Maintainer: Polygon diff --git a/packaging/templates/package_scripts/control.validator b/packaging/templates/package_scripts/control.validator index 0c6e5a0c9564..c6b5839ea213 100644 --- a/packaging/templates/package_scripts/control.validator +++ b/packaging/templates/package_scripts/control.validator @@ -1,5 +1,5 @@ Source: bor-profile -Version: 1.4.0-beta2 +Version: 1.4.1 Section: develop Priority: standard Maintainer: Polygon diff --git a/packaging/templates/package_scripts/control.validator.arm64 b/packaging/templates/package_scripts/control.validator.arm64 index fb3b126fff40..a9d1ec64fbab 100644 --- a/packaging/templates/package_scripts/control.validator.arm64 +++ b/packaging/templates/package_scripts/control.validator.arm64 @@ -1,5 +1,5 @@ Source: bor-profile -Version: 1.4.0-beta2 +Version: 1.4.1 Section: develop Priority: standard Maintainer: Polygon diff --git a/params/version.go b/params/version.go index 0c33c888b62d..32358be789ea 100644 --- a/params/version.go +++ b/params/version.go @@ -23,7 +23,7 @@ import ( const ( VersionMajor = 1 // Major 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 = "fh2.4" // Version metadata to append to the version string FirehoseVersionMajor = 2