From 18627cf26c3363101fbb765362077b4634dfc2be Mon Sep 17 00:00:00 2001 From: Aurora Gaffney Date: Mon, 24 Jun 2024 13:23:05 -0500 Subject: [PATCH] chore(deps): update fxamacker/cbor to v2.7.0 (#663) The encoder mode we used previously now has unwanted side effects, so we create our own with only the options we need --- cbor/encode.go | 6 +++++- go.mod | 2 +- go.sum | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/cbor/encode.go b/cbor/encode.go index ca1bedee..442b4be6 100644 --- a/cbor/encode.go +++ b/cbor/encode.go @@ -25,7 +25,11 @@ import ( func Encode(data interface{}) ([]byte, error) { buf := bytes.NewBuffer(nil) - em, err := _cbor.CoreDetEncOptions().EncModeWithTags(customTagSet) + opts := _cbor.EncOptions{ + // Make sure that maps have ordered keys + Sort: _cbor.SortCoreDeterministic, + } + em, err := opts.EncModeWithTags(customTagSet) if err != nil { return nil, err } diff --git a/go.mod b/go.mod index eecece7d..36c29574 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ toolchain go1.21.5 require ( filippo.io/edwards25519 v1.1.0 github.com/blinklabs-io/ouroboros-mock v0.3.1 - github.com/fxamacker/cbor/v2 v2.6.0 + github.com/fxamacker/cbor/v2 v2.7.0 github.com/jinzhu/copier v0.4.0 github.com/utxorpc/go-codegen v0.5.1 go.uber.org/goleak v1.3.0 diff --git a/go.sum b/go.sum index f462baf1..33416dfa 100644 --- a/go.sum +++ b/go.sum @@ -4,8 +4,8 @@ github.com/blinklabs-io/ouroboros-mock v0.3.1 h1:oQiMgH0VgsJIGy4lJGaySegObq5FsVg github.com/blinklabs-io/ouroboros-mock v0.3.1/go.mod h1:6DosKZuBZ4mmvky3hXUzGZqqb/KhbwOiKOldwAtNoxc= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/fxamacker/cbor/v2 v2.6.0 h1:sU6J2usfADwWlYDAFhZBQ6TnLFBHxgesMrQfQgk1tWA= -github.com/fxamacker/cbor/v2 v2.6.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ= +github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv5E= +github.com/fxamacker/cbor/v2 v2.7.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/jinzhu/copier v0.4.0 h1:w3ciUoD19shMCRargcpm0cm91ytaBhDvuRpz1ODO/U8=