Skip to content

Commit

Permalink
Fix issue with consumer v2.x compatibility e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bermuell committed Dec 21, 2023
1 parent becfdca commit 6d429df
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion app/consumer/genesis.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package app

import (
"bytes"
"encoding/json"
"fmt"
"os"
Expand Down Expand Up @@ -237,6 +238,11 @@ func transformToV2(jsonRaw []byte, ctx client.Context) (json.RawMessage, error)
if err != nil {
return nil, fmt.Errorf("marshalling transformation result failed: %v", err)
}

// remove all prehash_key_before_comparison entries not supported by ics23 versions used by v2.x
result = bytes.ReplaceAll(result, []byte(`,"prehash_key_before_comparison":false`), []byte{})
result = bytes.ReplaceAll(result, []byte(`,"prehash_key_before_comparison":true`), []byte{})

return result, nil
}

Expand All @@ -247,7 +253,8 @@ func transformGenesis(ctx client.Context, targetVersion IcsVersion, jsonRaw []by
var err error = nil

switch targetVersion {
case v2_x, v3_0_x, v3_1_x:
// v2.x, v3.0-v3.2 share same consumer genesis type
case v2_x, v3_0_x, v3_1_x, v3_2_x:
newConsumerGenesis, err = transformToV2(jsonRaw, ctx)
case v3_3_x:
newConsumerGenesis, err = transformToV33(jsonRaw, ctx)
Expand Down

0 comments on commit 6d429df

Please sign in to comment.