Skip to content

Commit

Permalink
update tests fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
skosito committed Sep 26, 2024
1 parent e8b32f2 commit b889c2f
Show file tree
Hide file tree
Showing 31 changed files with 458 additions and 333 deletions.
8 changes: 6 additions & 2 deletions docs/openapi/openapi.swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57281,8 +57281,10 @@ definitions:
tss_nonce:
type: string
format: uint64
call_options:
$ref: '#/definitions/crosschainCallOptions'
gas_limit:
type: string
format: uint64
title: Deprecated (v21), use CallOptions
gas_price:
type: string
gas_priority_fee:
Expand All @@ -57309,6 +57311,8 @@ definitions:
type: string
tx_finalization_status:
$ref: '#/definitions/crosschainTxFinalizationStatus'
call_options:
$ref: '#/definitions/crosschainCallOptions'
crosschainOutboundTracker:
type: object
properties:
Expand Down
3 changes: 2 additions & 1 deletion docs/spec/crosschain/messages.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,14 @@ message MsgVoteInbound {
string message = 8;
string inbound_hash = 9;
uint64 inbound_block_height = 10;
CallOptions call_options = 11;
uint64 gas_limit = 11;
pkg.coin.CoinType coin_type = 12;
string tx_origin = 13;
string asset = 14;
uint64 event_index = 15;
ProtocolContractVersion protocol_contract_version = 16;
RevertOptions revert_options = 17;
CallOptions call_options = 18;
}
```

Expand Down
3 changes: 2 additions & 1 deletion e2e/runner/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ func (l *Logger) CCTX(cctx crosschaintypes.CrossChainTx, name string) {
l.Info(" TxHeight: %d", outTxParam.ObservedExternalHeight)
l.Info(" BallotIndex: %s", outTxParam.BallotIndex)
l.Info(" TSSNonce: %d", outTxParam.TssNonce)
l.Info(" GasLimit: %d", outTxParam.CallOptions.GasLimit)
l.Info(" CallOptions: %+v", outTxParam.CallOptions)
l.Info(" GasLimit: %d", outTxParam.GasLimit)
l.Info(" GasPrice: %s", outTxParam.GasPrice)
l.Info(" GasUsed: %d", outTxParam.GasUsed)
l.Info(" EffectiveGasPrice: %s", outTxParam.EffectiveGasPrice.String())
Expand Down
5 changes: 4 additions & 1 deletion proto/zetachain/zetacore/crosschain/cross_chain_tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ message OutboundParams {
(gogoproto.nullable) = false
];
uint64 tss_nonce = 5;
CallOptions call_options = 6 [ (gogoproto.nullable) = false ];
// Deprecated (v21), use CallOptions
uint64 gas_limit = 6;
string gas_price = 7;
string gas_priority_fee = 23;
// the above are commands for zetaclients
Expand All @@ -85,6 +86,8 @@ message OutboundParams {
string tss_pubkey = 11;
TxFinalizationStatus tx_finalization_status = 12;

CallOptions call_options = 24;

// not used. do not edit.
reserved 13 to 19;
}
Expand Down
5 changes: 4 additions & 1 deletion proto/zetachain/zetacore/crosschain/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ message MsgVoteInbound {
string message = 8;
string inbound_hash = 9;
uint64 inbound_block_height = 10;
CallOptions call_options = 11 [ (gogoproto.nullable) = false ];
// Deprecated (v21), use CallOptions
uint64 gas_limit = 11;
pkg.coin.CoinType coin_type = 12;
string tx_origin = 13;
string asset = 14;
Expand All @@ -175,6 +176,8 @@ message MsgVoteInbound {

// revert options provided by the sender
RevertOptions revert_options = 17 [ (gogoproto.nullable) = false ];

CallOptions call_options = 18;
}

message MsgVoteInboundResponse {}
Expand Down
6 changes: 3 additions & 3 deletions testutil/sample/crosschain.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ func OutboundParams(r *rand.Rand) *types.OutboundParams {
CoinType: coin.CoinType(r.Intn(100)),
Amount: math.NewUint(uint64(r.Int63())),
TssNonce: r.Uint64(),
CallOptions: types.CallOptions{
CallOptions: &types.CallOptions{
GasLimit: r.Uint64(),
},
GasPrice: math.NewUint(uint64(r.Int63())).String(),
Expand All @@ -171,7 +171,7 @@ func OutboundParamsValidChainID(r *rand.Rand) *types.OutboundParams {
ReceiverChainId: chains.Goerli.ChainId,
Amount: math.NewUint(uint64(r.Int63())),
TssNonce: r.Uint64(),
CallOptions: types.CallOptions{
CallOptions: &types.CallOptions{
GasLimit: r.Uint64(),
},
GasPrice: math.NewUint(uint64(r.Int63())).String(),
Expand Down Expand Up @@ -283,7 +283,7 @@ func InboundVote(coinType coin.CoinType, from, to int64) types.MsgVoteInbound {
Amount: UintInRange(10000000, 1000000000),
Message: base64.StdEncoding.EncodeToString(Bytes()),
InboundBlockHeight: Uint64InRange(1, 10000),
CallOptions: types.CallOptions{
CallOptions: &types.CallOptions{
GasLimit: 1000000000,
},
InboundHash: Hash().String(),
Expand Down
11 changes: 9 additions & 2 deletions typescript/zetachain/zetacore/crosschain/cross_chain_tx_pb.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,11 @@ export declare class OutboundParams extends Message<OutboundParams> {
tssNonce: bigint;

/**
* @generated from field: zetachain.zetacore.crosschain.CallOptions call_options = 6;
* Deprecated (v21), use CallOptions
*
* @generated from field: uint64 gas_limit = 6;
*/
callOptions?: CallOptions;
gasLimit: bigint;

/**
* @generated from field: string gas_price = 7;
Expand Down Expand Up @@ -323,6 +325,11 @@ export declare class OutboundParams extends Message<OutboundParams> {
*/
txFinalizationStatus: TxFinalizationStatus;

/**
* @generated from field: zetachain.zetacore.crosschain.CallOptions call_options = 24;
*/
callOptions?: CallOptions;

constructor(data?: PartialMessage<OutboundParams>);

static readonly runtime: typeof proto3;
Expand Down
11 changes: 9 additions & 2 deletions typescript/zetachain/zetacore/crosschain/tx_pb.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -616,9 +616,11 @@ export declare class MsgVoteInbound extends Message<MsgVoteInbound> {
inboundBlockHeight: bigint;

/**
* @generated from field: zetachain.zetacore.crosschain.CallOptions call_options = 11;
* Deprecated (v21), use CallOptions
*
* @generated from field: uint64 gas_limit = 11;
*/
callOptions?: CallOptions;
gasLimit: bigint;

/**
* @generated from field: zetachain.zetacore.pkg.coin.CoinType coin_type = 12;
Expand Down Expand Up @@ -656,6 +658,11 @@ export declare class MsgVoteInbound extends Message<MsgVoteInbound> {
*/
revertOptions?: RevertOptions;

/**
* @generated from field: zetachain.zetacore.crosschain.CallOptions call_options = 18;
*/
callOptions?: CallOptions;

constructor(data?: PartialMessage<MsgVoteInbound>);

static readonly runtime: typeof proto3;
Expand Down
18 changes: 9 additions & 9 deletions x/crosschain/keeper/abci_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ func TestCheckAndUpdateCctxGasPrice(t *testing.T) {
OutboundParams: []*types.OutboundParams{
{
ReceiverChainId: 42,
CallOptions: types.CallOptions{
CallOptions: &types.CallOptions{
GasLimit: 1000,
},
GasPrice: "100",
Expand All @@ -161,7 +161,7 @@ func TestCheckAndUpdateCctxGasPrice(t *testing.T) {
OutboundParams: []*types.OutboundParams{
{
ReceiverChainId: 42,
CallOptions: types.CallOptions{
CallOptions: &types.CallOptions{
GasLimit: 1000,
},
GasPrice: "100",
Expand Down Expand Up @@ -192,7 +192,7 @@ func TestCheckAndUpdateCctxGasPrice(t *testing.T) {
OutboundParams: []*types.OutboundParams{
{
ReceiverChainId: 42,
CallOptions: types.CallOptions{
CallOptions: &types.CallOptions{
GasLimit: 1000,
},
GasPrice: "100",
Expand Down Expand Up @@ -223,7 +223,7 @@ func TestCheckAndUpdateCctxGasPrice(t *testing.T) {
OutboundParams: []*types.OutboundParams{
{
ReceiverChainId: 42,
CallOptions: types.CallOptions{
CallOptions: &types.CallOptions{
GasLimit: 1000,
},
GasPrice: "100",
Expand Down Expand Up @@ -253,7 +253,7 @@ func TestCheckAndUpdateCctxGasPrice(t *testing.T) {
OutboundParams: []*types.OutboundParams{
{
ReceiverChainId: 42,
CallOptions: types.CallOptions{
CallOptions: &types.CallOptions{
GasLimit: 100,
},
GasPrice: "",
Expand All @@ -278,7 +278,7 @@ func TestCheckAndUpdateCctxGasPrice(t *testing.T) {
OutboundParams: []*types.OutboundParams{
{
ReceiverChainId: 42,
CallOptions: types.CallOptions{
CallOptions: &types.CallOptions{
GasLimit: 0,
},
GasPrice: "100",
Expand All @@ -303,7 +303,7 @@ func TestCheckAndUpdateCctxGasPrice(t *testing.T) {
OutboundParams: []*types.OutboundParams{
{
ReceiverChainId: 42,
CallOptions: types.CallOptions{
CallOptions: &types.CallOptions{
GasLimit: 0,
},
GasPrice: "100",
Expand All @@ -328,7 +328,7 @@ func TestCheckAndUpdateCctxGasPrice(t *testing.T) {
OutboundParams: []*types.OutboundParams{
{
ReceiverChainId: 42,
CallOptions: types.CallOptions{
CallOptions: &types.CallOptions{
GasLimit: 1000,
},
GasPrice: "100",
Expand All @@ -352,7 +352,7 @@ func TestCheckAndUpdateCctxGasPrice(t *testing.T) {
OutboundParams: []*types.OutboundParams{
{
ReceiverChainId: 42,
CallOptions: types.CallOptions{
CallOptions: &types.CallOptions{
GasLimit: 1000,
},
GasPrice: "100",
Expand Down
10 changes: 5 additions & 5 deletions x/crosschain/keeper/cctx_orchestrator_validate_inbound_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func TestKeeper_ValidateInbound(t *testing.T) {
Message: message,
InboundHash: inboundHash.String(),
InboundBlockHeight: inboundBlockHeight,
CallOptions: types.CallOptions{
CallOptions: &types.CallOptions{
GasLimit: gasLimit,
},
CoinType: cointType,
Expand Down Expand Up @@ -138,7 +138,7 @@ func TestKeeper_ValidateInbound(t *testing.T) {
Message: message,
InboundHash: inboundHash.String(),
InboundBlockHeight: inboundBlockHeight,
CallOptions: types.CallOptions{
CallOptions: &types.CallOptions{
GasLimit: gasLimit,
},
CoinType: cointType,
Expand Down Expand Up @@ -207,7 +207,7 @@ func TestKeeper_ValidateInbound(t *testing.T) {
Message: message,
InboundHash: inboundHash.String(),
InboundBlockHeight: inboundBlockHeight,
CallOptions: types.CallOptions{
CallOptions: &types.CallOptions{
GasLimit: gasLimit,
},
CoinType: cointType,
Expand Down Expand Up @@ -273,7 +273,7 @@ func TestKeeper_ValidateInbound(t *testing.T) {
Message: message,
InboundHash: inboundHash.String(),
InboundBlockHeight: inboundBlockHeight,
CallOptions: types.CallOptions{
CallOptions: &types.CallOptions{
GasLimit: gasLimit,
},
CoinType: cointType,
Expand Down Expand Up @@ -337,7 +337,7 @@ func TestKeeper_ValidateInbound(t *testing.T) {
Message: message,
InboundHash: inboundHash.String(),
InboundBlockHeight: inboundBlockHeight,
CallOptions: types.CallOptions{
CallOptions: &types.CallOptions{
GasLimit: gasLimit,
},
CoinType: cointType,
Expand Down
2 changes: 1 addition & 1 deletion x/crosschain/keeper/cctx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func createNCctx(keeper *keeper.Keeper, ctx sdk.Context, n int, tssPubkey string
ReceiverChainId: int64(i),
Hash: fmt.Sprintf("%d", i),
TssNonce: uint64(i),
CallOptions: types.CallOptions{
CallOptions: &types.CallOptions{
GasLimit: uint64(i),
},
GasPrice: fmt.Sprintf("%d", i),
Expand Down
12 changes: 6 additions & 6 deletions x/crosschain/keeper/gas_payment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ func TestKeeper_PayGasNativeAndUpdateCctx(t *testing.T) {
{
ReceiverChainId: chains.ZetaChainPrivnet.ChainId,
CoinType: coin.CoinType_Gas,
CallOptions: types.CallOptions{},
CallOptions: &types.CallOptions{},
},
{
ReceiverChainId: chainID,
CallOptions: types.CallOptions{},
CallOptions: &types.CallOptions{},
},
},
}
Expand Down Expand Up @@ -478,7 +478,7 @@ func TestKeeper_PayGasInZetaAndUpdateCctx(t *testing.T) {
OutboundParams: []*types.OutboundParams{
{
ReceiverChainId: chainID,
CallOptions: types.CallOptions{
CallOptions: &types.CallOptions{
GasLimit: 1000,
},
},
Expand Down Expand Up @@ -516,7 +516,7 @@ func TestKeeper_PayGasInZetaAndUpdateCctx(t *testing.T) {
OutboundParams: []*types.OutboundParams{
{
ReceiverChainId: chainID,
CallOptions: types.CallOptions{
CallOptions: &types.CallOptions{
GasLimit: 1000,
},
},
Expand Down Expand Up @@ -588,7 +588,7 @@ func TestKeeper_PayGasInZetaAndUpdateCctx(t *testing.T) {
OutboundParams: []*types.OutboundParams{
{
ReceiverChainId: chainID,
CallOptions: types.CallOptions{
CallOptions: &types.CallOptions{
GasLimit: 1000,
},
},
Expand Down Expand Up @@ -624,7 +624,7 @@ func TestKeeper_PayGasInZetaAndUpdateCctx(t *testing.T) {
OutboundParams: []*types.OutboundParams{
{
ReceiverChainId: chainID,
CallOptions: types.CallOptions{
CallOptions: &types.CallOptions{
GasLimit: 1000,
},
},
Expand Down
4 changes: 2 additions & 2 deletions x/crosschain/keeper/msg_server_vote_inbound_tx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func TestKeeper_VoteInbound(t *testing.T) {
Amount: sdkmath.NewUintFromString("10000000"),
Message: "",
InboundBlockHeight: 1,
CallOptions: types.CallOptions{
CallOptions: &types.CallOptions{
GasLimit: 1000000000,
},
InboundHash: "0x7a900ef978743f91f57ca47c6d1a1add75df4d3531da17671e9cf149e1aefe0b",
Expand Down Expand Up @@ -155,7 +155,7 @@ func TestKeeper_VoteInbound(t *testing.T) {
Amount: sdkmath.NewUintFromString("10000000"),
Message: "",
InboundBlockHeight: 1,
CallOptions: types.CallOptions{
CallOptions: &types.CallOptions{
GasLimit: 1000000001, // <---- Change here
},
InboundHash: "0x7a900ef978743f91f57ca47c6d1a1add75df4d3531da17671e9cf149e1aefe0b",
Expand Down
Loading

0 comments on commit b889c2f

Please sign in to comment.