Browse Source

test only deterministic fields used in hash

pull/8094/head
William Banfield 2 years ago
parent
commit
dac4e84990
No known key found for this signature in database GPG Key ID: EFAD3442BF29E3AC
1 changed files with 28 additions and 0 deletions
  1. +28
    -0
      abci/types/types_test.go

+ 28
- 0
abci/types/types_test.go View File

@ -44,6 +44,34 @@ func TestHashAndProveResults(t *testing.T) {
}
}
func TestHashDeterministicFieldsOnly(t *testing.T) {
tr1 := abci.ExecTxResult{
Code: 1,
Data: []byte("transaction"),
Log: "nondeterministic data: abc",
Info: "nondeterministic data: abc",
GasWanted: 1000,
GasUsed: 1000,
Events: []abci.Event{},
Codespace: "nondeterministic.data.abc",
}
tr2 := abci.ExecTxResult{
Code: 1,
Data: []byte("transaction"),
Log: "nondeterministic data: def",
Info: "nondeterministic data: def",
GasWanted: 1000,
GasUsed: 1000,
Events: []abci.Event{},
Codespace: "nondeterministic.data.def",
}
r1, err := abci.TxResultsToByteSlices([]*abci.ExecTxResult{&tr1})
require.NoError(t, err)
r2, err := abci.TxResultsToByteSlices([]*abci.ExecTxResult{&tr2})
require.NoError(t, err)
require.Equal(t, merkle.HashFromByteSlices(r1), merkle.HashFromByteSlices(r2))
}
func TestValidateResponsePrepareProposal(t *testing.T) {
t.Run("should error on total transaction size exceeding max data size", func(t *testing.T) {
rpp := &abci.ResponsePrepareProposal{


Loading…
Cancel
Save