Skip to content

Commit

Permalink
deps: update protobuf
Browse files Browse the repository at this point in the history
The module we used previouly, github.com/golang/protobuf/proto, is
deprecated. See https://github.com/golang/protobuf/releases/tag/v1.5.2
and golang/protobuf#1306.

We use the official succssor:

```
(fix imports)
go get google.golang.org/protobuf/proto@v1.28.1
go mod tidy
```

The .pb.go generated files also needed to be updated with an updated
protoc-gen-go:

```
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28.1
```

A new script was added to generate the files, as the
`import_path=messages` flag seems to be removed in favour of the `M`
flag, which unfortunately has to be specified for each .proto file :(
  • Loading branch information
benma committed Aug 15, 2022
1 parent 9c5dd0d commit c42bf9e
Show file tree
Hide file tree
Showing 21 changed files with 7,716 additions and 4,213 deletions.
6 changes: 5 additions & 1 deletion README.md
Expand Up @@ -7,11 +7,15 @@ tagging versions.

Clone the [BitBox02 firmware repo](https://github.com/digitalbitbox/bitbox02-firmware):

Make sure you have `protoc` and
[protoc-gen-go](https://developers.google.com/protocol-buffers/docs/reference/go-generated)
installed:

`git clone https://github.com/digitalbitbox/bitbox02-firmware.git`

```sh
rm -rf api/firmware/messages/*
cp /path/to/bitbox02-firmware/messages/*.proto api/firmware/messages/
rm api/firmware/messages/backup.proto
go generate ./...
./api/firmware/messages/generate.sh
```
2 changes: 1 addition & 1 deletion api/firmware/btc.go
Expand Up @@ -24,7 +24,7 @@ import (
"github.com/digitalbitbox/bitbox02-api-go/api/firmware/messages"
"github.com/digitalbitbox/bitbox02-api-go/util/errp"
"github.com/digitalbitbox/bitbox02-api-go/util/semver"
"github.com/golang/protobuf/proto"
"google.golang.org/protobuf/proto"
)

const multisigNameMaxLen = 30
Expand Down
2 changes: 1 addition & 1 deletion api/firmware/btc_test.go
Expand Up @@ -20,8 +20,8 @@ import (

"github.com/digitalbitbox/bitbox02-api-go/api/firmware/messages"
"github.com/digitalbitbox/bitbox02-api-go/util/semver"
"github.com/golang/protobuf/proto"
"github.com/stretchr/testify/require"
"google.golang.org/protobuf/proto"
)

const hardenedKeyStart = 0x80000000
Expand Down
2 changes: 0 additions & 2 deletions api/firmware/device.go
Expand Up @@ -27,8 +27,6 @@ import (
"github.com/flynn/noise"
)

//go:generate sh -c "protoc --proto_path=messages/ --go_out='import_path=messages,paths=source_relative:messages' messages/*.proto"

var (
lowestSupportedFirmwareVersion = semver.NewSemVer(9, 0, 0)
lowestSupportedFirmwareVersionBTCOnly = semver.NewSemVer(9, 0, 0)
Expand Down
2 changes: 1 addition & 1 deletion api/firmware/device_test.go
Expand Up @@ -25,8 +25,8 @@ import (
"github.com/digitalbitbox/bitbox02-api-go/api/firmware/mocks"
"github.com/digitalbitbox/bitbox02-api-go/util/semver"
"github.com/flynn/noise"
"github.com/golang/protobuf/proto"
"github.com/stretchr/testify/require"
"google.golang.org/protobuf/proto"
)

// newDevice creates a device to test with, with init/pairing already processed.
Expand Down

0 comments on commit c42bf9e

Please sign in to comment.