From 88f37bc039e16b32cb1a9ba0f0abf72bb23f095c Mon Sep 17 00:00:00 2001 From: skosito Date: Tue, 16 Jul 2024 08:53:28 +0100 Subject: [PATCH 1/5] fix: emit events on revert (#2466) * emit events on revert * fix cast parsing error * fix tests * fix test * test fix * fix config * add assertion for ZETA minted in the fungible account * PR comments * fix new cctx status checking bug --------- Co-authored-by: lumtis --- cmd/zetae2e/config/local.yml | 4 +++- ...test_message_passing_evm_to_zevm_revert.go | 22 +++++++++++++++++++ rpc/backend/blocks_test.go | 6 ++--- rpc/backend/tx_info_test.go | 18 +++++++-------- rpc/types/utils.go | 6 ++--- x/crosschain/keeper/cctx_gateway_zevm.go | 2 +- x/fungible/keeper/evm.go | 8 +++---- 7 files changed, 45 insertions(+), 21 deletions(-) diff --git a/cmd/zetae2e/config/local.yml b/cmd/zetae2e/config/local.yml index ee5e171ccc..f4aa45599c 100644 --- a/cmd/zetae2e/config/local.yml +++ b/cmd/zetae2e/config/local.yml @@ -25,8 +25,10 @@ contracts: uniswap_router: "0x2ca7d64A7EFE2D62A725E2B35Cf7230D6677FfEe" connector_zevm: "0x239e96c8f17C85c30100AC26F635Ea15f23E9c67" wzeta: "0x5F0b1a82749cb4E2278EC87F8BF6B618dC71a8bf" + test_dapp: "0xA8D5060feb6B456e886F023709A2795373691E63" evm: zeta_eth: "0x733aB8b06DDDEf27Eaa72294B0d7c9cEF7f12db9" connector_eth: "0xD28D6A0b8189305551a0A8bd247a6ECa9CE781Ca" custody: "0xff3135df4F2775f4091b81f4c7B6359CfA07862a" - erc20: "0xbD1e64A22B9F92D9Ce81aA9B4b0fFacd80215564" \ No newline at end of file + erc20: "0xbD1e64A22B9F92D9Ce81aA9B4b0fFacd80215564" + test_dapp: "0xBFF76e77D56B3C1202107f059425D56f0AEF87Ed" \ No newline at end of file diff --git a/e2e/e2etests/test_message_passing_evm_to_zevm_revert.go b/e2e/e2etests/test_message_passing_evm_to_zevm_revert.go index 99a49fba56..85aca0caae 100644 --- a/e2e/e2etests/test_message_passing_evm_to_zevm_revert.go +++ b/e2e/e2etests/test_message_passing_evm_to_zevm_revert.go @@ -13,9 +13,15 @@ import ( cctxtypes "github.com/zeta-chain/zetacore/x/crosschain/types" ) +// fungibleModuleAddress is a constant representing the EVM address of the Fungible module account +const fungibleModuleAddress = "0x735b14BB79463307AAcBED86DAf3322B1e6226aB" + func TestMessagePassingEVMtoZEVMRevert(r *runner.E2ERunner, args []string) { require.Len(r, args, 1) + fungibleEthAddress := ethcommon.HexToAddress(fungibleModuleAddress) + require.True(r, fungibleEthAddress != ethcommon.Address{}, "invalid fungible module address") + amount, ok := big.NewInt(0).SetString(args[0], 10) require.True(r, ok) @@ -46,6 +52,9 @@ func TestMessagePassingEVMtoZEVMRevert(r *runner.E2ERunner, args []string) { previousBalanceEVM, err := r.ZetaEth.BalanceOf(&bind.CallOpts{}, r.EvmTestDAppAddr) require.NoError(r, err) + previousFungibleBalance, err := r.WZeta.BalanceOf(&bind.CallOpts{}, fungibleEthAddress) + require.NoError(r, err) + // Call the SendHelloWorld function on the EVM dapp Contract which would in turn create a new send, to be picked up by the zeta-clients // set Do revert to true which adds a message to signal the ZEVM zetaReceiver to revert the transaction tx, err = testDAppEVM.SendHelloWorld(r.EVMAuth, destinationAddress, zEVMChainID, amount, true) @@ -105,4 +114,17 @@ func TestMessagePassingEVMtoZEVMRevert(r *runner.E2ERunner, args []string) { previousBalanceAndAmountEVM.String(), newBalanceEVM.String(), ) + + // Check ZETA balance on Fungible Module and check new balance is previous balance + newFungibleBalance, err := r.WZeta.BalanceOf(&bind.CallOpts{}, fungibleEthAddress) + require.NoError(r, err) + + require.Equal( + r, + 0, + newFungibleBalance.Cmp(previousFungibleBalance), + "expected new balance to be %s, got %s", + previousFungibleBalance.String(), + newFungibleBalance.String(), + ) } diff --git a/rpc/backend/blocks_test.go b/rpc/backend/blocks_test.go index bec50ff5a5..ef8023e448 100644 --- a/rpc/backend/blocks_test.go +++ b/rpc/backend/blocks_test.go @@ -1716,7 +1716,7 @@ func (suite *BackendTestSuite) TestEthAndSyntheticGetBlockByNumber() { suite.Require().Equal("0x775b87ef5D82ca211811C1a02CE0fE0CA3a455d7", resSyntheticTx.To.Hex()) suite.Require().Equal("0x58", resSyntheticTx.Type.String()) suite.Require().Equal("0x1", resSyntheticTx.Nonce.String()) - suite.Require().Nil(resSyntheticTx.V) - suite.Require().Nil(resSyntheticTx.R) - suite.Require().Nil(resSyntheticTx.S) + suite.Require().Equal((*hexutil.Big)(big.NewInt(0)), resSyntheticTx.V) + suite.Require().Equal((*hexutil.Big)(big.NewInt(0)), resSyntheticTx.R) + suite.Require().Equal((*hexutil.Big)(big.NewInt(0)), resSyntheticTx.S) } diff --git a/rpc/backend/tx_info_test.go b/rpc/backend/tx_info_test.go index 0ceb0160a6..f564494f19 100644 --- a/rpc/backend/tx_info_test.go +++ b/rpc/backend/tx_info_test.go @@ -59,9 +59,9 @@ func (suite *BackendTestSuite) TestGetSyntheticTransactionByHash() { gas, _ := hexutil.DecodeUint64(res.Gas.String()) suite.Require().Equal(uint64(21000), gas) suite.Require().Equal("0x1234", res.Input.String()) - suite.Require().Nil(res.V) - suite.Require().Nil(res.R) - suite.Require().Nil(res.S) + suite.Require().Equal((*hexutil.Big)(big.NewInt(0)), res.V) + suite.Require().Equal((*hexutil.Big)(big.NewInt(0)), res.R) + suite.Require().Equal((*hexutil.Big)(big.NewInt(0)), res.S) } func (suite *BackendTestSuite) TestGetSyntheticTransactionReceiptByHash() { @@ -127,9 +127,9 @@ func (suite *BackendTestSuite) TestGetSyntheticTransactionByBlockNumberAndIndex( suite.Require().Equal(uint64(88), txType) suite.Require().Equal(int64(7001), res.ChainID.ToInt().Int64()) suite.Require().Equal(int64(1000), res.Value.ToInt().Int64()) - suite.Require().Nil(res.V) - suite.Require().Nil(res.R) - suite.Require().Nil(res.S) + suite.Require().Equal((*hexutil.Big)(big.NewInt(0)), res.V) + suite.Require().Equal((*hexutil.Big)(big.NewInt(0)), res.R) + suite.Require().Equal((*hexutil.Big)(big.NewInt(0)), res.S) } func (suite *BackendTestSuite) TestGetSyntheticTransactionByBlockNumberAndIndexWithRealTransaction() { @@ -160,9 +160,9 @@ func (suite *BackendTestSuite) TestGetSyntheticTransactionByBlockNumberAndIndexW suite.Require().Equal(uint64(88), txType) suite.Require().Equal(int64(7001), res.ChainID.ToInt().Int64()) suite.Require().Equal(int64(1000), res.Value.ToInt().Int64()) - suite.Require().Nil(res.V) - suite.Require().Nil(res.R) - suite.Require().Nil(res.S) + suite.Require().Equal((*hexutil.Big)(big.NewInt(0)), res.V) + suite.Require().Equal((*hexutil.Big)(big.NewInt(0)), res.R) + suite.Require().Equal((*hexutil.Big)(big.NewInt(0)), res.S) } func (suite *BackendTestSuite) TestGetTransactionByHash() { diff --git a/rpc/types/utils.go b/rpc/types/utils.go index cd00d55746..5e93d97ae8 100644 --- a/rpc/types/utils.go +++ b/rpc/types/utils.go @@ -257,9 +257,9 @@ func NewRPCTransactionFromIncompleteMsg( Nonce: hexutil.Uint64(txAdditional.Nonce), // TODO: get nonce for "from" from ethermint To: to, Value: (*hexutil.Big)(txAdditional.Value), - V: nil, - R: nil, - S: nil, + V: (*hexutil.Big)(big.NewInt(0)), + R: (*hexutil.Big)(big.NewInt(0)), + S: (*hexutil.Big)(big.NewInt(0)), ChainID: (*hexutil.Big)(chainID), } if blockHash != (common.Hash{}) { diff --git a/x/crosschain/keeper/cctx_gateway_zevm.go b/x/crosschain/keeper/cctx_gateway_zevm.go index 3a6f9a8135..d9061be54a 100644 --- a/x/crosschain/keeper/cctx_gateway_zevm.go +++ b/x/crosschain/keeper/cctx_gateway_zevm.go @@ -33,7 +33,7 @@ func (c CCTXGatewayZEVM) InitiateOutbound( } newCCTXStatus = c.crosschainKeeper.ValidateOutboundZEVM(ctx, config.CCTX, err, isContractReverted) - if newCCTXStatus == types.CctxStatus_OutboundMined { + if newCCTXStatus == types.CctxStatus_OutboundMined || newCCTXStatus == types.CctxStatus_PendingRevert { commit() } diff --git a/x/fungible/keeper/evm.go b/x/fungible/keeper/evm.go index 8deaaf0e1b..dbbae8294f 100644 --- a/x/fungible/keeper/evm.go +++ b/x/fungible/keeper/evm.go @@ -746,10 +746,6 @@ func (k Keeper) CallEVMWithData( return nil, err } - if res.Failed() { - return res, cosmoserrors.Wrap(evmtypes.ErrVMExecution, fmt.Sprintf("%s: ret 0x%x", res.VmError, res.Ret)) - } - // Emit events and log for the transaction if it is committed if commit { msgBytes, err := json.Marshal(msg) @@ -826,5 +822,9 @@ func (k Keeper) CallEVMWithData( } } + if res.Failed() { + return res, cosmoserrors.Wrapf(evmtypes.ErrVMExecution, "%s: ret 0x%x", res.VmError, res.Ret) + } + return res, nil } From fde03f77d0c9476f7a69a6e2a5df706c039189d8 Mon Sep 17 00:00:00 2001 From: brewmaster012 <88689859+brewmaster012@users.noreply.github.com> Date: Tue, 16 Jul 2024 05:29:04 -0500 Subject: [PATCH 2/5] rename a file to unblock go get (#2485) --- .../{migration_v12.2->v12.3.md => migration_v12.2-v12.3.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename docs/zetaclient/{migration_v12.2->v12.3.md => migration_v12.2-v12.3.md} (100%) diff --git a/docs/zetaclient/migration_v12.2->v12.3.md b/docs/zetaclient/migration_v12.2-v12.3.md similarity index 100% rename from docs/zetaclient/migration_v12.2->v12.3.md rename to docs/zetaclient/migration_v12.2-v12.3.md From 7521b6d44f76d371326b8b7ebf5c08e415fdc279 Mon Sep 17 00:00:00 2001 From: mohitsethia <45464245+mohitsethia@users.noreply.github.com> Date: Tue, 16 Jul 2024 13:19:03 +0200 Subject: [PATCH 3/5] refactor: rename txHashList to txHash (#2476) * rename txHashList to txHash * run make generate * run make generate * change struct in test file too --- docs/openapi/openapi.swagger.yaml | 4 +- .../crosschain/outbound_tracker.proto | 4 +- .../crosschain/outbound_tracker_pb.d.ts | 20 ++-- .../keeper/msg_server_add_outbound_tracker.go | 4 +- .../msg_server_add_outbound_tracker_test.go | 10 +- x/crosschain/types/outbound_tracker.pb.go | 106 +++++++++--------- 6 files changed, 74 insertions(+), 74 deletions(-) diff --git a/docs/openapi/openapi.swagger.yaml b/docs/openapi/openapi.swagger.yaml index a6ee4a79f3..ef6d1c39d6 100644 --- a/docs/openapi/openapi.swagger.yaml +++ b/docs/openapi/openapi.swagger.yaml @@ -57273,7 +57273,7 @@ definitions: type: array items: type: object - $ref: '#/definitions/crosschainTxHashList' + $ref: '#/definitions/crosschainTxHash' crosschainQueryAllCctxResponse: type: object properties: @@ -57502,7 +57502,7 @@ definitions: - NotFinalized: the corresponding tx is not finalized - Finalized: the corresponding tx is finalized but not executed yet - Executed: the corresponding tx is executed - crosschainTxHashList: + crosschainTxHash: type: object properties: tx_hash: diff --git a/proto/zetachain/zetacore/crosschain/outbound_tracker.proto b/proto/zetachain/zetacore/crosschain/outbound_tracker.proto index 4547703444..2599a0c7da 100644 --- a/proto/zetachain/zetacore/crosschain/outbound_tracker.proto +++ b/proto/zetachain/zetacore/crosschain/outbound_tracker.proto @@ -3,7 +3,7 @@ package zetachain.zetacore.crosschain; option go_package = "github.com/zeta-chain/zetacore/x/crosschain/types"; -message TxHashList { +message TxHash { string tx_hash = 1; string tx_signer = 2; bool proved = 3; @@ -12,5 +12,5 @@ message OutboundTracker { string index = 1; // format: "chain-nonce" int64 chain_id = 2; uint64 nonce = 3; - repeated TxHashList hash_list = 4; + repeated TxHash hash_list = 4; } diff --git a/typescript/zetachain/zetacore/crosschain/outbound_tracker_pb.d.ts b/typescript/zetachain/zetacore/crosschain/outbound_tracker_pb.d.ts index 58b98223c9..ddf1798fc8 100644 --- a/typescript/zetachain/zetacore/crosschain/outbound_tracker_pb.d.ts +++ b/typescript/zetachain/zetacore/crosschain/outbound_tracker_pb.d.ts @@ -7,9 +7,9 @@ import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialM import { Message, proto3 } from "@bufbuild/protobuf"; /** - * @generated from message zetachain.zetacore.crosschain.TxHashList + * @generated from message zetachain.zetacore.crosschain.TxHash */ -export declare class TxHashList extends Message { +export declare class TxHash extends Message { /** * @generated from field: string tx_hash = 1; */ @@ -25,19 +25,19 @@ export declare class TxHashList extends Message { */ proved: boolean; - constructor(data?: PartialMessage); + constructor(data?: PartialMessage); static readonly runtime: typeof proto3; - static readonly typeName = "zetachain.zetacore.crosschain.TxHashList"; + static readonly typeName = "zetachain.zetacore.crosschain.TxHash"; static readonly fields: FieldList; - static fromBinary(bytes: Uint8Array, options?: Partial): TxHashList; + static fromBinary(bytes: Uint8Array, options?: Partial): TxHash; - static fromJson(jsonValue: JsonValue, options?: Partial): TxHashList; + static fromJson(jsonValue: JsonValue, options?: Partial): TxHash; - static fromJsonString(jsonString: string, options?: Partial): TxHashList; + static fromJsonString(jsonString: string, options?: Partial): TxHash; - static equals(a: TxHashList | PlainMessage | undefined, b: TxHashList | PlainMessage | undefined): boolean; + static equals(a: TxHash | PlainMessage | undefined, b: TxHash | PlainMessage | undefined): boolean; } /** @@ -62,9 +62,9 @@ export declare class OutboundTracker extends Message { nonce: bigint; /** - * @generated from field: repeated zetachain.zetacore.crosschain.TxHashList hash_list = 4; + * @generated from field: repeated zetachain.zetacore.crosschain.TxHash hash_list = 4; */ - hashList: TxHashList[]; + hashList: TxHash[]; constructor(data?: PartialMessage); diff --git a/x/crosschain/keeper/msg_server_add_outbound_tracker.go b/x/crosschain/keeper/msg_server_add_outbound_tracker.go index 2bfb63d8ab..b82fba7f79 100644 --- a/x/crosschain/keeper/msg_server_add_outbound_tracker.go +++ b/x/crosschain/keeper/msg_server_add_outbound_tracker.go @@ -83,7 +83,7 @@ func (k msgServer) AddOutboundTracker( // fetch the tracker // if the tracker does not exist, initialize a new one tracker, found := k.GetOutboundTracker(ctx, msg.ChainId, msg.Nonce) - hash := types.TxHashList{ + hash := types.TxHash{ TxHash: msg.TxHash, TxSigner: msg.Creator, Proved: isProven, @@ -93,7 +93,7 @@ func (k msgServer) AddOutboundTracker( Index: "", ChainId: msg.ChainId, Nonce: msg.Nonce, - HashList: []*types.TxHashList{&hash}, + HashList: []*types.TxHash{&hash}, }) return &types.MsgAddOutboundTrackerResponse{}, nil } diff --git a/x/crosschain/keeper/msg_server_add_outbound_tracker_test.go b/x/crosschain/keeper/msg_server_add_outbound_tracker_test.go index 7abe63fe15..b6cb5d4bff 100644 --- a/x/crosschain/keeper/msg_server_add_outbound_tracker_test.go +++ b/x/crosschain/keeper/msg_server_add_outbound_tracker_test.go @@ -117,7 +117,7 @@ func TestMsgServer_AddToOutboundTracker(t *testing.T) { k.SetOutboundTracker(ctx, types.OutboundTracker{ ChainId: chainID, Nonce: 42, - HashList: []*types.TxHashList{ + HashList: []*types.TxHash{ { TxHash: existinghHash, }, @@ -249,9 +249,9 @@ func TestMsgServer_AddToOutboundTracker(t *testing.T) { observerMock.On("IsNonTombstonedObserver", mock.Anything, mock.Anything).Return(false) keepertest.MockCctxByNonce(t, ctx, *k, observerMock, types.CctxStatus_PendingOutbound, false) - hashes := make([]*types.TxHashList, keeper.MaxOutboundTrackerHashes) + hashes := make([]*types.TxHash, keeper.MaxOutboundTrackerHashes) for i := 0; i < keeper.MaxOutboundTrackerHashes; i++ { - hashes[i] = &types.TxHashList{ + hashes[i] = &types.TxHash{ TxHash: sample.Hash().Hex(), } } @@ -298,7 +298,7 @@ func TestMsgServer_AddToOutboundTracker(t *testing.T) { k.SetOutboundTracker(ctx, types.OutboundTracker{ ChainId: chainID, Nonce: 42, - HashList: []*types.TxHashList{ + HashList: []*types.TxHash{ { TxHash: existinghHash, }, @@ -397,7 +397,7 @@ func TestMsgServer_AddToOutboundTracker(t *testing.T) { k.SetOutboundTracker(ctx, types.OutboundTracker{ ChainId: chainID, Nonce: 42, - HashList: []*types.TxHashList{ + HashList: []*types.TxHash{ { TxHash: sample.Hash().Hex(), Proved: false, diff --git a/x/crosschain/types/outbound_tracker.pb.go b/x/crosschain/types/outbound_tracker.pb.go index d457726b91..03e17709f6 100644 --- a/x/crosschain/types/outbound_tracker.pb.go +++ b/x/crosschain/types/outbound_tracker.pb.go @@ -22,24 +22,24 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -type TxHashList struct { +type TxHash struct { TxHash string `protobuf:"bytes,1,opt,name=tx_hash,json=txHash,proto3" json:"tx_hash,omitempty"` TxSigner string `protobuf:"bytes,2,opt,name=tx_signer,json=txSigner,proto3" json:"tx_signer,omitempty"` Proved bool `protobuf:"varint,3,opt,name=proved,proto3" json:"proved,omitempty"` } -func (m *TxHashList) Reset() { *m = TxHashList{} } -func (m *TxHashList) String() string { return proto.CompactTextString(m) } -func (*TxHashList) ProtoMessage() {} -func (*TxHashList) Descriptor() ([]byte, []int) { +func (m *TxHash) Reset() { *m = TxHash{} } +func (m *TxHash) String() string { return proto.CompactTextString(m) } +func (*TxHash) ProtoMessage() {} +func (*TxHash) Descriptor() ([]byte, []int) { return fileDescriptor_77cb2cfe04eb42d9, []int{0} } -func (m *TxHashList) XXX_Unmarshal(b []byte) error { +func (m *TxHash) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *TxHashList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *TxHash) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_TxHashList.Marshal(b, m, deterministic) + return xxx_messageInfo_TxHash.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -49,33 +49,33 @@ func (m *TxHashList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } -func (m *TxHashList) XXX_Merge(src proto.Message) { - xxx_messageInfo_TxHashList.Merge(m, src) +func (m *TxHash) XXX_Merge(src proto.Message) { + xxx_messageInfo_TxHash.Merge(m, src) } -func (m *TxHashList) XXX_Size() int { +func (m *TxHash) XXX_Size() int { return m.Size() } -func (m *TxHashList) XXX_DiscardUnknown() { - xxx_messageInfo_TxHashList.DiscardUnknown(m) +func (m *TxHash) XXX_DiscardUnknown() { + xxx_messageInfo_TxHash.DiscardUnknown(m) } -var xxx_messageInfo_TxHashList proto.InternalMessageInfo +var xxx_messageInfo_TxHash proto.InternalMessageInfo -func (m *TxHashList) GetTxHash() string { +func (m *TxHash) GetTxHash() string { if m != nil { return m.TxHash } return "" } -func (m *TxHashList) GetTxSigner() string { +func (m *TxHash) GetTxSigner() string { if m != nil { return m.TxSigner } return "" } -func (m *TxHashList) GetProved() bool { +func (m *TxHash) GetProved() bool { if m != nil { return m.Proved } @@ -83,10 +83,10 @@ func (m *TxHashList) GetProved() bool { } type OutboundTracker struct { - Index string `protobuf:"bytes,1,opt,name=index,proto3" json:"index,omitempty"` - ChainId int64 `protobuf:"varint,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` - Nonce uint64 `protobuf:"varint,3,opt,name=nonce,proto3" json:"nonce,omitempty"` - HashList []*TxHashList `protobuf:"bytes,4,rep,name=hash_list,json=hashList,proto3" json:"hash_list,omitempty"` + Index string `protobuf:"bytes,1,opt,name=index,proto3" json:"index,omitempty"` + ChainId int64 `protobuf:"varint,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + Nonce uint64 `protobuf:"varint,3,opt,name=nonce,proto3" json:"nonce,omitempty"` + HashList []*TxHash `protobuf:"bytes,4,rep,name=hash_list,json=hashList,proto3" json:"hash_list,omitempty"` } func (m *OutboundTracker) Reset() { *m = OutboundTracker{} } @@ -143,7 +143,7 @@ func (m *OutboundTracker) GetNonce() uint64 { return 0 } -func (m *OutboundTracker) GetHashList() []*TxHashList { +func (m *OutboundTracker) GetHashList() []*TxHash { if m != nil { return m.HashList } @@ -151,7 +151,7 @@ func (m *OutboundTracker) GetHashList() []*TxHashList { } func init() { - proto.RegisterType((*TxHashList)(nil), "zetachain.zetacore.crosschain.TxHashList") + proto.RegisterType((*TxHash)(nil), "zetachain.zetacore.crosschain.TxHash") proto.RegisterType((*OutboundTracker)(nil), "zetachain.zetacore.crosschain.OutboundTracker") } @@ -160,29 +160,29 @@ func init() { } var fileDescriptor_77cb2cfe04eb42d9 = []byte{ - // 303 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x90, 0xcd, 0x4a, 0x3b, 0x31, - 0x14, 0xc5, 0x9b, 0x7f, 0xfb, 0x6f, 0xa7, 0x71, 0x21, 0x04, 0xd1, 0x11, 0x31, 0x94, 0xae, 0xea, - 0xc2, 0x14, 0x3f, 0x9e, 0xc0, 0x85, 0x28, 0x0a, 0xc2, 0xd8, 0x55, 0x37, 0xc3, 0x7c, 0x84, 0x26, - 0xa8, 0xc9, 0x90, 0xdc, 0x91, 0xe8, 0x53, 0xf8, 0x08, 0x3e, 0x8e, 0xcb, 0x2e, 0x5d, 0xca, 0xcc, - 0x8b, 0x48, 0x33, 0xa3, 0x15, 0x17, 0xee, 0xee, 0xef, 0x5e, 0xce, 0xe1, 0xdc, 0x83, 0x4f, 0x9f, - 0x39, 0x24, 0x99, 0x48, 0xa4, 0x9a, 0xfa, 0x49, 0x1b, 0x3e, 0xcd, 0x8c, 0xb6, 0xb6, 0xd9, 0xe9, - 0x12, 0x52, 0x5d, 0xaa, 0x3c, 0x06, 0x93, 0x64, 0x77, 0xdc, 0xb0, 0xc2, 0x68, 0xd0, 0x64, 0xff, - 0x5b, 0xc5, 0xbe, 0x54, 0x6c, 0xad, 0x1a, 0xcf, 0x31, 0x9e, 0xb9, 0x8b, 0xc4, 0x8a, 0x6b, 0x69, - 0x81, 0xec, 0xe0, 0x01, 0xb8, 0x58, 0x24, 0x56, 0x84, 0x68, 0x84, 0x26, 0xc3, 0xa8, 0x0f, 0xfe, - 0x48, 0xf6, 0xf0, 0x10, 0x5c, 0x6c, 0xe5, 0x42, 0x71, 0x13, 0xfe, 0xf3, 0xa7, 0x00, 0xdc, 0xad, - 0x67, 0xb2, 0x8d, 0xfb, 0x85, 0xd1, 0x8f, 0x3c, 0x0f, 0xbb, 0x23, 0x34, 0x09, 0xa2, 0x96, 0xc6, - 0xaf, 0x08, 0x6f, 0xde, 0xb4, 0xa9, 0x66, 0x4d, 0x28, 0xb2, 0x85, 0xff, 0x4b, 0x95, 0x73, 0xd7, - 0xfa, 0x37, 0x40, 0x76, 0x71, 0xe0, 0xe3, 0xc4, 0x32, 0xf7, 0xee, 0xdd, 0x68, 0xe0, 0xf9, 0x32, - 0x5f, 0x09, 0x94, 0x56, 0x19, 0xf7, 0xde, 0xbd, 0xa8, 0x01, 0x72, 0x8e, 0x87, 0xab, 0x94, 0xf1, - 0xbd, 0xb4, 0x10, 0xf6, 0x46, 0xdd, 0xc9, 0xc6, 0xf1, 0x01, 0xfb, 0xf3, 0x53, 0xb6, 0x7e, 0x33, - 0x0a, 0x44, 0x3b, 0x9d, 0x5d, 0xbd, 0x55, 0x14, 0x2d, 0x2b, 0x8a, 0x3e, 0x2a, 0x8a, 0x5e, 0x6a, - 0xda, 0x59, 0xd6, 0xb4, 0xf3, 0x5e, 0xd3, 0xce, 0xfc, 0x68, 0x21, 0x41, 0x94, 0x29, 0xcb, 0xf4, - 0x83, 0xaf, 0xfb, 0xf0, 0x57, 0xf3, 0xee, 0x67, 0xf7, 0xf0, 0x54, 0x70, 0x9b, 0xf6, 0x7d, 0xe3, - 0x27, 0x9f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x81, 0x92, 0xa6, 0x84, 0xa9, 0x01, 0x00, 0x00, -} - -func (m *TxHashList) Marshal() (dAtA []byte, err error) { + // 301 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x90, 0xcb, 0x4a, 0x03, 0x31, + 0x14, 0x86, 0x1b, 0x5b, 0xa7, 0xd3, 0xb8, 0x10, 0x82, 0xe8, 0x88, 0x18, 0x4a, 0x41, 0xe8, 0xc6, + 0x14, 0x2f, 0x4f, 0xd0, 0x95, 0xa2, 0x20, 0x8c, 0xc5, 0x85, 0x9b, 0x61, 0x3a, 0x13, 0x3a, 0x41, + 0x4d, 0x4a, 0x72, 0x46, 0xa2, 0x4f, 0xe1, 0x03, 0xf8, 0x40, 0x2e, 0xbb, 0x74, 0x29, 0x33, 0x2f, + 0x22, 0x93, 0x8c, 0x17, 0x5c, 0xb8, 0xcb, 0x97, 0xc3, 0x77, 0xf8, 0xcf, 0x8f, 0x4f, 0x9f, 0x39, + 0xa4, 0x59, 0x91, 0x0a, 0x39, 0x71, 0x2f, 0xa5, 0xf9, 0x24, 0xd3, 0xca, 0x18, 0xff, 0xa7, 0x4a, + 0x98, 0xab, 0x52, 0xe6, 0x09, 0xe8, 0x34, 0xbb, 0xe3, 0x9a, 0x2d, 0xb5, 0x02, 0x45, 0xf6, 0xbf, + 0x2d, 0xf6, 0x65, 0xb1, 0x1f, 0x6b, 0x74, 0x83, 0x83, 0x99, 0x3d, 0x4b, 0x4d, 0x41, 0x76, 0x70, + 0x1f, 0x6c, 0x52, 0xa4, 0xa6, 0x88, 0xd0, 0x10, 0x8d, 0x07, 0x71, 0x00, 0x7e, 0xb0, 0x87, 0x07, + 0x60, 0x13, 0x23, 0x16, 0x92, 0xeb, 0x68, 0xcd, 0x8d, 0x42, 0xb0, 0xd7, 0x8e, 0xc9, 0x36, 0x0e, + 0x96, 0x5a, 0x3d, 0xf2, 0x3c, 0xea, 0x0e, 0xd1, 0x38, 0x8c, 0x5b, 0x1a, 0xbd, 0x22, 0xbc, 0x79, + 0xd5, 0x26, 0x9a, 0xf9, 0x40, 0x64, 0x0b, 0xaf, 0x0b, 0x99, 0x73, 0xdb, 0xee, 0xf7, 0x40, 0x76, + 0x71, 0xe8, 0xa2, 0x24, 0x22, 0x77, 0xdb, 0xbb, 0x71, 0xdf, 0xf1, 0x79, 0xde, 0x08, 0x52, 0xc9, + 0x8c, 0xbb, 0xdd, 0xbd, 0xd8, 0x03, 0x99, 0xe2, 0x41, 0x93, 0x32, 0xb9, 0x17, 0x06, 0xa2, 0xde, + 0xb0, 0x3b, 0xde, 0x38, 0x3e, 0x60, 0xff, 0x5e, 0xc9, 0xfc, 0x89, 0x71, 0xd8, 0x78, 0x97, 0xc2, + 0xc0, 0xf4, 0xe2, 0xad, 0xa2, 0x68, 0x55, 0x51, 0xf4, 0x51, 0x51, 0xf4, 0x52, 0xd3, 0xce, 0xaa, + 0xa6, 0x9d, 0xf7, 0x9a, 0x76, 0x6e, 0x8f, 0x16, 0x02, 0x8a, 0x72, 0xce, 0x32, 0xf5, 0xe0, 0x6a, + 0x3e, 0xfc, 0xd3, 0xb8, 0xfd, 0xdd, 0x39, 0x3c, 0x2d, 0xb9, 0x99, 0x07, 0xae, 0xe9, 0x93, 0xcf, + 0x00, 0x00, 0x00, 0xff, 0xff, 0xec, 0x29, 0xc8, 0x7e, 0xa1, 0x01, 0x00, 0x00, +} + +func (m *TxHash) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -192,12 +192,12 @@ func (m *TxHashList) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *TxHashList) MarshalTo(dAtA []byte) (int, error) { +func (m *TxHash) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *TxHashList) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *TxHash) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -294,7 +294,7 @@ func encodeVarintOutboundTracker(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *TxHashList) Size() (n int) { +func (m *TxHash) Size() (n int) { if m == nil { return 0 } @@ -345,7 +345,7 @@ func sovOutboundTracker(x uint64) (n int) { func sozOutboundTracker(x uint64) (n int) { return sovOutboundTracker(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *TxHashList) Unmarshal(dAtA []byte) error { +func (m *TxHash) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -368,10 +368,10 @@ func (m *TxHashList) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: TxHashList: wiretype end group for non-group") + return fmt.Errorf("proto: TxHash: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: TxHashList: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: TxHash: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -607,7 +607,7 @@ func (m *OutboundTracker) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.HashList = append(m.HashList, &TxHashList{}) + m.HashList = append(m.HashList, &TxHash{}) if err := m.HashList[len(m.HashList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } From cba50db9400cfea6b9b7e67aa3d2551fdf213641 Mon Sep 17 00:00:00 2001 From: morde08 Date: Tue, 16 Jul 2024 07:55:13 -0700 Subject: [PATCH 4/5] fix nightly performance tests and push metrics into pushgateway (#2488) --- .github/actions/performance-tests/art.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/actions/performance-tests/art.yaml b/.github/actions/performance-tests/art.yaml index 35f79a788f..f854e93d13 100644 --- a/.github/actions/performance-tests/art.yaml +++ b/.github/actions/performance-tests/art.yaml @@ -1,5 +1,5 @@ config: - target: "-=http_request_protocol=-://-=endpoint_to_test=-" + target: "http://localhost:9545" phases: - duration: 300 arrivalRate: 400 @@ -14,6 +14,11 @@ config: ensure: - type: "failure" threshold: 1 + publish-metrics: + - type: prometheus + pushgateway: 'https://pushgateway.dev-zetachain-internal.com' + tags: + - 'type:loadtest' summary: true reports: - type: "html" From 0f95277ddf2a7c72f29d185281f4277859747e08 Mon Sep 17 00:00:00 2001 From: Alex Gartner Date: Tue, 16 Jul 2024 08:23:33 -0700 Subject: [PATCH 5/5] refactor(ci): finish matrix migration and update release workflow (#2475) * refactor(ci): finish matrix migration and update release workflow * update readme go version * use actions script * test? * use core * use context references --- .github/workflows/build.yml | 2 +- .github/workflows/e2e.yml | 122 +++++-- .github/workflows/execute_advanced_tests.yaml | 119 ------- .github/workflows/publish-release.yml | 329 +----------------- .github/workflows/reusable-e2e.yml | 2 +- .github/workflows/sast-linters.yml | 4 +- readme.md | 2 +- 7 files changed, 102 insertions(+), 478 deletions(-) delete mode 100644 .github/workflows/execute_advanced_tests.yaml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ea1e2cad2d..c8b5869c15 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,6 +4,7 @@ on: push: branches: - develop + - release/* merge_group: pull_request: branches: @@ -12,7 +13,6 @@ on: - synchronize - opened - reopened - - ready_for_review concurrency: group: pr-testing-${{ github.head_ref || github.run_id }} diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index e0dc06924a..0213c3fdfc 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -4,15 +4,45 @@ on: push: branches: - develop + - release/* pull_request: branches: - "*" merge_group: - workflow_dispatch: schedule: # run at 6AM UTC Daily # 6AM UTC -> 11PM PT - cron: "0 6 * * *" + workflow_dispatch: + inputs: + default-test: + type: boolean + required: false + default: false + upgrade-light-test: + type: boolean + required: false + default: false + upgrade-test: + type: boolean + required: false + default: false + admin-test: + type: boolean + required: false + default: false + upgrade-import-mainnet-test: + type: boolean + required: false + default: false + performance-test: + type: boolean + required: false + default: false + stateful-data-test: + type: boolean + required: false + default: false concurrency: group: e2e-${{ github.head_ref || github.sha }} @@ -27,34 +57,61 @@ jobs: DEFAULT_TESTS: ${{ steps.matrix-conditionals.outputs.DEFAULT_TESTS }} UPGRADE_TESTS: ${{ steps.matrix-conditionals.outputs.UPGRADE_TESTS }} UPGRADE_LIGHT_TESTS: ${{ steps.matrix-conditionals.outputs.UPGRADE_LIGHT_TESTS }} + UPGRADE_IMPORT_MAINNET_TESTS: ${{ steps.matrix-conditionals.outputs.UPGRADE_IMPORT_MAINNET_TESTS }} ADMIN_TESTS: ${{ steps.matrix-conditionals.outputs.ADMIN_TESTS }} + PERFORMANCE_TESTS: ${{ steps.matrix-conditionals.outputs.PERFORMANCE_TESTS }} + STATEFUL_DATA_TESTS: ${{ steps.matrix-conditionals.outputs.STATEFUL_DATA_TESTS }} steps: - # use cli rather than event context to avoid race conditions (label added after push) + # use api rather than event context to avoid race conditions (label added after push) - id: matrix-conditionals - run: | - if [[ ${{ github.event_name }} == 'pull_request' ]]; then - echo "DEFAULT_TESTS=true" >> $GITHUB_OUTPUT - labels=$(gh pr view -R ${{github.repository}} ${{github.event.pull_request.number}} --json labels -q '.labels[].name') - if [[ "$labels" == *"UPGRADE_TESTS"* ]]; then - echo "UPGRADE_TESTS=true" >> $GITHUB_OUTPUT - fi - - if [[ "$labels" == *"UPGRADE_LIGHT_TESTS"* ]]; then - echo "UPGRADE_LIGHT_TESTS=true" >> $GITHUB_OUTPUT - fi - - if [[ "$labels" == *"ADMIN_TESTS"* ]]; then - echo "ADMIN_TESTS=true" >> $GITHUB_OUTPUT - fi - elif [[ ${{ github.event_name }} == 'merge_group' ]]; then - echo "DEFAULT_TESTS=true" >> $GITHUB_OUTPUT - elif [[ ${{ github.event_name }} == 'push' && ${{ github.ref }} == 'refs/heads/develop' ]]; then - echo "DEFAULT_TESTS=true" >> $GITHUB_OUTPUT - elif [[ ${{ github.event_name }} == 'schedule' ]]; then - echo "UPGRADE_TESTS=true" >> $GITHUB_OUTPUT - echo "UPGRADE_LIGHT_TESTS=true" >> $GITHUB_OUTPUT - echo "ADMIN_TESTS=true" >> $GITHUB_OUTPUT - fi + uses: actions/github-script@v7 + with: + script: | + console.log(context); + if (context.eventName === 'pull_request') { + const { data: pr } = await github.rest.pulls.get({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: context.payload.pull_request.number, + }); + const labels = pr.labels.map(label => label.name); + console.log("labels:", labels); + core.setOutput('DEFAULT_TESTS', true); + core.setOutput('UPGRADE_TESTS', labels.includes('UPGRADE_TESTS')); + core.setOutput('UPGRADE_LIGHT_TESTS', labels.includes('UPGRADE_LIGHT_TESTS')); + core.setOutput('UPGRADE_IMPORT_MAINNET_TESTS', labels.includes('UPGRADE_IMPORT_MAINNET_TESTS')); + core.setOutput('ADMIN_TESTS', labels.includes('ADMIN_TESTS')); + core.setOutput('PERFORMANCE_TESTS', labels.includes('PERFORMANCE_TESTS')); + core.setOutput('STATEFUL_DATA_TESTS', labels.includes('STATEFUL_DATA_TESTS')); + } else if (context.eventName === 'merge_group') { + core.setOutput('DEFAULT_TESTS', true); + } else if (context.eventName === 'push' && context.ref === 'refs/heads/develop') { + core.setOutput('DEFAULT_TESTS', true); + } else if (context.eventName === 'push' && context.ref.startsWith('refs/heads/release/')) { + core.setOutput('DEFAULT_TESTS', true); + core.setOutput('UPGRADE_TESTS', true); + core.setOutput('UPGRADE_LIGHT_TESTS', true); + core.setOutput('UPGRADE_IMPORT_MAINNET_TESTS', true); + core.setOutput('ADMIN_TESTS', true); + core.setOutput('PERFORMANCE_TESTS', true); + core.setOutput('STATEFUL_DATA_TESTS', true); + } else if (context.eventName === 'schedule') { + core.setOutput('DEFAULT_TESTS', true); + core.setOutput('UPGRADE_TESTS', true); + core.setOutput('UPGRADE_LIGHT_TESTS', true); + core.setOutput('UPGRADE_IMPORT_MAINNET_TESTS', true); + core.setOutput('ADMIN_TESTS', true); + core.setOutput('PERFORMANCE_TESTS', true); + core.setOutput('STATEFUL_DATA_TESTS', true); + } else if (context.eventName === 'workflow_dispatch') { + core.setOutput('DEFAULT_TESTS', context.payload.inputs['default-test']); + core.setOutput('UPGRADE_TESTS', context.payload.inputs['upgrade-test']); + core.setOutput('UPGRADE_LIGHT_TESTS', context.payload.inputs['upgrade-light-test']); + core.setOutput('UPGRADE_IMPORT_MAINNET_TESTS', context.payload.inputs['upgrade-import-mainnet-test']); + core.setOutput('ADMIN_TESTS', context.payload.inputs['admin-test']); + core.setOutput('PERFORMANCE_TESTS', context.payload.inputs['performance-test']); + core.setOutput('STATEFUL_DATA_TESTS', context.payload.inputs['stateful-data-test']); + } e2e: needs: matrix-conditionals @@ -71,9 +128,18 @@ jobs: - make-target: "start-upgrade-test-light" runs-on: ubuntu-20.04 run: ${{ needs.matrix-conditionals.outputs.UPGRADE_LIGHT_TESTS == 'true' }} + - make-target: "start-upgrade-import-mainnet-test" + runs-on: buildjet-16vcpu-ubuntu-2204 + run: ${{ needs.matrix-conditionals.outputs.UPGRADE_IMPORT_MAINNET_TESTS == 'true' }} - make-target: "start-e2e-admin-test" runs-on: ubuntu-20.04 run: ${{ needs.matrix-conditionals.outputs.ADMIN_TESTS == 'true' }} + - make-target: "start-e2e-performance-test" + runs-on: buildjet-4vcpu-ubuntu-2204 + run: ${{ needs.matrix-conditionals.outputs.PERFORMANCE_TESTS == 'true' }} + - make-target: "start-e2e-import-mainnet-test" + runs-on: buildjet-16vcpu-ubuntu-2204 + run: ${{ needs.matrix-conditionals.outputs.STATEFUL_DATA_TESTS == 'true' }} name: ${{ matrix.make-target }} uses: ./.github/workflows/reusable-e2e.yml with: @@ -84,7 +150,9 @@ jobs: # this allows you to set a required status check e2e-ok: runs-on: ubuntu-22.04 - needs: e2e + needs: + - matrix-conditionals + - e2e if: always() steps: - run: | diff --git a/.github/workflows/execute_advanced_tests.yaml b/.github/workflows/execute_advanced_tests.yaml deleted file mode 100644 index e8a4683812..0000000000 --- a/.github/workflows/execute_advanced_tests.yaml +++ /dev/null @@ -1,119 +0,0 @@ -name: "TESTING:ADVANCED:E2E" - -on: - workflow_dispatch: - inputs: - e2e-stateful-upgrade-test: - type: boolean - required: false - default: false - e2e-performance-test: - type: boolean - required: false - default: false - e2e-stateful-data-test: - type: boolean - required: false - default: false - debug: - type: boolean - required: false - default: false - schedule: - # run at 6AM UTC Daily - # 6AM UTC -> 11PM PT - - cron: "0 6 * * *" - -jobs: - e2e-stateful-upgrade-test: - if: ${{ github.event.inputs.e2e-stateful-upgrade-test == 'true' || github.event_name == 'schedule' }} - runs-on: buildjet-16vcpu-ubuntu-2204 - timeout-minutes: 120 - steps: - - name: "Checkout Code" - uses: actions/checkout@v4 - - - name: Start Test - run: make start-upgrade-import-mainnet-test - - - name: Watch Test - run: | - container_id=$(docker ps --filter "ancestor=orchestrator:latest" --format "{{.ID}}") - docker logs -f "${container_id}" & - exit $(docker wait "${container_id}") - - - name: Full Log Dump On Failure - if: failure() - run: | - make stop-localnet - - - name: Notify Slack on Failure - if: failure() && github.event_name == 'schedule' - uses: 8398a7/action-slack@v3 - with: - status: ${{ job.status }} - fields: repo,message,commit,author,action,eventName,ref,workflow,job,took - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_CI_ALERTS }} - - e2e-performance-test: - if: ${{ github.event.inputs.e2e-performance-test == 'true' }} - runs-on: buildjet-4vcpu-ubuntu-2204 - timeout-minutes: 120 - steps: - - name: "Checkout Code" - uses: actions/checkout@v4 - - - name: Start Test - run: make start-e2e-performance-test - - - name: Watch Test - run: | - container_id=$(docker ps --filter "ancestor=orchestrator:latest" --format "{{.ID}}") - docker logs -f "${container_id}" & - exit $(docker wait "${container_id}") - - - name: Full Log Dump On Failure - if: failure() - run: | - make stop-localnet - - - name: Notify Slack on Failure - if: failure() && github.event_name == 'schedule' - uses: 8398a7/action-slack@v3 - with: - status: ${{ job.status }} - fields: repo,message,commit,author,action,eventName,ref,workflow,job,took - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_CI_ALERTS }} - - e2e-stateful-data-test: - if: ${{ github.event.inputs.e2e-stateful-data-test == 'true' || github.event_name == 'schedule' }} - runs-on: buildjet-16vcpu-ubuntu-2204 - timeout-minutes: 120 - steps: - - name: "Checkout Code" - uses: actions/checkout@v4 - - - name: Start Test - run: make start-e2e-import-mainnet-test - - - name: Watch Test - run: | - container_id=$(docker ps --filter "ancestor=orchestrator:latest" --format "{{.ID}}") - docker logs -f "${container_id}" & - exit $(docker wait "${container_id}") - - - name: Full Log Dump On Failure - if: failure() - run: | - make stop-localnet - - - name: Notify Slack on Failure - if: failure() && github.event_name == 'schedule' - uses: 8398a7/action-slack@v3 - with: - status: ${{ job.status }} - fields: repo,message,commit,author,action,eventName,ref,workflow,job,took - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_CI_ALERTS }} \ No newline at end of file diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 44e3fa0538..ff454a4032 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -11,7 +11,7 @@ on: type: boolean required: false default: false - description: 'Use this to skip: gosec, gosec-cosmos, check-changelog, check-upgrade-uandler-updated, build-test, smoke-test and go straight to approval step.' + description: 'Use this to skip: check-changelog and check-upgrade-handler-updated go straight to approval step.' skip_release: type: boolean required: false @@ -31,99 +31,6 @@ jobs: run: | echo "${{ github.ref }}" - gosec: - needs: - - check_branch - runs-on: ubuntu-22.04 - env: - GO111MODULE: on - steps: - - name: Checkout Source - if: ${{ github.event.inputs.skip_checks != 'true' }} - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Set up Go - if: ${{ github.event.inputs.skip_checks != 'true' }} - uses: actions/setup-go@v5 - with: - go-version: '1.22' - - - name: Run Gosec Security Scanner - if: ${{ github.event.inputs.skip_checks != 'true' }} - uses: securego/gosec@v2.19.0 - with: - args: ./... - - - name: Mark Job Complete Skipped - if: ${{ github.event.inputs.skip_checks == 'true' }} - shell: bash - run: | - echo "continue" - - gosec-cosmos: - needs: - - check_branch - runs-on: ubuntu-22.04 - env: - GO111MODULE: on - steps: - - name: Checkout Source - if: ${{ github.event.inputs.skip_checks != 'true' }} - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Set up Go - if: ${{ github.event.inputs.skip_checks != 'true' }} - uses: actions/setup-go@v5 - with: - go-version: '1.22' - - - name: Run Cosmos Gosec Security Scanner - if: ${{ github.event.inputs.skip_checks != 'true' }} - run: make lint-cosmos-gosec - - - name: Mark Job Complete Skipped - if: ${{ github.event.inputs.skip_checks == 'true' }} - shell: bash - run: | - echo "continue" - - lint: - needs: - - check_branch - runs-on: ubuntu-22.04 - timeout-minutes: 15 - env: - GO111MODULE: on - steps: - - name: Checkout Source - if: ${{ github.event.inputs.skip_checks != 'true' }} - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Set up Go - if: ${{ github.event.inputs.skip_checks != 'true' }} - uses: actions/setup-go@v5 - with: - go-version: '1.22' - - - name: Run golangci-lint - if: ${{ github.event.inputs.skip_checks != 'true' }} - uses: golangci/golangci-lint-action@v6 - with: - version: v1.59 - skip-cache: true - - - name: Mark Job Complete Skipped - if: ${{ github.event.inputs.skip_checks == 'true' }} - shell: bash - run: | - echo "continue" - check-changelog: needs: - check_branch @@ -198,232 +105,6 @@ jobs: run: | echo "continue" - build-test: - needs: - - check_branch - runs-on: ubuntu-22.04 - timeout-minutes: 15 - concurrency: - group: "build-test" - steps: - - name: "Checkout Code" - if: ${{ github.event.inputs.skip_checks != 'true' }} - uses: actions/checkout@v4 - - - name: Set CPU Architecture - if: ${{ github.event.inputs.skip_checks != 'true' }} - shell: bash - run: | - if [ "$(uname -m)" == "aarch64" ]; then - echo "CPU_ARCH=arm64" >> $GITHUB_ENV - elif [ "$(uname -m)" == "x86_64" ]; then - echo "CPU_ARCH=amd64" >> $GITHUB_ENV - else - echo "Unsupported architecture" >&2 - exit 1 - fi - - - name: Install Pipeline Dependencies - if: ${{ github.event.inputs.skip_checks != 'true' }} - uses: ./.github/actions/install-dependencies - timeout-minutes: 8 - with: - cpu_architecture: ${{ env.CPU_ARCH }} - skip_python: "true" - skip_aws_cli: "true" - skip_docker_compose: "false" - - - name: Test - if: ${{ github.event.inputs.skip_checks != 'true' }} - uses: nick-fields/retry@v2 - with: - timeout_minutes: 20 - max_attempts: 2 - retry_on: error - command: | - echo "Running Build Tests" - make clean - make test-coverage - - - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@v4.0.1 - with: - file: coverage.out - token: ${{ secrets.CODECOV_TOKEN }} - slug: zeta-chain/node - - - name: Build zetacored and zetaclientd - if: ${{ github.event.inputs.skip_checks != 'true' }} - env: - CGO_ENABLED: 1 - GOOS: linux - GOARCH: ${{ env.CPU_ARCH }} - run: | - make install - cp "$HOME"/go/bin/* ./ - chmod a+x ./zetacored - ./zetacored version - - - name: Clean Up Workspace - if: always() - shell: bash - run: rm -rf * - - - name: Mark Job Complete Skipped - if: ${{ github.event.inputs.skip_checks == 'true' }} - shell: bash - run: | - echo "continue" - - smoke-test: - needs: - - check_branch - runs-on: ubuntu-22.04 - timeout-minutes: 25 - steps: - - name: "Checkout Code" - if: ${{ github.event.inputs.skip_checks != 'true' }} - uses: actions/checkout@v4 - - - name: Set CPU Architecture - if: ${{ github.event.inputs.skip_checks != 'true' }} - shell: bash - run: | - if [ "$(uname -m)" == "aarch64" ]; then - echo "CPU_ARCH=arm64" >> $GITHUB_ENV - elif [ "$(uname -m)" == "x86_64" ]; then - echo "CPU_ARCH=amd64" >> $GITHUB_ENV - else - echo "Unsupported architecture" >&2 - exit 1 - fi - - - name: Install Pipeline Dependencies - if: ${{ github.event.inputs.skip_checks != 'true' }} - uses: ./.github/actions/install-dependencies - timeout-minutes: 8 - with: - cpu_architecture: ${{ env.CPU_ARCH }} - skip_python: "false" - skip_aws_cli: "true" - skip_docker_compose: "false" - - - name: Login to Docker Hub - uses: docker/login-action@v2 - if: ${{ github.event.repository.full_name == 'zetachain-chain/node' && github.event.inputs.skip_checks != 'true' }} - with: - username: ${{ secrets.DOCKER_HUB_USERNAME }} - password: ${{ secrets.DOCKER_HUB_READ_ONLY }} - - - name: Build zetanode - if: ${{ github.event.inputs.skip_checks != 'true' }} - run: | - make zetanode - - - name: Start Private Network - if: ${{ github.event.inputs.skip_checks != 'true' }} - run: | - cd contrib/localnet/ - docker compose up -d zetacore0 zetacore1 zetaclient0 zetaclient1 eth bitcoin - - - name: Run Smoke Test - if: ${{ github.event.inputs.skip_checks != 'true' }} - run: | - cd contrib/localnet - docker-compose up orchestrator --exit-code-from orchestrator - if [ $? -ne 0 ]; then - echo "Smoke Test Failed" - exit 1 - fi - - - name: Stop Private Network - if: ${{ always() && github.event.inputs.skip_checks != 'true' }} - run: | - make stop-localnet - - - name: Clean Up Workspace - if: always() - shell: bash - run: sudo rm -rf * - - - name: Mark Job Complete Skipped - if: ${{ github.event.inputs.skip_checks == 'true' }} - shell: bash - run: | - echo "continue" - - e2e-admin-tests: - needs: - - check_branch - runs-on: ubuntu-22.04 - timeout-minutes: 120 - steps: - - name: "Checkout Code" - if: ${{ github.event.inputs.skip_checks != 'true' }} - uses: actions/checkout@v4 - - - name: Execute e2e-admin-tests - if: ${{ github.event.inputs.skip_checks != 'true' }} - shell: bash - run: | - make start-e2e-admin-test - container_id=$(docker ps --filter "ancestor=orchestrator:latest" --format "{{.ID}}") - docker logs -f "${container_id}" & exit $(docker wait "${container_id}") - - - name: Mark Job Complete Skipped - if: ${{ github.event.inputs.skip_checks == 'true' }} - shell: bash - run: | - echo "continue" - - e2e-upgrade-test: - needs: - - check_branch - runs-on: buildjet-16vcpu-ubuntu-2204 - timeout-minutes: 120 - steps: - - name: "Checkout Code" - if: ${{ github.event.inputs.skip_checks != 'true' }} - uses: actions/checkout@v4 - - - name: Execute upgrade-test - if: ${{ github.event.inputs.skip_checks != 'true' }} - shell: bash - run: | - make start-upgrade-import-mainnet-test - container_id=$(docker ps --filter "ancestor=orchestrator:latest" --format "{{.ID}}") - docker logs -f "${container_id}" & exit $(docker wait "${container_id}") - - - name: Mark Job Complete Skipped - if: ${{ github.event.inputs.skip_checks == 'true' }} - shell: bash - run: | - echo "continue" - - e2e-stateful-data-test: - needs: - - check_branch - runs-on: buildjet-16vcpu-ubuntu-2204 - timeout-minutes: 120 - steps: - - name: "Checkout Code" - if: ${{ github.event.inputs.skip_checks != 'true' }} - uses: actions/checkout@v3 - - - name: Execute stateful-data-test - if: ${{ github.event.inputs.skip_checks != 'true' }} - shell: bash - run: | - make start-e2e-import-mainnet-test - container_id=$(docker ps --filter "ancestor=orchestrator:latest" --format "{{.ID}}") - docker logs -f "${container_id}" & exit $(docker wait "${container_id}") - - - name: Mark Job Complete Skipped - if: ${{ github.event.inputs.skip_checks == 'true' }} - shell: bash - run: | - echo "continue" - publish-release: permissions: id-token: write @@ -431,16 +112,8 @@ jobs: attestations: write if: ${{ github.event.inputs.skip_release == 'false' }} needs: - - gosec - - gosec-cosmos - - lint - check-changelog - check-upgrade-handler-updated - - smoke-test - - build-test - - e2e-admin-tests - - e2e-stateful-data-test - - e2e-upgrade-test - check_branch runs-on: ubuntu-22.04 timeout-minutes: 60 diff --git a/.github/workflows/reusable-e2e.yml b/.github/workflows/reusable-e2e.yml index 2bc75efcfb..d67f53db0e 100644 --- a/.github/workflows/reusable-e2e.yml +++ b/.github/workflows/reusable-e2e.yml @@ -101,7 +101,7 @@ jobs: path: /tmp/logs.txt - name: Notify Slack on Failure - if: failure() && ((github.event_name == 'push' && github.ref == 'refs/heads/develop') || github.event_name == 'schedule') + if: failure() && (github.event_name == 'push' || github.event_name == 'schedule') uses: 8398a7/action-slack@v3 with: status: ${{ job.status }} diff --git a/.github/workflows/sast-linters.yml b/.github/workflows/sast-linters.yml index 30a8ab1f33..270e9cffc6 100644 --- a/.github/workflows/sast-linters.yml +++ b/.github/workflows/sast-linters.yml @@ -1,13 +1,15 @@ name: Linters and SAST on: push: + branches: + - develop + - release/* tags: - "*" merge_group: pull_request: types: - opened - - edited - synchronize concurrency: diff --git a/readme.md b/readme.md index 3bc4c33d1a..3f00b4b7f5 100644 --- a/readme.md +++ b/readme.md @@ -5,7 +5,7 @@ smart contracts and messaging between any blockchain. ## Prerequisites -- [Go](https://golang.org/doc/install) 1.20 +- [Go](https://golang.org/doc/install) 1.22 - [Docker](https://docs.docker.com/install/) and [Docker Compose](https://docs.docker.com/compose/install/) (optional, for running tests locally)