Skip to content

Commit

Permalink
fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Eikix committed Jan 20, 2025
1 parent 203db75 commit c4140c2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
4 changes: 2 additions & 2 deletions cairo/ethereum/cancun/state.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ func move_ether{range_check_ptr, poseidon_ptr: PoseidonBuiltin*, state: State}(
let sender_balance = sender_account.value.balance;

let is_sender_balance_sufficient = U256_le(amount, sender_balance);
if (is_sender_balance_sufficient.value == 0) {
assert 0 = 1;
with_attr error_message("Sender has insufficient balance") {
assert is_sender_balance_sufficient.value = 1;
}

let new_sender_account_balance = U256_sub(sender_balance, amount);
Expand Down
14 changes: 6 additions & 8 deletions cairo/ethereum/utils/numeric.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,11 @@ func U256_from_be_bytes20{range_check_ptr, bitwise_ptr: BitwiseBuiltin*}(bytes20
func U256_add{range_check_ptr}(a: U256, b: U256) -> U256 {
alloc_locals;
let (res, carry) = uint256_add([a.value], [b.value]);
if (carry != 0) {
with_attr error_message("OverflowError") {
assert 0 = 1;
}

with_attr error_message("OverflowError") {
assert carry = 0;
}

tempvar result = U256(new U256Struct(res.low, res.high));
return result;
}
Expand All @@ -184,10 +184,8 @@ func U256_add{range_check_ptr}(a: U256, b: U256) -> U256 {
func U256_sub{range_check_ptr}(a: U256, b: U256) -> U256 {
alloc_locals;
let is_within_bounds = U256_le(b, a);
if (is_within_bounds.value == 0) {
with_attr error_message("OverflowError") {
assert 0 = 1;
}
with_attr error_message("OverflowError") {
assert is_within_bounds.value = 1;
}
let (result) = uint256_sub([a.value], [b.value]);
tempvar res = U256(new U256Struct(result.low, result.high));
Expand Down

0 comments on commit c4140c2

Please sign in to comment.