Skip to content

Commit

Permalink
fix test_blockchain_json for new tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jangko committed Jul 5, 2023
1 parent 498f73a commit 16a4fe9
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 15 deletions.
56 changes: 48 additions & 8 deletions newBlockchainTests.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@ newBlockchainTests
===
## bc4895-withdrawals
```diff
+ accountInteractions.json OK
+ amountIs0.json OK
+ amountIs0TouchAccount.json OK
+ amountIs0TouchAccountAndTransaction.json OK
+ differentValidatorToTheSameAddress.json OK
+ incorrectWithdrawalsRoot.json OK
+ shanghaiWithoutWithdrawalsRLP.json OK
+ staticcall.json OK
+ twoIdenticalIndex.json OK
+ twoIdenticalIndexDifferentValidator.json OK
+ warmup.json OK
+ withdrawalsAddressBounds.json OK
+ withdrawalsAmountBounds.json OK
+ withdrawalsIndexBounds.json OK
Expand All @@ -18,7 +21,7 @@ newBlockchainTests
+ withdrawalsRLPnotAList.json OK
+ withdrawalsValidatorIndexBounds.json OK
```
OK: 15/15 Fail: 0/15 Skip: 0/15
OK: 18/18 Fail: 0/18 Skip: 0/18
## bcArrowGlacierToMerge
```diff
+ difficultyFormula.json OK
Expand Down Expand Up @@ -380,12 +383,12 @@ OK: 96/96 Fail: 0/96 Skip: 0/96
+ testOpcode_70.json OK
+ testOpcode_80.json OK
+ testOpcode_90.json OK
+ testOpcode_A0.json OK
+ testOpcode_B0.json OK
+ testOpcode_C0.json OK
+ testOpcode_D0.json OK
+ testOpcode_E0.json OK
+ testOpcode_F0.json OK
+ testOpcode_a0.json OK
+ testOpcode_b0.json OK
+ testOpcode_c0.json OK
+ testOpcode_d0.json OK
+ testOpcode_e0.json OK
+ testOpcode_f0.json OK
+ transactionFromNotExistingAccount.json OK
+ transactionFromSelfDestructedContract.json OK
+ txCost-sec73.json OK
Expand Down Expand Up @@ -507,6 +510,23 @@ OK: 19/19 Fail: 0/19 Skip: 0/19
+ walletReorganizeOwners.json OK
```
OK: 5/5 Fail: 0/5 Skip: 0/5
## eips
```diff
+ initcode_limit_contract_creating_tx.json OK
+ initcode_limit_contract_creating_tx_gas_usage.json OK
+ initcode_limit_create2_opcode.json OK
+ initcode_limit_create_opcode.json OK
+ push0.json OK
+ warm_coinbase_call_out_of_gas.json OK
+ warm_coinbase_gas_usage.json OK
```
OK: 7/7 Fail: 0/7 Skip: 0/7
## example
```diff
+ access_list.json OK
+ yul.json OK
```
OK: 2/2 Fail: 0/2 Skip: 0/2
## stArgsZeroOneBalance
```diff
+ addNonConst.json OK
Expand Down Expand Up @@ -3296,6 +3316,12 @@ OK: 133/133 Fail: 0/133 Skip: 0/133
+ ecmul_1-2_2_21000_96.json OK
```
OK: 130/130 Fail: 0/130 Skip: 0/130
## vm
```diff
+ chain_id.json OK
+ dup.json OK
```
OK: 2/2 Fail: 0/2 Skip: 0/2
## vmArithmeticTest
```diff
+ add.json OK
Expand Down Expand Up @@ -3384,6 +3410,20 @@ OK: 0/3 Fail: 0/3 Skip: 3/3
+ swap.json OK
```
OK: 11/11 Fail: 0/11 Skip: 0/11
## withdrawals
```diff
+ balance_within_block.json OK
+ large_amount.json OK
+ many_withdrawals.json OK
+ multiple_withdrawals_same_address.json OK
+ newly_created_contract.json OK
+ no_evm_execution.json OK
+ self_destructing_account.json OK
+ use_value_in_contract.json OK
+ use_value_in_tx.json OK
+ zero_amount.json OK
```
OK: 10/10 Fail: 0/10 Skip: 0/10

---TOTAL---
OK: 2910/3016 Fail: 0/3016 Skip: 106/3016
OK: 2934/3040 Fail: 0/3040 Skip: 106/3040
11 changes: 4 additions & 7 deletions tests/test_blockchain_json.nim
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,6 @@ func normalizeNumber(n: JsonNode): JsonNode =
result = n
elif str == "0x00":
result = newJString("0x0")
elif str == "0x0000000000000000000000000000000000000000":
# withdrawalsAddressBounds contains this; it's meant as an address, not a number,
# so it shouldn't be shortened to "0x0"
result = n
elif str[2] == '0':
var i = 2
while str[i] == '0':
Expand Down Expand Up @@ -96,7 +92,7 @@ func normalizeBlockHeader(node: JsonNode): JsonNode =
func normalizeWithdrawal(node: JsonNode): JsonNode =
for k, v in node:
case k
of "address", "amount", "index", "validatorIndex":
of "amount", "index", "validatorIndex":
node[k] = normalizeNumber(v)
else: discard
result = node
Expand Down Expand Up @@ -128,7 +124,7 @@ proc parseBlocks(blocks: JsonNode): seq[TestBlock] =
t.goodBlock = true
of "rlp":
fixture.fromJson "rlp", t.blockRLP
of "transactions", "uncleHeaders",
of "transactions", "uncleHeaders", "hasBigInt",
"blocknumber", "chainname", "chainnetwork":
discard
of "transactionSequence":
Expand Down Expand Up @@ -312,7 +308,8 @@ proc dumpDebugData(tester: Tester, fixtureName: string, fixtureIndex: int, succe
debugDataFromAccountList(tester)

let status = if success: "_success" else: "_failed"
writeFile("debug_" & fixtureName & "_" & $fixtureIndex & status & ".json", debugData.pretty())
let name = fixtureName.replace('/', '-')
writeFile("debug_" & name & "_" & $fixtureIndex & status & ".json", debugData.pretty())

proc testFixture(node: JsonNode, testStatusIMPL: var TestStatus, debugMode = false, trace = false) =
# 1 - mine the genesis block
Expand Down

0 comments on commit 16a4fe9

Please sign in to comment.