@@ -693,12 +693,43 @@ func TestInboundCEAFundsAndPayload(t *testing.T) {
693693 "isCEA=true should succeed using recipient UEA directly, ignoring whether sender has a UEA" )
694694 })
695695
696- t .Run ("verified payload hash stores UEA owner as sender when isCEA is true for FUNDS_AND_PAYLOAD" , func (t * testing.T ) {
696+ t .Run ("verified payload hash stored under UEA origin chain with UEA owner as sender for CEA FUNDS_AND_PAYLOAD" , func (t * testing.T ) {
697697 chainApp , ctx , vals , _ , coreVals , ueaAddrHex := setupInboundCEAPayloadTest (t , 4 )
698698 usdcAddress := utils .GetDefaultAddresses ().ExternalUSDCAddr
699+ prc20Address := utils .GetDefaultAddresses ().PRC20USDCAddr
699700 testAddress := utils .GetDefaultAddresses ().DefaultTestAddr
700701
701- // person B — a different sender that is NOT the UEA owner
702+ // Register a second chain (eip155:97) so we can send a CEA inbound from a different chain
703+ chainApp .UregistryKeeper .AddChainConfig (ctx , & uregistrytypes.ChainConfig {
704+ Chain : "eip155:97" ,
705+ VmType : uregistrytypes .VmType_EVM ,
706+ PublicRpcUrl : "https://data-seed-prebsc-1-s1.binance.org:8545" ,
707+ GatewayAddress : "0x0000000000000000000000000000000000000000" ,
708+ BlockConfirmation : & uregistrytypes.BlockConfirmation {
709+ FastInbound : 5 ,
710+ StandardInbound : 12 ,
711+ },
712+ Enabled : & uregistrytypes.ChainEnabled {
713+ IsInboundEnabled : true ,
714+ IsOutboundEnabled : true ,
715+ },
716+ })
717+ chainApp .UregistryKeeper .AddTokenConfig (ctx , & uregistrytypes.TokenConfig {
718+ Chain : "eip155:97" ,
719+ Address : usdcAddress .String (),
720+ Name : "USD Coin" ,
721+ Symbol : "USDC" ,
722+ Decimals : 6 ,
723+ Enabled : true ,
724+ LiquidityCap : "1000000000000000000000000" ,
725+ TokenType : 1 ,
726+ NativeRepresentation : & uregistrytypes.NativeRepresentation {
727+ Denom : "" ,
728+ ContractAddress : prc20Address .String (),
729+ },
730+ })
731+
732+ // person B — a different sender on a different chain
702733 personBSender := utils .GetDefaultAddresses ().TargetAddr2
703734
704735 validUP := & uexecutortypes.UniversalPayload {
@@ -713,8 +744,9 @@ func TestInboundCEAFundsAndPayload(t *testing.T) {
713744 VType : uexecutortypes .VerificationType (1 ),
714745 }
715746
747+ // CEA inbound from eip155:97, but UEA origin is eip155:11155111
716748 ceaInbound := & uexecutortypes.Inbound {
717- SourceChain : "eip155:11155111 " ,
749+ SourceChain : "eip155:97 " ,
718750 TxHash : "0xcea07" ,
719751 Sender : personBSender ,
720752 Recipient : ueaAddrHex .String (),
@@ -739,12 +771,18 @@ func TestInboundCEAFundsAndPayload(t *testing.T) {
739771 require .NoError (t , err )
740772 }
741773
742- // Verify the stored sender in VerifiedTxMetadata is the UEA owner, not personBSender
743- verified , found , err := chainApp .UtxverifierKeeper .GetVerifiedInboundTxMetadata (ctx , ceaInbound .SourceChain , ceaInbound .TxHash )
774+ // Payload hash should be stored under UEA origin chain (eip155:11155111), NOT source chain (eip155:97)
775+ ueaOriginChain := "eip155:11155111"
776+ verified , found , err := chainApp .UtxverifierKeeper .GetVerifiedInboundTxMetadata (ctx , ueaOriginChain , ceaInbound .TxHash )
744777 require .NoError (t , err )
745- require .True (t , found , "verified tx metadata should exist after execution " )
778+ require .True (t , found , "verified tx metadata should be stored under UEA origin chain " )
746779 require .NotEmpty (t , verified .PayloadHashes , "payload hashes should be stored" )
747780
781+ // Should NOT be found under source chain
782+ _ , foundUnderSource , err := chainApp .UtxverifierKeeper .GetVerifiedInboundTxMetadata (ctx , ceaInbound .SourceChain , ceaInbound .TxHash )
783+ require .NoError (t , err )
784+ require .False (t , foundUnderSource , "verified tx metadata should NOT be stored under inbound source chain for CEA" )
785+
748786 // The sender should be the UEA owner (testAddress), NOT personBSender
749787 require .NotEqual (t , personBSender , verified .Sender ,
750788 "stored sender should NOT be the CEA executor" )
0 commit comments