Skip to content

Commit

Permalink
Fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pierluca committed Aug 4, 2023
1 parent 9d3c145 commit 99f2c25
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion contracts/value/value.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const (
credentialAllCommand = "all"

// contractKeyPrefix is used to prefix keys in the K/V store.
contractKeyPrefix = "VAL"
contractKeyPrefix = "VALU" // intentionally 4 bytes only, not a typo!
)

// Command defines a type of command for the value contract
Expand Down
12 changes: 9 additions & 3 deletions test/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func getTest[T require.TestingT](numNode, numTx int) func(t T) {
require.NoError(t, err)

for i := 0; i < numTx; i++ {
key := make([]byte, 32)
key := make([]byte, 28) // only 224 bits are available

_, err = rand.Read(key)
require.NoError(t, err)
Expand All @@ -102,7 +102,7 @@ func getTest[T require.TestingT](numNode, numTx int) func(t T) {
err = addAndWait(t, timeout, manager, nodes[0].(cosiDelaNode), args...)
require.NoError(t, err)

proof, err := nodes[0].GetOrdering().GetProof(key)
proof, err := nodes[0].GetOrdering().GetProof(append([]byte("VALU"), key...))
require.NoError(t, err)
require.Equal(t, []byte("value1"), proof.GetValue())
}
Expand All @@ -112,7 +112,13 @@ func getTest[T require.TestingT](numNode, numTx int) func(t T) {
// -----------------------------------------------------------------------------
// Utility functions

func addAndWait(t require.TestingT, to time.Duration, manager txn.Manager, node cosiDelaNode, args ...txn.Arg) error {
func addAndWait(
t require.TestingT,
to time.Duration,
manager txn.Manager,
node cosiDelaNode,
args ...txn.Arg,
) error {
manager.Sync()

tx, err := manager.Make(args...)
Expand Down

0 comments on commit 99f2c25

Please sign in to comment.