Skip to content

Commit

Permalink
chore: Let's spell tuple correctly (#748)
Browse files Browse the repository at this point in the history
  • Loading branch information
cclauss authored Feb 1, 2023
1 parent 60d7896 commit 8349152
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions Tests/web3swiftTests/localTests/EIP1559BlockTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ class EIP1559BlockTests: LocalTestCase {
(40_000_000, 12_965_000, 39_960_938, false) // Lower limit -1
]

headerArray.forEach { (touple: (parentGasLimit: BigUInt, parentNumber: BigUInt, currentGasLimit: BigUInt, is1559: Bool)) in
let parent = Block(number: touple.parentNumber,
headerArray.forEach { (tuple: (parentGasLimit: BigUInt, parentNumber: BigUInt, currentGasLimit: BigUInt, is1559: Bool)) in
let parent = Block(number: tuple.parentNumber,
hash: uselessBlockPart.hash,
parentHash: uselessBlockPart.parentHash,
nonce: uselessBlockPart.nonce,
Expand All @@ -72,14 +72,14 @@ class EIP1559BlockTests: LocalTestCase {
totalDifficulty: uselessBlockPart.totalDifficulty,
extraData: uselessBlockPart.extraData,
size: uselessBlockPart.size,
gasLimit: touple.parentGasLimit,
gasUsed: touple.parentGasLimit / 2,
gasLimit: tuple.parentGasLimit,
gasUsed: tuple.parentGasLimit / 2,
baseFeePerGas: Web3.InitialBaseFee,
timestamp: uselessBlockPart.timestamp,
transactions: uselessBlockPart.transactions,
uncles: uselessBlockPart.uncles)

let current = Block(number: touple.parentNumber + 1,
let current = Block(number: tuple.parentNumber + 1,
hash: uselessBlockPart.hash,
parentHash: uselessBlockPart.parentHash,
nonce: uselessBlockPart.nonce,
Expand All @@ -93,14 +93,14 @@ class EIP1559BlockTests: LocalTestCase {
totalDifficulty: uselessBlockPart.totalDifficulty,
extraData: uselessBlockPart.extraData,
size: uselessBlockPart.size,
gasLimit: touple.currentGasLimit,
gasUsed: touple.currentGasLimit / 2,
gasLimit: tuple.currentGasLimit,
gasUsed: tuple.currentGasLimit / 2,
baseFeePerGas: Web3.InitialBaseFee,
timestamp: uselessBlockPart.timestamp,
transactions: uselessBlockPart.transactions,
uncles: uselessBlockPart.uncles)

if touple.is1559 {
if tuple.is1559 {
XCTAssertTrue(Web3.isEip1559Block(parent: parent, current: current),
"Shoult not fail, got parent: \(parent.gasLimit), current: \(current.gasLimit)")
} else {
Expand All @@ -124,8 +124,8 @@ class EIP1559BlockTests: LocalTestCase {
(Web3.InitialBaseFee, 12_965_000, 20000000, 11000000, 1012500000) // current above target
]

headerArray.forEach { (touple: (parentBaseFee: BigUInt, parentNumber: BigUInt, parentGasLimit: BigUInt, parentGasUsed: BigUInt, expectedBaseFee: BigUInt)) in
let parent = Block(number: touple.parentNumber,
headerArray.forEach { (tuple: (parentBaseFee: BigUInt, parentNumber: BigUInt, parentGasLimit: BigUInt, parentGasUsed: BigUInt, expectedBaseFee: BigUInt)) in
let parent = Block(number: tuple.parentNumber,
hash: uselessBlockPart.hash,
parentHash: uselessBlockPart.parentHash,
nonce: uselessBlockPart.nonce,
Expand All @@ -139,16 +139,16 @@ class EIP1559BlockTests: LocalTestCase {
totalDifficulty: uselessBlockPart.totalDifficulty,
extraData: uselessBlockPart.extraData,
size: uselessBlockPart.size,
gasLimit: touple.parentGasLimit,
gasUsed: touple.parentGasUsed,
gasLimit: tuple.parentGasLimit,
gasUsed: tuple.parentGasUsed,
baseFeePerGas: Web3.InitialBaseFee,
timestamp: uselessBlockPart.timestamp,
transactions: uselessBlockPart.transactions,
uncles: uselessBlockPart.uncles)

let calculatedBaseFee = Web3.calcBaseFee(parent)

XCTAssertEqual(calculatedBaseFee, touple.expectedBaseFee, "Base fee calculation fails: should be \(touple.expectedBaseFee), got: \(String(describing: calculatedBaseFee))")
XCTAssertEqual(calculatedBaseFee, tuple.expectedBaseFee, "Base fee calculation fails: should be \(tuple.expectedBaseFee), got: \(String(describing: calculatedBaseFee))")
}
}
}

0 comments on commit 8349152

Please sign in to comment.