add support for types.SetCodeTxType, fix testdata prestate JSON panicking on empty config sections

This commit is contained in:
Stéphane Duchesneau 2025-02-10 15:58:46 -05:00 committed by Matthieu Vachon
parent 4664464ff8
commit 9f4c25d3ee
4 changed files with 691 additions and 983 deletions

View file

@ -1740,6 +1740,8 @@ func transactionTypeFromChainTxType(txType uint8) pbeth.TransactionTrace_Type {
return pbeth.TransactionTrace_TRX_TYPE_LEGACY return pbeth.TransactionTrace_TRX_TYPE_LEGACY
case types.BlobTxType: case types.BlobTxType:
return pbeth.TransactionTrace_TRX_TYPE_BLOB return pbeth.TransactionTrace_TRX_TYPE_BLOB
case types.SetCodeTxType:
return pbeth.TransactionTrace_TRX_TYPE_SET_CODE
default: default:
panic(fmt.Errorf("unknown transaction type %d", txType)) panic(fmt.Errorf("unknown transaction type %d", txType))
} }
@ -1920,7 +1922,7 @@ func maxFeePerGas(tx *types.Transaction) *pbeth.BigInt {
case types.LegacyTxType, types.AccessListTxType: case types.LegacyTxType, types.AccessListTxType:
return nil return nil
case types.DynamicFeeTxType, types.BlobTxType: case types.DynamicFeeTxType, types.BlobTxType, types.SetCodeTxType:
return firehoseBigIntFromNative(tx.GasFeeCap()) return firehoseBigIntFromNative(tx.GasFeeCap())
} }
@ -1933,7 +1935,7 @@ func maxPriorityFeePerGas(tx *types.Transaction) *pbeth.BigInt {
case types.LegacyTxType, types.AccessListTxType: case types.LegacyTxType, types.AccessListTxType:
return nil return nil
case types.DynamicFeeTxType, types.BlobTxType: case types.DynamicFeeTxType, types.BlobTxType, types.SetCodeTxType:
return firehoseBigIntFromNative(tx.GasTipCap()) return firehoseBigIntFromNative(tx.GasTipCap())
} }
@ -1946,7 +1948,7 @@ func gasPrice(tx *types.Transaction, baseFee *big.Int) *pbeth.BigInt {
return firehoseBigIntFromNative(tx.GasPrice()) return firehoseBigIntFromNative(tx.GasPrice())
// In the context of dynamic fee transactions, `GasPrice() == GasFeeCap()` // In the context of dynamic fee transactions, `GasPrice() == GasFeeCap()`
case types.DynamicFeeTxType, types.BlobTxType: case types.DynamicFeeTxType, types.BlobTxType, types.SetCodeTxType:
if baseFee == nil { if baseFee == nil {
return firehoseBigIntFromNative(tx.GasPrice()) return firehoseBigIntFromNative(tx.GasPrice())
} }
@ -2280,6 +2282,7 @@ func staticFirehoseChainValidationOnInit() {
types.AccessListTxType: true, types.AccessListTxType: true,
types.DynamicFeeTxType: true, types.DynamicFeeTxType: true,
types.BlobTxType: true, types.BlobTxType: true,
types.SetCodeTxType: true,
} }
for txType := byte(0); txType < 255; txType++ { for txType := byte(0); txType < 255; txType++ {

View file

@ -157,7 +157,14 @@
"cancunTime": 1706655072, "cancunTime": 1706655072,
"terminalTotalDifficulty": 17000000000000000, "terminalTotalDifficulty": 17000000000000000,
"terminalTotalDifficultyPassed": true, "terminalTotalDifficultyPassed": true,
"ethash": {} "ethash": {},
"blobSchedule": {
"cancun": {
"target": 3,
"max": 6,
"baseFeeUpdateFraction": 3338477
}
}
} }
}, },
"context": { "context": {

View file

@ -52,7 +52,14 @@
"cancunTime": 1707305664, "cancunTime": 1707305664,
"terminalTotalDifficulty": 0, "terminalTotalDifficulty": 0,
"depositContractAddress": "0x0000000000000000000000000000000000000000", "depositContractAddress": "0x0000000000000000000000000000000000000000",
"ethash": {} "ethash": {},
"blobSchedule": {
"cancun": {
"target": 3,
"max": 6,
"baseFeeUpdateFraction": 3338477
}
}
}, },
"difficulty": "0", "difficulty": "0",
"totalDifficulty": "0", "totalDifficulty": "0",

File diff suppressed because it is too large Load diff