Skip to content

Commit

Permalink
fix: update OperatorStateHash tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hopeyen committed Dec 2, 2024
1 parent 9f53085 commit fdf599b
Showing 1 changed file with 22 additions and 16 deletions.
38 changes: 22 additions & 16 deletions core/state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,39 @@ func TestOperatorStateHash(t *testing.T) {
Operators: map[core.QuorumID]map[core.OperatorID]*core.OperatorInfo{
0: {
[32]byte{0}: &core.OperatorInfo{
Stake: big.NewInt(12),
Index: uint(2),
Stake: big.NewInt(12),
Index: uint(2),
Socket: "192.168.1.100:8080",
},
[32]byte{1}: &core.OperatorInfo{
Stake: big.NewInt(23),
Index: uint(3),
Stake: big.NewInt(23),
Index: uint(3),
Socket: "127.0.0.1:3000",
},
},
1: {
[32]byte{1}: &core.OperatorInfo{
Stake: big.NewInt(23),
Index: uint(3),
Stake: big.NewInt(23),
Index: uint(3),
Socket: "127.0.0.1:3000",
},
[32]byte{2}: &core.OperatorInfo{
Stake: big.NewInt(34),
Index: uint(4),
Stake: big.NewInt(34),
Index: uint(4),
Socket: "192.168.1.100:8080",
},
},
},
Totals: map[core.QuorumID]*core.OperatorInfo{
0: {
Stake: big.NewInt(35),
Index: uint(2),
Stake: big.NewInt(35),
Index: uint(2),
Socket: "",
},
1: {
Stake: big.NewInt(57),
Index: uint(2),
Stake: big.NewInt(57),
Index: uint(2),
Socket: "",
},
},
BlockNumber: uint(123),
Expand All @@ -50,8 +56,8 @@ func TestOperatorStateHash(t *testing.T) {
assert.NoError(t, err)
q0 := hash1[0]
q1 := hash1[1]
assert.Equal(t, "3805338f34f77ff1fa23bbc23b1e86c4", hex.EncodeToString(q0[:]))
assert.Equal(t, "2f110a29f2bdd8a19c2d87d05736be0a", hex.EncodeToString(q1[:]))
assert.Equal(t, "6098562ea2e61a8f68743f9162b0adc0", hex.EncodeToString(q0[:]))
assert.Equal(t, "8ceea2ec543eb311e51ccfdc9e00ea4f", hex.EncodeToString(q1[:]))

s2 := core.OperatorState{
Operators: map[core.QuorumID]map[core.OperatorID]*core.OperatorInfo{
Expand Down Expand Up @@ -93,6 +99,6 @@ func TestOperatorStateHash(t *testing.T) {
assert.NoError(t, err)
q0 = hash2[0]
q1 = hash2[1]
assert.Equal(t, "1836448b57ae79decdcb77157cf31698", hex.EncodeToString(q0[:]))
assert.Equal(t, "2f110a29f2bdd8a19c2d87d05736be0a", hex.EncodeToString(q1[:]))
assert.Equal(t, "dc1bbb0b2b5d20238adfd4bd33661423", hex.EncodeToString(q0[:]))
assert.Equal(t, "8ceea2ec543eb311e51ccfdc9e00ea4f", hex.EncodeToString(q1[:]))
}

0 comments on commit fdf599b

Please sign in to comment.