Skip to content

Commit

Permalink
Fix Wasm Event Decoding
Browse files Browse the repository at this point in the history
  • Loading branch information
joelsmith-2019 committed Oct 8, 2024
1 parent 57036a9 commit 1301b60
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 24 deletions.
28 changes: 16 additions & 12 deletions node/pkg/watchers/ibc/wasm_attrs.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package ibc

import (
"encoding/base64"
"fmt"
"strconv"

Expand Down Expand Up @@ -76,17 +75,22 @@ func (wa *WasmAttributes) Parse(logger *zap.Logger, event gjson.Result) error {
if !valueBase.Exists() {
return fmt.Errorf("event attribute does not have a value: %s", attribute.String())
}
keyRaw, err := base64.StdEncoding.DecodeString(keyBase.String())
if err != nil {
return fmt.Errorf("event attribute key is invalid base64: %s", attribute.String())
}
valueRaw, err := base64.StdEncoding.DecodeString(valueBase.String())
if err != nil {
return fmt.Errorf("event attribute value is invalid base64: %s", attribute.String())
}

key := string(keyRaw)
value := string(valueRaw)
// keyRaw, err := base64.StdEncoding.DecodeString(keyBase.String())
// if err != nil {
// return fmt.Errorf("event attribute key is invalid base64: %s", attribute.String())
// }
// valueRaw, err := base64.StdEncoding.DecodeString(valueBase.String())
// if err != nil {
// return fmt.Errorf("event attribute value is invalid base64: %s", attribute.String())
// }

// key := string(keyRaw)
// value := string(valueRaw)

// TODO: JOEL - VALIDATE WASM EVENTS ARE NO LONGER BASE64 ENCODED

key := keyBase.String()
value := valueBase.String()

if _, ok := wa.m[key]; ok {
return fmt.Errorf("duplicate key in event: %s", key)
Expand Down
3 changes: 0 additions & 3 deletions sdk/js/src/bridge/__tests__/wormhole_ibc_e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ import {
} from "../../token_bridge/__tests__/utils/helpers";
import { CHAIN_ID_SEI } from "../../utils/consts";

// TODO: JOEL - REMOVE ME
jest.setTimeout(600000);

const TERRA2_PRIVATE_KEY_4 =
"bounce success option birth apple portion aunt rural episode solution hockey pencil lend session cause hedgehog slender journey system canvas decorate razor catch empty";

Expand Down
3 changes: 0 additions & 3 deletions sdk/js/src/token_bridge/__tests__/algorand-integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@ import {
WORMHOLE_RPC_HOSTS,
} from "./utils/consts";

// TODO: JOEL - REMOVE ME
jest.setTimeout(600000);

const CORE_ID = BigInt(1004);
const TOKEN_BRIDGE_ID = BigInt(1006);

Expand Down
3 changes: 0 additions & 3 deletions sdk/js/src/token_bridge/__tests__/aptos-integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@ import {
WORMHOLE_RPC_HOSTS,
} from "./utils/consts";

// TODO: JOEL - REMOVE ME
jest.setTimeout(600000);

describe("Aptos SDK tests", () => {
test("Transfer native token from Aptos to Ethereum", async () => {
const APTOS_TOKEN_BRIDGE = CONTRACTS.DEVNET.aptos.token_bridge;
Expand Down
3 changes: 0 additions & 3 deletions sdk/js/src/token_bridge/__tests__/solana-integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ import {
WORMHOLE_RPC_HOSTS,
} from "./utils/consts";

// TODO: JOEL - REMOVE ME
jest.setTimeout(600000);

describe("Solana to Ethereum", () => {
test("Attest Solana SPL to Ethereum", (done) => {
(async () => {
Expand Down

0 comments on commit 1301b60

Please sign in to comment.