Comments (4)
According to the go doc, Atoi is equivalent to ParseInt(s, 10, 0)
. I don't see there is necessity to use ParseInt. We can close it after one more agreement from @Brando753 @smartyalgo @banshee
from sifnode.
So the issue is:
AtoI outputs int32/int64 depending on the machine.
This could be an issue if downstream expects int32, and we're passing int64
e.g.
In cli/tx.go
func GetCmdUpdateWhiteListValidator() *cobra.Command {
...
188 power , err := strconv . Atoi ( args [2])
power is type int, aka int64 depending on the machine. Later on, it is cast as uint32 to updateWhiteListValidator, thus downcasting.
if caller tries to update validator power to 4294967296 (max uint32 + 1), the uint32 cast results in 0
ParseInt returns an err, which will tell us when string input is out of range, thus preventing input beyond int32 range
var power64string string = "9223372036854775807"
power32, err := strconv.ParseInt(power64string, 10, 32)
if err != nil {
fmt.Println("Errored", err)
}
fmt.Println(power32)
Gives
Errored strconv.ParseInt: parsing "9223372036854775807": value out of range
2147483647
from sifnode.
I agree, ParseInt can avoid this downcasting error. will create a PR to fix it.
from sifnode.
close it after #3287 merged.
from sifnode.
Related Issues (20)
- HAL-03 lack of validation on setblacklist message HOT 2
- HAL-04 sensitive information in environment variables HOT 2
- HAL-05 lack of validation of ethereum address formats HOT 7
- HAL-06 iteration over map source of non-determinism HOT 10
- HAL-09 hardcoded mnemonic phrases in the repository HOT 1
- HAL-10 use of outdated solidity version HOT 4
- HAL-12 open todos HOT 2
- HAL-14 unused variables HOT 2
- HAL-13 panic is used for error handling HOT 3
- Add peggy2 test case for a token that does a reentrant lock/burn
- Peggy2 protobuf files need to be compatible with peggy1 HOT 2
- saw in the validator logs `module=x/ibc/channel sequence="marshaling error: json: unsupported type: func() uint64"`
- Add missing integration test to github action
- Enhance Non-Rowan Yield Reward Functionality with Optional Duration Feature HOT 3
- Enhance Non-Rowan Yield Reward Functionality with Optional Duration Feature
- Enhance Non-Rowan Yield Reward Functionality with Optional Duration Feature HOT 1
- Enhance Non-Rowan Yield Reward Functionality with Optional Duration Feature HOT 2
- Enhance Non-Rowan Yield Reward Functionality with Optional Duration Feature HOT 1
- The SifChain website should be revamped
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sifnode.