Skip to content

Commit 419061a

Browse files
authored
fix: incorrect verification of bn254 public keys (#1076)
### Uniond & Galoisd - Update cometbls to latest commit of https://github.com/unionlabs/cometbls/commits/cometbls-v0.38%2Btm-light-client - Update cosmos-sdk to latest commit of https://github.com/unionlabs/cosmos-sdk/tree/v0.50.2u-bn254 #### Galoisd Upgrade to go 1.21 and cosmos-sdk v0.50.2 which is now in par with uniond closes #1075 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Refactor** - Replaced `sdk.NewInt` with `math.NewInt` for improved mathematical operations - Modified usage of `sdk.TokensToConsensusPower` for more accurate voting power calculation - Modified `perSystem` function within a Nix expression and added new parameter `goPkgs` <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2 parents 98873e1 + b348d59 commit 419061a

File tree

2,249 files changed

+433629
-217986
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,249 files changed

+433629
-217986
lines changed

galoisd/cmd/galoisd/cmd/example_prove.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"math/rand"
1010
"strconv"
1111

12+
"cosmossdk.io/math"
1213
cometbn254 "github.com/cometbft/cometbft/crypto/bn254"
1314
ce "github.com/cometbft/cometbft/crypto/encoding"
1415
"github.com/cometbft/cometbft/libs/protoio"
@@ -38,7 +39,7 @@ func ExampleProveCmd() *cobra.Command {
3839
}
3940
return &types.SimpleValidator{
4041
PubKey: &protoPK,
41-
VotingPower: sdk.TokensToConsensusPower(sdk.NewInt(rand.Int63n(9223372036854775807/8)), sdk.DefaultPowerReduction),
42+
VotingPower: sdk.TokensToConsensusPower(math.NewInt(rand.Int63n(9223372036854775807/8)), sdk.DefaultPowerReduction),
4243
}, nil
4344
}
4445

galoisd/cmd/galoisd/cmd/example_prove16.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"log"
1010
"math/big"
1111

12+
"cosmossdk.io/math"
1213
cometbn254 "github.com/cometbft/cometbft/crypto/bn254"
1314
ce "github.com/cometbft/cometbft/crypto/encoding"
1415
"github.com/cometbft/cometbft/proto/tendermint/types"
@@ -44,7 +45,7 @@ func ExampleProve16Cmd() *cobra.Command {
4445
}
4546
return &types.SimpleValidator{
4647
PubKey: &protoPK,
47-
VotingPower: sdk.TokensToConsensusPower(sdk.NewIntFromBigInt(tokens), sdk.DefaultPowerReduction),
48+
VotingPower: sdk.TokensToConsensusPower(math.NewIntFromBigInt(tokens), sdk.DefaultPowerReduction),
4849
}
4950
}
5051

galoisd/cmd/galoisd/cmd/example_verify.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"log"
1111
"math/big"
1212

13+
"cosmossdk.io/math"
1314
cometbft_bn254 "github.com/cometbft/cometbft/crypto/bn254"
1415
cometbn254 "github.com/cometbft/cometbft/crypto/bn254"
1516
ce "github.com/cometbft/cometbft/crypto/encoding"
@@ -50,7 +51,7 @@ func ExampleVerifyCmd() *cobra.Command {
5051
}
5152
return &types.SimpleValidator{
5253
PubKey: &protoPK,
53-
VotingPower: sdk.TokensToConsensusPower(sdk.NewIntFromBigInt(tokens), sdk.DefaultPowerReduction),
54+
VotingPower: sdk.TokensToConsensusPower(math.NewIntFromBigInt(tokens), sdk.DefaultPowerReduction),
5455
}
5556
}
5657

galoisd/galoisd.nix

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{ ... }: {
2-
perSystem = { self', pkgs, proto, ... }: {
2+
perSystem = { self', pkgs, proto, goPkgs, ... }: {
33
packages =
44
{
5-
galoisd = pkgs.buildGoModule ({
5+
galoisd = goPkgs.buildGoModule ({
66
name = "galoisd";
77
src = ./.;
88
vendorSha256 = null;

galoisd/go.mod

+61-48
Original file line numberDiff line numberDiff line change
@@ -1,107 +1,120 @@
11
module galois
22

3-
go 1.20
3+
go 1.21
4+
5+
toolchain go1.21.4
46

57
require (
6-
github.com/cometbft/cometbft v0.37.2
8+
github.com/cometbft/cometbft v0.38.2
79
github.com/consensys/gnark v0.7.2-0.20230418172633-f83323bdf138
810
github.com/consensys/gnark-crypto v0.12.2-0.20231012161402-206544105834
9-
github.com/cosmos/cosmos-sdk v0.47.0
11+
github.com/cosmos/cosmos-sdk v0.50.2
1012
github.com/gogo/protobuf v1.3.2
11-
github.com/rs/zerolog v1.30.0
13+
github.com/rs/zerolog v1.31.0
1214
github.com/spf13/cobra v1.7.0
13-
golang.org/x/net v0.14.0
14-
google.golang.org/grpc v1.57.0
15+
golang.org/x/net v0.19.0
16+
google.golang.org/grpc v1.59.0
1517
google.golang.org/protobuf v1.31.0
1618
)
1719

1820
require (
21+
cosmossdk.io/api v0.7.2 // indirect
22+
cosmossdk.io/collections v0.4.0 // indirect
23+
cosmossdk.io/core v0.11.0 // indirect
24+
cosmossdk.io/depinject v1.0.0-alpha.4 // indirect
1925
cosmossdk.io/errors v1.0.0 // indirect
20-
cosmossdk.io/math v1.1.2 // indirect
26+
cosmossdk.io/log v1.2.1 // indirect
27+
cosmossdk.io/math v1.2.0 // indirect
28+
cosmossdk.io/store v1.0.1 // indirect
29+
cosmossdk.io/x/tx v0.12.0 // indirect
30+
github.com/DataDog/zstd v1.5.5 // indirect
2131
github.com/beorn7/perks v1.0.1 // indirect
2232
github.com/bits-and-blooms/bitset v1.8.0 // indirect
2333
github.com/blang/semver/v4 v4.0.0 // indirect
2434
github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
2535
github.com/cespare/xxhash v1.1.0 // indirect
2636
github.com/cespare/xxhash/v2 v2.2.0 // indirect
27-
github.com/cometbft/cometbft-db v0.7.0 // indirect
28-
github.com/confio/ics23/go v0.9.0 // indirect
37+
github.com/cockroachdb/errors v1.11.1 // indirect
38+
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
39+
github.com/cockroachdb/pebble v0.0.0-20231101195458-481da04154d6 // indirect
40+
github.com/cockroachdb/redact v1.1.5 // indirect
41+
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect
42+
github.com/cometbft/cometbft-db v0.9.1 // indirect
2943
github.com/consensys/bavard v0.1.13 // indirect
3044
github.com/cosmos/btcutil v1.0.5 // indirect
31-
github.com/cosmos/cosmos-proto v1.0.0-beta.2 // indirect
32-
github.com/cosmos/gogoproto v1.4.10 // indirect
45+
github.com/cosmos/cosmos-db v1.0.0 // indirect
46+
github.com/cosmos/cosmos-proto v1.0.0-beta.3 // indirect
47+
github.com/cosmos/gogoproto v1.4.11 // indirect
48+
github.com/cosmos/ics23/go v0.10.0 // indirect
3349
github.com/davecgh/go-spew v1.1.1 // indirect
34-
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect
50+
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
3551
github.com/dgraph-io/badger/v2 v2.2007.4 // indirect
3652
github.com/dgraph-io/ristretto v0.1.1 // indirect
3753
github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect
3854
github.com/dustin/go-humanize v1.0.1 // indirect
39-
github.com/fsnotify/fsnotify v1.6.0 // indirect
4055
github.com/fxamacker/cbor/v2 v2.5.0 // indirect
56+
github.com/getsentry/sentry-go v0.25.0 // indirect
4157
github.com/go-kit/kit v0.12.0 // indirect
4258
github.com/go-kit/log v0.2.1 // indirect
43-
github.com/go-logfmt/logfmt v0.5.1 // indirect
44-
github.com/golang/glog v1.1.0 // indirect
59+
github.com/go-logfmt/logfmt v0.6.0 // indirect
60+
github.com/golang/glog v1.2.0 // indirect
4561
github.com/golang/protobuf v1.5.3 // indirect
4662
github.com/golang/snappy v0.0.4 // indirect
4763
github.com/google/btree v1.1.2 // indirect
48-
github.com/google/go-cmp v0.5.9 // indirect
64+
github.com/google/go-cmp v0.6.0 // indirect
4965
github.com/google/pprof v0.0.0-20230817174616-7a8ec2ada47b // indirect
50-
github.com/gtank/merlin v0.1.1 // indirect
51-
github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d // indirect
52-
github.com/hashicorp/hcl v1.0.0 // indirect
53-
github.com/holiman/uint256 v1.2.2 // indirect
66+
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
67+
github.com/hashicorp/go-metrics v0.5.1 // indirect
68+
github.com/hashicorp/golang-lru v1.0.2 // indirect
69+
github.com/holiman/uint256 v1.2.3 // indirect
70+
github.com/iancoleman/strcase v0.3.0 // indirect
5471
github.com/inconshreveable/mousetrap v1.1.0 // indirect
5572
github.com/jmhodges/levigo v1.0.0 // indirect
56-
github.com/klauspost/compress v1.16.3 // indirect
73+
github.com/klauspost/compress v1.17.4 // indirect
74+
github.com/kr/pretty v0.3.1 // indirect
75+
github.com/kr/text v0.2.0 // indirect
5776
github.com/libp2p/go-buffer-pool v0.1.0 // indirect
58-
github.com/magiconair/properties v1.8.6 // indirect
77+
github.com/linxGnu/grocksdb v1.8.6 // indirect
5978
github.com/mattn/go-colorable v0.1.13 // indirect
60-
github.com/mattn/go-isatty v0.0.19 // indirect
61-
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
62-
github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0 // indirect
63-
github.com/mitchellh/mapstructure v1.5.0 // indirect
79+
github.com/mattn/go-isatty v0.0.20 // indirect
80+
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect
6481
github.com/mmcloughlin/addchain v0.4.0 // indirect
65-
github.com/pelletier/go-toml v1.9.5 // indirect
66-
github.com/pelletier/go-toml/v2 v2.0.7 // indirect
67-
github.com/petermattis/goid v0.0.0-20230317030725-371a4b8eda08 // indirect
82+
github.com/oasisprotocol/curve25519-voi v0.0.0-20220708102147-0a8a51822cae // indirect
83+
github.com/petermattis/goid v0.0.0-20230904192822-1876fd5063bc // indirect
6884
github.com/pkg/errors v0.9.1 // indirect
6985
github.com/pmezard/go-difflib v1.0.0 // indirect
70-
github.com/prometheus/client_golang v1.14.0 // indirect
71-
github.com/prometheus/client_model v0.3.0 // indirect
72-
github.com/prometheus/common v0.42.0 // indirect
73-
github.com/prometheus/procfs v0.9.0 // indirect
86+
github.com/prometheus/client_golang v1.17.0 // indirect
87+
github.com/prometheus/client_model v0.5.0 // indirect
88+
github.com/prometheus/common v0.45.0 // indirect
89+
github.com/prometheus/procfs v0.12.0 // indirect
90+
github.com/rogpeppe/go-internal v1.11.0 // indirect
7491
github.com/sasha-s/go-deadlock v0.3.1 // indirect
75-
github.com/spf13/afero v1.9.2 // indirect
76-
github.com/spf13/cast v1.5.0 // indirect
77-
github.com/spf13/jwalterweatherman v1.1.0 // indirect
92+
github.com/spf13/cast v1.5.1 // indirect
7893
github.com/spf13/pflag v1.0.5 // indirect
79-
github.com/spf13/viper v1.14.0 // indirect
8094
github.com/stretchr/testify v1.8.4 // indirect
81-
github.com/subosito/gotenv v1.4.1 // indirect
8295
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect
83-
github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c // indirect
8496
github.com/tendermint/go-amino v0.16.0 // indirect
8597
github.com/x448/float16 v0.8.4 // indirect
86-
go.etcd.io/bbolt v1.3.7 // indirect
87-
golang.org/x/crypto v0.12.0 // indirect
88-
golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63 // indirect
98+
go.etcd.io/bbolt v1.3.8 // indirect
99+
golang.org/x/crypto v0.16.0 // indirect
100+
golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect
89101
golang.org/x/sync v0.3.0 // indirect
90-
golang.org/x/sys v0.11.0 // indirect
91-
golang.org/x/text v0.12.0 // indirect
92-
google.golang.org/genproto/googleapis/rpc v0.0.0-20230815205213-6bfd019c3878 // indirect
93-
gopkg.in/ini.v1 v1.67.0 // indirect
102+
golang.org/x/sys v0.15.0 // indirect
103+
golang.org/x/text v0.14.0 // indirect
104+
google.golang.org/genproto v0.0.0-20231016165738-49dd2c1f3d0b // indirect
105+
google.golang.org/genproto/googleapis/api v0.0.0-20231012201019-e917dd12ba7a // indirect
106+
google.golang.org/genproto/googleapis/rpc v0.0.0-20231030173426-d783a09b4405 // indirect
94107
gopkg.in/yaml.v2 v2.4.0 // indirect
95108
gopkg.in/yaml.v3 v3.0.1 // indirect
96109
rsc.io/tmplfunc v0.0.3 // indirect
97110
sigs.k8s.io/yaml v1.3.0 // indirect
98111
)
99112

100113
replace (
101-
github.com/cometbft/cometbft => github.com/unionlabs/cometbls v0.0.0-20231016073256-18a1c30dccac
114+
github.com/cometbft/cometbft => github.com/unionlabs/cometbls v0.0.0-20231225001748-d638e57b7566
102115
github.com/consensys/gnark => github.com/consensys/gnark v0.9.1-0.20231013131835-4ebcccd9c0a8
103116
// Fork of gnark crypto until https://github.com/ConsenSys/gnark-crypto/pull/314 is merged
104117
github.com/consensys/gnark-crypto => github.com/unionlabs/gnark-crypto v0.0.0-20231016072529-15c0507b6578
105-
github.com/cosmos/cosmos-sdk => github.com/unionlabs/cosmos-sdk v0.0.0-20231016073706-ce776180ee80
118+
github.com/cosmos/cosmos-sdk => github.com/unionlabs/cosmos-sdk v0.0.0-20231206211859-a69e5866af6b
106119
github.com/cosmos/gogoproto => github.com/cosmos/gogoproto v1.4.11
107120
)

0 commit comments

Comments
 (0)