Skip to content

Commit

Permalink
use the ZEVM address decoded from memo as Receiver in MsgVoteInbound
Browse files Browse the repository at this point in the history
  • Loading branch information
ws4charlie committed Dec 4, 2024
1 parent a8236ed commit 87c4792
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions e2e/e2etests/test_solana_deposit.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ func TestSolanaDeposit(r *runner.E2ERunner, args []string) {
cctx := utils.WaitCctxMinedByInboundHash(r.Ctx, sig.String(), r.CctxClient, r.Logger, r.CctxTimeout)
r.Logger.CCTX(*cctx, "solana_deposit")
utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_OutboundMined)
require.Equal(r, cctx.GetCurrentOutboundParam().Receiver, r.EVMAddress().Hex())

// get ERC20 SOL balance after deposit
balanceAfter, err := r.SOLZRC20.BalanceOf(&bind.CallOpts{}, r.EVMAddress())
Expand Down
1 change: 1 addition & 0 deletions e2e/e2etests/test_solana_deposit_call.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ func TestSolanaDepositAndCall(r *runner.E2ERunner, args []string) {
cctx := utils.WaitCctxMinedByInboundHash(r.Ctx, sig.String(), r.CctxClient, r.Logger, r.CctxTimeout)
r.Logger.CCTX(*cctx, "solana_deposit_and_call")
utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_OutboundMined)
require.Equal(r, cctx.GetCurrentOutboundParam().Receiver, contractAddr.Hex())

// check if example contract has been called, bar value should be set to amount
utils.MustHaveCalledExampleContract(r, contract, depositAmount)
Expand Down
1 change: 1 addition & 0 deletions e2e/e2etests/test_spl_deposit.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ func TestSPLDeposit(r *runner.E2ERunner, args []string) {
cctx := utils.WaitCctxMinedByInboundHash(r.Ctx, sig.String(), r.CctxClient, r.Logger, r.CctxTimeout)
r.Logger.CCTX(*cctx, "solana_deposit_spl")
utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_OutboundMined)
require.Equal(r, cctx.GetCurrentOutboundParam().Receiver, r.EVMAddress().Hex())

// verify balances are updated
pdaBalanceAfter, err := r.SolanaClient.GetTokenAccountBalance(r.Ctx, pdaAta, rpc.CommitmentFinalized)
Expand Down
1 change: 1 addition & 0 deletions e2e/e2etests/test_spl_deposit_and_call.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ func TestSPLDepositAndCall(r *runner.E2ERunner, args []string) {
cctx := utils.WaitCctxMinedByInboundHash(r.Ctx, sig.String(), r.CctxClient, r.Logger, r.CctxTimeout)
r.Logger.CCTX(*cctx, "solana_deposit_spl_and_call")
utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_OutboundMined)
require.Equal(r, cctx.GetCurrentOutboundParam().Receiver, contractAddr.Hex())

// check if example contract has been called, bar value should be set to amount
utils.MustHaveCalledExampleContract(r, contract, big.NewInt(int64(amount)))
Expand Down
6 changes: 3 additions & 3 deletions zetaclient/chains/solana/observer/inbound.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ func (ob *Observer) FilterInboundEvents(txResult *rpc.GetTransactionResult) ([]*
events = append(events, &clienttypes.InboundEvent{
SenderChainID: ob.Chain().ChainId,
Sender: deposit.Sender,
Receiver: deposit.Sender, // receiver is pulled out from memo
Receiver: "", // receiver will be pulled out from memo later
TxOrigin: deposit.Sender,
Amount: deposit.Amount,
Memo: deposit.Memo,
Expand Down Expand Up @@ -240,7 +240,7 @@ func (ob *Observer) FilterInboundEvents(txResult *rpc.GetTransactionResult) ([]*
events = append(events, &clienttypes.InboundEvent{
SenderChainID: ob.Chain().ChainId,
Sender: deposit.Sender,
Receiver: deposit.Sender, // receiver is pulled out from memo
Receiver: "", // receiver will be pulled out from memo later
TxOrigin: deposit.Sender,
Amount: deposit.Amount,
Memo: deposit.Memo,
Expand Down Expand Up @@ -288,7 +288,7 @@ func (ob *Observer) BuildInboundVoteMsgFromEvent(event *clienttypes.InboundEvent
event.Sender,
event.SenderChainID,
event.Sender,
event.Sender,
event.Receiver,
ob.ZetacoreClient().Chain().ChainId,
cosmosmath.NewUint(event.Amount),
hex.EncodeToString(event.Memo),
Expand Down

0 comments on commit 87c4792

Please sign in to comment.