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 needd 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 bd718df
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Loading

0 comments on commit bd718df

Please # to comment.