Skip to content

fix!: low and info audittens fixes#524

Merged
0xVolosnikov merged 24 commits intodevfrom
alocascio-audittens-fixes
Feb 25, 2026
Merged

fix!: low and info audittens fixes#524
0xVolosnikov merged 24 commits intodevfrom
alocascio-audittens-fixes

Conversation

@antoniolocascio
Copy link
Contributor

What ❔

Fixes for the latest review from Audittens

Why ❔

Is this a breaking change?

  • Yes
  • No

Checklist

  • PR title corresponds to the body of PR (we generate changelog entries from PRs).
  • Tests for the changes have been added / updated.
  • Documentation comments have been added / updated.
  • Code has been formatted.

@antoniolocascio antoniolocascio changed the title fix!: low and infor audittens fixes fix!: low and info audittens fixes Feb 19, 2026
@antoniolocascio antoniolocascio force-pushed the alocascio-audittens-fixes branch 3 times, most recently from a05c0d6 to b3de3bb Compare February 19, 2026 13:34
@antoniolocascio antoniolocascio force-pushed the alocascio-audittens-fixes branch from b3de3bb to 3c8f35a Compare February 23, 2026 07:17
*limb = unsafe { <u64 as UsizeDeserializable>::from_iter(src).unwrap_unchecked() };
let mut new = MaybeUninit::uninit();
unsafe {
Self::init_from_iter(&mut new, src)?;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one should be taken with care, as on 32 bit architecture it may be 5 words, so topmost bits of storage will not be initialized (and B160 == [u64; 3] with zero top bits)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We explicitly deserialize limbs as u64 values:

*limb = unsafe { <u64 as UsizeDeserializable>::from_iter(src).unwrap_unchecked() };

So it has to be encoded as 3 u64 or 6 u32 values

self.btree.clear();
self.state.next_snapshot_id = CacheSnapshotId(1);
self.state.frozen_snapshot_id = CacheSnapshotId(0);
self.state.pending_updated_elements = StackLinkedList::empty(self.state.alloc.clone());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: here we'll still have deallocations and allocations (same is true for the commit() function). This is not extremely important, but theoretically we can optimize it in future

@0xVolosnikov
Copy link
Contributor

Would be nice to add some tests

@antoniolocascio antoniolocascio force-pushed the alocascio-audittens-fixes branch from 05615d7 to c2c60b1 Compare February 24, 2026 11:25
@antoniolocascio
Copy link
Contributor Author

@0xVolosnikov added a couple more regression tests. The rest of the changes I don't think need one, but happy to add one if you disagree

@github-actions
Copy link
Contributor

Benchmark report

Benchmark Symbol Base Eff Head Eff (%) Base Raw Head Raw (%) Base Blake Head Blake (%) Base Bigint Head Bigint (%)
block_19299001 process_block 315,727,782 315,731,032 (+0.00%) 273,062,382 273,065,632 (+0.00%) 410,630 410,630 (+0.00%) 9,023,830 9,023,830 (+0.00%)
block_22244135 process_block 197,606,679 197,597,860 (-0.00%) 170,690,887 170,682,068 (-0.01%) 172,040 172,040 (+0.00%) 6,040,788 6,040,788 (+0.00%)
precompiles bn254_ecadd 53,268 53,268 (+0.00%) 47,816 47,816 (+0.00%) 0 0 (+0.00%) 1,363 1,363 (+0.00%)
precompiles bn254_ecmul 728,781 728,781 (+0.00%) 564,593 564,593 (+0.00%) 0 0 (+0.00%) 41,047 41,047 (+0.00%)
precompiles bn254_pairing 72,336,733 72,336,733 (+0.00%) 57,808,589 57,808,589 (+0.00%) 0 0 (+0.00%) 3,632,036 3,632,036 (+0.00%)
precompiles ecrecover 476,923 478,906 (+0.42%) 309,055 310,334 (+0.41%) 0 0 (+0.00%) 41,967 42,143 (+0.42%)
precompiles id 927 927 (+0.00%) 927 927 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
precompiles keccak 137,579 137,579 (+0.00%) 137,579 137,579 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
precompiles modexp 31,267,898 31,267,898 (+0.00%) 20,610,078 20,610,078 (+0.00%) 0 0 (+0.00%) 2,664,455 2,664,455 (+0.00%)
precompiles p256_verify 748,861 748,861 (+0.00%) 470,169 470,169 (+0.00%) 0 0 (+0.00%) 69,673 69,673 (+0.00%)
precompiles point_evaluation 52,918,413 52,918,413 (+0.00%) 40,570,377 40,570,377 (+0.00%) 0 0 (+0.00%) 3,087,009 3,087,009 (+0.00%)
precompiles process_block 147,550,676 147,541,544 (-0.01%) 118,081,984 118,076,748 (-0.00%) 5,160 5,160 (+0.00%) 7,346,533 7,345,559 (-0.01%)
precompiles process_transaction 73,483,310 73,478,115 (-0.01%) 58,782,282 58,785,563 (+0.01%) 160 160 (+0.00%) 3,674,617 3,672,498 (-0.06%)
precompiles ripemd 8,013 8,013 (+0.00%) 8,013 8,013 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
precompiles run_tx_loop 146,899,686 146,889,842 (-0.01%) 117,510,674 117,504,726 (-0.01%) 180 180 (+0.00%) 7,346,533 7,345,559 (-0.01%)
precompiles sha256 13,168 13,168 (+0.00%) 13,168 13,168 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
precompiles system_init 46,797 46,797 (+0.00%) 46,797 46,797 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
precompiles verify_and_apply_batch 146,508 146,198 (-0.21%) 110,188 109,878 (-0.28%) 2,270 2,270 (+0.00%) 0 0 (+0.00%)

@0xVolosnikov 0xVolosnikov merged commit 5ee0794 into dev Feb 25, 2026
16 checks passed
@0xVolosnikov 0xVolosnikov deleted the alocascio-audittens-fixes branch February 25, 2026 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants