Skip to content

Commit

Permalink
Minor fixes (#878)
Browse files Browse the repository at this point in the history
* remove type conversion not needed

* typos and fix comments

* remove unnecessary type conversion, txCost is already uint64
  • Loading branch information
mariajdab authored Apr 11, 2023
1 parent 4f0fe1e commit c9425c1
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 15 deletions.
12 changes: 6 additions & 6 deletions api/autoswag/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ func UpdateRouterTags(fset *token.FileSet, parsedFile *ast.File, fmap map[string
for _, pm := range pms {
line := &ast.Comment{
Text: fmt.Sprintf("//\t@Router %s [%s]", pm.path, pm.method),
Slash: token.Pos(int(x.Pos() - 1)),
Slash: x.Pos() - 1,
}
list = append(list, line)
}
Expand Down Expand Up @@ -201,23 +201,23 @@ func InitComments(fset *token.FileSet, parsedFile *ast.File, fmap map[string][]P
list := []*ast.Comment{}
list = append(list, &ast.Comment{
Text: fmt.Sprintf("// %s", x.Name.Name),
Slash: token.Pos(int(x.Pos() - 1)),
Slash: x.Pos() - 1,
})
list = append(list, &ast.Comment{
Text: "//",
Slash: token.Pos(int(x.Pos() - 1)),
Slash: x.Pos() - 1,
})
list = append(list, &ast.Comment{
Text: "// @Summary TODO",
Slash: token.Pos(int(x.Pos() - 1)),
Slash: x.Pos() - 1,
})
list = append(list, &ast.Comment{
Text: "// @Description TODO",
Slash: token.Pos(int(x.Pos() - 1)),
Slash: x.Pos() - 1,
})
list = append(list, &ast.Comment{
Text: "// @Success 200 {object} object",
Slash: token.Pos(int(x.Pos() - 1)),
Slash: x.Pos() - 1,
})

cmap[x] = []*ast.CommentGroup{
Expand Down
2 changes: 1 addition & 1 deletion apiclient/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ func (c *HTTPclient) SetHostAddr(addr *url.URL) error {
return nil
}

// Request performs a `method` type raw request to the endpoint specyfied in urlPath parameter.
// Request performs a `method` type raw request to the endpoint specified in urlPath parameter.
// Method is either GET or POST. If POST, a JSON struct should be attached. Returns the response,
// the status code and an error.
func (c *HTTPclient) Request(method string, jsonBody any, urlPath ...string) ([]byte, int, error) {
Expand Down
2 changes: 1 addition & 1 deletion apiclient/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func (c *HTTPclient) WaitUntilTxIsMined(ctx context.Context,
}
}

// GetFaucetPackageFromDefaultDevService returns a faucet package.
// GetFaucetPackageFromDevService returns a faucet package.
// Needs just the destination wallet address, the URL and bearer token are hardcoded
func GetFaucetPackageFromDevService(account string) (*models.FaucetPackage, error) {
return GetFaucetPackageFromRemoteService(
Expand Down
2 changes: 1 addition & 1 deletion cmd/cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ func accountSetMetadata(cli *vocdoniCLI) error {
}

func electionHandler(cli *vocdoniCLI) error {
infoPrint.Printf("preparing the eletion template...\n")
infoPrint.Printf("preparing the election template...\n")
description := api.ElectionDescription{
Title: map[string]string{"default": "election title"},
Description: map[string]string{"default": "election description"},
Expand Down
4 changes: 2 additions & 2 deletions cmd/end2endtest/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,12 @@ func testSendTokens(api *apiclient.HTTPclient, aliceKeys, bobKeys *ethereum.Sign

// now check the resulting state
err = checkAccountNonceAndBalance(alice, aliceAcc.Nonce+1,
(aliceAcc.Balance - amountAtoB - uint64(txCost) + amountBtoA))
(aliceAcc.Balance - amountAtoB - txCost + amountBtoA))
if err != nil {
return err
}
err = checkAccountNonceAndBalance(bob, bobAcc.Nonce+1,
(bobAcc.Balance - amountBtoA - uint64(txCost) + amountAtoB))
(bobAcc.Balance - amountBtoA - txCost + amountAtoB))
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/vochaintest/vochaintest.go
Original file line number Diff line number Diff line change
Expand Up @@ -1289,7 +1289,7 @@ func (c *testClient) testSetAccountDelegate(signer, signer2 *ethereum.SignKeys)
}
addedDelegate := common.BytesToAddress(acc.DelegateAddrs[0])
if addedDelegate != signer2.Address() {
log.Fatalf("expeted delegate to be %s got %s", signer2.Address(), addedDelegate)
log.Fatalf("expected delegate to be %s got %s", signer2.Address(), addedDelegate)
}
// delete delegate
acc, err = c.GetAccount(signer.Address())
Expand Down
2 changes: 1 addition & 1 deletion cmd/voconed/voconed.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func main() {
flag.IntVar(&config.port, "port", 9095, "network port for the HTTP API")
flag.StringVar(&config.path, "urlPath", "/api", "HTTP path for the API rest")
flag.IntVar(&config.blockSeconds, "blockPeriod", int(vocone.DefaultBlockTimeTarget.Seconds()), "block time target in seconds")
flag.IntVar(&config.blockSize, "blockSize", int(vocone.DefaultTxsPerBlock), "max number of transactions per block")
flag.IntVar(&config.blockSize, "blockSize", vocone.DefaultTxsPerBlock, "max number of transactions per block")
setTxCosts := flag.Bool("setTxCosts", false, "if true, transaction costs are set to the value of txCosts flag")
flag.Uint64Var(&config.txCosts, "txCosts", vocone.DefaultTxCosts, "transaction costs for all types")
flag.Uint64Var(&config.enableFaucetWithAmount, "enableFaucet", 0, "enable faucet API service for the given amount")
Expand Down
4 changes: 2 additions & 2 deletions vochain/transaction/vote_tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ func (t *TransactionHandler) VoteTxCheck(vtx *vochaintx.VochainTx, forCommit boo
return vote, nil
}

// initializeZkVote initializes a zkSNARK vote. It does not check the proof nor includes the the weight of the vote.
// initializeZkVote initializes a zkSNARK vote. It does not check the proof nor includes the weight of the vote.
func initializeZkVote(voteEnvelope *models.VoteEnvelope, height uint32) *vstate.Vote {
return &vstate.Vote{
Height: height,
Expand All @@ -208,7 +208,7 @@ func initializeZkVote(voteEnvelope *models.VoteEnvelope, height uint32) *vstate.
}
}

// initializeSignedVote initializes a signed vote. It does not check the proof nor includes the the weight of the vote.
// initializeSignedVote initializes a signed vote. It does not check the proof nor includes the weight of the vote.
func initializeSignedVote(voteEnvelope *models.VoteEnvelope,
signedBody, signature []byte, height uint32) (*vstate.Vote, error) {
// Create a new vote object with the provided parameters
Expand Down

0 comments on commit c9425c1

Please sign in to comment.