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

there are various erros in the generated proto file when use sol-anchor-beta #570

Open
cxp-13 opened this issue Dec 25, 2024 · 4 comments
Open

Comments

@cxp-13
Copy link

cxp-13 commented Dec 25, 2024

My IDL File: https://gist.github.com/cxp-13/3e5b6880cdd218d1fc4d35d8fe249641
The questionable generated proto file: https://gist.github.com/cxp-13/7173242746d4f07ecc68ae599411f080

@cxp-13 ➜ /workspace (main) $ substreams build
Building manifest file: /workspace/substreams.yaml
Running command in /workspace: `substreams protogen /workspace/substreams.yaml --exclude-paths sf/substreams/rpc,sf/substreams/v1,sf/substreams/sink,sf/substreams/index,sf/substreams/index/v1,instructions.proto,transactions.proto,google`...
Error: reading manifest "/workspace/substreams.yaml": unable to get package: unable to convert manifest to package: loading protobuf: error parsing proto files ["program.proto"] (import paths: ["/workspace/proto" "/workspace"]): program.proto:157:17: syntax error: unexpected '='
Error: error running protogen: error running protogen: error running `substreams protogen /workspace/substreams.yaml --exclude-paths sf/substreams/rpc,sf/substreams/v1,sf/substreams/sink,sf/substreams/index,sf/substreams/index/v1,instructions.proto,transactions.proto,google`: exit status 1
@cxp-13 ➜ /workspace (main) $ substreams build
Building manifest file: /workspace/substreams.yaml
Running command in /workspace: `substreams protogen /workspace/substreams.yaml --exclude-paths sf/substreams/rpc,sf/substreams/v1,sf/substreams/sink,sf/substreams/index,sf/substreams/index/v1,instructions.proto,transactions.proto,google`...
Error: reading manifest "/workspace/substreams.yaml": unable to get package: unable to convert manifest to package: loading protobuf: error parsing proto files ["program.proto"] (import paths: ["/workspace/proto" "/workspace"]): program.proto:159:9: symbol "substreams.v1.program.LendingAccountBorrowEvent" already defined at program.proto:20:9
Error: error running protogen: error running protogen: error running `substreams protogen /workspace/substreams.yaml --exclude-paths sf/substreams/rpc,sf/substreams/v1,sf/substreams/sink,sf/substreams/index,sf/substreams/index/v1,instructions.proto,transactions.proto,google`: exit status 1

It generate program.proto has problem, when execute substreams init and choose the sol-anchor-beta - Given an Anchor JSON IDL, create a Substreams that decodes instructions and events

there are various erros in the generated proto file.

question 1: Produce two same pieces of message.

message LendingAccountBorrowEvent {
  string trx_hash = 1;
}
message LendingAccountBorrowEvent {
      AccountEventHeader header = 1;
      string bank = 2;
      string mint = 3;
      uint64 amount = 4;
}
@cxp-13 ➜ /workspace (main) $ substreams build
Building manifest file: /workspace/substreams.yaml
Running command in /workspace: `substreams protogen /workspace/substreams.yaml --exclude-paths sf/substreams/rpc,sf/substreams/v1,sf/substreams/sink,sf/substreams/index,sf/substreams/index/v1,instructions.proto,transactions.proto,google`...
Error: reading manifest "/workspace/substreams.yaml": unable to get package: unable to convert manifest to package: loading protobuf: error parsing proto files ["program.proto"] (import paths: ["/workspace/proto" "/workspace"]): program.proto:157:17: syntax error: unexpected '='
Error: error running protogen: error running protogen: error running `substreams protogen /workspace/substreams.yaml --exclude-paths sf/substreams/rpc,sf/substreams/v1,sf/substreams/sink,sf/substreams/index,sf/substreams/index/v1,instructions.proto,transactions.proto,google`: exit status 1

There are even missing parts:

message LendingAccount {
       balances = 1;
}

Should be :

message LendingAccount {
     repeated Balance  balances = 1;
}
idl::idl::program::events::LendingAccountLiquidateEvent::DISCRIMINATOR => {
                                if let Ok(event) =
                                    idl::idl::program::events::LendingAccountLiquidateEvent::deserialize(
                                        &mut &slice_u8[8..],
                                    )
                                {
                                    lending_account_liquidate_event_list.push(LendingAccountLiquidateEvent {
                                        trx_hash: transaction.id(),
                                    });
                                }
                            }

In src/lib.rs, the event just used trx_hash, so I removed the other message and the building process was successful.

message LendingAccountBorrowEvent {
     AccountEventHeader header = 1;
     string bank = 2;
     string mint = 3;
     uint64 amount = 4;
}
@enoldev
Copy link
Contributor

enoldev commented Jan 7, 2025

@cxp-13 Could you share a block range with data for the IDL? We're currently fixing this issue

@cxp-13
Copy link
Author

cxp-13 commented Jan 8, 2025

@cxp-13 Could you share a block range with data for the IDL? We're currently fixing this issue
I have pasted the IDL link above, feel free to parse it by the substreams.

@enoldev
Copy link
Contributor

enoldev commented Jan 8, 2025

@cxp-13 I've fixed the compilation issue (it's still not merged), but I'd like to test if the Substreams can decode the data successfully using substreams gui. For that, I need a block range where I know there is data to decode, since the IDL is not verified in Solana.FM.

@cxp-13
Copy link
Author

cxp-13 commented Jan 8, 2025

@cxp-13 I've fixed the compilation issue (it's still not merged), but I'd like to test if the Substreams can decode the data successfully using substreams gui. For that, I need a block range where I know there is data to decode, since the IDL is not verified in Solana.FM.

sorry about that the verified not work on Devnet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants