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

feat: remove protoc pkg and also nodetime helpers ts-proto and sta #4090

Merged
merged 33 commits into from
May 28, 2024

Conversation

Pantani
Copy link
Collaborator

@Pantani Pantani commented Apr 20, 2024

Description

stop using the protoc with the node plugins so we can remove the node time binary. This PR's makes all ts generation using the buf generate command.

Changes

  • Move buf mode update to buf dep update;
  • Remove protoc and nodetime;
  • Add buf.lock dependency digest;

How to test

ignite s chain venus && cd venus && ignite g ts-client

check the ts-client folder into the chain

Copy link
Member

@ilgooz ilgooz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do we provide discovered modules' proto files into code generation process?

@Pantani
Copy link
Collaborator Author

Pantani commented Apr 20, 2024

How do we provide discovered modules' proto files into code generation process?

is almost the same thing as the protoc, we are passing the discovered modules to the include-import flag into the buf generation

@Pantani Pantani requested a review from ilgooz April 22, 2024 10:07
@Pantani Pantani enabled auto-merge (squash) April 22, 2024 10:49
@clockworkgr
Copy link
Collaborator

clockworkgr commented Apr 23, 2024

Tried testing off this branch:

Chain scaffolds ok..

On ignite g ts-client, I get this prompt:

Now ignite supports the `buf.build` (https://buf.build) registry to manage the protobuf dependencies. The embed protoc binary was deprecated and, your blockchain is still using it. Would you like to upgrade and add the `buf.build` config files to `proto/` folder: y/N

Answering No:

✘ Code generation using protoc is only supported by Ignite CLI v0.26.1 or older

Answering Yes:

 buf.build files added: 

/media/clockwork/Projects/Tendermint/venus//buf.gen.ts.yaml
/media/clockwork/Projects/Tendermint/venus//buf.lock
/media/clockwork/Projects/Tendermint/venus//buf.yaml
/media/clockwork/Projects/Tendermint/venus//buf.gen.gogo.yaml
/media/clockwork/Projects/Tendermint/venus//buf.gen.pulsar.yaml
/media/clockwork/Projects/Tendermint/venus//buf.gen.sta.yaml
/media/clockwork/Projects/Tendermint/venus//buf.gen.swagger.yaml

✗ Ignite proto directory path from the chain config doesn't match the proto directory path from the chain `buf.work.yaml`. Do you want to add the proto path `` to the directories list from the buf work file Y/N:

Answering Yes:

✘ Cannot build app:                                                                                                                                                                                                                                                                                                                                                                                                                               
                                                                                                                                                                                                                                                                                                                                                                                                                                                
error while running command /home/clockwork/go/bin/buf export /media/clockwork/Projects/Tendermint/venus/proto --output=/tmp/includeFolder1117887864: Failure: directory "." listed in /media/clockwork/Projects/Tendermint/venus/buf.work.yaml, it is not valid to have "." as a workspace directory, as this is no different than not having a workspace at all, see https://buf.build/docs/reference/workspaces/#directories for more details
: exit status 1

Answering No:

✘ Cannot build app:                                                                                   
                                                                                                    
invalid Cosmos SDK mod path: [/home/clockwork/go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.50.5/proto]

Guessing we need to explicitly supply the proto dir? or the default is not picked up correctly in ignite g commands?

@Pantani
Copy link
Collaborator Author

Pantani commented Apr 23, 2024

Tried testing off this branch:

Chain scaffolds ok..

On ignite g ts-client, I get this prompt:

Now ignite supports the `buf.build` (https://buf.build) registry to manage the protobuf dependencies. The embed protoc binary was deprecated and, your blockchain is still using it. Would you like to upgrade and add the `buf.build` config files to `proto/` folder: y/N

Answering No:

✘ Code generation using protoc is only supported by Ignite CLI v0.26.1 or older

Answering Yes:

 buf.build files added: 

/media/clockwork/Projects/Tendermint/venus//buf.gen.ts.yaml
/media/clockwork/Projects/Tendermint/venus//buf.lock
/media/clockwork/Projects/Tendermint/venus//buf.yaml
/media/clockwork/Projects/Tendermint/venus//buf.gen.gogo.yaml
/media/clockwork/Projects/Tendermint/venus//buf.gen.pulsar.yaml
/media/clockwork/Projects/Tendermint/venus//buf.gen.sta.yaml
/media/clockwork/Projects/Tendermint/venus//buf.gen.swagger.yaml

✗ Ignite proto directory path from the chain config doesn't match the proto directory path from the chain `buf.work.yaml`. Do you want to add the proto path `` to the directories list from the buf work file Y/N:

Answering Yes:

✘ Cannot build app:                                                                                                                                                                                                                                                                                                                                                                                                                               
                                                                                                                                                                                                                                                                                                                                                                                                                                                
error while running command /home/clockwork/go/bin/buf export /media/clockwork/Projects/Tendermint/venus/proto --output=/tmp/includeFolder1117887864: Failure: directory "." listed in /media/clockwork/Projects/Tendermint/venus/buf.work.yaml, it is not valid to have "." as a workspace directory, as this is no different than not having a workspace at all, see https://buf.build/docs/reference/workspaces/#directories for more details
: exit status 1

Answering No:

✘ Cannot build app:                                                                                   
                                                                                                    
invalid Cosmos SDK mod path: [/home/clockwork/go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.50.5/proto]

Guessing we need to explicitly supply the proto dir? or the default is not picked up correctly in ignite g commands?

Oh, I got it. It's a bug from another PR. I will fix it. Can you test using the chain serve command?

@clockworkgr
Copy link
Collaborator

Tried testing off this branch:
Chain scaffolds ok..
On ignite g ts-client, I get this prompt:

Now ignite supports the `buf.build` (https://buf.build) registry to manage the protobuf dependencies. The embed protoc binary was deprecated and, your blockchain is still using it. Would you like to upgrade and add the `buf.build` config files to `proto/` folder: y/N

Answering No:

✘ Code generation using protoc is only supported by Ignite CLI v0.26.1 or older

Answering Yes:

 buf.build files added: 

/media/clockwork/Projects/Tendermint/venus//buf.gen.ts.yaml
/media/clockwork/Projects/Tendermint/venus//buf.lock
/media/clockwork/Projects/Tendermint/venus//buf.yaml
/media/clockwork/Projects/Tendermint/venus//buf.gen.gogo.yaml
/media/clockwork/Projects/Tendermint/venus//buf.gen.pulsar.yaml
/media/clockwork/Projects/Tendermint/venus//buf.gen.sta.yaml
/media/clockwork/Projects/Tendermint/venus//buf.gen.swagger.yaml

✗ Ignite proto directory path from the chain config doesn't match the proto directory path from the chain `buf.work.yaml`. Do you want to add the proto path `` to the directories list from the buf work file Y/N:

Answering Yes:

✘ Cannot build app:                                                                                                                                                                                                                                                                                                                                                                                                                               
                                                                                                                                                                                                                                                                                                                                                                                                                                                
error while running command /home/clockwork/go/bin/buf export /media/clockwork/Projects/Tendermint/venus/proto --output=/tmp/includeFolder1117887864: Failure: directory "." listed in /media/clockwork/Projects/Tendermint/venus/buf.work.yaml, it is not valid to have "." as a workspace directory, as this is no different than not having a workspace at all, see https://buf.build/docs/reference/workspaces/#directories for more details
: exit status 1

Answering No:

✘ Cannot build app:                                                                                   
                                                                                                    
invalid Cosmos SDK mod path: [/home/clockwork/go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.50.5/proto]

Guessing we need to explicitly supply the proto dir? or the default is not picked up correctly in ignite g commands?

Oh, I got it. It's a bug from another PR. I will fix it. Can you test using the chain serve command?

not really...the whole idea is to see if the ignite g ts-client command works like before

@clockworkgr
Copy link
Collaborator

still unable to test this properly to check correctness of ts-client output

@faddat
Copy link
Contributor

faddat commented May 19, 2024

I was just downloading.... the nearly 1gb main branch here.

This PR is great!

Pantani added 2 commits May 21, 2024 20:47
# Conflicts:
#	ignite/pkg/cosmosbuf/buf.go
#	ignite/pkg/cosmosgen/generate_go.go
#	ignite/pkg/cosmosgen/generate_openapi.go
@Pantani Pantani marked this pull request as ready for review May 22, 2024 15:58
@Pantani
Copy link
Collaborator Author

Pantani commented May 23, 2024

This PR also speeds up the scaffold and sever commands and the CI test

@Pantani Pantani enabled auto-merge (squash) May 27, 2024 19:00
@Pantani Pantani merged commit 8e0937d into main May 28, 2024
46 checks passed
@Pantani Pantani deleted the feat/remove-protoc branch May 28, 2024 23:21
julienrbrt pushed a commit that referenced this pull request May 29, 2024
…ta` (#4090)

* remove protoc

* add changelog

* run go mod tidy

* remove unused proto folder handling

* add ts-client tests

* remove unused methods

* use import includes instead manual

* use buf dep instead buf mod

* change buf mod update to comand to buf dep update

* improve code readbility

* bump buf.build

* bump buf into the go.mod

* bump protobuf pkgs for buf

* check if the folder has proto before update buf dependencies

---------

Co-authored-by: Pantani <Pantani>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants