diff --git a/proxy-router/build.sh b/proxy-router/build.sh index ea7c4235..03a22e3c 100755 --- a/proxy-router/build.sh +++ b/proxy-router/build.sh @@ -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 diff --git a/proxy-router/internal/blockchainapi/rating_test.go b/proxy-router/internal/blockchainapi/rating_test.go index ab57666e..f91ff726 100644 --- a/proxy-router/internal/blockchainapi/rating_test.go +++ b/proxy-router/internal/blockchainapi/rating_test.go @@ -4,8 +4,8 @@ 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" ) @@ -13,7 +13,11 @@ import ( 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") diff --git a/proxy-router/internal/rating/rating_factory.go b/proxy-router/internal/rating/rating_factory.go index 34ff1ef8..0522eaf8 100644 --- a/proxy-router/internal/rating/rating_factory.go +++ b/proxy-router/internal/rating/rating_factory.go @@ -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") @@ -63,7 +70,7 @@ func NewRatingFromConfig(config json.RawMessage, log lib.ILogger) (*Rating, erro return &Rating{ scorer: scorer, providerAllowList: allowList, - }, nil + } } var (