Skip to content

Generate giga's protobuf code from its own trimmed protos - #4656

Open
alexander-sei wants to merge 3 commits into
mainfrom
alexanderh/giga-generated-proto-cleanup
Open

alexander-sei wants to merge 3 commits into
mainfrom
alexanderh/giga-generated-proto-cleanup

Conversation

@alexander-sei

@alexander-sei alexander-sei commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #4645, for @masih's review note that the generated protobuf code under giga/ needed a deep clean.

The giga fork's .pb.go files were copies of the x/evm, eth and sei-cosmos bank generated code with the registered type names rewritten by hand. There was no .proto source behind them, so nothing could regenerate them, and they had drifted:

  • After Remove pointer code that nothing reaches anymore #4645 they still carried Whitelist and MsgInternalEVMDelegateCall.codeHash, along with the whole Query service and its gRPC gateway, the Msg service, and every pointer, claim, associate and send message. Giga's code uses none of them.
  • Their embedded descriptors were verbatim upstream bytes: package seiprotocol.seichain.evm, the x/evm go_package, and pre-flatten github.com/cosmos/cosmos-sdk/... customtype paths. They were registered under the upstream file names. gogoproto's RegisterFile is last-writer-wins, so in seid giga's stale copies of cosmos/bank/v1beta1/{bank,genesis,authz}.proto replaced sei-cosmos's own descriptors in the registry. The evm/*.proto copies happened to lose that race to x/evm.

What changes

Giga gets its own proto sources. giga/proto is a new buf module with gigaevm, gigaeth and gigabank packages. It is listed in buf.yaml and added as an input in buf.gen.yaml, so go generate (scripts/protoc.sh) produces giga's code the same way as every other module's, and the Buf check lints it and checks it for breaking changes. Each file is its upstream counterpart with the package and go_package changed and the unused messages deleted. That means diff proto/evm/params.proto giga/proto/gigaevm/params.proto shows exactly where giga diverges. The module is outside proto/, so the BSR push does not publish it.

Kept, because giga's code reads them:

  • DeferredInfo, MsgEVMTransaction, GenesisState with AddressAssociation, Params and the four ParamsPreV* variants, ChainConfig, Log, Receipt
  • the nine eth tx-data types
  • bank's Params, SendEnabled, Input, Output, DenomUnit, Metadata, GenesisState, Balance and WeiBalance

Removed: 37 messages, 2 enums, 2 services and the gateway.

  • query.pb.go, query.pb.gw.go, enums.pb.go and bank's authz.pb.go, entirely
  • from tx.pb.go, the Msg service and every message except MsgEVMTransaction, including MsgEVMTransactionResponse
  • Whitelist, ExtensionOptionsEthereumTx and bank's Supply, plus the AllowList descriptor entry that Remove the tokenfactory module behind the v6.8 upgrade #4536 had to leave behind
  • the Code, ContractState, Nonce and Serialized genesis messages and their GenesisState fields, which giga's InitGenesis never read

Hand-written code that only served the removed messages:

  • the eight message_*.go files that gave them sdk.Msg behaviour, and their three tests
  • MsgEVMTransactionResponse.DecorateSdkResult
  • in codec.go, RegisterInterfaces, whose remaining job was registering the removed Msg service. Giga is not a module, and nothing ever called it.
  • the amino ModuleCdc, which only those messages' GetSignBytes used

What does not change

Outside giga/, nothing imports these packages, and app only uses giga's keepers and state DB.

I decoded every giga descriptor before and after. After normalizing the expected renames (package, the pre-flatten customtype paths, and the derived customtype path the Go code already pointed at giga's copy), the 29 kept messages other than GenesisState have identical fields, field numbers and options. Each Descriptor() method now points at the new descriptor. Apart from those, the generated functions of the kept types, 402 in all (Marshal, Size, Unmarshal, getters, Equal), are byte-identical once import aliases are normalized. The only codec change is GenesisState dropping fields 3 to 6.

Registered type names under seiprotocol.seichain.gigaevm and seiprotocol.seichain.gigaeth are unchanged. Bank's move from seiprotocol.sei-chain.gigabank, which is not a valid proto package name, to seiprotocol.seichain.gigabank; nothing resolves them by name. Giga's files now register as gigaevm/*.proto, gigaeth/tx.proto and gigabank/*.proto. In a binary that links giga and the upstream modules, cosmos/bank/v1beta1/*.proto and evm/*.proto now resolve to their owners' descriptors.

Not in this PR

Giga's MsgEVMTransaction and the whole giga/deps/xevm/types/ethtx package are only reachable from the giga keeper's SetMsgs and GetAllEVMTxDeferredInfo, which only tests call. Production goes through app.EvmKeeper for both. Removing them means removing keeper code, so that is left for a separate change.

Verification

  • buf build, buf lint, buf format -d --exit-code, and buf breaking against main. The new module has no counterpart in the base, and the check passes.
  • With Go 1.27.3, the version CI uses, the full scripts/protoc.sh regenerates every committed .pb.go byte-for-byte, giga's included.
  • go build ./..., go vet ./giga/... ./app/..., make fmtcheck, and golangci-lint run ./giga/deps/xevm/... ./giga/deps/xbank/... (0 issues)
  • scripts/ramtest.sh ./giga/... ./app/: every package passes

The giga fork's .pb.go files were hand-renamed copies of the x/evm, eth
and bank generated code with no .proto source, so nothing could
regenerate them and they drifted: after #4645 they still carried
Whitelist and MsgInternalEVMDelegateCall.codeHash, along with the Query
service and its gateway, the Msg service, and every pointer, claim,
associate and send message. Their descriptors were verbatim upstream
bytes registered under the upstream file names, so in seid giga's stale
bank copies replaced sei-cosmos's own entries in the gogoproto registry.

giga/proto is now a buf module generated by scripts/protoc.sh like the
others. Each file is its upstream counterpart with the package changed
and only the messages giga's code reads kept. The hand-written sdk.Msg
implementations of the removed messages go with them, as do the
uncalled RegisterInterfaces and the amino codec only they used.

Every kept message has the same fields, numbers and options as before
and byte-identical generated codec functions, except GenesisState, which
drops the four fields giga's InitGenesis never read.

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions

github-actions Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedOct 28, 2026, 2:52 PM

@codecov

codecov Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 60.07%. Comparing base (a2cea36) to head (6708be3).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4656      +/-   ##
==========================================
+ Coverage   60.04%   60.07%   +0.02%     
==========================================
  Files        2020     2012       -8     
  Lines      158499   158368     -131     
==========================================
- Hits        95168    95134      -34     
+ Misses      63326    63229      -97     
  Partials        5        5              
Flag Coverage Δ
sei-chain 58.03% <ø> (+0.03%) ⬆️
sei-db 75.17% <ø> (ø)
sei-db-state-db 81.36% <ø> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
giga/deps/xevm/types/codec.go 22.58% <ø> (-0.83%) ⬇️
giga/deps/xevm/types/message_evm_transaction.go 41.30% <ø> (+3.30%) ⬆️

... and 27 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

The giga descriptors were gzipped by a protoc-gen-gocosmos built with
Go 1.26, whose compress/flate closes the stream with a stored block
where Go 1.27 writes a fixed-Huffman one, so the Go / Lint generate
check reported a diff. The decompressed descriptors are unchanged.

Co-authored-by: Cursor <cursoragent@cursor.com>
@alexander-sei
alexander-sei marked this pull request as ready for review October 28, 2026 14:51
@cursor

cursor Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes protobuf registration and genesis wire shape for giga bank/EVM types, which can affect compatibility if anything still relied on removed messages or old descriptor paths; production paths reportedly use app.EvmKeeper, limiting runtime exposure.

Overview
Introduces a dedicated giga/proto buf module and wires it into buf.yaml / buf.gen.yaml so giga’s .pb.go files are produced by the normal scripts/protoc.sh flow instead of hand-copied upstream codegen.

Proto definitions are trimmed forks of bank, EVM params/genesis/tx, and gigaeth/tx, with package names fixed to seiprotocol.seichain.*. Large slices of unused surface area are dropped from both the .proto files and generated Go: query/gRPC gateway, most Msg types and their hand-written message_*.go helpers, bank authz/Supply, EVM enums, pointer/claim/associate/send messages, and extra EVM genesis fields (Code, ContractState, Nonce, Serialized). xevm/types/codec.go no longer registers amino/interfaces for removed messages; it keeps only tx-data packing helpers.

Regenerated descriptors register under gigabank/, gigaevm/, and gigaeth/, which stops giga’s stale copies from overwriting sei-cosmos bank and x/evm file descriptors in the global registry.

Reviewed by Cursor Bugbot for commit 6708be3. Bugbot is set up for automated code reviews on this repo. Configure here.

@seidroid seidroid Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This PR gives giga's forked protobuf code its own trimmed .proto sources under giga/proto, wired into buf lint, breaking and generate, and deletes the unused messages, services, the gateway and the hand-written sdk.Msg code. I approve because every kept type's field numbers, wire tags and Marshal/Unmarshal paths are unchanged apart from import aliases and descriptor pointers; the only codec change is giga's genesis dropping fields 3–6, which InitGenesis never read and only test helpers feed with DefaultGenesis. Nothing in giga/ or app/ still references a removed type, and the BSR push publishes only proto/. I reviewed against the PR's merge tree, but this sandbox has no Go or buf toolchain, so I could not build, test or check the regeneration; I dropped codex's one finding because nothing in the repo ever called the deleted giga RegisterInterfaces, so no registry could unpack giga's TxData before this change either.

seidroid review · decision approve · session 0ba61c4ddf8a4e739319e1304c1a9498 · turn resp_claude_d2fda472dbe98b6ac5a6c5e4c7926c3a · item 6b1871a812ef5d468360f1ad0f924c84

Findings: 0 blocking | 0 non-blocking | 0 posted inline

@masih masih left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

oh actually the proto generation needs to be connected to CI

@alexander-sei

Copy link
Copy Markdown
Contributor Author

@masih it's already hooked up the same way as the other modules. giga/proto is an input in buf.gen.yaml, so go generate ./... regenerates giga's .pb.go files, and the "Check generated files" step in Go / Lint fails on any diff. It caught this PR's first push, where all nine giga files differed (run) because my local Go 1.26.5 had built protoc-gen-gocosmos. 9b2b189 regenerated them with 1.27.3. The module is in buf.yaml too, so the Buf check lints it and runs breaking on it.

The "drift in 85 other files" in the description came from the same local toolchain, not from main being stale. With 1.27.3 the whole tree regenerates byte for byte, and I've corrected that line. Did you mean something beyond this?

This branch has not been deployed

No deployments
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.

2 participants