From 9674f8160ccc72ac482a0c8f6023f87e7ec889de Mon Sep 17 00:00:00 2001 From: Matee Ullah Malik Date: Wed, 5 Nov 2025 14:01:03 +0500 Subject: [PATCH 1/2] Change action price to str --- go.mod | 2 +- go.sum | 4 ++-- supernode/cascade/helper.go | 19 ++++++++++++------- tests/system/go.mod | 2 +- tests/system/go.sum | 4 ++-- 5 files changed, 18 insertions(+), 13 deletions(-) diff --git a/go.mod b/go.mod index 9c16367..34c0794 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ replace github.com/cosmos/cosmos-sdk => github.com/cosmos/cosmos-sdk v0.50.14 require ( cosmossdk.io/math v1.5.3 github.com/AlecAivazis/survey/v2 v2.3.7 - github.com/LumeraProtocol/lumera v1.8.0 + github.com/LumeraProtocol/lumera v1.8.1 github.com/LumeraProtocol/rq-go v0.2.1 github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce github.com/cenkalti/backoff/v4 v4.3.0 diff --git a/go.sum b/go.sum index 51e2590..92ba1df 100644 --- a/go.sum +++ b/go.sum @@ -76,8 +76,8 @@ github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.50 github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.50.0 h1:ig/FpDD2JofP/NExKQUbn7uOSZzJAQqogfqluZK4ed4= github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.50.0/go.mod h1:otE2jQekW/PqXk1Awf5lmfokJx4uwuqcj1ab5SpGeW0= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= -github.com/LumeraProtocol/lumera v1.8.0 h1:uE7mrK2/F6naY6Y09+D1DP9n1/EVkE3IS8w0dzCMESY= -github.com/LumeraProtocol/lumera v1.8.0/go.mod h1:38uAZxxleZyXaWKbqOQKwjw7CSX92lTxdF+B7c4SRPw= +github.com/LumeraProtocol/lumera v1.8.1 h1:tN9h7hj1t9ImI0jdLKiTo1TkwCjr0wfT4DenzWh3bdY= +github.com/LumeraProtocol/lumera v1.8.1/go.mod h1:twrSLfuXcHvmfQoN5e02Bg7rfeevUjF34SVqEJIvH1E= github.com/LumeraProtocol/rq-go v0.2.1 h1:8B3UzRChLsGMmvZ+UVbJsJj6JZzL9P9iYxbdUwGsQI4= github.com/LumeraProtocol/rq-go v0.2.1/go.mod h1:APnKCZRh1Es2Vtrd2w4kCLgAyaL5Bqrkz/BURoRJ+O8= github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY= diff --git a/supernode/cascade/helper.go b/supernode/cascade/helper.go index cbc5699..394b59f 100644 --- a/supernode/cascade/helper.go +++ b/supernode/cascade/helper.go @@ -3,6 +3,7 @@ package cascade import ( "context" "strconv" + "strings" "cosmossdk.io/math" actiontypes "github.com/LumeraProtocol/lumera/x/action/v1/types" @@ -192,15 +193,19 @@ func (task *CascadeRegistrationTask) verifyActionFee(ctx context.Context, action requiredFee := sdk.NewCoin("ulume", math.NewInt(amount)) logtrace.Debug(ctx, "calculated required fee", logtrace.Fields{"fee": requiredFee.String(), "dataBytes": dataSize}) // Accept paying more than the minimum required fee. Only enforce denom match and Amount >= required. - if action.Price == nil { - return task.wrapErr(ctx, "insufficient fee", errors.Errorf("expected at least %s, got ", requiredFee.String()), fields) + if strings.TrimSpace(action.Price) == "" { + return task.wrapErr(ctx, "insufficient fee", errors.Errorf("expected at least %s, got empty price", requiredFee.String()), fields) } - if action.Price.Denom != requiredFee.Denom { - return task.wrapErr(ctx, "invalid fee denom", errors.Errorf("expected denom %s, got %s", requiredFee.Denom, action.Price.Denom), fields) + providedFee, err := sdk.ParseCoinNormalized(action.Price) + if err != nil { + return task.wrapErr(ctx, "invalid fee format", errors.Errorf("price parse error: %v", err), fields) + } + if providedFee.Denom != requiredFee.Denom { + return task.wrapErr(ctx, "invalid fee denom", errors.Errorf("expected denom %s, got %s", requiredFee.Denom, providedFee.Denom), fields) } - if action.Price.Amount.LT(requiredFee.Amount) { - return task.wrapErr(ctx, "insufficient fee", errors.Errorf("expected at least %s, got %s", requiredFee.String(), action.Price.String()), fields) + if providedFee.Amount.LT(requiredFee.Amount) { + return task.wrapErr(ctx, "insufficient fee", errors.Errorf("expected at least %s, got %s", requiredFee.String(), providedFee.String()), fields) } - logtrace.Info(ctx, "register: verify action fee ok", logtrace.Fields{"required_fee": requiredFee.String(), "provided_fee": action.Price.String()}) + logtrace.Info(ctx, "register: verify action fee ok", logtrace.Fields{"required_fee": requiredFee.String(), "provided_fee": providedFee.String()}) return nil } diff --git a/tests/system/go.mod b/tests/system/go.mod index f974568..b98ddfd 100644 --- a/tests/system/go.mod +++ b/tests/system/go.mod @@ -54,7 +54,7 @@ require ( github.com/99designs/keyring v1.2.2 // indirect github.com/DataDog/datadog-go v4.8.3+incompatible // indirect github.com/DataDog/zstd v1.5.7 // indirect - github.com/LumeraProtocol/lumera v1.8.0 // indirect + github.com/LumeraProtocol/lumera v1.8.1 // indirect github.com/LumeraProtocol/rq-go v0.2.1 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect github.com/beorn7/perks v1.0.1 // indirect diff --git a/tests/system/go.sum b/tests/system/go.sum index c981822..fff1060 100644 --- a/tests/system/go.sum +++ b/tests/system/go.sum @@ -72,8 +72,8 @@ github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.50 github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.50.0 h1:ig/FpDD2JofP/NExKQUbn7uOSZzJAQqogfqluZK4ed4= github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.50.0/go.mod h1:otE2jQekW/PqXk1Awf5lmfokJx4uwuqcj1ab5SpGeW0= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= -github.com/LumeraProtocol/lumera v1.8.0 h1:0t5/6qOSs9wKti7utPAWo9Jq8wk2X+L/eEaH8flk/Hc= -github.com/LumeraProtocol/lumera v1.8.0/go.mod h1:38uAZxxleZyXaWKbqOQKwjw7CSX92lTxdF+B7c4SRPw= +github.com/LumeraProtocol/lumera v1.8.1 h1:tN9h7hj1t9ImI0jdLKiTo1TkwCjr0wfT4DenzWh3bdY= +github.com/LumeraProtocol/lumera v1.8.1/go.mod h1:twrSLfuXcHvmfQoN5e02Bg7rfeevUjF34SVqEJIvH1E= github.com/LumeraProtocol/rq-go v0.2.1 h1:8B3UzRChLsGMmvZ+UVbJsJj6JZzL9P9iYxbdUwGsQI4= github.com/LumeraProtocol/rq-go v0.2.1/go.mod h1:APnKCZRh1Es2Vtrd2w4kCLgAyaL5Bqrkz/BURoRJ+O8= github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY= From 737484e92b6ce233ccfef24eef59c377276e6704 Mon Sep 17 00:00:00 2001 From: Matee Ullah Malik Date: Wed, 5 Nov 2025 14:40:01 +0500 Subject: [PATCH 2/2] Update lumera install script --- tests/scripts/install-lumera.sh | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/tests/scripts/install-lumera.sh b/tests/scripts/install-lumera.sh index d3c5773..594a6ef 100755 --- a/tests/scripts/install-lumera.sh +++ b/tests/scripts/install-lumera.sh @@ -41,14 +41,25 @@ GITHUB_API="https://api.github.com/repos/$REPO" if [ "$MODE" == "latest-tag" ]; then if command -v jq >/dev/null 2>&1; then TAG_NAME=$(curl -s "$GITHUB_API/tags" | jq -r '.[0].name') + DOWNLOAD_URL=$(curl -s "$GITHUB_API/releases/tags/$TAG_NAME" \ + | jq -r '.assets[] | select(.name | test("linux_amd64.tar.gz$")) | .browser_download_url') else TAG_NAME=$(curl -s "$GITHUB_API/tags" | grep '"name"' | head -n 1 | sed -E 's/.*"([^"]+)".*/\1/') + DOWNLOAD_URL=$(curl -s "$GITHUB_API/releases/tags/$TAG_NAME" \ + | grep -o '"browser_download_url"[[:space:]]*:[[:space:]]*"[^"]*linux_amd64\.tar\.gz[^"]*"' \ + | sed 's/.*"browser_download_url"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/') fi - DOWNLOAD_URL="https://github.com/${REPO}/releases/download/${TAG_NAME}/lumera_${TAG_NAME}_linux_amd64.tar.gz" elif [[ "$MODE" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then TAG_NAME="$MODE" - DOWNLOAD_URL="https://github.com/${REPO}/releases/download/${TAG_NAME}/lumera_${TAG_NAME}_linux_amd64.tar.gz" + if command -v jq >/dev/null 2>&1; then + DOWNLOAD_URL=$(curl -s "$GITHUB_API/releases/tags/$TAG_NAME" \ + | jq -r '.assets[] | select(.name | test("linux_amd64.tar.gz$")) | .browser_download_url') + else + DOWNLOAD_URL=$(curl -s "$GITHUB_API/releases/tags/$TAG_NAME" \ + | grep -o '"browser_download_url"[[:space:]]*:[[:space:]]*"[^"]*linux_amd64\.tar\.gz[^"]*"' \ + | sed 's/.*"browser_download_url"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/') + fi elif [ "$MODE" == "latest-release" ]; then RELEASE_INFO=$(curl -s -S -L "$GITHUB_API/releases/latest") @@ -103,4 +114,4 @@ fi # Clean up cd "$ORIG_DIR" -rm -rf "$TEMP_DIR" \ No newline at end of file +rm -rf "$TEMP_DIR"