fix test_blockchain_json for new tests

This commit is contained in:
jangko 2023-07-05 16:30:01 +07:00
parent 9c8f15c7a5
commit 270dfc33e3
No known key found for this signature in database
GPG Key ID: 31702AE10541E6B9
2 changed files with 52 additions and 15 deletions

View File

@ -2,14 +2,17 @@ newBlockchainTests
=== ===
## bc4895-withdrawals ## bc4895-withdrawals
```diff ```diff
+ accountInteractions.json OK
+ amountIs0.json OK + amountIs0.json OK
+ amountIs0TouchAccount.json OK + amountIs0TouchAccount.json OK
+ amountIs0TouchAccountAndTransaction.json OK + amountIs0TouchAccountAndTransaction.json OK
+ differentValidatorToTheSameAddress.json OK + differentValidatorToTheSameAddress.json OK
+ incorrectWithdrawalsRoot.json OK + incorrectWithdrawalsRoot.json OK
+ shanghaiWithoutWithdrawalsRLP.json OK + shanghaiWithoutWithdrawalsRLP.json OK
+ staticcall.json OK
+ twoIdenticalIndex.json OK + twoIdenticalIndex.json OK
+ twoIdenticalIndexDifferentValidator.json OK + twoIdenticalIndexDifferentValidator.json OK
+ warmup.json OK
+ withdrawalsAddressBounds.json OK + withdrawalsAddressBounds.json OK
+ withdrawalsAmountBounds.json OK + withdrawalsAmountBounds.json OK
+ withdrawalsIndexBounds.json OK + withdrawalsIndexBounds.json OK
@ -18,7 +21,7 @@ newBlockchainTests
+ withdrawalsRLPnotAList.json OK + withdrawalsRLPnotAList.json OK
+ withdrawalsValidatorIndexBounds.json OK + withdrawalsValidatorIndexBounds.json OK
``` ```
OK: 15/15 Fail: 0/15 Skip: 0/15 OK: 18/18 Fail: 0/18 Skip: 0/18
## bcArrowGlacierToMerge ## bcArrowGlacierToMerge
```diff ```diff
+ difficultyFormula.json OK + difficultyFormula.json OK
@ -380,12 +383,12 @@ OK: 96/96 Fail: 0/96 Skip: 0/96
+ testOpcode_70.json OK + testOpcode_70.json OK
+ testOpcode_80.json OK + testOpcode_80.json OK
+ testOpcode_90.json OK + testOpcode_90.json OK
+ testOpcode_A0.json OK + testOpcode_a0.json OK
+ testOpcode_B0.json OK + testOpcode_b0.json OK
+ testOpcode_C0.json OK + testOpcode_c0.json OK
+ testOpcode_D0.json OK + testOpcode_d0.json OK
+ testOpcode_E0.json OK + testOpcode_e0.json OK
+ testOpcode_F0.json OK + testOpcode_f0.json OK
+ transactionFromNotExistingAccount.json OK + transactionFromNotExistingAccount.json OK
+ transactionFromSelfDestructedContract.json OK + transactionFromSelfDestructedContract.json OK
+ txCost-sec73.json OK + txCost-sec73.json OK
@ -507,6 +510,23 @@ OK: 19/19 Fail: 0/19 Skip: 0/19
+ walletReorganizeOwners.json OK + walletReorganizeOwners.json OK
``` ```
OK: 5/5 Fail: 0/5 Skip: 0/5 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 ## stArgsZeroOneBalance
```diff ```diff
+ addNonConst.json OK + addNonConst.json OK
@ -3296,6 +3316,12 @@ OK: 133/133 Fail: 0/133 Skip: 0/133
+ ecmul_1-2_2_21000_96.json OK + ecmul_1-2_2_21000_96.json OK
``` ```
OK: 130/130 Fail: 0/130 Skip: 0/130 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 ## vmArithmeticTest
```diff ```diff
+ add.json OK + add.json OK
@ -3384,6 +3410,20 @@ OK: 0/3 Fail: 0/3 Skip: 3/3
+ swap.json OK + swap.json OK
``` ```
OK: 11/11 Fail: 0/11 Skip: 0/11 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--- ---TOTAL---
OK: 2910/3016 Fail: 0/3016 Skip: 106/3016 OK: 2934/3040 Fail: 0/3040 Skip: 106/3040

View File

@ -59,10 +59,6 @@ func normalizeNumber(n: JsonNode): JsonNode =
result = n result = n
elif str == "0x00": elif str == "0x00":
result = newJString("0x0") 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': elif str[2] == '0':
var i = 2 var i = 2
while str[i] == '0': while str[i] == '0':
@ -96,7 +92,7 @@ func normalizeBlockHeader(node: JsonNode): JsonNode =
func normalizeWithdrawal(node: JsonNode): JsonNode = func normalizeWithdrawal(node: JsonNode): JsonNode =
for k, v in node: for k, v in node:
case k case k
of "address", "amount", "index", "validatorIndex": of "amount", "index", "validatorIndex":
node[k] = normalizeNumber(v) node[k] = normalizeNumber(v)
else: discard else: discard
result = node result = node
@ -128,7 +124,7 @@ proc parseBlocks(blocks: JsonNode): seq[TestBlock] =
t.goodBlock = true t.goodBlock = true
of "rlp": of "rlp":
fixture.fromJson "rlp", t.blockRLP fixture.fromJson "rlp", t.blockRLP
of "transactions", "uncleHeaders", of "transactions", "uncleHeaders", "hasBigInt",
"blocknumber", "chainname", "chainnetwork": "blocknumber", "chainname", "chainnetwork":
discard discard
of "transactionSequence": of "transactionSequence":
@ -312,7 +308,8 @@ proc dumpDebugData(tester: Tester, fixtureName: string, fixtureIndex: int, succe
debugDataFromAccountList(tester) debugDataFromAccountList(tester)
let status = if success: "_success" else: "_failed" 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) = proc testFixture(node: JsonNode, testStatusIMPL: var TestStatus, debugMode = false, trace = false) =
# 1 - mine the genesis block # 1 - mine the genesis block