Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
19 changes: 12 additions & 7 deletions supernode/cascade/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package cascade
import (
"context"
"strconv"
"strings"

"cosmossdk.io/math"
actiontypes "github.com/LumeraProtocol/lumera/x/action/v1/types"
Expand Down Expand Up @@ -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 <nil>", 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
}
17 changes: 14 additions & 3 deletions tests/scripts/install-lumera.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -103,4 +114,4 @@ fi

# Clean up
cd "$ORIG_DIR"
rm -rf "$TEMP_DIR"
rm -rf "$TEMP_DIR"
2 changes: 1 addition & 1 deletion tests/system/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions tests/system/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down