diff --git a/changelog.md b/changelog.md index 680f3695ce..7c90838f7f 100644 --- a/changelog.md +++ b/changelog.md @@ -20,6 +20,7 @@ * [3184](https://github.com/zeta-chain/node/pull/3184) - zetaclient should not retry if inbound vote message validation fails * [3230](https://github.com/zeta-chain/node/pull/3230) - update pending nonces when aborting a cctx through MsgAbortStuckCCTX * [3225](https://github.com/zeta-chain/node/pull/3225) - use separate database file names for btc signet and testnet4 +* [3242](https://github.com/zeta-chain/node/pull/3242) - set the `Receiver` of `MsgVoteInbound` to the address pulled from solana memo * [3253](https://github.com/zeta-chain/node/pull/3253) - fix solana inbound version 0 queries and move tss keysign prior to relayer key checking ## v23.0.0 diff --git a/e2e/e2etests/test_solana_deposit.go b/e2e/e2etests/test_solana_deposit.go index d46a56c015..eb238c8c58 100644 --- a/e2e/e2etests/test_solana_deposit.go +++ b/e2e/e2etests/test_solana_deposit.go @@ -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()) diff --git a/e2e/e2etests/test_solana_deposit_call.go b/e2e/e2etests/test_solana_deposit_call.go index 2692936a9e..7719b1c0a3 100644 --- a/e2e/e2etests/test_solana_deposit_call.go +++ b/e2e/e2etests/test_solana_deposit_call.go @@ -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) diff --git a/e2e/e2etests/test_spl_deposit.go b/e2e/e2etests/test_spl_deposit.go index e20ff5879a..7bf1ffa7a9 100644 --- a/e2e/e2etests/test_spl_deposit.go +++ b/e2e/e2etests/test_spl_deposit.go @@ -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) diff --git a/e2e/e2etests/test_spl_deposit_and_call.go b/e2e/e2etests/test_spl_deposit_and_call.go index d7e11cd999..51730b815e 100644 --- a/e2e/e2etests/test_spl_deposit_and_call.go +++ b/e2e/e2etests/test_spl_deposit_and_call.go @@ -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))) diff --git a/zetaclient/chains/solana/observer/inbound.go b/zetaclient/chains/solana/observer/inbound.go index 2b30b5818d..6eab1242ac 100644 --- a/zetaclient/chains/solana/observer/inbound.go +++ b/zetaclient/chains/solana/observer/inbound.go @@ -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, @@ -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, @@ -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), diff --git a/zetaclient/chains/solana/observer/inbound_test.go b/zetaclient/chains/solana/observer/inbound_test.go index 0b118ae55e..ff0ad101a2 100644 --- a/zetaclient/chains/solana/observer/inbound_test.go +++ b/zetaclient/chains/solana/observer/inbound_test.go @@ -81,7 +81,7 @@ func Test_FilterInboundEvents(t *testing.T) { eventExpected := &clienttypes.InboundEvent{ SenderChainID: chain.ChainId, Sender: sender, - Receiver: sender, + Receiver: "", TxOrigin: sender, Amount: 100000, Memo: []byte("0x7F8ae2ABb69A558CE6bAd546f25F0464D9e09e5B4955a3F38ff86ae92A914445099caa8eA2B9bA32"), @@ -123,11 +123,13 @@ func Test_BuildInboundVoteMsgFromEvent(t *testing.T) { t.Run("should return vote msg for valid event", func(t *testing.T) { sender := sample.SolanaAddress(t) - memo := sample.EthAddress().Bytes() - event := sample.InboundEvent(chain.ChainId, sender, sender, 1280, []byte(memo)) + receiver := sample.EthAddress() + event := sample.InboundEvent(chain.ChainId, sender, "", 1280, receiver.Bytes()) msg := ob.BuildInboundVoteMsgFromEvent(event) require.NotNil(t, msg) + require.Equal(t, sender, msg.Sender) + require.Equal(t, receiver.Hex(), msg.Receiver) }) t.Run("should return nil if failed to decode memo", func(t *testing.T) {