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

Removal of un-checked numerics #2577

Closed
prasannavl opened this issue Oct 13, 2023 · 1 comment
Closed

Removal of un-checked numerics #2577

prasannavl opened this issue Oct 13, 2023 · 1 comment
Labels

Comments

@prasannavl
Copy link
Member

prasannavl commented Oct 13, 2023

A tracker to remove all the unchecked numeric ops on the Rust crates

@prasannavl prasannavl added the bug label Oct 13, 2023
@prasannavl
Copy link
Member Author

prasannavl commented Oct 13, 2023

Safety and miner opt. PRs like #2575 will incidentally cover this up (which was the cause for rc1 crash), but a few more left:

A quick grep after #2567.

rg -g "lib/**/*.rs" '\w* [-+*/] \w*'

Key usages (and likely a few more):

lib/ain-evm/src/executor.rs                                    
205:        if !system_tx && total_gas_used + U256::from(used_gas) > block_gas_limit {

lib/ain-evm/src/evm.rs                                         
182:        let total_burnt_fees = template.total_gas_used * base_fee;
183:        let total_priority_fees = total_gas_fees - total_burnt_fees;
516:            Some(block) => (block.header.number + 1, block.header.state_root),

lib/ain-evm/src/receipt.rs                                     
96:                    logs_index: logs_size - logs_len,

lib/ain-evm/src/weiamount.rs                                   
21:        Ok(self.0 / WEI_TO_GWEI)
30:        Ok(self.0 / WEI_TO_SATS)

lib/ain-grpc/src/rpc/debug.rs                                  
190:                let gas_fee = cmp::min(max_fee_per_gas, max_priority_fee_per_gas + base_fee);
202:        let burnt_fee = used_gas * base_fee;
203:        let priority_fee = gas_fee - burnt_fee;

lib/ain-grpc/src/rpc/debug.rs                                  
190:                let gas_fee = cmp::min(max_fee_per_gas, max_priority_fee_per_gas + base_fee);
202:        let burnt_fee = used_gas * base_fee;
203:        let priority_fee = gas_fee - burnt_fee;

@prasannavl prasannavl changed the title Removal of un-checked ops Removal of un-checked numerics Oct 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant