Node/Watcher: Terra Classic fix (#3116)

* Node/Watcher: Terra Classic fix

Change-Id: Icc47e3727f75b0d8a7e74fa7195b6aa404fbcaf4

* Use the old format for tilt

Change-Id: I67495d55c899b627ba06890085201b47db30fb14
This commit is contained in:
bruce-riley 2023-06-23 10:29:49 -05:00 committed by GitHub
parent 74e53beac7
commit 73bd1abe0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 7 deletions

View File

@ -1323,7 +1323,7 @@ func runNode(cmd *cobra.Command, args []string) {
common.MustRegisterReadinessSyncing(vaa.ChainIDTerra)
chainObsvReqC[vaa.ChainIDTerra] = make(chan *gossipv1.ObservationRequest, observationRequestBufferSize)
if err := supervisor.Run(ctx, "terrawatch",
common.WrapWithScissors(cosmwasm.NewWatcher(*terraWS, *terraLCD, *terraContract, chainMsgC[vaa.ChainIDTerra], chainObsvReqC[vaa.ChainIDTerra], vaa.ChainIDTerra).Run, "terrawatch")); err != nil {
common.WrapWithScissors(cosmwasm.NewWatcher(*terraWS, *terraLCD, *terraContract, chainMsgC[vaa.ChainIDTerra], chainObsvReqC[vaa.ChainIDTerra], vaa.ChainIDTerra, *unsafeDevMode).Run, "terrawatch")); err != nil {
return err
}
}
@ -1333,7 +1333,7 @@ func runNode(cmd *cobra.Command, args []string) {
common.MustRegisterReadinessSyncing(vaa.ChainIDTerra2)
chainObsvReqC[vaa.ChainIDTerra2] = make(chan *gossipv1.ObservationRequest, observationRequestBufferSize)
if err := supervisor.Run(ctx, "terra2watch",
common.WrapWithScissors(cosmwasm.NewWatcher(*terra2WS, *terra2LCD, *terra2Contract, chainMsgC[vaa.ChainIDTerra2], chainObsvReqC[vaa.ChainIDTerra2], vaa.ChainIDTerra2).Run, "terra2watch")); err != nil {
common.WrapWithScissors(cosmwasm.NewWatcher(*terra2WS, *terra2LCD, *terra2Contract, chainMsgC[vaa.ChainIDTerra2], chainObsvReqC[vaa.ChainIDTerra2], vaa.ChainIDTerra2, *unsafeDevMode).Run, "terra2watch")); err != nil {
return err
}
}
@ -1343,7 +1343,7 @@ func runNode(cmd *cobra.Command, args []string) {
common.MustRegisterReadinessSyncing(vaa.ChainIDXpla)
chainObsvReqC[vaa.ChainIDXpla] = make(chan *gossipv1.ObservationRequest, observationRequestBufferSize)
if err := supervisor.Run(ctx, "xplawatch",
common.WrapWithScissors(cosmwasm.NewWatcher(*xplaWS, *xplaLCD, *xplaContract, chainMsgC[vaa.ChainIDXpla], chainObsvReqC[vaa.ChainIDXpla], vaa.ChainIDXpla).Run, "xplawatch")); err != nil {
common.WrapWithScissors(cosmwasm.NewWatcher(*xplaWS, *xplaLCD, *xplaContract, chainMsgC[vaa.ChainIDXpla], chainObsvReqC[vaa.ChainIDXpla], vaa.ChainIDXpla, *unsafeDevMode).Run, "xplawatch")); err != nil {
return err
}
}
@ -1417,7 +1417,7 @@ func runNode(cmd *cobra.Command, args []string) {
common.MustRegisterReadinessSyncing(vaa.ChainIDInjective)
chainObsvReqC[vaa.ChainIDInjective] = make(chan *gossipv1.ObservationRequest, observationRequestBufferSize)
if err := supervisor.Run(ctx, "injectivewatch",
common.WrapWithScissors(cosmwasm.NewWatcher(*injectiveWS, *injectiveLCD, *injectiveContract, chainMsgC[vaa.ChainIDInjective], chainObsvReqC[vaa.ChainIDInjective], vaa.ChainIDInjective).Run, "injectivewatch")); err != nil {
common.WrapWithScissors(cosmwasm.NewWatcher(*injectiveWS, *injectiveLCD, *injectiveContract, chainMsgC[vaa.ChainIDInjective], chainObsvReqC[vaa.ChainIDInjective], vaa.ChainIDInjective, *unsafeDevMode).Run, "injectivewatch")); err != nil {
return err
}
}

View File

@ -102,13 +102,18 @@ func NewWatcher(
contract string,
msgC chan<- *common.MessagePublication,
obsvReqC <-chan *gossipv1.ObservationRequest,
chainID vaa.ChainID) *Watcher {
chainID vaa.ChainID,
unsafeDevMode bool,
) *Watcher {
// CosmWasm 1.0.0
contractAddressFilterKey := "execute._contract_address"
contractAddressLogKey := "_contract_address"
if chainID == vaa.ChainIDTerra {
// CosmWasm <1.0.0
if chainID == vaa.ChainIDTerra && unsafeDevMode {
// Terra Classic upgraded CosmWasm versions, so they now use the new format. Here is a message from their Discord:
// The v2.1.1 upgrade will occur on blockheight 13215800 on June 14th (2023) at approximately 14:00 UTC.
// Queries for transactions before that block no longer work, so we don't have to worry about supporting them.
// It is going to take some work to upgrade our tilt environment, so for now, stick with the old format in dev.
contractAddressFilterKey = "execute_contract.contract_address"
contractAddressLogKey = "contract_address"
}
@ -406,6 +411,10 @@ func EventsToMessagePublications(contract string, txHash string, events []gjson.
continue
}
logger.Debug("msg attribute",
zap.String("network", networkName),
zap.String("tx_hash", txHash), zap.String("key", string(key)), zap.String("value", string(value)))
mappedAttributes[string(key)] = string(value)
}