Skip to content

Commit ef8efcd

Browse files
committed
deps: update protobuf
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/[email protected] 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/[email protected] ``` 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 :( ----------- In `BTCSign()`, the inputs are not copied anymore due to: ``` api/firmware/btc.go:300:20: cannot use &input (value of type **messages.BTCSignInputRequest) as *messages.BTCSignInputRequest value in struct literal (typecheck) BtcSignInput: &input, ```
1 parent 9c5dd0d commit ef8efcd

21 files changed

+7718
-4215
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,15 @@ tagging versions.
77

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

10+
Make sure you have `protoc` and
11+
[protoc-gen-go](https://developers.google.com/protocol-buffers/docs/reference/go-generated)
12+
installed:
13+
1014
`git clone https://github.com/digitalbitbox/bitbox02-firmware.git`
1115

1216
```sh
1317
rm -rf api/firmware/messages/*
1418
cp /path/to/bitbox02-firmware/messages/*.proto api/firmware/messages/
1519
rm api/firmware/messages/backup.proto
16-
go generate ./...
20+
./api/firmware/messages/generate.sh
1721
```

api/firmware/btc.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
"github.com/digitalbitbox/bitbox02-api-go/api/firmware/messages"
2525
"github.com/digitalbitbox/bitbox02-api-go/util/errp"
2626
"github.com/digitalbitbox/bitbox02-api-go/util/semver"
27-
"github.com/golang/protobuf/proto"
27+
"google.golang.org/protobuf/proto"
2828
)
2929

3030
const multisigNameMaxLen = 30
@@ -277,7 +277,7 @@ func (device *Device) BTCSign(
277277
switch next.Type {
278278
case messages.BTCSignNextResponse_INPUT:
279279
inputIndex := next.Index
280-
input := *tx.Inputs[inputIndex].Input
280+
input := tx.Inputs[inputIndex].Input
281281

282282
inputIsSchnorr := isTaproot(scriptConfigs[input.ScriptConfigIndex])
283283

@@ -297,7 +297,7 @@ func (device *Device) BTCSign(
297297
}
298298
next, err = device.queryBtcSign(&messages.Request{
299299
Request: &messages.Request_BtcSignInput{
300-
BtcSignInput: &input,
300+
BtcSignInput: input,
301301
}})
302302
if err != nil {
303303
return nil, err

api/firmware/btc_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ import (
2020

2121
"github.com/digitalbitbox/bitbox02-api-go/api/firmware/messages"
2222
"github.com/digitalbitbox/bitbox02-api-go/util/semver"
23-
"github.com/golang/protobuf/proto"
2423
"github.com/stretchr/testify/require"
24+
"google.golang.org/protobuf/proto"
2525
)
2626

2727
const hardenedKeyStart = 0x80000000

api/firmware/device.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ import (
2727
"github.com/flynn/noise"
2828
)
2929

30-
//go:generate sh -c "protoc --proto_path=messages/ --go_out='import_path=messages,paths=source_relative:messages' messages/*.proto"
31-
3230
var (
3331
lowestSupportedFirmwareVersion = semver.NewSemVer(9, 0, 0)
3432
lowestSupportedFirmwareVersionBTCOnly = semver.NewSemVer(9, 0, 0)

api/firmware/device_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ import (
2525
"github.com/digitalbitbox/bitbox02-api-go/api/firmware/mocks"
2626
"github.com/digitalbitbox/bitbox02-api-go/util/semver"
2727
"github.com/flynn/noise"
28-
"github.com/golang/protobuf/proto"
2928
"github.com/stretchr/testify/require"
29+
"google.golang.org/protobuf/proto"
3030
)
3131

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

0 commit comments

Comments
 (0)