github-vet / github-vet/rangeloop-pointer-findings

UranusBlockStack/uranus: test/dposfaststart/main.go; 12 LoC

Open
#16,480 0 comments 0 reactions 0 assignees View on GitHub
fresh small
Dominant language
No language data
Stars
0
Forks
0
PR merge metrics
PR metrics pending

Description

Found a possible issue in [UranusBlockStack/uranus](https://www.github.com/UranusBlockStack/uranus) at [test/dposfaststart/main.go](https://github.com/UranusBlockStack/uranus/blob/91a82d4c4936f397afaf584c1607ca8d65c01ce9/test/dposfaststart/main.go#L185-L196)

Below is the message reported by the analyzer for this snippet of code. Beware that the analyzer only reports the first issue it finds, so please do not limit your consideration to the contents of the below message.

> reference to addr was used in a composite literal at line 188

[Click here to see the code in its original context.](https://github.com/UranusBlockStack/uranus/blob/91a82d4c4936f397afaf584c1607ca8d65c01ce9/test/dposfaststart/main.go#L185-L196)

Click here to show the 12 line(s) of Go which triggered the analyzer.

```go
for addr, priv := range producers {
nonce := getnonce(addr)
fmt.Println("Tx(Delegate) from [", addr.String(), "] to:[", addr.String(), "] nonce:", nonce)
txVote := types.NewTransaction(types.Delegate, nonce, val, gasLimit, gasPrice, nil, []*utils.Address{&addr}...)
txVote.SignTx(signer, priv)
result, err := sendrawtransaction(txVote)
if err != nil {
fmt.Println("sendrawtransaction failed:", err)
} else {
fmt.Println("Tx Hash:", result.String())
}
}

```

Leave a reaction on this issue to contribute to the project by classifying this instance as a **Bug** :-1:, **Mitigated** :+1:, or **Desirable Behavior** :rocket:
See the descriptions of the classifications [here](https://github.com/github-vet/rangeclosure-findings#how-can-i-help) for more information.

commit ID: 91a82d4c4936f397afaf584c1607ca8d65c01ce9

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with test/dposfaststart/main.go at lines 185-196 and inspect how the range variables are used in the transaction construction. Check the reported reference to addr and any other analyzer findings in this snippet. Done means the finding is resolved or confirmed as intended without changing the surrounding transaction behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
blockchain
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.