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 #883

Open
cxp-13 opened this issue Dec 22, 2024 · 5 comments
Open

Comments

@cxp-13
Copy link

cxp-13 commented Dec 22, 2024

@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
Copy link
Author

cxp-13 commented Dec 22, 2024

@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;
}

@cxp-13
Copy link
Author

cxp-13 commented Dec 22, 2024

@cxp-13 cxp-13 changed the title Through the way that proto is fully error on event there are various erros in the generated proto file when use sol-anchor-beta Dec 22, 2024
@matthewdarwin
Copy link
Collaborator

Seems not a graph-client issue.

@cxp-13
Copy link
Author

cxp-13 commented Dec 23, 2024

Seems not a graph-client issue.

I can't find the substreams repo, so I temporarily put the issue here.

@cxp-13
Copy link
Author

cxp-13 commented Dec 23, 2024

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;
}

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