Repository navigation
Commit 674d136
Generate giga's protobuf code from its own trimmed protos (#4656)
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 #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 #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
---------
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Masih H. Derkani <m@derkani.org>1 parent 0de95ed commit 674d136
37 files changed
Lines changed: 1466 additions & 10774 deletions
File tree
- giga
- deps
- xbank/types
- xevm/types
- ethtx
- proto
- gigabank
- gigaeth
- gigaevm
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
This file was deleted.
0 commit comments