-
Notifications
You must be signed in to change notification settings - Fork 21
Aaron/fix cosmwasm pusher #263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -148,10 +148,6 @@ func NewStorkContract( | |
| chainID string, | ||
| chainPrefix string, | ||
| ) (*StorkContract, error) { | ||
| config := sdktypes.GetConfig() | ||
| config.SetBech32PrefixForAccount(chainPrefix, chainPrefix+"pub") | ||
| config.Seal() | ||
|
|
||
| rpcClient, err := http.New(rpcUrl, "/websocket") | ||
| if err != nil { | ||
| return nil, fmt.Errorf("failed to create rpc http client: %w", err) | ||
|
|
@@ -356,8 +352,13 @@ func (s *StorkContract) executeContract( | |
| Funds: funds, | ||
| } | ||
|
|
||
| senderBech32Acc, err := sdktypes.Bech32ifyAddressBytes(s.ChainPrefix, s.clientCtx.FromAddress) | ||
| if err != nil { | ||
| return "", fmt.Errorf("%w: failed to bech32ify account address", err) | ||
| } | ||
|
|
||
| accMsg := &authtypes.QueryAccountRequest{ | ||
| Address: s.clientCtx.FromAddress.String(), | ||
| Address: senderBech32Acc, | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. s.clientCtx.FromAddress wont work anymore now that we're not setting a global config. This works though locally |
||
| } | ||
|
|
||
| rawAccMsg, err := s.marshaler.Marshal(accMsg) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -101,14 +101,7 @@ func (p *Pusher) Run(ctx context.Context) { | |
|
|
||
| initialValues, err := p.pullWithTimeout(ctx, encodedAssetIDs) | ||
| if err != nil { | ||
| p.logger.Error().Err(err).Msg("Failed to pull initial values from contract") | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not an error when the assets have never been pushed before, was always reconnecting before first push before. |
||
|
|
||
| p.logger.Info().Str("httpRpcUrl", p.chainRpcUrl).Msg("Reconnecting to HTTP RPC URL") | ||
|
|
||
| err = p.interactor.ConnectHTTP(ctx, p.chainRpcUrl) | ||
| if err != nil { | ||
| p.logger.Error().Err(err).Msg("failed to reconnect to HTTP RPC") | ||
| } | ||
| p.logger.Warn().Err(err).Msg("Failed to pull initial values from contract") | ||
| } | ||
|
|
||
| for encodedAssetID, value := range initialValues { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This gets treated as a singleton so every time you create a new instance of this contract it was panicking. This is why the pusher that is currently running is constantly restarting. Tested this locally be forcing a new instance to load and it didn't fail after this change.