@@ -15,7 +15,9 @@ class OracleTests: XCTestCase {
15
15
16
16
let web3 = Web3 . InfuraMainnetWeb3 ( accessToken: Constants . infuraToken)
17
17
18
- lazy var oracle : Web3 . Oracle = . init( web3, block: . exact( 14571792 ) , blockCount: 20 , percentiles: [ 10 , 40 , 60 , 90 ] )
18
+ let blockNumber : BigUInt = 14571792
19
+
20
+ lazy var oracle : Web3 . Oracle = . init( web3, block: . exact( blockNumber) , blockCount: 20 , percentiles: [ 10 , 40 , 60 , 90 ] )
19
21
20
22
func testPretictBaseFee( ) throws {
21
23
let etalonPercentiles : [ BigUInt ] = [
@@ -64,13 +66,24 @@ class OracleTests: XCTestCase {
64
66
65
67
func testPredictLegacyGasPrice( ) throws {
66
68
let etalonPercentiles : [ BigUInt ] = [
67
- 100474449775 , // 10 percentile
68
- 114000000000 , // 40 percentile
69
- 125178275323 , // 60 percentile
70
- 146197706224 // 90 percentile
69
+ 93253857566 , // 10 percentile
70
+ 106634912620 , // 40 percentile
71
+ 111000000000 , // 60 percentile
72
+ 127210686305 // 90 percentile
71
73
]
72
74
73
75
let gasPriceLegacyPercentiles = oracle. gasPriceLegacyPercentiles
74
76
XCTAssertEqual ( gasPriceLegacyPercentiles, etalonPercentiles, " Arrays should be equal " )
75
77
}
78
+
79
+ func testAllTransactionInBlockDecodesWell( ) throws {
80
+ let blockWithTransaction = try web3. eth. getBlockByNumber ( blockNumber, fullTransactions: true )
81
+
82
+ let nullTransactions = blockWithTransaction. transactions. filter {
83
+ guard case . null = $0 else { return false }
84
+ return true
85
+ }
86
+
87
+ XCTAssert ( nullTransactions. isEmpty, " This amount transaction fails to decode: \( nullTransactions. count) " )
88
+ }
76
89
}
0 commit comments