This folder contains the experimental setup for measuring gas costs of the time-bucketed balance record algorithm.
The algorithm is dependent on evm-auth.
Add the current repository into test/ folder of evmauth-core repository.
# From the repository root
forge test --match-path test/tbbr/*.sol --gas-report# Create a gas snapshot file
forge snapshot --match-path "test/*.sol" --snap test/tbbr/.gas-snapshot
# Compare with previous snapshot
forge snapshot --match-path "test/tbbr/*.sol" --diff test/tbbr/.gas-snapshotforge test --match-path test/tbbr/*.sol -vvvforge test --match-test "test_gas_" -vvv./test/paper1_experiments/run_benchmarks.shMeasures gas for core operations:
- Mint (new record): First mint creating a new balance record
- Mint (coalesce): Mint within same time bucket (record merging)
- Transfer: FIFO consumption from sender + insert to recipient
- Burn: FIFO consumption
- Balance query: View function cost
- Prune: Cleanup of expired/empty records
Measures how gas scales with:
- Number of existing records (1, 10, 50, 100)
- Various TTL configurations
- Worst-case insertion (shifting all elements)
Demonstrates bounded gas costs:
- Adversary creates many deposits
- Victim's operation cost remains O(k)
| Operation | Gas Cost |
|---|---|
| Mint (new record) | 95,407 |
| Mint (coalesce) | 4,931 |
| Transfer | 94,853 |
| Burn | 4,511 |
| Balance query | 2,265 |
| Operation | Gas Cost |
|---|---|
| Burn all records | 335,499 |
| Transfer all records | 9,994,917 |