Skip to content

Commit

Permalink
clean
Browse files Browse the repository at this point in the history
  • Loading branch information
pivilartisant committed Dec 3, 2024
1 parent 68a38cc commit 1ddbd0b
Show file tree
Hide file tree
Showing 13 changed files with 6 additions and 23 deletions.
1 change: 0 additions & 1 deletion api/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ func TopMiddleware(handler http.Handler) http.Handler {
if configDir == "" {
var err error
configDir, err = configuration.Path()

if err != nil {
logger.Warnf("TLS: unable to get CA root path: %s", err)
}
Expand Down
1 change: 0 additions & 1 deletion api/swagger/server/restapi/configure_massastation.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ func configureTLS(tlsConfig *tls.Config) {
if caPath == "" {
var err error
caPath, err = configuration.CertPath()

if err != nil {
logger.Warnf("TLS: unable to get CA root path: %s", err)
}
Expand Down
5 changes: 2 additions & 3 deletions int/api/cmd/deploySC.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,12 @@ func (d *deploySC) Handle(params operations.CmdDeploySCParams) middleware.Respon
})
}


operationResponse, events, err := onchain.DeploySC(
d.networkInfos,
params.Body.Nickname,
sendoperation.MaxGasAllowedExecuteSC, // default
maxCoins, // maxCoins
fees, // smart contract deployment "fee"
maxCoins, // maxCoins
fees, // smart contract deployment "fee"
sendoperation.DefaultExpiryInSlot,
parameters,
smartContractByteCode,
Expand Down
1 change: 0 additions & 1 deletion int/api/frontend.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ func MassaStationWebAppHandler(params operations.MassaStationWebAppParams) middl
if err != nil {
resourceName = "index.html"
resourceContent, err = contentReact.ReadFile(basePathReact + "massastation/" + resourceName)

if err != nil {
return operations.NewMassaStationWebAppNotFound()
}
Expand Down
1 change: 0 additions & 1 deletion int/api/myplugin/execute.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ func (e *execute) Handle(params operations.PluginManagerExecuteCommandParams) mi
}

err = plugin.Start()

if err != nil {
return executeFailed(cmd, status,
fmt.Sprintf("Error while restarting plugin %s: %s.\n", pluginName, err))
Expand Down
2 changes: 0 additions & 2 deletions int/api/myplugin/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ func (r *register) Handle(param operations.PluginManagerRegisterParams) middlewa
}

err = wantedPlugin.SetInformation(urlPlugin)

if err != nil {
return operations.NewPluginManagerRegisterBadRequest().WithPayload(
&models.Error{Code: errorCodePluginRegisterInvalidData, Message: fmt.Sprintf("parsing Plugin URL: %s", err.Error())},
Expand All @@ -57,7 +56,6 @@ func (r *register) Handle(param operations.PluginManagerRegisterParams) middlewa
// Add alias for http requests.

err = r.manager.SetAlias(alias, param.Body.ID)

if err != nil {
logger.Debugf("setting plugin alias: %s", err)

Expand Down
1 change: 0 additions & 1 deletion pkg/certstore/store_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ func (s *CertStore) AddCertificate(cert *x509.Certificate) error {
windows.CERT_STORE_ADD_NEW,
nil,
)

if err != nil {
return interpretError(err)
}
Expand Down
1 change: 0 additions & 1 deletion pkg/node/address.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ func Addresses(client *Client, addr []string) ([]Address, error) {

var content []Address
err = response.GetObject(&content)

if err != nil {
return nil, fmt.Errorf("parsing get_addresses jsonrpc response '%+v': %w", response, err)
}
Expand Down
2 changes: 0 additions & 2 deletions pkg/node/sendoperation/sendoperation.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"strings"

"github.com/massalabs/station/pkg/convert"
"github.com/massalabs/station/pkg/logger"
"github.com/massalabs/station/pkg/node"
"github.com/massalabs/station/pkg/node/base58"
"github.com/massalabs/station/pkg/node/sendoperation/signer"
Expand Down Expand Up @@ -77,7 +76,6 @@ func Call(
}

content := createOperationContent(description, msgB64, chainID)
logger.Infof("json content: %v",content)

res, err := signer.Sign(nickname, []byte(content))
if err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ func DecodeAddress(buf *bytes.Reader) (string, error) {
addressBytes := make([]byte, publicKeyHashSize)

_, err = buf.Read(addressBytes)

if err != nil {
return "", fmt.Errorf("failed to read address portion: %w", err)
}
Expand Down
1 change: 0 additions & 1 deletion pkg/node/sendoperation/signer/signer.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ func (s *WalletPlugin) Sign(nickname string, operation []byte) (*SignOperationRe

res := SignOperationResponse{"", "", "", ""}
err = json.Unmarshal(httpRawResponse, &res)

if err != nil {
return nil, fmt.Errorf("unmarshalling '%s' JSON: %w", res, err)
}
Expand Down
10 changes: 4 additions & 6 deletions pkg/onchain/datastore.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,9 @@ type datastoreEntry struct {
Value []byte
}


/*
*
populateDatastore creates and serializes a datastore for the given contract.
*/
func populateDatastore(contract ContractDatastore) ([]byte, error) {
var datastore []datastoreEntry
Expand All @@ -37,15 +35,15 @@ func populateDatastore(contract ContractDatastore) ([]byte, error) {
datastore = append(datastore, datastoreEntry{Key: contractKey, Value: contract.Data})

// args data
//nolint: lll

// hardcoded for now, could be dynamix see: https://github.com/massalabs/massa-web3/blob/main/src/dataStore.ts
argsKey := []byte{1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0}
argsKey := []byte{1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0}
datastore = append(datastore, datastoreEntry{Key: argsKey, Value: contract.Args})

// coins data
//nolint: lll
// 12/02/2024 single contract deployement is supported. Multiple not planned. see https://github.com/massalabs/station/issues/1364
coinsKey := []byte{1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1}
// 12/02/2024 single contract deployement is supported. Multiple not planned. see https://github.com/massalabs/station/issues/1364
coinsKey := []byte{1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1}
datastore = append(datastore, datastoreEntry{Key: coinsKey, Value: convert.U64ToBytes(contract.Coins)})

// Serialize the datastore
Expand Down
2 changes: 0 additions & 2 deletions pkg/plugin/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ func (p *Plugin) getInformation() (*Information, error) {
var info *Information

err = json.Unmarshal(jsonObj, &info)

if err != nil {
return nil, fmt.Errorf("parsing manifest file '%s': %w", manifestPath, err)
}
Expand Down Expand Up @@ -136,7 +135,6 @@ type prefixWriter struct {
func (pw prefixWriter) Write(buf []byte) (n int, err error) {
data := []byte(pw.prefix + string(buf))
n, err = pw.w.Write(data)

if err != nil {
return n, fmt.Errorf("writing logs with prefix: %w", err)
}
Expand Down

0 comments on commit 1ddbd0b

Please sign in to comment.