Skip to content

Commit

Permalink
fixed logs and resolved comments 1
Browse files Browse the repository at this point in the history
  • Loading branch information
kingpinXD committed Apr 19, 2024
1 parent 704e507 commit ca1c113
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 32 deletions.
10 changes: 5 additions & 5 deletions app/ante/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
"github.com/cosmos/cosmos-sdk/x/authz"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
tmlog "github.com/tendermint/tendermint/libs/log"
cctxtypes "github.com/zeta-chain/zetacore/x/crosschain/types"
crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types"
observertypes "github.com/zeta-chain/zetacore/x/observer/types"
)

Expand Down Expand Up @@ -168,10 +168,10 @@ func IsSystemTx(tx sdk.Tx, isAuthorizedSigner func(string) bool) bool {
}
}
switch innerMsg.(type) {
case *cctxtypes.MsgVoteGasPrice,
*cctxtypes.MsgVoteOnObservedInboundTx,
*cctxtypes.MsgVoteOnObservedOutboundTx,
*cctxtypes.MsgAddToOutTxTracker,
case *crosschaintypes.MsgVoteGasPrice,
*crosschaintypes.MsgVoteOnObservedInboundTx,
*crosschaintypes.MsgVoteOnObservedOutboundTx,
*crosschaintypes.MsgAddToOutTxTracker,
*observertypes.MsgVoteBlockHeader,
*observertypes.MsgVoteTSS,
*observertypes.MsgAddBlameVote:
Expand Down
6 changes: 2 additions & 4 deletions e2e/e2etests/test_eth_deposit.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ func TestEtherDepositAndCall(r *runner.E2ERunner, args []string) {
}
cctx := utils.WaitCctxMinedByInTxHash(r.Ctx, signedTx.Hash().Hex(), r.CctxClient, r.Logger, r.CctxTimeout)
if cctx.CctxStatus.Status != types.CctxStatus_OutboundMined {
r.Logger.Print(fmt.Sprintf("###### expected cctx status to be mined; got %s , %s", cctx.CctxStatus.Status, cctx.Index))
//panic(fmt.Sprintf("expected cctx status to be mined; got %s", cctx.CctxStatus.Status))
panic(fmt.Sprintf("expected cctx status to be mined; got %s", cctx.CctxStatus.Status))
}

// Checking example contract has been called, bar value should be set to amount
Expand Down Expand Up @@ -143,8 +142,7 @@ func TestEtherDepositAndCall(r *runner.E2ERunner, args []string) {

cctx = utils.WaitCctxMinedByInTxHash(r.Ctx, signedTx.Hash().Hex(), r.CctxClient, r.Logger, r.CctxTimeout)
if cctx.CctxStatus.Status != types.CctxStatus_Reverted {
//panic(fmt.Sprintf("expected cctx status to be reverted; got %s", cctx.CctxStatus.Status))
r.Logger.Print(fmt.Sprintf("##########################expected cctx status to be reverted; got %s", cctx.CctxStatus.Status))
panic(fmt.Sprintf("expected cctx status to be reverted; got %s", cctx.CctxStatus.Status))
}
r.Logger.Info("Cross-chain call to reverter reverted")

Expand Down
28 changes: 10 additions & 18 deletions e2e/e2etests/test_message_passing_zevm.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,14 @@ func TestMessagePassingEVMtoZEVM(r *runner.E2ERunner, args []string) {
destinationAddress := r.ZevmTestDAppAddr

// Contract call originates from EVM chain
auth := r.EVMAuth
tx, err := r.ZetaEth.Approve(auth, r.EvmTestDAppAddr, amount)
tx, err := r.ZetaEth.Approve(r.EVMAuth, r.EvmTestDAppAddr, amount)
if err != nil {
panic(err)
}
r.Logger.Info("Approve tx hash: %s", tx.Hash().Hex())
receipt := utils.MustWaitForTxReceipt(r.Ctx, r.EVMClient, tx, r.Logger, r.ReceiptTimeout)
if receipt.Status != 1 {
panic("tx failed")
panic("approve tx failed")
}
r.Logger.Info("Approve tx receipt: %d", receipt.Status)
testDAppEVM, err := testdapp.NewTestDApp(r.EvmTestDAppAddr, r.EVMClient)
Expand All @@ -45,7 +44,7 @@ func TestMessagePassingEVMtoZEVM(r *runner.E2ERunner, args []string) {
}
// 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 false which adds a message to signal the ZEVM zetaReceiver to not revert the transaction
tx, err = testDAppEVM.SendHelloWorld(auth, destinationAddress, zEVMChainID, amount, false)
tx, err = testDAppEVM.SendHelloWorld(r.EVMAuth, destinationAddress, zEVMChainID, amount, false)
if err != nil {
panic(err)
}
Expand Down Expand Up @@ -80,7 +79,7 @@ func TestMessagePassingEVMtoZEVM(r *runner.E2ERunner, args []string) {
}
}
if !receivedHelloWorldEvent {
panic("expected HelloWorld event")
panic(fmt.Sprintf("expected HelloWorld event, logs: %+v", receipt.Logs))
}
}

Expand All @@ -103,8 +102,7 @@ func TestMessagePassingEVMtoZEVMRevert(r *runner.E2ERunner, args []string) {
destinationAddress := r.ZevmTestDAppAddr

// Contract call originates from EVM chain
auth := r.EVMAuth
tx, err := r.ZetaEth.Approve(auth, r.EvmTestDAppAddr, amount)
tx, err := r.ZetaEth.Approve(r.EVMAuth, r.EvmTestDAppAddr, amount)
if err != nil {
panic(err)
}
Expand All @@ -120,7 +118,7 @@ func TestMessagePassingEVMtoZEVMRevert(r *runner.E2ERunner, args []string) {
}
// 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(auth, destinationAddress, zEVMChainID, amount, true)
tx, err = testDAppEVM.SendHelloWorld(r.EVMAuth, destinationAddress, zEVMChainID, amount, true)
if err != nil {
panic(err)
}
Expand All @@ -133,7 +131,6 @@ func TestMessagePassingEVMtoZEVMRevert(r *runner.E2ERunner, args []string) {
if cctx.CctxStatus.Status != cctxtypes.CctxStatus_Reverted {
panic("expected cctx to be reverted")
}
r.Logger.Print(fmt.Sprintf("🔄 Cctx mined for revert contract call chain zevm %s", cctx.Index))

// On finalization the Tss address calls the onRevert function which in turn calls the onZetaRevert function on the sender contract
receipt, err = r.EVMClient.TransactionReceipt(r.Ctx, ethcommon.HexToHash(cctx.GetCurrentOutTxParam().OutboundTxHash))
Expand All @@ -152,7 +149,7 @@ func TestMessagePassingEVMtoZEVMRevert(r *runner.E2ERunner, args []string) {
}
}
if !receivedHelloWorldEvent {
panic("expected HelloWorld event")
panic(fmt.Sprintf("expected Reverted HelloWorld event, logs: %+v", receipt.Logs))
}
}

Expand Down Expand Up @@ -216,7 +213,6 @@ func TestMessagePassingZEVMtoEVM(r *runner.E2ERunner, args []string) {
if cctx.CctxStatus.Status != cctxtypes.CctxStatus_OutboundMined {
panic("expected cctx to be outbound_mined")
}
r.Logger.Print(fmt.Sprintf("🔄 Cctx mined for contract call chain zevm %s", cctx.Index))

// On finalization the Tss calls the onReceive function which in turn calls the onZetaMessage function on the destination contract.
receipt, err = r.EVMClient.TransactionReceipt(r.Ctx, ethcommon.HexToHash(cctx.GetCurrentOutTxParam().OutboundTxHash))
Expand All @@ -239,7 +235,7 @@ func TestMessagePassingZEVMtoEVM(r *runner.E2ERunner, args []string) {
}
}
if !receivedHelloWorldEvent {
panic("expected HelloWorld event")
panic(fmt.Sprintf("expected HelloWorld event, logs: %+v", receipt.Logs))
}
}

Expand Down Expand Up @@ -293,7 +289,7 @@ func TestMessagePassingZEVMtoEVMRevert(r *runner.E2ERunner, args []string) {
if err != nil {
panic(err)
}
r.Logger.Print("TestDApp ZEVM address: %s", r.ZevmTestDAppAddr.String())

r.Logger.Info("TestDApp.SendHello tx hash: %s", tx.Hash().Hex())
receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout)
if receipt.Status == 0 {
Expand All @@ -305,7 +301,6 @@ func TestMessagePassingZEVMtoEVMRevert(r *runner.E2ERunner, args []string) {
if cctx.CctxStatus.Status != cctxtypes.CctxStatus_Reverted {
panic("expected cctx to be reverted")
}
r.Logger.Print(fmt.Sprintf("🔄 Cctx mined for contract call chain zevm %s", cctx.Index))

// On finalization the Fungible module calls the onRevert function which in turn calls the onZetaRevert function on the sender contract
receipt, err = r.ZEVMClient.TransactionReceipt(r.Ctx, ethcommon.HexToHash(cctx.GetCurrentOutTxParam().OutboundTxHash))
Expand All @@ -324,9 +319,6 @@ func TestMessagePassingZEVMtoEVMRevert(r *runner.E2ERunner, args []string) {
}
}
if !receivedHelloWorldEvent {
panic("expected HelloWorld event")
panic(fmt.Sprintf("expected Reverted HelloWorld event, logs: %+v", receipt.Logs))
}
}

// bgGCGUux3roBhJr9PgNaC3DOfLBp5ILuZjUZx2z1abQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQ==
// bgGCGUux3roBhJr9PgNaC3DOfLBp5ILuZjUZx2z1abQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQ==
2 changes: 1 addition & 1 deletion x/crosschain/keeper/cctx.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func (k Keeper) SetCctxAndNonceToCctxAndInTxHashToCctx(ctx sdk.Context, cctx typ
}

k.SetCrossChainTx(ctx, cctx)
//set mapping inTxHash -> cctxIndex
// set mapping inTxHash -> cctxIndex
in, _ := k.GetInTxHashToCctx(ctx, cctx.InboundTxParams.InboundTxObservedHash)
in.InTxHash = cctx.InboundTxParams.InboundTxObservedHash
found = false
Expand Down
8 changes: 4 additions & 4 deletions x/fungible/keeper/evm.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ func (k Keeper) DepositZRC20AndCallContract(ctx sdk.Context,
// The onReceive function will then wrap this native zeta into WZETA and call the onReceive function of the destination contract specified by the destinationAddress
func (k Keeper) CallOnReceiveZevmConnector(ctx sdk.Context,
zetaTxSenderAddress []byte,
sourceChainId *big.Int,
sourceChainID *big.Int,
destinationAddress ethcommon.Address,
zetaValue *big.Int,
message []byte,
Expand Down Expand Up @@ -347,7 +347,7 @@ func (k Keeper) CallOnReceiveZevmConnector(ctx sdk.Context,
false,
"onReceive",
zetaTxSenderAddress,
sourceChainId,
sourceChainID,
destinationAddress,
zetaValue,
message,
Expand All @@ -361,7 +361,7 @@ func (k Keeper) CallOnReceiveZevmConnector(ctx sdk.Context,
// Note the destination address is the original destination address of the transaction and not the current destination .
func (k Keeper) CallOnRevertZevmConnector(ctx sdk.Context,
zetaTxSenderAddress ethcommon.Address,
sourceChainId *big.Int,
sourceChainID *big.Int,
destinationAddress []byte,
destinationChainID *big.Int,
remainingZetaValue *big.Int,
Expand Down Expand Up @@ -393,7 +393,7 @@ func (k Keeper) CallOnRevertZevmConnector(ctx sdk.Context,
false,
"onRevert",
zetaTxSenderAddress,
sourceChainId,
sourceChainID,
destinationAddress,
destinationChainID,
remainingZetaValue,
Expand Down

0 comments on commit ca1c113

Please sign in to comment.