-
Notifications
You must be signed in to change notification settings - Fork 333
/
Copy pathFeeModelTestPoints.t.sol
65 lines (54 loc) · 1.57 KB
/
FeeModelTestPoints.t.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// SPDX-License-Identifier: Apache-2.0
// Copyright 2024 Aztec Labs.
// solhint-disable var-name-mixedcase
pragma solidity >=0.8.27;
import {Test} from "forge-std/Test.sol";
// Remember that foundry json parsing is alphabetically done, so you MUST
// sort the struct fields alphabetically or prepare for a headache.
struct L1Fees {
uint256 base_fee;
uint256 blob_fee;
}
struct Header {
uint256 excess_mana;
uint256 fee_asset_price_numerator;
uint256 mana_used;
uint256 proving_cast_per_mana_numerator;
}
struct OracleInput {
int256 fee_asset_price_modifier;
int256 proving_cost_modifier;
}
struct ManaBaseFeeComponents {
uint256 congestion_cost;
uint256 congestion_multiplier;
uint256 data_cost;
uint256 gas_cost;
uint256 proving_cost;
}
struct TestPointOutputs {
uint256 fee_asset_price_at_execution;
ManaBaseFeeComponents mana_base_fee_components_in_fee_asset;
ManaBaseFeeComponents mana_base_fee_components_in_wei;
}
struct TestPoint {
uint256 l1_block_number;
L1Fees l1_fees;
Header header;
OracleInput oracle_input;
TestPointOutputs outputs;
Header parent_header;
}
contract FeeModelTestPoints is Test {
TestPoint[] public points;
constructor() {
string memory root = vm.projectRoot();
string memory path = string.concat(root, "/test/fixtures/fee_data_points.json");
string memory json = vm.readFile(path);
bytes memory jsonBytes = vm.parseJson(json);
TestPoint[] memory dataPoints = abi.decode(jsonBytes, (TestPoint[]));
for (uint256 i = 0; i < dataPoints.length; i++) {
points.push(dataPoints[i]);
}
}
}