Skip to content

Commit 0b299d4

Browse files
authored
Merge pull request #278 from onflow/secure-cadence
Update to Cadence v0.24 (Secure Cadence)
2 parents 28cc789 + 035e722 commit 0b299d4

7 files changed

Lines changed: 34 additions & 79 deletions

File tree

access/grpc/convert.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ func cadenceValuesToMessages(values []cadence.Value) ([][]byte, error) {
212212
}
213213

214214
func messageToCadenceValue(m []byte) (cadence.Value, error) {
215-
v, err := jsoncdc.Decode(m)
215+
v, err := jsoncdc.Decode(nil, m)
216216
if err != nil {
217217
return nil, fmt.Errorf("convert: %w", err)
218218
}

access/http/convert.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ func encodeCadenceValue(value string) (cadence.Value, error) {
241241
return nil, err
242242
}
243243

244-
return cadenceJSON.Decode(decoded)
244+
return cadenceJSON.Decode(nil, decoded)
245245
}
246246

247247
func toProposalKey(key *models.ProposalKey) flow.ProposalKey {
@@ -318,7 +318,7 @@ func toEvents(events []models.Event) ([]flow.Event, error) {
318318
return nil, err
319319
}
320320

321-
event, err := cadenceJSON.Decode(payload)
321+
event, err := cadenceJSON.Decode(nil, payload)
322322
if err != nil {
323323
return nil, err
324324
}

decode_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import (
2929
)
3030

3131
func TestDecodeFlowTypeID(t *testing.T) {
32-
location, qualifiedIdentifier, err := common.DecodeTypeID(flow.EventAccountCreated)
32+
location, qualifiedIdentifier, err := common.DecodeTypeID(nil, flow.EventAccountCreated)
3333
require.NoError(t, err)
3434
assert.Equal(t, common.LocationID("flow"), location.ID())
3535
assert.Equal(t, "AccountCreated", qualifiedIdentifier)

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.16
55
require (
66
cloud.google.com/go/kms v1.4.0
77
github.com/ethereum/go-ethereum v1.9.13
8-
github.com/onflow/cadence v0.23.4
8+
github.com/onflow/cadence v0.24.0
99
github.com/onflow/flow-go/crypto v0.24.3
1010
github.com/onflow/flow/protobuf/go/flow v0.2.5
1111
github.com/onflow/sdks v0.4.4

go.sum

Lines changed: 27 additions & 72 deletions
Large diffs are not rendered by default.

test/entities.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ func (g *Events) New() flow.Event {
278278
cadence.String("foo"),
279279
}).WithType(testEventType)
280280

281-
typeID := location.TypeID(identifier)
281+
typeID := location.TypeID(nil, identifier)
282282

283283
payload, err := jsoncdc.Encode(testEvent)
284284
if err != nil {

transaction.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ func (t *Transaction) Argument(i int) (cadence.Value, error) {
162162

163163
encodedArg := t.Arguments[i]
164164

165-
arg, err := jsoncdc.Decode(encodedArg)
165+
arg, err := jsoncdc.Decode(nil, encodedArg)
166166
if err != nil {
167167
return nil, fmt.Errorf("failed to decode argument at index %d: %w", i, err)
168168
}

0 commit comments

Comments
 (0)