Repository navigation
Generate giga's protobuf code from its own trimmed protos - #4656
alexander-sei wants to merge 3 commits into
Conversation
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>
|
The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ 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
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
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>
PR SummaryMedium Risk Overview Proto definitions are trimmed forks of bank, EVM params/genesis/tx, and Regenerated descriptors register under Reviewed by Cursor Bugbot for commit 6708be3. Bugbot is set up for automated code reviews on this repo. Configure here. |
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
oh actually the proto generation needs to be connected to CI
|
@masih it's already hooked up the same way as the other modules. 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? |
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.gofiles were copies of thex/evm,ethand sei-cosmos bank generated code with the registered type names rewritten by hand. There was no.protosource behind them, so nothing could regenerate them, and they had drifted:WhitelistandMsgInternalEVMDelegateCall.codeHash, along with the wholeQueryservice and its gRPC gateway, theMsgservice, and every pointer, claim, associate and send message. Giga's code uses none of them.seiprotocol.seichain.evm, thex/evmgo_package, and pre-flattengithub.com/cosmos/cosmos-sdk/...customtype paths. They were registered under the upstream file names. gogoproto'sRegisterFileis last-writer-wins, so inseidgiga's stale copies ofcosmos/bank/v1beta1/{bank,genesis,authz}.protoreplaced sei-cosmos's own descriptors in the registry. Theevm/*.protocopies happened to lose that race tox/evm.What changes
Giga gets its own proto sources.
giga/protois a new buf module withgigaevm,gigaethandgigabankpackages. It is listed inbuf.yamland added as an input inbuf.gen.yaml, sogo 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 andgo_packagechanged and the unused messages deleted. That meansdiff proto/evm/params.proto giga/proto/gigaevm/params.protoshows exactly where giga diverges. The module is outsideproto/, so the BSR push does not publish it.Kept, because giga's code reads them:
DeferredInfo,MsgEVMTransaction,GenesisStatewithAddressAssociation,Paramsand the fourParamsPreV*variants,ChainConfig,Log,ReceiptParams,SendEnabled,Input,Output,DenomUnit,Metadata,GenesisState,BalanceandWeiBalanceRemoved: 37 messages, 2 enums, 2 services and the gateway.
query.pb.go,query.pb.gw.go,enums.pb.goand bank'sauthz.pb.go, entirelytx.pb.go, theMsgservice and every message exceptMsgEVMTransaction, includingMsgEVMTransactionResponseWhitelist,ExtensionOptionsEthereumTxand bank'sSupply, plus theAllowListdescriptor entry that Remove the tokenfactory module behind the v6.8 upgrade #4536 had to leave behindCode,ContractState,NonceandSerializedgenesis messages and theirGenesisStatefields, which giga'sInitGenesisnever readHand-written code that only served the removed messages:
message_*.gofiles that gave themsdk.Msgbehaviour, and their three testsMsgEVMTransactionResponse.DecorateSdkResultcodec.go,RegisterInterfaces, whose remaining job was registering the removedMsgservice. Giga is not a module, and nothing ever called it.ModuleCdc, which only those messages'GetSignBytesusedWhat does not change
Outside
giga/, nothing imports these packages, andapponly 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
derivedcustomtype path the Go code already pointed at giga's copy), the 29 kept messages other thanGenesisStatehave identical fields, field numbers and options. EachDescriptor()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 isGenesisStatedropping fields 3 to 6.Registered type names under
seiprotocol.seichain.gigaevmandseiprotocol.seichain.gigaethare unchanged. Bank's move fromseiprotocol.sei-chain.gigabank, which is not a valid proto package name, toseiprotocol.seichain.gigabank; nothing resolves them by name. Giga's files now register asgigaevm/*.proto,gigaeth/tx.protoandgigabank/*.proto. In a binary that links giga and the upstream modules,cosmos/bank/v1beta1/*.protoandevm/*.protonow resolve to their owners' descriptors.Not in this PR
Giga's
MsgEVMTransactionand the wholegiga/deps/xevm/types/ethtxpackage are only reachable from the giga keeper'sSetMsgsandGetAllEVMTxDeferredInfo, which only tests call. Production goes throughapp.EvmKeeperfor 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, andbuf breakingagainstmain. The new module has no counterpart in the base, and the check passes.scripts/protoc.shregenerates every committed.pb.gobyte-for-byte, giga's included.go build ./...,go vet ./giga/... ./app/...,make fmtcheck, andgolangci-lint run ./giga/deps/xevm/... ./giga/deps/xbank/...(0 issues)scripts/ramtest.sh ./giga/... ./app/: every package passes