Skip to content

Commit

Permalink
chore: improve gas usage
Browse files Browse the repository at this point in the history
  • Loading branch information
Th0rgal committed Jan 8, 2024
1 parent 8a71c62 commit 8d63a6d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/naming/asserts.cairo
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use core::traits::TryInto;
use core::array::SpanTrait;
use naming::{
interface::{
Expand Down Expand Up @@ -66,12 +67,13 @@ impl AssertionsImpl of AssertionsTrait {
fn assert_is_owner(
self: @Naming::ContractState, domain: Span<felt252>, account: ContractAddress
) {
let mut i = 1;
let stop = domain.len() + 1;
let mut i: felt252 = 1;
let stop = (domain.len() + 1).into();
let mut parent_key = 0;
loop {
assert(i != stop, 'you don\'t own this domain');
let active_domain = domain.slice(domain.len() - i, i);
let i_gas_saver = i.try_into().unwrap();
let active_domain = domain.slice(domain.len() - i_gas_saver, i_gas_saver);
let hashed_domain = self.hash_domain(active_domain);
let data = self._domain_data.read(hashed_domain);

Expand Down

0 comments on commit 8d63a6d

Please sign in to comment.