diff --git a/relayer/chains/icon/icon_chain_processor.go b/relayer/chains/icon/icon_chain_processor.go index 44fb638a2..514e201f9 100644 --- a/relayer/chains/icon/icon_chain_processor.go +++ b/relayer/chains/icon/icon_chain_processor.go @@ -353,6 +353,9 @@ loop: break } + icp.log.Debug("Verified block ", + zap.Int64("height", int64(processedheight))) + icp.latestBlock = provider.LatestBlock{ Height: uint64(processedheight), } diff --git a/relayer/chains/wasm/provider.go b/relayer/chains/wasm/provider.go index fcb77454d..c3ad74207 100644 --- a/relayer/chains/wasm/provider.go +++ b/relayer/chains/wasm/provider.go @@ -346,8 +346,6 @@ func (ap *WasmProvider) Init(ctx context.Context) error { } ap.LightProvider = lightprovider - ap.SetSDKContext() - clientCtx := client.Context{}. WithClient(rpcClient). WithFromName(ap.PCfg.Key). diff --git a/relayer/chains/wasm/query.go b/relayer/chains/wasm/query.go index 053fcfadd..44176237f 100644 --- a/relayer/chains/wasm/query.go +++ b/relayer/chains/wasm/query.go @@ -334,7 +334,8 @@ func (ap *WasmProvider) QueryClientConsensusState(ctx context.Context, chainHeig } func (ap *WasmProvider) QueryIBCHandlerContract(ctx context.Context, param wasmtypes.RawContractMessage) (*wasmtypes.QuerySmartContractStateResponse, error) { - + done := ap.SetSDKContext() + defer done() return ap.QueryClient.SmartContractState(ctx, &wasmtypes.QuerySmartContractStateRequest{ Address: ap.PCfg.IbcHandlerAddress, QueryData: param, diff --git a/relayer/chains/wasm/tx.go b/relayer/chains/wasm/tx.go index 711fe02ee..00692f19b 100644 --- a/relayer/chains/wasm/tx.go +++ b/relayer/chains/wasm/tx.go @@ -807,6 +807,8 @@ func (ap *WasmProvider) LogFailedTx(res *provider.RelayerTxResponse, err error, func (ap *WasmProvider) LogSuccessTx(res *sdk.TxResponse, msgs []provider.RelayerMessage) { // Include the chain_id fields := []zapcore.Field{zap.String("chain_id", ap.ChainId())} + done := ap.SetSDKContext() + defer done() // Include the gas used fields = append(fields, zap.Int64("gas_used", res.GasUsed)) @@ -879,6 +881,9 @@ func (ap *WasmProvider) sdkError(codespace string, code uint32) error { } func (ap *WasmProvider) buildMessages(clientCtx client.Context, txf tx.Factory, msgs ...sdk.Msg) ([]byte, uint64, error) { + done := ap.SetSDKContext() + defer done() + for _, msg := range msgs { if err := msg.ValidateBasic(); err != nil { return nil, 0, err diff --git a/relayer/chains/wasm/wasm_prefix.go b/relayer/chains/wasm/wasm_prefix.go index ed04aa8e6..1a77d255f 100644 --- a/relayer/chains/wasm/wasm_prefix.go +++ b/relayer/chains/wasm/wasm_prefix.go @@ -16,12 +16,13 @@ var sdkConfigMutex sync.Mutex // SetSDKContext sets the SDK config to the proper bech32 prefixes for wasm. // Don't use this unless you know what you're doing. // TODO: :dagger: :knife: :chainsaw: remove this function -func (ap *WasmProvider) SetSDKContext() { +func (ap *WasmProvider) SetSDKContext() func() { + sdkConfigMutex.Lock() - cfg := sdk.GetConfig() - cfg.SetBech32PrefixForAccount(ap.PCfg.AccountPrefix, app.Bech32PrefixAccPub) - cfg.SetBech32PrefixForValidator(ap.PCfg.AccountPrefix, app.Bech32PrefixValPub) - cfg.SetBech32PrefixForConsensusNode(app.Bech32PrefixConsAddr, app.Bech32PrefixConsPub) - cfg.SetAddressVerifier(wasmtypes.VerifyAddressLen()) - sdkConfigMutex.Unlock() + cfg_update := sdk.GetConfig() + cfg_update.SetBech32PrefixForAccount(ap.PCfg.AccountPrefix, app.Bech32PrefixAccPub) + cfg_update.SetBech32PrefixForValidator(ap.PCfg.AccountPrefix, app.Bech32PrefixValPub) + cfg_update.SetBech32PrefixForConsensusNode(app.Bech32PrefixConsAddr, app.Bech32PrefixConsPub) + cfg_update.SetAddressVerifier(wasmtypes.VerifyAddressLen()) + return sdkConfigMutex.Unlock }