Skip to content

EIP-7823 and EIP-7883 --- MODEXP pricing tests #2496

@OlivierBBB

Description

@OlivierBBB

MODEXP pricing + the 500 minimum gas cost boundary testing

With MODEXP pricing we have several interesting questions

  • the new pricing of the log of the exponent
  • the comparison to 500

The cost of MODEXP is now

   cost ≡ 500 ∨ ζ
   ζ ≡ (l + 16 ∙ x) ∙ 2 ∙ words^2

with l ≡ lead_log, x ≡ (ebs - 32) ∨ 0, words ≡ ⌈max(mbs, bbs)/8⌉.

Testing will explore these variables somewhat extensively. We should test like so

bbs / mbs pairs
===============

(bbs, mbs) ∈ { <see table> }

|------------|-----|-------|---------|
| (bbs, mbs) | max | words | words^2 |
|------------|-----|-------|---------|
| (0, 0)     | 0   | 0     | 0       |
| (0, 3)     | 3   | 1     | 1       |
| (21, 23)   | 23  | 3     | 9       |
| (56, 55)   | 56  | 7     | 49      |
|------------|-----|-------|---------|

NOTE: The (0,3) case gives us the most fine grained exploration of the 500 vs ζ boundary

⇒ there are 4 options

cds options:
============

cds ≡ 96 + bbs + extra, extra ∈ { ebs / 2, ebs, ebs + mbs }

⇒ there are 3 options

ebs options:
============

ebs ≡ 0, 1, 16, 27, 32, 39, 173 where the first (ebs ∧ 32) bytes are, in base two,

   0b 00..01..11

with z ∈ {0, 1, ..., 8 ∙ (ebs ∧ 32) } one's (and lead_log ≡ 0, 1, ..., 8 ∙ (ebs ∧ 32))

⇒ there are (0 + 1 + 16 + 27 + 32 + 32 + 32) ∙ 8 + 7 ≡ 1127 options

Total options:
==============

   4 ∙ 3 ∙ 1127 ≡ 13524 variants

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions