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": {
@ -169,4 +176,4 @@
"baseFeePerGas": "2727" "baseFeePerGas": "2727"
}, },
"input": "0xf8771b820b4583030d4094549a32d57c35d36811de6a462596970c83ea9b238095012cb672d8c128acc0825dcbaf61e43a293a5a52761ba0fe7f0de0e0fd2b337dbdf1b4fdf97a144457f8502497172eb1344ab6e25a6806a00b8c1589fb14dcbb91d53a0f8acb1ee1ede901c89749ee15bfe86c6beec7052e" "input": "0xf8771b820b4583030d4094549a32d57c35d36811de6a462596970c83ea9b238095012cb672d8c128acc0825dcbaf61e43a293a5a52761ba0fe7f0de0e0fd2b337dbdf1b4fdf97a144457f8502497172eb1344ab6e25a6806a00b8c1589fb14dcbb91d53a0f8acb1ee1ede901c89749ee15bfe86c6beec7052e"
} }

File diff suppressed because it is too large Load diff