Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use the ZEVM address pulled from memo as Receiver in MsgVoteInbound #3242

Merged
merged 5 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
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 @@
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 @@
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

Check warning on line 243 in zetaclient/chains/solana/observer/inbound.go

View check run for this annotation

Codecov / codecov/patch

zetaclient/chains/solana/observer/inbound.go#L243

Added line #L243 was not covered by tests
TxOrigin: deposit.Sender,
Amount: deposit.Amount,
Memo: deposit.Memo,
Expand Down Expand Up @@ -288,7 +288,7 @@
event.Sender,
event.SenderChainID,
event.Sender,
event.Sender,
event.Receiver,
ws4charlie marked this conversation as resolved.
Show resolved Hide resolved
ob.ZetacoreClient().Chain().ChainId,
cosmosmath.NewUint(event.Amount),
hex.EncodeToString(event.Memo),
Expand Down
8 changes: 5 additions & 3 deletions zetaclient/chains/solana/observer/inbound_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down Expand Up @@ -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) {
Expand Down
Loading