fix: update gpb library to fix type error

This fixes a bug in the protobuf schema registry functionality. Before
this fix one would get a badarith error if one tried to assign a float
value to an uint64 field. However, this commit fixes this by upgrading
gpb so we instead will get a gpb_type_error which is what we want.

Fixes:
https://emqx.atlassian.net/browse/EMQX-10775
This commit is contained in:
Kjell Winblad 2023-08-30 11:12:33 +02:00
parent 885dfe53e0
commit 2b2e84b83c
4 changed files with 17 additions and 4 deletions

View File

@ -6,7 +6,7 @@
{emqx_utils, {path, "../emqx_utils"}},
{emqx_rule_engine, {path, "../emqx_rule_engine"}},
{erlavro, {git, "https://github.com/klarna/erlavro.git", {tag, "2.9.8"}}},
{gpb, "4.19.7"}
{gpb, "4.19.9"}
]}.
{shell, [

View File

@ -42,7 +42,8 @@ sparkplug_tests() ->
[
t_sparkplug_decode,
t_sparkplug_encode,
t_sparkplug_decode_encode_with_message_name
t_sparkplug_decode_encode_with_message_name,
t_sparkplug_encode_float_to_uint64_key
].
init_per_suite(Config) ->
@ -847,6 +848,18 @@ t_sparkplug_encode(_Config) ->
?assertMatch(#{data := ExpectedRuleOutput}, Res),
ok.
t_sparkplug_encode_float_to_uint64_key(_Config) ->
%% Test that the following bug is fixed:
%% https://emqx.atlassian.net/browse/EMQX-10775
%% When one assign a float value to a uint64 key, one should get a
%% gpb_type_error and not a badarith error
wait_for_sparkplug_schema_registered(),
?assertException(
error,
{gpb_type_error, _},
emqx_rule_funcs:sparkplug_encode(#{<<"seq">> => 1.5})
).
t_sparkplug_decode_encode_with_message_name(_Config) ->
SQL =
<<

View File

@ -93,7 +93,7 @@ defmodule EMQXUmbrella.MixProject do
# in conflict by cowboy_swagger and cowboy
{:ranch, github: "emqx/ranch", tag: "1.8.1-emqx", override: true},
# in conflict by grpc and eetcd
{:gpb, "4.19.7", override: true, runtime: false},
{:gpb, "4.19.9", override: true, runtime: false},
{:hackney, github: "emqx/hackney", tag: "1.18.1-1", override: true},
# set by hackney (dependency)
{:ssl_verify_fun, "1.1.6", override: true},

View File

@ -53,7 +53,7 @@
[ {lc, {git, "https://github.com/emqx/lc.git", {tag, "0.3.2"}}}
, {redbug, "2.0.8"}
, {covertool, {git, "https://github.com/zmstone/covertool", {tag, "2.0.4.1"}}}
, {gpb, "4.19.7"}
, {gpb, "4.19.9"}
, {typerefl, {git, "https://github.com/ieQu1/typerefl", {tag, "0.9.1"}}}
, {gun, {git, "https://github.com/emqx/gun", {tag, "1.3.9"}}}
, {ehttpc, {git, "https://github.com/emqx/ehttpc", {tag, "0.4.11"}}}