Skip to content

Commit

Permalink
fix: build args, version
Browse files Browse the repository at this point in the history
  • Loading branch information
shev-titan committed Dec 2, 2024
1 parent 63dce8d commit 3531a56
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
4 changes: 2 additions & 2 deletions proxy-router/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ go mod tidy
go build \
-tags docker \
-ldflags="-s -w \
-X 'github.com/Lumerin-protocol/Morpheus-Lumerin-Node/proxy-router/internal/config.BuildVersion=$VERSION' \
-X 'github.com/Lumerin-protocol/Morpheus-Lumerin-Node/proxy-router/internal/config.Commit=$COMMIT' \
-X 'github.com/MorpheusAIs/Morpheus-Lumerin-Node/proxy-router/internal/config.BuildVersion=$VERSION' \
-X 'github.com/MorpheusAIs/Morpheus-Lumerin-Node/proxy-router/internal/config.Commit=$COMMIT' \
" \
-o bin/proxy-router cmd/main.go
8 changes: 6 additions & 2 deletions proxy-router/internal/blockchainapi/rating_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,20 @@ import (
"math/big"
"testing"

"github.com/MorpheusAIs/Morpheus-Lumerin-Node/proxy-router/internal/blockchainapi/scorer"
"github.com/MorpheusAIs/Morpheus-Lumerin-Node/proxy-router/internal/lib"
"github.com/MorpheusAIs/Morpheus-Lumerin-Node/proxy-router/internal/rating"
"github.com/MorpheusAIs/Morpheus-Lumerin-Node/proxy-router/internal/repositories/contracts/bindings/providerregistry"
"github.com/stretchr/testify/require"
)

func TestRating(t *testing.T) {
bidIds, bids, pmStats, mStats := sampleDataTPS()

scoredBids := RateBids(bidIds, bids, pmStats, []providerregistry.IProviderStorageProvider{}, mStats, scorer.NewScorerMock(), big.NewInt(0), lib.NewTestLogger())
bs := BlockchainService{
rating: rating.NewRating(rating.NewScorerMock(), nil, lib.NewTestLogger()),
}

scoredBids := bs.rateBids(bidIds, bids, pmStats, []providerregistry.IProviderStorageProvider{}, mStats, big.NewInt(0), lib.NewTestLogger())

for i := 1; i < len(scoredBids); i++ {
require.GreaterOrEqual(t, scoredBids[i-1].Score, scoredBids[i].Score, "scoredBids not sorted")
Expand Down
13 changes: 10 additions & 3 deletions proxy-router/internal/rating/rating_factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,16 @@ func NewRatingFromConfig(config json.RawMessage, log lib.ILogger) (*Rating, erro
return nil, err
}

return NewRating(scorer, cfg.ProviderAllowList, log), nil
}

func NewRating(scorer Scorer, providerAllowList []common.Address, log lib.ILogger) *Rating {
allowList := map[common.Address]struct{}{}
for _, addr := range cfg.ProviderAllowList {
allowList[addr] = struct{}{}

if providerAllowList != nil {
for _, addr := range providerAllowList {
allowList[addr] = struct{}{}
}
}

providerAllowListLegacy := os.Getenv("PROVIDER_ALLOW_LIST")
Expand Down Expand Up @@ -63,7 +70,7 @@ func NewRatingFromConfig(config json.RawMessage, log lib.ILogger) (*Rating, erro
return &Rating{
scorer: scorer,
providerAllowList: allowList,
}, nil
}
}

var (
Expand Down

0 comments on commit 3531a56

Please sign in to comment.