Skip to content
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

unable to resolve type URL error when running tests #21915

Open
akankshadhyani05 opened this issue Sep 25, 2024 · 1 comment
Open

unable to resolve type URL error when running tests #21915

akankshadhyani05 opened this issue Sep 25, 2024 · 1 comment
Assignees
Labels

Comments

@akankshadhyani05
Copy link

Hi, I am running an appchain using the latest sdk version (0.50.8) and I am trying to run test but I am getting error in my code which I have posted below:
Error is originating from this code(here cctptypes is a dependency that i am importing in my repo):

msgs := []sdk.Msg{}

	msgs = append(msgs, &cctptypes.MsgAddRemoteTokenMessenger{
		From:     gw.fiatTfRoles.Owner.FormattedAddress(),
		DomainId: 0,
		Address:  tokenMessenger,
	})

The error is:
"unable to resolve type URL /cctp.MsgAddRemoteTokenMessenger"

I have pasted the code snippet of its tx.pb.go file :

proto.RegisterType((*MsgAddRemoteTokenMessenger)(nil), "cctp.MsgAddRemoteTokenMessenger")
proto.RegisterType((*MsgAddRemoteTokenMessengerResponse)(nil), "cctp.MsgAddRemoteTokenMessengerResponse")

where could the issue be?

I have added these lines in my app.go file:

app.BasicModuleManager = module.NewBasicManagerFromManager(
		app.mm,
		map[string]module.AppModuleBasic{
			genutiltypes.ModuleName: genutil.NewAppModuleBasic(genutiltypes.DefaultMessageValidator),
			govtypes.ModuleName: gov.NewAppModuleBasic(
				[]govclient.ProposalHandler{
					paramsclient.ProposalHandler,
				},
			),
			CCTPModuleName:         cctp.AppModuleBasic{}
		},
	)

	app.BasicModuleManager.RegisterLegacyAminoCodec(legacyAmino)
	app.BasicModuleManager.RegisterInterfaces(interfaceRegistry)
@github-actions github-actions bot added the needs-triage Issue that needs to be triaged label Sep 25, 2024
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Cosmos-SDK Sep 25, 2024
@julienrbrt julienrbrt added T:question and removed needs-triage Issue that needs to be triaged labels Sep 27, 2024
@educlerici-zondax educlerici-zondax added the S:zondax Squad: Zondax label Oct 7, 2024
@lucaslopezf
Copy link
Contributor

Hi @akankshadhyani05

The issue you're encountering, "unable to resolve type URL /cctp.MsgAddRemoteTokenMessenger", is related to the fact that the protobuf message type MsgAddRemoteTokenMessenger is not properly registered in the interface registry.
The error indicates that the MsgAddRemoteTokenMessenger type URL /cctp.MsgAddRemoteTokenMessenger hasn't been registered properly in the interface registry. This typically happens when the RegisterInterfaces method for the module is missing or incomplete, leading to the message types not being recognized when processing transactions.
You can see the main method here:

func (registry *interfaceRegistry) Resolve(typeURL string) (proto.Message, error) {
.
If you want reproduce it, you can do it easily comment this line and execute the test.
You need to ensure that your cctp module registers all message types with the protobuf interface registry. And here has an explanation of this.
Let me know if this helped you or you need anything else!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: 📋 Backlog
Development

No branches or pull requests

5 participants