From 180fcef0d9dab34bf4dac64378a7efbe63f7509b Mon Sep 17 00:00:00 2001 From: Lucas Bertrand Date: Wed, 29 May 2024 18:23:17 +0200 Subject: [PATCH] feat(`pkg/chains`): add a `CCTXGateway` field to chain static data (#2279) * proto gen * add field to chains * make generate * changelog * fix test * update comment * make format --- changelog.md | 1 + docs/openapi/openapi.swagger.yaml | 15 ++ pkg/chains/chains.go | 20 +++ pkg/chains/chains.pb.go | 155 +++++++++++++----- .../zetacore/pkg/chains/chains.proto | 16 ++ .../zetacore/pkg/chains/chains_pb.d.ts | 30 ++++ zetaclient/zetacore/tx_test.go | 3 +- 7 files changed, 196 insertions(+), 44 deletions(-) diff --git a/changelog.md b/changelog.md index 27b8257de4..a2fdd6c26c 100644 --- a/changelog.md +++ b/changelog.md @@ -16,6 +16,7 @@ * [2113](https://github.com/zeta-chain/node/pull/2113) - add zetaclientd-supervisor process * [2154](https://github.com/zeta-chain/node/pull/2154) - add `ibccrosschain` module * [2258](https://github.com/zeta-chain/node/pull/2258) - add Optimism and Base in static chain information +* [2279](https://github.com/zeta-chain/node/pull/2279) - add a CCTXGateway field to chain static data * [2275](https://github.com/zeta-chain/node/pull/2275) - add ChainInfo singleton state variable in authority ### Refactor diff --git a/docs/openapi/openapi.swagger.yaml b/docs/openapi/openapi.swagger.yaml index 9067eccc6d..9c0dbc1e10 100644 --- a/docs/openapi/openapi.swagger.yaml +++ b/docs/openapi/openapi.swagger.yaml @@ -56744,6 +56744,18 @@ definitions: description: |- QueryGetPoliciesResponse is the response type for the Query/Policies RPC method. + chainsCCTXGateway: + type: string + enum: + - zevm + - observers + default: zevm + description: |- + - zevm: zevm is the internal CCTX gateway to process outbound on the ZEVM and read + inbound events from the ZEVM only used for ZetaChain chains + - observers: observers is the CCTX gateway for chains relying on the observer set to + observe inbounds and TSS for outbounds + title: CCTXGateway describes for the chain the gateway used to handle CCTX outbounds chainsChain: type: object properties: @@ -56769,6 +56781,9 @@ definitions: is_external: type: boolean title: IsExternal describe if the chain is ZetaChain or external + cctx_gateway: + $ref: '#/definitions/chainsCCTXGateway' + title: CCTXGateway is the gateway used to handle CCTX outbounds title: |- Chain represents static data about a blockchain network it is identified by a unique chain ID diff --git a/pkg/chains/chains.go b/pkg/chains/chains.go index 21718f874d..61fffece76 100644 --- a/pkg/chains/chains.go +++ b/pkg/chains/chains.go @@ -16,6 +16,7 @@ var ( Vm: Vm_evm, Consensus: Consensus_tendermint, IsExternal: false, + CctxGateway: CCTXGateway_zevm, } // Ethereum is Ethereum mainnet @@ -27,6 +28,7 @@ var ( Vm: Vm_evm, Consensus: Consensus_ethereum, IsExternal: true, + CctxGateway: CCTXGateway_observers, } // BscMainnet is Binance Smart Chain mainnet @@ -38,6 +40,7 @@ var ( Vm: Vm_evm, Consensus: Consensus_ethereum, IsExternal: true, + CctxGateway: CCTXGateway_observers, } // BitcoinMainnet is Bitcoin mainnet @@ -49,6 +52,7 @@ var ( Vm: Vm_no_vm, Consensus: Consensus_bitcoin, IsExternal: true, + CctxGateway: CCTXGateway_observers, } // Polygon is Polygon mainnet @@ -60,6 +64,7 @@ var ( Vm: Vm_evm, Consensus: Consensus_ethereum, IsExternal: true, + CctxGateway: CCTXGateway_observers, } // OptimismMainnet is Optimism mainnet @@ -71,6 +76,7 @@ var ( Vm: Vm_evm, Consensus: Consensus_op_stack, IsExternal: true, + CctxGateway: CCTXGateway_observers, } // BaseMainnet is Base mainnet @@ -82,6 +88,7 @@ var ( Vm: Vm_evm, Consensus: Consensus_op_stack, IsExternal: true, + CctxGateway: CCTXGateway_observers, } /** @@ -97,6 +104,7 @@ var ( Vm: Vm_evm, Consensus: Consensus_tendermint, IsExternal: false, + CctxGateway: CCTXGateway_zevm, } // Sepolia is Ethereum sepolia testnet @@ -108,6 +116,7 @@ var ( Vm: Vm_evm, Consensus: Consensus_ethereum, IsExternal: true, + CctxGateway: CCTXGateway_observers, } // BscTestnet is Binance Smart Chain testnet @@ -119,6 +128,7 @@ var ( Vm: Vm_evm, Consensus: Consensus_ethereum, IsExternal: true, + CctxGateway: CCTXGateway_observers, } // BitcoinTestnet is Bitcoin testnet3 @@ -130,6 +140,7 @@ var ( Vm: Vm_no_vm, Consensus: Consensus_bitcoin, IsExternal: true, + CctxGateway: CCTXGateway_observers, } // Amoy is Polygon amoy testnet @@ -141,6 +152,7 @@ var ( Vm: Vm_evm, Consensus: Consensus_ethereum, IsExternal: true, + CctxGateway: CCTXGateway_observers, } // OptimismSepolia is Optimism sepolia testnet @@ -152,6 +164,7 @@ var ( Vm: Vm_evm, Consensus: Consensus_op_stack, IsExternal: true, + CctxGateway: CCTXGateway_observers, } // BaseSepolia is Base sepolia testnet @@ -163,6 +176,7 @@ var ( Vm: Vm_evm, Consensus: Consensus_op_stack, IsExternal: true, + CctxGateway: CCTXGateway_observers, } /** @@ -179,6 +193,7 @@ var ( Vm: Vm_evm, Consensus: Consensus_tendermint, IsExternal: false, + CctxGateway: CCTXGateway_zevm, } /** @@ -194,6 +209,7 @@ var ( Vm: Vm_evm, Consensus: Consensus_tendermint, IsExternal: false, + CctxGateway: CCTXGateway_zevm, } // BitcoinRegtest is Bitcoin regtest (localnet) @@ -205,6 +221,7 @@ var ( Vm: Vm_no_vm, Consensus: Consensus_bitcoin, IsExternal: true, + CctxGateway: CCTXGateway_observers, } // GoerliLocalnet is Ethereum local goerli (localnet) @@ -216,6 +233,7 @@ var ( Vm: Vm_evm, Consensus: Consensus_ethereum, IsExternal: true, + CctxGateway: CCTXGateway_observers, } /** @@ -231,6 +249,7 @@ var ( Vm: Vm_evm, Consensus: Consensus_ethereum, IsExternal: true, + CctxGateway: CCTXGateway_observers, } // Mumbai is Polygon mumbai testnet (deprecated for amoy) @@ -242,6 +261,7 @@ var ( Vm: Vm_evm, Consensus: Consensus_ethereum, IsExternal: true, + CctxGateway: CCTXGateway_observers, } ) diff --git a/pkg/chains/chains.pb.go b/pkg/chains/chains.pb.go index 1153208c6d..848a7e1bc0 100644 --- a/pkg/chains/chains.pb.go +++ b/pkg/chains/chains.pb.go @@ -269,6 +269,36 @@ func (Consensus) EnumDescriptor() ([]byte, []int) { return fileDescriptor_236b85e7bff6130d, []int{5} } +// CCTXGateway describes for the chain the gateway used to handle CCTX outbounds +type CCTXGateway int32 + +const ( + // zevm is the internal CCTX gateway to process outbound on the ZEVM and read + // inbound events from the ZEVM only used for ZetaChain chains + CCTXGateway_zevm CCTXGateway = 0 + // observers is the CCTX gateway for chains relying on the observer set to + // observe inbounds and TSS for outbounds + CCTXGateway_observers CCTXGateway = 1 +) + +var CCTXGateway_name = map[int32]string{ + 0: "zevm", + 1: "observers", +} + +var CCTXGateway_value = map[string]int32{ + "zevm": 0, + "observers": 1, +} + +func (x CCTXGateway) String() string { + return proto.EnumName(CCTXGateway_name, int32(x)) +} + +func (CCTXGateway) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_236b85e7bff6130d, []int{6} +} + // Chain represents static data about a blockchain network // it is identified by a unique chain ID type Chain struct { @@ -286,6 +316,8 @@ type Chain struct { Consensus Consensus `protobuf:"varint,6,opt,name=consensus,proto3,enum=zetachain.zetacore.pkg.chains.Consensus" json:"consensus,omitempty"` // IsExternal describe if the chain is ZetaChain or external IsExternal bool `protobuf:"varint,7,opt,name=is_external,json=isExternal,proto3" json:"is_external,omitempty"` + // CCTXGateway is the gateway used to handle CCTX outbounds + CctxGateway CCTXGateway `protobuf:"varint,8,opt,name=cctx_gateway,json=cctxGateway,proto3,enum=zetachain.zetacore.pkg.chains.CCTXGateway" json:"cctx_gateway,omitempty"` } func (m *Chain) Reset() { *m = Chain{} } @@ -370,6 +402,13 @@ func (m *Chain) GetIsExternal() bool { return false } +func (m *Chain) GetCctxGateway() CCTXGateway { + if m != nil { + return m.CctxGateway + } + return CCTXGateway_zevm +} + func init() { proto.RegisterEnum("zetachain.zetacore.pkg.chains.ReceiveStatus", ReceiveStatus_name, ReceiveStatus_value) proto.RegisterEnum("zetachain.zetacore.pkg.chains.ChainName", ChainName_name, ChainName_value) @@ -377,6 +416,7 @@ func init() { proto.RegisterEnum("zetachain.zetacore.pkg.chains.NetworkType", NetworkType_name, NetworkType_value) proto.RegisterEnum("zetachain.zetacore.pkg.chains.Vm", Vm_name, Vm_value) proto.RegisterEnum("zetachain.zetacore.pkg.chains.Consensus", Consensus_name, Consensus_value) + proto.RegisterEnum("zetachain.zetacore.pkg.chains.CCTXGateway", CCTXGateway_name, CCTXGateway_value) proto.RegisterType((*Chain)(nil), "zetachain.zetacore.pkg.chains.Chain") } @@ -385,49 +425,51 @@ func init() { } var fileDescriptor_236b85e7bff6130d = []byte{ - // 658 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x94, 0xcf, 0x6e, 0x13, 0x3b, - 0x14, 0xc6, 0x33, 0x93, 0xff, 0x27, 0x69, 0xea, 0xeb, 0x76, 0x91, 0x5b, 0xe9, 0xce, 0xed, 0xbd, - 0x0b, 0x14, 0x22, 0x91, 0x08, 0x58, 0xb2, 0x41, 0x54, 0x14, 0x81, 0x44, 0x17, 0x03, 0xaa, 0x04, - 0x9b, 0x68, 0xe2, 0x1c, 0x26, 0x56, 0x62, 0x7b, 0x34, 0x76, 0x02, 0xe1, 0x29, 0x58, 0xf2, 0x00, - 0x2c, 0x78, 0x14, 0x96, 0x5d, 0xb2, 0x44, 0xed, 0x03, 0xf0, 0x0a, 0xc8, 0xce, 0x78, 0x02, 0x0b, - 0x68, 0x57, 0x73, 0xfc, 0x9b, 0xef, 0x7c, 0xe7, 0xd8, 0x3e, 0x32, 0x0c, 0xdf, 0xa3, 0x49, 0xd8, - 0x3c, 0xe1, 0x72, 0xec, 0x22, 0x95, 0xe3, 0x38, 0x5b, 0xa4, 0x63, 0x87, 0x74, 0xf1, 0x19, 0x65, - 0xb9, 0x32, 0x8a, 0xfe, 0x53, 0x6a, 0x47, 0x5e, 0x3b, 0xca, 0x16, 0xe9, 0x68, 0x2b, 0x3a, 0x3a, - 0x4c, 0x55, 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 0xa9, 0x61, 0x24, 0xb4, - 0xf7, 0x56, 0x9c, 0x25, 0xa9, 0x3a, 0xaa, 0x19, 0xa9, 0xd1, 0x2e, 0xb4, 0x7c, 0x71, 0x52, 0xb7, - 0x69, 0xb6, 0x04, 0x69, 0x14, 0xd6, 0xa7, 0xd0, 0xf9, 0x69, 0x82, 0xad, 0x85, 0x6f, 0xc7, 0xcd, - 0x81, 0xdf, 0x59, 0xe0, 0xcc, 0x73, 0xbe, 0xde, 0x5e, 0x23, 0x40, 0x63, 0x86, 0x2e, 0xae, 0x16, - 0x3e, 0x11, 0x84, 0xe7, 0xc2, 0x0e, 0x83, 0x54, 0x93, 0xb5, 0x20, 0x15, 0xd7, 0xe8, 0x5a, 0x90, - 0xa0, 0xf8, 0xff, 0x0c, 0xda, 0xe5, 0xa8, 0xda, 0x96, 0xd0, 0xcc, 0x31, 0xc7, 0x95, 0x55, 0xf6, - 0x00, 0x0c, 0xca, 0x19, 0xe6, 0x82, 0xcb, 0xa2, 0xd2, 0x94, 0x1b, 0xa6, 0xb8, 0x24, 0xe1, 0xb6, - 0xfb, 0x89, 0x36, 0x09, 0x5b, 0xf8, 0x5a, 0x8f, 0x4e, 0xbe, 0x5c, 0x46, 0xc1, 0xc5, 0x65, 0x14, - 0x7c, 0xbb, 0x8c, 0x82, 0x0f, 0x57, 0x51, 0xe5, 0xe2, 0x2a, 0xaa, 0x7c, 0xbd, 0x8a, 0x2a, 0xaf, - 0x6f, 0xa7, 0xdc, 0xcc, 0x57, 0xd3, 0x11, 0x53, 0xc2, 0x3d, 0x6a, 0x77, 0x7e, 0xfb, 0xbe, 0x4d, - 0x1b, 0xee, 0x91, 0xba, 0xff, 0x23, 0x00, 0x00, 0xff, 0xff, 0x15, 0x2a, 0x93, 0x8e, 0x07, 0x05, - 0x00, 0x00, + // 704 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0x3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, 0xe7, 0xcc, 0x4b, + 0x71, 0xa8, 0xae, 0x11, 0x60, 0xb0, 0x46, 0x57, 0x77, 0x6b, 0x9f, 0x08, 0xfc, 0x6b, 0x69, 0x87, + 0x21, 0x57, 0xc9, 0x41, 0x92, 0x8e, 0x0b, 0x7a, 0x90, 0xc4, 0xab, 0xbf, 0x7f, 0x03, 0xe3, 0x76, + 0xf2, 0x6d, 0x24, 0x34, 0x1b, 0x2c, 0x71, 0x6f, 0x99, 0x53, 0x00, 0x83, 0xf9, 0x1a, 0x4b, 0x29, + 0xf2, 0xba, 0x53, 0x2a, 0x0c, 0x57, 0x22, 0x27, 0x7e, 0x95, 0x3e, 0xd1, 0x86, 0xf1, 0x6d, 0xdb, + 0xeb, 0x23, 0x08, 0x1e, 0x4d, 0x76, 0x75, 0x12, 0xae, 0xe7, 0x19, 0x8c, 0x55, 0xaa, 0xb1, 0x3c, + 0x60, 0xa9, 0x9b, 0xce, 0x5f, 0xae, 0x7e, 0xbf, 0x8f, 0xbc, 0xbb, 0xfb, 0xc8, 0xfb, 0xf3, 0x3e, + 0xf2, 0x7e, 0x79, 0x88, 0x3a, 0x77, 0x0f, 0x51, 0xe7, 0x8f, 0x87, 0xa8, 0xf3, 0xe3, 0x87, 0x99, + 0x30, 0x9b, 0x7d, 0xba, 0xe0, 0x4a, 0xba, 0x17, 0xf5, 0xe3, 0xff, 0x7c, 0x5c, 0xd3, 0x81, 0x7b, + 0x21, 0x3f, 0xfb, 0x27, 0x00, 0x00, 0xff, 0xff, 0x05, 0xa7, 0x7f, 0x40, 0x84, 0x05, 0x00, 0x00, } func (m *Chain) Marshal() (dAtA []byte, err error) { @@ -450,6 +492,11 @@ func (m *Chain) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.CctxGateway != 0 { + i = encodeVarintChains(dAtA, i, uint64(m.CctxGateway)) + i-- + dAtA[i] = 0x40 + } if m.IsExternal { i-- if m.IsExternal { @@ -531,6 +578,9 @@ func (m *Chain) Size() (n int) { if m.IsExternal { n += 2 } + if m.CctxGateway != 0 { + n += 1 + sovChains(uint64(m.CctxGateway)) + } return n } @@ -703,6 +753,25 @@ func (m *Chain) Unmarshal(dAtA []byte) error { } } m.IsExternal = bool(v != 0) + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CctxGateway", wireType) + } + m.CctxGateway = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowChains + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CctxGateway |= CCTXGateway(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipChains(dAtA[iNdEx:]) diff --git a/proto/zetachain/zetacore/pkg/chains/chains.proto b/proto/zetachain/zetacore/pkg/chains/chains.proto index 1f2279af35..8075822471 100644 --- a/proto/zetachain/zetacore/pkg/chains/chains.proto +++ b/proto/zetachain/zetacore/pkg/chains/chains.proto @@ -88,6 +88,19 @@ enum Consensus { op_stack = 3; } +// CCTXGateway describes for the chain the gateway used to handle CCTX outbounds +enum CCTXGateway { + option (gogoproto.goproto_enum_stringer) = true; + + // zevm is the internal CCTX gateway to process outbound on the ZEVM and read + // inbound events from the ZEVM only used for ZetaChain chains + zevm = 0; + + // observers is the CCTX gateway for chains relying on the observer set to + // observe inbounds and TSS for outbounds + observers = 1; +} + // Chain represents static data about a blockchain network // it is identified by a unique chain ID message Chain { @@ -111,4 +124,7 @@ message Chain { // IsExternal describe if the chain is ZetaChain or external bool is_external = 7; + + // CCTXGateway is the gateway used to handle CCTX outbounds + CCTXGateway cctx_gateway = 8; } diff --git a/typescript/zetachain/zetacore/pkg/chains/chains_pb.d.ts b/typescript/zetachain/zetacore/pkg/chains/chains_pb.d.ts index 6abe26cd04..782e669d43 100644 --- a/typescript/zetachain/zetacore/pkg/chains/chains_pb.d.ts +++ b/typescript/zetachain/zetacore/pkg/chains/chains_pb.d.ts @@ -253,6 +253,29 @@ export declare enum Consensus { op_stack = 3, } +/** + * CCTXGateway describes for the chain the gateway used to handle CCTX outbounds + * + * @generated from enum zetachain.zetacore.pkg.chains.CCTXGateway + */ +export declare enum CCTXGateway { + /** + * zevm is the internal CCTX gateway to process outbound on the ZEVM and read + * inbound events from the ZEVM only used for ZetaChain chains + * + * @generated from enum value: zevm = 0; + */ + zevm = 0, + + /** + * observers is the CCTX gateway for chains relying on the observer set to + * observe inbounds and TSS for outbounds + * + * @generated from enum value: observers = 1; + */ + observers = 1, +} + /** * Chain represents static data about a blockchain network * it is identified by a unique chain ID @@ -309,6 +332,13 @@ export declare class Chain extends Message { */ isExternal: boolean; + /** + * CCTXGateway is the gateway used to handle CCTX outbounds + * + * @generated from field: zetachain.zetacore.pkg.chains.CCTXGateway cctx_gateway = 8; + */ + cctxGateway: CCTXGateway; + constructor(data?: PartialMessage); static readonly runtime: typeof proto3; diff --git a/zetaclient/zetacore/tx_test.go b/zetaclient/zetacore/tx_test.go index f12fcc8b6a..919f9cc058 100644 --- a/zetaclient/zetacore/tx_test.go +++ b/zetaclient/zetacore/tx_test.go @@ -247,7 +247,6 @@ func TestZetacore_UpdateZetacoreContext(t *testing.T) { WithPayload(observertypes.QuerySupportedChains{}). Return(observertypes.QuerySupportedChainsResponse{ Chains: []*chains.Chain{ - { chains.BitcoinMainnet.ChainId, chains.BitcoinMainnet.ChainName, @@ -256,6 +255,7 @@ func TestZetacore_UpdateZetacoreContext(t *testing.T) { chains.BscMainnet.Vm, chains.BscMainnet.Consensus, chains.BscMainnet.IsExternal, + chains.BscMainnet.CctxGateway, }, { chains.Ethereum.ChainId, @@ -265,6 +265,7 @@ func TestZetacore_UpdateZetacoreContext(t *testing.T) { chains.Ethereum.Vm, chains.Ethereum.Consensus, chains.Ethereum.IsExternal, + chains.Ethereum.CctxGateway, }, }, })