Skip to content

Commit

Permalink
Merge tag 'v1.4.1' into release/polygon-1.x-fh2.4
Browse files Browse the repository at this point in the history
Via commit '0b28bb5e2fde74a0bdaad83bdcca7822e1b1b715' due to tag conflicts

# Conflicts:
#	params/version.go
  • Loading branch information
maoueh committed Sep 24, 2024
2 parents 63fea36 + 0b28bb5 commit 368dc3c
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 27 deletions.
9 changes: 6 additions & 3 deletions core/state/statedb.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
34 changes: 17 additions & 17 deletions core/state/statedb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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 {
Expand All @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion packaging/templates/package_scripts/control
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Source: bor
Version: 1.4.0-beta2
Version: 1.4.1
Section: develop
Priority: standard
Maintainer: Polygon <[email protected]>
Expand Down
2 changes: 1 addition & 1 deletion packaging/templates/package_scripts/control.arm64
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Source: bor
Version: 1.4.0-beta2
Version: 1.4.1
Section: develop
Priority: standard
Maintainer: Polygon <[email protected]>
Expand Down
2 changes: 1 addition & 1 deletion packaging/templates/package_scripts/control.profile.amd64
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Source: bor-profile
Version: 1.4.0-beta2
Version: 1.4.1
Section: develop
Priority: standard
Maintainer: Polygon <[email protected]>
Expand Down
2 changes: 1 addition & 1 deletion packaging/templates/package_scripts/control.profile.arm64
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Source: bor-profile
Version: 1.4.0-beta2
Version: 1.4.1
Section: develop
Priority: standard
Maintainer: Polygon <[email protected]>
Expand Down
2 changes: 1 addition & 1 deletion packaging/templates/package_scripts/control.validator
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Source: bor-profile
Version: 1.4.0-beta2
Version: 1.4.1
Section: develop
Priority: standard
Maintainer: Polygon <[email protected]>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Source: bor-profile
Version: 1.4.0-beta2
Version: 1.4.1
Section: develop
Priority: standard
Maintainer: Polygon <[email protected]>
Expand Down
2 changes: 1 addition & 1 deletion params/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 368dc3c

Please sign in to comment.