From 68806ebadd19dd39d14d577cb705b7f85cbacbda Mon Sep 17 00:00:00 2001 From: Alistair Singh Date: Mon, 19 Sep 2022 13:52:52 +0200 Subject: [PATCH] Encode to hex before calling RPC. (#689) * encode to hex before call * added pruning archive * updated variable names * changed error message --- relayer/relays/parachain/beefy-listener.go | 11 ++++++++--- test/config/launch-config.json | 4 ++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/relayer/relays/parachain/beefy-listener.go b/relayer/relays/parachain/beefy-listener.go index 07d410c8f6369..990f4f807b79e 100644 --- a/relayer/relays/parachain/beefy-listener.go +++ b/relayer/relays/parachain/beefy-listener.go @@ -767,7 +767,7 @@ func markAccountScanDone(scanBasicChannelAccounts map[types.AccountID]bool, acco func fetchBundleProof( api *gsrpc.SubstrateAPI, - digestItemHash types.H256, + commitmentHash types.H256, bundleIndex int, bundle BasicOutboundChannelMessageBundle, ) (BundleProof, error) { @@ -775,9 +775,14 @@ func fetchBundleProof( var rawProof RawMerkleProof var bundleProof BundleProof - err := api.Client.Call(&proofHex, "basicOutboundChannel_getMerkleProof", digestItemHash, bundleIndex) + commitmentHashHex, err := types.EncodeToHexString(commitmentHash) + if err != nil { + return bundleProof, fmt.Errorf("encode commitmentHash(%v): %w", commitmentHash, err) + } + + err = api.Client.Call(&proofHex, "basicOutboundChannel_getMerkleProof", commitmentHashHex, bundleIndex) if err != nil { - return bundleProof, fmt.Errorf("call rpc basicOutboundChannel_getMerkleProof(%v, %v): %w", digestItemHash, bundleIndex, err) + return bundleProof, fmt.Errorf("call rpc basicOutboundChannel_getMerkleProof(%v, %v): %w", commitmentHash, bundleIndex, err) } err = types.DecodeFromHexString(proofHex, &rawProof) diff --git a/test/config/launch-config.json b/test/config/launch-config.json index 73868cc133f75..2ec65b86fa838 100644 --- a/test/config/launch-config.json +++ b/test/config/launch-config.json @@ -57,6 +57,7 @@ "--rpc-methods=Unsafe", "--enable-offchain-indexing=true", "--execution=wasm", + "--pruning=archive", "--", "--execution=wasm" ] @@ -73,6 +74,7 @@ "--rpc-methods=Unsafe", "--enable-offchain-indexing=true", "--execution=wasm", + "--pruning=archive", "--", "--execution=wasm" ] @@ -97,6 +99,7 @@ "--rpc-methods=Unsafe", "--enable-offchain-indexing=true", "--execution=wasm", + "--pruning=archive", "--", "--execution=wasm" ] @@ -114,6 +117,7 @@ "--rpc-methods=Unsafe", "--enable-offchain-indexing=true", "--execution=wasm", + "--pruning=archive", "--", "--execution=wasm" ]