diff --git a/encoding/ccf/consts.go b/encoding/ccf/consts.go index f4d25b2d0..45124a131 100644 --- a/encoding/ccf/consts.go +++ b/encoding/ccf/consts.go @@ -125,7 +125,7 @@ const ( CBORTagIntersectionTypeValue CBORTagCapabilityTypeValue CBORTagFunctionTypeValue - CBORTagInclusiveRangeTypeValue // InclusiveRange is stored as a composite value. + CBORTagInclusiveRangeTypeValue CBORTagEntitlementSetAuthorizationAccessTypeValue CBORTagEntitlementMapAuthorizationAccessTypeValue _ diff --git a/encoding/ccf/decode.go b/encoding/ccf/decode.go index db5ab6d09..186bd738d 100644 --- a/encoding/ccf/decode.go +++ b/encoding/ccf/decode.go @@ -369,8 +369,7 @@ func (d *Decoder) decodeTypeAndValue(types *cadenceTypeByCCFTypeID) (cadence.Val // / dict-value // / composite-value // / path-value -// / path-capability-value -// / id-capability-value +// / capability-value // / inclusiverange-value // / function-value // / type-value @@ -1446,24 +1445,12 @@ func (d *Decoder) decodePath() (cadence.Value, error) { // decodeCapability decodes encoded capability-value as // language=CDDL // -// capability-value = -// -// id-capability-value -// / path-capability-value -// -// id-capability-value = [ +// capability-value = [ // // address: address-value, // id: uint64-value // // ] -// -// path-capability-value = [ -// -// address: address-value, -// path: path-value -// -// ] func (d *Decoder) decodeCapability(typ *cadence.CapabilityType, types *cadenceTypeByCCFTypeID) (cadence.Value, error) { // typ can be different from runtime CapabilityType because borrow type can be nil. // In this case, runtime type is encoded with the value (as tag content for tag CBORTagTypeAndValue). diff --git a/encoding/ccf/decode_type.go b/encoding/ccf/decode_type.go index 4092a48c9..3fa743c6f 100644 --- a/encoding/ccf/decode_type.go +++ b/encoding/ccf/decode_type.go @@ -361,14 +361,14 @@ func (d *Decoder) decodeCapabilityType( // // ; cbor-tag-entitlement-set-authorization-type // #6.146([ -// kind: uint8, -// entitlements: +[string] +// kind: uint, +// entitlements: [+ tstr], // ]) // // entitlement-map-authorization-type = // // ; cbor-tag-entitlement-map-authorization-type -// #6.147(entitlement: string) +// #6.147(tstr) // // authorization-type-value = // @@ -382,14 +382,14 @@ func (d *Decoder) decodeCapabilityType( // // ; cbor-tag-entitlement-set-authorization-type-value // #6.195([ -// kind: uint8, -// entitlements: +[string] +// kind: uint, +// entitlements: [+ tstr], // ]) // // entitlement-map-authorization-type-value = // // ; cbor-tag-entitlement-map-authorization-type-value -// #6.196(entitlement: string) +// #6.196(tstr) func (d *Decoder) decodeAuthorization(isType bool) (cadence.Authorization, error) { nt, err := d.dec.NextType() if err != nil { @@ -454,8 +454,8 @@ const entitlementSetAuthorizationArraySize = 2 // // ; cbor-tag-entitlement-set-authorization-type // #6.146([ -// kind: uint8, -// entitlements: +[string] +// kind: uint, +// entitlements: [+ tstr], // ]) func (d *Decoder) decodeEntitlementSetAuthorization() (cadence.Authorization, error) { @@ -569,7 +569,7 @@ func (d *Decoder) decodeEntitlementMapAuthorization() (cadence.Authorization, er // // ; cbor-tag-reference-type-value // #6.190([ -// authorized: authorization-type, +// authorized: authorization-type-value, // type: type-value, // ]) // diff --git a/encoding/ccf/decode_typedef.go b/encoding/ccf/decode_typedef.go index 192260d52..efbff6b4e 100644 --- a/encoding/ccf/decode_typedef.go +++ b/encoding/ccf/decode_typedef.go @@ -330,7 +330,7 @@ func (d *Decoder) decodeTypeDef( // fields: [ // * [ // field-name: tstr, -// field-type: inline-type +// field-type: inline-type, // ] // ] // diff --git a/encoding/ccf/encode.go b/encoding/ccf/encode.go index f8b9a9b4e..224eadf4f 100644 --- a/encoding/ccf/encode.go +++ b/encoding/ccf/encode.go @@ -423,8 +423,7 @@ func (e *Encoder) encodeTypeDefs(types []cadence.Type, tids ccfTypeIDByCadenceTy // / dict-value // / composite-value // / path-value -// / path-capability-value -// / id-capability-value +// / capability-value // / inclusiverange-value // / function-value // / type-value @@ -1030,7 +1029,13 @@ func encodeAndSortKeyValuePairs( // encodeInclusiveRange encodes cadence.InclusiveRange as // language=CDDL -// inclusiverange-value = [3*3 (key: value, value: value)] +// inclusiverange-value = [ +// +// start: value, +// stop: value, +// step: value, +// +// ] func (e *Encoder) encodeInclusiveRange(v *cadence.InclusiveRange, tids ccfTypeIDByCadenceType) error { staticElementType := v.InclusiveRangeType.ElementType @@ -1240,7 +1245,7 @@ func (e *Encoder) encodePath(x cadence.Path) error { // encodeCapability encodes cadence.Capability as // language=CDDL -// id-capability-value = [ +// capability-value = [ // // address: address-value, // id: uint64-value diff --git a/encoding/ccf/encode_type.go b/encoding/ccf/encode_type.go index 223c6b22d..509a6b4dd 100644 --- a/encoding/ccf/encode_type.go +++ b/encoding/ccf/encode_type.go @@ -376,14 +376,14 @@ func (e *Encoder) encodeReferenceType( // // ; cbor-tag-entitlement-set-authorization-type // #6.146([ -// kind: uint8, -// entitlements: +[string] +// kind: uint, +// entitlements: [+ tstr], // ]) // // entitlement-map-authorization-type = // // ; cbor-tag-entitlement-map-authorization-type -// #6.147(entitlement: string) +// #6.147(tstr) // // authorization-type-value = // @@ -397,8 +397,8 @@ func (e *Encoder) encodeReferenceType( // // ; cbor-tag-entitlement-set-authorization-type-value // #6.195([ -// kind: uint8, -// entitlements: +[string] +// kind: uint, +// entitlements: [+ tstr], // ]) // // entitlement-map-authorization-type-value = @@ -442,8 +442,8 @@ func (e *Encoder) encodeAuthorization( // // ; cbor-tag-entitlement-set-authorization-type // #6.146([ -// kind: uint8, -// entitlements: +[string] +// kind: uint, +// entitlements: [+ tstr], // ]) // // or @@ -452,8 +452,8 @@ func (e *Encoder) encodeAuthorization( // // ; cbor-tag-entitlement-set-authorization-type-value // #6.195([ -// kind: uint8, -// entitlements: +[string] +// kind: uint, +// entitlements: [+ tstr], // ]) func (e *Encoder) encodeEntitlementSetAuthorizationWithRawTag( auth *cadence.EntitlementSetAuthorization,