DefiantLabs / probe

a light weight cosmos-sdk querier
Apache License 2.0
2 stars 1 forks source link

Osmosis: Unable to query MsgCreatePool transaction #17

Open itsciccio opened 4 months ago

itsciccio commented 4 months ago

Using main.go, I am trying to query block 3513 from an Osmosis Archive Node. Although I am able to retrieve the block, I am unable to retrieve the transactions with the following error message:

rpc error: code = Unknown desc = unable to resolve type URL /osmosis.gamm.v1beta1.MsgCreatePool: tx parse error: unknown request

I have also attempted to add the following lines to the MakeCodec function, with the hopes of the system being able to recognize the MsgCreatePool transaction, however had no luck:

func MakeCodec(moduleBasics []module.AppModuleBasic) Codec {
    modBasic := module.NewBasicManager(moduleBasics...)
    encodingConfig := MakeCodecConfig()
    std.RegisterLegacyAminoCodec(encodingConfig.Amino)
    std.RegisterInterfaces(encodingConfig.InterfaceRegistry)
    modBasic.RegisterLegacyAminoCodec(encodingConfig.Amino)
    modBasic.RegisterInterfaces(encodingConfig.InterfaceRegistry)
 --->   RegisterOsmosisInterfaces(encodingConfig.InterfaceRegistry)
 --->   RegisterTendermintLiquidityInterfaces(encodingConfig.Amino, encodingConfig.InterfaceRegistry)

    return encodingConfig
}

Is there something I am doing incorrectly, or is this a bug?

NB: Querying other blocks not containing this transaction type works as intended.

TIA

pharr117 commented 4 months ago

@itsciccio

This could be 1 of 2 possible issues:

  1. This is an error on the RPC server indicating that the Node could not decode the underlying type in its own database. This is a known problem with Osmosis RPC archive servers. They had deprecated an old message type without keeping the underlying type in their codebase, (see here for details https://github.com/osmosis-labs/osmosis/issues/1017)
  2. This is an error during codec decoding of the RPC response where probe is missing the correct type

I will test this out myself to see if its possible to query it from probe.

itsciccio commented 4 months ago

Thanks for the reply @pharr117. Let me know of any updates on the matter. I probably think its a node issue due to a deprecating change.

However, I also noticed that I was unable to fetch a few Osmosis blocks, for example 551165, as probe was unable to retrieve the block results for the block.

Got status, some data follows:
Node moniker: Simply Staking: Archive Node NL
Got block, some data follows:
Height: 551165
Error getting block results
error in json rpc client, with http response metadata: (Status: 200 OK, Protocol HTTP/1.1). Failed to read response body: unexpected EOF

Highly unlikely it is probe-related, as it is probably once again due to node versioning problems. However if you do get the chance to try querying it, would be appreciated also.

pharr117 commented 4 months ago

@itsciccio A few things to note on Probe that I feel may block you later on down the road:

  1. Cosmos RPC querying for transactions/messages is entirely dependent on the Codecs you bring into the registry.
  2. If you dig into the Codecs Probe includes, you will see its VERY limited. The lift to bring the entire Osmosis message Codec is very high and prone to error as they deprecate changes.
    • Its a manually intensive process to bring the proto definitions, run buf generation on them and ensure the message types satisfy the Message interface, then get them included in the InterfaceRegistry

Defiant's Osmosis-specific solution to this was to:

  1. Fork the Lens package, which is what Probe is based off of
  2. Rework the entire package to use the exact Cosmos SDK versions/deps that Osmosis uses
  3. Include all Osmosis modules in the Codec AppModuleBasic by default
  4. Fix random one off bugs in missing Codecs as we found them
  5. Continue to update the codebase as Osmosis updates https://github.com/DefiantLabs/lens/branches/all?query=v0.0.

This gets around Codec issues, but is Osmosis-specific in that:

  1. You are tied to Osmosis' version of the Cosmos SDK which they forked
  2. You cannot bring any other Codecs in from non-Osmosis chains that rely on other Cosmos SDK versions

Both methods are pretty brittle and hard to maintain, but we found success in both.

tl;dr

What you may be looking for is the Defiant Lens fork branch v0.0.19-dl