Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor, move lighthouseURL to conf, fix naming in build #604

Merged
merged 3 commits into from
Nov 25, 2024
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
5 changes: 2 additions & 3 deletions authutils/auth_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,8 @@ func CurrentBlock() (*big.Int, error) {

// VerifyAddress Check if the payment address/signer passed matches to what is present in the metadata
func VerifyAddress(address common.Address, otherAddress common.Address) error {
isSameAddress := otherAddress == address
if !isSameAddress {
return fmt.Errorf("the Address: %s does not match to what has been expected / registered", blockchain.AddressToHex(&address))
if otherAddress != address {
return fmt.Errorf("the address: %s does not match to what has been expected / registered", blockchain.AddressToHex(&address))
}
return nil
}
Expand Down
7 changes: 7 additions & 0 deletions authutils/auth_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
package authutils

import (
"github.com/ethereum/go-ethereum/common"
"math/big"
"testing"
"time"
Expand Down Expand Up @@ -34,3 +35,9 @@ func TestCheckAllowedBlockDifferenceForToken(t *testing.T) {
err = CheckIfTokenHasExpired(currentBlockNum.Add(currentBlockNum, big.NewInt(20)))
assert.Equal(t, nil, err)
}

func TestVerifyAddress(t *testing.T) {
var addr = common.Address(common.FromHex("0x7DF35C98f41F3AF0DF1DC4C7F7D4C19A71DD079F"))
var addrLowCase = common.Address(common.FromHex("0x7df35c98f41f3af0df1dc4c7f7d4c19a71Dd079f"))
assert.Nil(t, VerifyAddress(addr, addrLowCase))
}
2 changes: 2 additions & 0 deletions blockchain/ethereumClient.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package blockchain
import (
"context"
"encoding/base64"
"go.uber.org/zap"

"github.com/singnet/snet-daemon/v5/config"

Expand Down Expand Up @@ -42,6 +43,7 @@ func CreateHTTPEthereumClient() (*EthereumClient, error) {
config.GetBlockChainHTTPEndPoint(),
rpc.WithHeader("Authorization", "Basic "+basicAuth("", config.GetString(config.BlockchainProviderApiKey))))
if err != nil {
zap.L().Error("Error creating ethereum client", zap.Error(err), zap.String("endpoint", config.GetBlockChainHTTPEndPoint()))
return nil, errors.Wrap(err, "error creating RPC client")
}

Expand Down
32 changes: 18 additions & 14 deletions blockchain/serviceMetadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,14 +254,20 @@ func (metaData ServiceMetadata) GetDefaultPricing() Pricing {
func ServiceMetaData() *ServiceMetadata {
var metadata *ServiceMetadata
var err error
if config.GetBool(config.BlockchainEnabledKey) {
ipfsHash := string(getServiceMetaDataURIfromRegistry())
metadata, err = GetServiceMetaDataFromIPFS(ipfsHash)
if err != nil {
zap.L().Panic("error on determining service metadata from file"+errs.ErrDescURL(errs.InvalidMetadata), zap.Error(err))
}
} else {
var ipfsHash []byte
if !config.GetBool(config.BlockchainEnabledKey) {
metadata = &ServiceMetadata{Encoding: "proto", ServiceType: "grpc"}
return metadata
}
ipfsHash, err = getServiceMetaDataURIfromRegistry()
if err != nil {
zap.L().Fatal("error retrieving contract details for the given organization and service ids"+errs.ErrDescURL(errs.InvalidConfig),
zap.String("OrganizationId", config.GetString(config.OrganizationId)),
zap.String("ServiceId", config.GetString(config.ServiceId)))
}
metadata, err = GetServiceMetaDataFromIPFS(string(ipfsHash))
if err != nil {
zap.L().Panic("error on determining service metadata from file"+errs.ErrDescURL(errs.InvalidMetadata), zap.Error(err))
}
zap.L().Debug("service type: " + metadata.GetServiceType())
return metadata
Expand Down Expand Up @@ -302,20 +308,18 @@ func GetRegistryFilterer(ethWsClient *ethclient.Client) *RegistryFilterer {
return reg
}

func getServiceMetaDataURIfromRegistry() []byte {
func getServiceMetaDataURIfromRegistry() ([]byte, error) {
reg := getRegistryCaller()

orgId := StringToBytes32(config.GetString(config.OrganizationId))
serviceId := StringToBytes32(config.GetString(config.ServiceId))

serviceRegistration, err := reg.GetServiceRegistrationById(nil, orgId, serviceId)
if err != nil || !serviceRegistration.Found {
zap.L().Panic("Error Retrieving contract details for the Given Organization and Service Ids ",
zap.String("OrganizationId", config.GetString(config.OrganizationId)),
zap.String("ServiceId", config.GetString(config.ServiceId)))
return nil, fmt.Errorf("error retrieving contract details for the given organization and service ids")
}

return serviceRegistration.MetadataURI[:]
return serviceRegistration.MetadataURI[:], nil
}

func GetServiceMetaDataFromIPFS(hash string) (*ServiceMetadata, error) {
Expand Down Expand Up @@ -355,7 +359,7 @@ func InitServiceMetaDataFromJson(jsonData []byte) (*ServiceMetadata, error) {
zap.L().Error(err.Error())
}

zap.L().Debug("Training method", zap.String("json", string(trainingMethodsJson)))
zap.L().Debug("Training methods", zap.String("json", string(trainingMethodsJson)))

return metaData, err
}
Expand Down Expand Up @@ -511,7 +515,7 @@ func setServiceProto(metaData *ServiceMetadata) (err error) {

// If Dynamic pricing is enabled, there will be mandatory checks on the service proto
//this is to ensure that the standards on how one defines the methods to invoke is followed
if config.GetBool(config.EnableDynamicPricing) {
if config.GetBool(config.EnableDynamicPricing) || config.GetBool(config.ModelTrainingEnabled) {
if srvProto, err := parseServiceProto(file); err != nil {
return err
} else {
Expand Down
10 changes: 6 additions & 4 deletions blockchain/serviceMetadata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ func TestAllGetterMethods(t *testing.T) {
assert.True(t, metaData.IsFreeCallAllowed())
assert.Equal(t, 12, metaData.GetFreeCallsAllowed())
assert.Equal(t, metaData.GetLicenses().Subscriptions.Type, "Subscription")

}

func TestSubscription(t *testing.T) {
Expand Down Expand Up @@ -86,10 +85,13 @@ func TestReadServiceMetaDataFromLocalFile(t *testing.T) {
}

func Test_getServiceMetaDataUrifromRegistry(t *testing.T) {
assert.Panics(t, func() { getServiceMetaDataURIfromRegistry() })
config.Vip().Set(config.BlockChainNetworkSelected, "sepolia")
config.Validate()
assert.Panics(t, func() { getServiceMetaDataURIfromRegistry() })
_, err := getServiceMetaDataURIfromRegistry()
assert.NotNil(t, err)
config.Vip().Set(config.ServiceId, "semyon_dev")
config.Vip().Set(config.OrganizationId, "semyon_dev")
_, err = getServiceMetaDataURIfromRegistry()
assert.Nil(t, err)
}

func Test_setDefaultPricing(t *testing.T) {
Expand Down
8 changes: 6 additions & 2 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const (
ExecutablePathKey = "executable_path"
EnableDynamicPricing = "enable_dynamic_pricing"
IpfsEndPoint = "ipfs_end_point"
LighthouseEndpoint = "lighthouse_endpoint"
IpfsTimeout = "ipfs_timeout"
LogKey = "log"
MaxMessageSizeInMB = "max_message_size_in_mb"
Expand Down Expand Up @@ -77,7 +78,8 @@ const (
"daemon_end_point": "127.0.0.1:8080",
"daemon_group_name":"default_group",
"payment_channel_storage_type": "etcd",
"ipfs_end_point": "http://ipfs.singularitynet.io:80",
"ipfs_end_point": "https://ipfs.singularitynet.io:443",
"lighthouse_endpoint": "https://gateway.lighthouse.storage/ipfs/",
"ipfs_timeout" : 30,
"passthrough_enabled": true,
"passthrough_endpoint":"YOUR_SERVICE_ENDPOINT",
Expand Down Expand Up @@ -144,7 +146,8 @@ const (
"daemon_group_name":"default_group",
"passthrough_enabled": true,
"payment_channel_storage_type": "etcd",
"ipfs_end_point": "http://ipfs.singularitynet.io:80",
"ipfs_end_point": "https://ipfs.singularitynet.io:443",
"lighthouse_endpoint": "https://gateway.lighthouse.storage/ipfs/",
"log": {
"output": {
"type": ["file", "stdout"]
Expand Down Expand Up @@ -349,6 +352,7 @@ var DisplayKeys = map[string]bool{
strings.ToUpper(DaemonEndPoint): true,
strings.ToUpper(ExecutablePathKey): true,
strings.ToUpper(IpfsEndPoint): true,
strings.ToUpper(LighthouseEndpoint): true,
strings.ToUpper(IpfsTimeout): true,
strings.ToUpper(LogKey): true,
strings.ToUpper(MaxMessageSizeInMB): true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (l *ContractEventListener) ListenOrganizationMetadataChanging() {
select {
case err := <-sub.Err():
if err != nil {
zap.L().Error("Subscription error: ", zap.Error(err))
zap.L().Warn("Subscription error: ", zap.Error(err))
if websocket.IsCloseError(
err,
websocket.CloseNormalClosure,
Expand Down
14 changes: 12 additions & 2 deletions etcddb/etcddb_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -443,8 +443,18 @@ func (client *EtcdClient) getState(keySet *set.Set, getResp *clientv3.GetRespons

// Close closes etcd client
func (client *EtcdClient) Close() {
defer client.session.Close()
defer client.etcdv3.Close()
defer func(etcdv3 *clientv3.Client) {
err := etcdv3.Close()
if err != nil {
zap.L().Error("close etcd client failed", zap.Error(err))
}
}(client.etcdv3)
defer func(session *concurrency.Session) {
err := session.Close()
if err != nil {
zap.L().Error("close session failed", zap.Error(err))
}
}(client.session)
}

func (client *EtcdClient) StartTransaction(keys []string) (_transaction storage.Transaction, err error) {
Expand Down
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/OneOfOne/go-utils v0.0.0-20180319162427-6019ff89a94e
github.com/bufbuild/protocompile v0.14.1
github.com/emicklei/proto v1.13.2
github.com/ethereum/go-ethereum v1.14.11
github.com/ethereum/go-ethereum v1.14.12
github.com/golang-collections/collections v0.0.0-20130729185459-604e922904d3
github.com/golang-jwt/jwt/v5 v5.2.1
github.com/gorilla/handlers v1.5.2
Expand All @@ -15,7 +15,7 @@ require (
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0
github.com/improbable-eng/grpc-web v0.15.0
github.com/ipfs/go-cid v0.4.1
github.com/ipfs/kubo v0.32.0
github.com/ipfs/kubo v0.32.1
github.com/magiconair/properties v1.8.7
github.com/pkg/errors v0.9.1
github.com/rs/cors v1.11.1
Expand Down Expand Up @@ -88,7 +88,7 @@ require (
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
github.com/gofrs/flock v0.8.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
github.com/golang-jwt/jwt/v4 v4.5.1 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect
github.com/google/btree v1.1.2 // indirect
Expand Down Expand Up @@ -145,7 +145,7 @@ require (
github.com/libp2p/go-flow-metrics v0.2.0 // indirect
github.com/libp2p/go-libp2p v0.37.0 // indirect
github.com/libp2p/go-libp2p-asn-util v0.4.1 // indirect
github.com/libp2p/go-libp2p-kad-dht v0.28.0 // indirect
github.com/libp2p/go-libp2p-kad-dht v0.28.1 // indirect
github.com/libp2p/go-libp2p-kbucket v0.6.4 // indirect
github.com/libp2p/go-libp2p-record v0.2.0 // indirect
github.com/libp2p/go-libp2p-routing-helpers v0.7.4 // indirect
Expand Down
8 changes: 8 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@ github.com/ethereum/c-kzg-4844 v1.0.3 h1:IEnbOHwjixW2cTvKRUlAAUOeleV7nNM/umJR+qy
github.com/ethereum/c-kzg-4844 v1.0.3/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0=
github.com/ethereum/go-ethereum v1.14.11 h1:8nFDCUUE67rPc6AKxFj7JKaOa2W/W1Rse3oS6LvvxEY=
github.com/ethereum/go-ethereum v1.14.11/go.mod h1:+l/fr42Mma+xBnhefL/+z11/hcmJ2egl+ScIVPjhc7E=
github.com/ethereum/go-ethereum v1.14.12 h1:8hl57x77HSUo+cXExrURjU/w1VhL+ShCTJrTwcCQSe4=
github.com/ethereum/go-ethereum v1.14.12/go.mod h1:RAC2gVMWJ6FkxSPESfbshrcKpIokgQKsVKmAuqdekDY=
github.com/ethereum/go-verkle v0.1.1-0.20240829091221-dffa7562dbe9 h1:8NfxH2iXvJ60YRB8ChToFTUzl8awsc3cJ8CbLjGIl/A=
github.com/ethereum/go-verkle v0.1.1-0.20240829091221-dffa7562dbe9/go.mod h1:M3b90YRnzqKyyzBEWJGqj8Qff4IDeXnzFw0P9bFw3uk=
github.com/facebookgo/atomicfile v0.0.0-20151019160806-2de1f203e7d5 h1:BBso6MBKW8ncyZLv37o+KNyy0HrrHgfnOaGQC2qvN+A=
Expand Down Expand Up @@ -292,6 +294,8 @@ github.com/golang-collections/collections v0.0.0-20130729185459-604e922904d3 h1:
github.com/golang-collections/collections v0.0.0-20130729185459-604e922904d3/go.mod h1:nPpo7qLxd6XL3hWJG/O60sR8ZKfMCiIoNap5GvD12KU=
github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg=
github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
github.com/golang-jwt/jwt/v4 v4.5.1 h1:JdqV9zKUdtaa9gdPlywC3aeoEsR681PlKC+4F5gQgeo=
github.com/golang-jwt/jwt/v4 v4.5.1/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk=
github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
Expand Down Expand Up @@ -528,6 +532,8 @@ github.com/ipfs/go-verifcid v0.0.3 h1:gmRKccqhWDocCRkC+a59g5QW7uJw5bpX9HWBevXa0z
github.com/ipfs/go-verifcid v0.0.3/go.mod h1:gcCtGniVzelKrbk9ooUSX/pM3xlH73fZZJDzQJRvOUw=
github.com/ipfs/kubo v0.32.0 h1:0in5oT7WaCkkJ6JyOFH/NiNFYK7z1oELpFLgKTXU7Ak=
github.com/ipfs/kubo v0.32.0/go.mod h1:vtxKR1IburF+anxjesDMp39LT8H5YYmZV/Yk5t5xNAk=
github.com/ipfs/kubo v0.32.1 h1:nkx5qrkMeJ2f1ET7v3vx7U1ycurM0dC9R7AnsuSrNjk=
github.com/ipfs/kubo v0.32.1/go.mod h1:7fi1IMPgW5fupyMFUjJ4d4zbvkTEwq6tV3T+EQvtF28=
github.com/ipld/go-car v0.6.2 h1:Hlnl3Awgnq8icK+ze3iRghk805lu8YNq3wlREDTF2qc=
github.com/ipld/go-car v0.6.2/go.mod h1:oEGXdwp6bmxJCZ+rARSkDliTeYnVzv3++eXajZ+Bmr8=
github.com/ipld/go-car/v2 v2.14.2 h1:9ERr7KXpCC7If0rChZLhYDlyr6Bes6yRKPJnCO3hdHY=
Expand Down Expand Up @@ -613,6 +619,8 @@ github.com/libp2p/go-libp2p-asn-util v0.4.1 h1:xqL7++IKD9TBFMgnLPZR6/6iYhawHKHl9
github.com/libp2p/go-libp2p-asn-util v0.4.1/go.mod h1:d/NI6XZ9qxw67b4e+NgpQexCIiFYJjErASrYW4PFDN8=
github.com/libp2p/go-libp2p-kad-dht v0.28.0 h1:sDqfW784w7CZQLlnMUwfeqWfXcpedKeZIM/B9/w0Tbk=
github.com/libp2p/go-libp2p-kad-dht v0.28.0/go.mod h1:0wHURlSFdAC42+wF7GEmpLoARw8JuS8do2guCtc/Y/w=
github.com/libp2p/go-libp2p-kad-dht v0.28.1 h1:DVTfzG8Ybn88g9RycIq47evWCRss5f0Wm8iWtpwyHso=
github.com/libp2p/go-libp2p-kad-dht v0.28.1/go.mod h1:0wHURlSFdAC42+wF7GEmpLoARw8JuS8do2guCtc/Y/w=
github.com/libp2p/go-libp2p-kbucket v0.6.4 h1:OjfiYxU42TKQSB8t8WYd8MKhYhMJeO2If+NiuKfb6iQ=
github.com/libp2p/go-libp2p-kbucket v0.6.4/go.mod h1:jp6w82sczYaBsAypt5ayACcRJi0lgsba7o4TzJKEfWA=
github.com/libp2p/go-libp2p-pubsub v0.12.0 h1:PENNZjSfk8KYxANRlpipdS7+BfLmOl3L2E/6vSNjbdI=
Expand Down
2 changes: 0 additions & 2 deletions handler/interceptors.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,7 @@ func GrpcPaymentValidationInterceptor(serviceData *blockchain.ServiceMetadata, d
interceptor.paymentHandlers[handler.Type()] = handler
zap.L().Info("Payment handler for type registered", zap.Any("paymentType", handler.Type()))
}

return interceptor.intercept

}

type paymentValidationInterceptor struct {
Expand Down
8 changes: 8 additions & 0 deletions ipfsutils/common_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package ipfsutils

import (
"fmt"
"github.com/stretchr/testify/assert"
"testing"
)
Expand All @@ -11,6 +12,13 @@ func TestReadFile(t *testing.T) {
assert.NotNil(t, file)
}

func TestIpfsReadFile(t *testing.T) {
file, err := ReadFile("ipfs://QmQcT5SJB9s8LXom8zuNGksCa7d34XbVn52dACWvgzeWAW")
assert.Nil(t, err)
assert.NotNil(t, file)
fmt.Println(string(file))
}

func TestFormatHash(t *testing.T) {
s2 := []byte("ipfs://Here is a string....+=")
hash := formatHash(string(s2))
Expand Down
2 changes: 1 addition & 1 deletion ipfsutils/compressed.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func ReadFilesCompressed(compressedFile []byte) (protofiles []string, err error)
case tar.TypeDir:
zap.L().Debug("Directory name", zap.String("name", name))
case tar.TypeReg:
zap.L().Debug("File name", zap.String("name", name))
zap.L().Debug("File from archive", zap.String("name", name))
data := make([]byte, header.Size)
_, err := tarReader.Read(data)
if err != nil && err != io.EOF {
Expand Down
10 changes: 10 additions & 0 deletions ipfsutils/ipfsutils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@ func (suite *IpfsUtilsTestSuite) BeforeTest() {
assert.NotNil(suite.T(), suite.ipfsClient)
}

func (suite *IpfsUtilsTestSuite) TestGetProtoFiles() {
hash := "ipfs://Qmc32Gi3e62gcw3fFfRPidxrGR7DncNki2ptfh9rVESsTc"
data, err := ReadFile(hash)
assert.Nil(suite.T(), err)
assert.NotNil(suite.T(), data)
protoFiles, err := ReadFilesCompressed(data)
assert.Nil(suite.T(), err)
assert.NotNil(suite.T(), protoFiles)
}

func (suite *IpfsUtilsTestSuite) TestReadFiles() {
// For testing purposes, a hash is used from the calculator service.
hash := "QmeyrQkEyba8dd4rc3jrLd5pEwsxHutfH2RvsSaeSMqTtQ"
Expand Down
5 changes: 2 additions & 3 deletions ipfsutils/lighthouse.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
package ipfsutils

import (
"github.com/singnet/snet-daemon/v5/config"
"io"
"net/http"
)

const lighthouseURL = "https://gateway.lighthouse.storage/ipfs/"

func GetLighthouseFile(cID string) ([]byte, error) {
resp, err := http.Get(lighthouseURL + cID)
resp, err := http.Get(config.GetString(config.LighthouseEndpoint) + cID)
if err != nil {
return nil, err
}
Expand Down
1 change: 0 additions & 1 deletion pricing/pricing_strategy.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ func (pricing PricingStrategy) determinePricingApplicable(context *handler.GrpcS
} else {
zap.L().Info("No Dynamic Price method defined in service proto", zap.String("Method", context.Info.FullMethod))
}

}
//Default pricing is Fixed Pricing
return pricing.pricingTypes[pricing.serviceMetaData.GetDefaultPricing().PriceModel], nil
Expand Down
8 changes: 4 additions & 4 deletions scripts/build
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ fi

CGO_ENABLED=0 GOOS=$1 GOARCH=$2 go build -ldflags "
-X google.golang.org/protobuf/reflect/protoregistry.conflictPolicy=ignore
-X github.com/singnet/snet-daemon/config.sha1Revision=$githash
-X github.com/singnet/snet-daemon/config.versionTag=$3
-X github.com/singnet/snet-daemon/config.buildTime=$now
-X 'github.com/singnet/snet-daemon/config.networkIdNameMapping=$networkJson'
-X github.com/singnet/snet-daemon/v5/config.sha1Revision=$githash
-X github.com/singnet/snet-daemon/v5/config.versionTag=$3
-X github.com/singnet/snet-daemon/v5/config.buildTime=$now
-X 'github.com/singnet/snet-daemon/v5/config.networkIdNameMapping=$networkJson'
" -o build/"$buildname" snetd/main.go
popd

Expand Down
8 changes: 4 additions & 4 deletions scripts/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ if ($GOOS -eq "windows")
# build with Go
$Env:CGO_ENABLED = 0; $Env:GOOS = $GOOS; $Env:GOARCH = $GOARCH; go build -ldflags "
-X google.golang.org/protobuf/reflect/protoregistry.conflictPolicy=ignore
-X github.com/singnet/snet-daemon/config.sha1Revision=$GitHash
-X github.com/singnet/snet-daemon/config.versionTag=$Version
-X github.com/singnet/snet-daemon/config.buildTime=$Now
-X 'github.com/singnet/snet-daemon/config.networkIdNameMapping=$NetworkJson'" -o (Join-Path $BuildDirectory $BuildName) snetd/main.go
-X github.com/singnet/snet-daemon/v5/config.sha1Revision=$GitHash
-X github.com/singnet/snet-daemon/v5/config.versionTag=$Version
-X github.com/singnet/snet-daemon/v5/config.buildTime=$Now
-X 'github.com/singnet/snet-daemon/v5/config.networkIdNameMapping=$NetworkJson'" -o (Join-Path $BuildDirectory $BuildName) snetd/main.go

# return to previous directory
Pop-Location
Expand Down
1 change: 0 additions & 1 deletion snetd/cmd/components.go
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,6 @@ func (components *Components) GrpcPaymentValidationInterceptor() grpc.StreamServ
if config.GetBool(config.AllowedUserFlag) {
zap.L().Info("Blockchain is disabled And AllowedUserFlag is enabled")
return handler.GrpcPaymentValidationInterceptor(components.ServiceMetaData(), components.AllowedUserPaymentHandler())

}
zap.L().Info("Blockchain is disabled: no payment validation")
return handler.NoOpInterceptor
Expand Down
Loading
Loading