Skip to content

Commit

Permalink
Encode to hex before calling RPC. (paritytech#689)
Browse files Browse the repository at this point in the history
* encode to hex before call

* added pruning archive

* updated variable names

* changed error message
  • Loading branch information
alistair-singh authored Sep 19, 2022
1 parent 820ec5d commit 68806eb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
11 changes: 8 additions & 3 deletions relayer/relays/parachain/beefy-listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -767,17 +767,22 @@ 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) {
var proofHex string
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)
Expand Down
4 changes: 4 additions & 0 deletions test/config/launch-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"--rpc-methods=Unsafe",
"--enable-offchain-indexing=true",
"--execution=wasm",
"--pruning=archive",
"--",
"--execution=wasm"
]
Expand All @@ -73,6 +74,7 @@
"--rpc-methods=Unsafe",
"--enable-offchain-indexing=true",
"--execution=wasm",
"--pruning=archive",
"--",
"--execution=wasm"
]
Expand All @@ -97,6 +99,7 @@
"--rpc-methods=Unsafe",
"--enable-offchain-indexing=true",
"--execution=wasm",
"--pruning=archive",
"--",
"--execution=wasm"
]
Expand All @@ -114,6 +117,7 @@
"--rpc-methods=Unsafe",
"--enable-offchain-indexing=true",
"--execution=wasm",
"--pruning=archive",
"--",
"--execution=wasm"
]
Expand Down

0 comments on commit 68806eb

Please sign in to comment.