Skip to content

Commit 47af65f

Browse files
authored
Merge branch 'master' into dependabot/go_modules/github.com/aws/aws-sdk-go-v2/service/kms-1.50.0
2 parents 38a04c1 + 8e34795 commit 47af65f

3 files changed

Lines changed: 31 additions & 4 deletions

File tree

CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
* @janezpodhostnik @chasefleming @nvdtf @jribbink
1+
* @janezpodhostnik @chasefleming @nvdtf @jribbink @peterargue
22
/crypto/** @tarakby

transaction.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -416,9 +416,12 @@ func (t *Transaction) payloadCanonicalForm() payloadCanonicalForm {
416416
}
417417

418418
// note(sideninja): This is a temporary workaround until cadence defines canonical format addressing the issue https://github.com/onflow/flow-go-sdk/issues/286
419-
for i, arg := range t.Arguments {
420-
if len(arg) > 0 && arg[len(arg)-1] == byte(10) { // extra new line character
421-
t.Arguments[i] = arg[:len(arg)-1]
419+
// system transactions (Payer == EmptyAddress) preserve trailing newlines in arguments
420+
if t.Payer != EmptyAddress {
421+
for i, arg := range t.Arguments {
422+
if len(arg) > 0 && arg[len(arg)-1] == byte(10) { // extra new line character
423+
t.Arguments[i] = arg[:len(arg)-1]
424+
}
422425
}
423426
}
424427

transaction_test.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
748757
func 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

Comments
 (0)