@@ -745,6 +745,15 @@ func baseTx() *flow.Transaction {
745745 AddPayloadSignature (flow .HexToAddress ("01" ), 4 , sig )
746746}
747747
748+ func baseSystemTx () * flow.Transaction {
749+ return flow .NewTransaction ().
750+ SetScript ([]byte (`transaction { execute { log("Hello, World!") } }` )).
751+ SetReferenceBlockID (flow .HexToID ("f0e4c2f76c58916ec258f246851bea091d14d4247a2fc3e18694461b1816e13b" )).
752+ SetComputeLimit (42 ).
753+ SetProposalKey (flow .HexToAddress ("01" ), 4 , 10 ).
754+ AddAuthorizer (flow .HexToAddress ("02" ))
755+ }
756+
748757func copyTxPayload (tx * flow.Transaction ) * flow.Transaction {
749758 return & flow.Transaction {
750759 Script : tx .Script ,
@@ -835,6 +844,21 @@ func TestTransaction_RLPMessages(t *testing.T) {
835844 payload : "f8afb07472616e73616374696f6e207b2065786563757465207b206c6f67282248656c6c6f2c20576f726c64212229207d207df83c9f7b2276616c7565223a22666f6f222c2274797065223a22537472696e67227d9b7b2276616c7565223a223432222c2274797065223a22496e74227da0f0e4c2f76c58916ec258f246851bea091d14d4247a2fc3e18694461b1816e13b2a880000000000000001040a880000000000000001c9880000000000000001" ,
836845 envelope : "f8d6f8afb07472616e73616374696f6e207b2065786563757465207b206c6f67282248656c6c6f2c20576f726c64212229207d207df83c9f7b2276616c7565223a22666f6f222c2274797065223a22537472696e67227d9b7b2276616c7565223a223432222c2274797065223a22496e74227da0f0e4c2f76c58916ec258f246851bea091d14d4247a2fc3e18694461b1816e13b2a880000000000000001040a880000000000000001c9880000000000000001e4e38004a0f7225388c1d69d57e6251c9fda50cbbf9e05131e5adb81e5aa0422402f048162" ,
837846 },
847+ {
848+ // System transactions (Payer == EmptyAddress) preserve trailing newlines in arguments.
849+ name : "System transaction with single argument" ,
850+ tx : baseSystemTx ().AddRawArgument (jsoncdc .MustEncode (cadence .String ("foo" ))),
851+ payload : "f893b07472616e73616374696f6e207b2065786563757465207b206c6f67282248656c6c6f2c20576f726c64212229207d207de1a07b2276616c7565223a22666f6f222c2274797065223a22537472696e67227d0aa0f0e4c2f76c58916ec258f246851bea091d14d4247a2fc3e18694461b1816e13b2a880000000000000001040a880000000000000000c9880000000000000002" ,
852+ envelope : "f896f893b07472616e73616374696f6e207b2065786563757465207b206c6f67282248656c6c6f2c20576f726c64212229207d207de1a07b2276616c7565223a22666f6f222c2274797065223a22537472696e67227d0aa0f0e4c2f76c58916ec258f246851bea091d14d4247a2fc3e18694461b1816e13b2a880000000000000001040a880000000000000000c9880000000000000002c0" ,
853+ },
854+ {
855+ name : "System transaction with multiple arguments" ,
856+ tx : baseSystemTx ().
857+ AddRawArgument (jsoncdc .MustEncode (cadence .String ("foo" ))).
858+ AddRawArgument (jsoncdc .MustEncode (cadence .NewInt (42 ))),
859+ payload : "f8b1b07472616e73616374696f6e207b2065786563757465207b206c6f67282248656c6c6f2c20576f726c64212229207d207df83ea07b2276616c7565223a22666f6f222c2274797065223a22537472696e67227d0a9c7b2276616c7565223a223432222c2274797065223a22496e74227d0aa0f0e4c2f76c58916ec258f246851bea091d14d4247a2fc3e18694461b1816e13b2a880000000000000001040a880000000000000000c9880000000000000002" ,
860+ envelope : "f8b4f8b1b07472616e73616374696f6e207b2065786563757465207b206c6f67282248656c6c6f2c20576f726c64212229207d207df83ea07b2276616c7565223a22666f6f222c2274797065223a22537472696e67227d0a9c7b2276616c7565223a223432222c2274797065223a22496e74227d0aa0f0e4c2f76c58916ec258f246851bea091d14d4247a2fc3e18694461b1816e13b2a880000000000000001040a880000000000000000c9880000000000000002c0" ,
861+ },
838862 }
839863
840864 for _ , tt := range tests {
0 commit comments