fix blob tx limit
This commit is contained in:
parent
1eca772a08
commit
ab79cfc775
|
@ -75,9 +75,7 @@ const
|
||||||
MAX_CALLDATA_SIZE* = 1 shl 24 # 2^24
|
MAX_CALLDATA_SIZE* = 1 shl 24 # 2^24
|
||||||
MAX_ACCESS_LIST_SIZE* = 1 shl 24 # 2^24
|
MAX_ACCESS_LIST_SIZE* = 1 shl 24 # 2^24
|
||||||
MAX_ACCESS_LIST_STORAGE_KEYS* = 1 shl 24 # 2^24
|
MAX_ACCESS_LIST_STORAGE_KEYS* = 1 shl 24 # 2^24
|
||||||
MAX_VERSIONED_HASHES_LIST_SIZE* = 1 shl 24 # 2^24
|
|
||||||
MAX_TX_WRAP_COMMITMENTS* = 1 shl 12 # 2^12
|
MAX_TX_WRAP_COMMITMENTS* = 1 shl 12 # 2^12
|
||||||
LIMIT_BLOBS_PER_TX* = 1 shl 12 # 2^12
|
|
||||||
BLOB_COMMITMENT_VERSION_KZG* = 0x01.byte
|
BLOB_COMMITMENT_VERSION_KZG* = 0x01.byte
|
||||||
FIELD_ELEMENTS_PER_BLOB* = 4096
|
FIELD_ELEMENTS_PER_BLOB* = 4096
|
||||||
DATA_GAS_PER_BLOB* = (1 shl 17).uint64 # 2^17
|
DATA_GAS_PER_BLOB* = (1 shl 17).uint64 # 2^17
|
||||||
|
@ -85,5 +83,6 @@ const
|
||||||
MIN_DATA_GASPRICE* = 1'u64
|
MIN_DATA_GASPRICE* = 1'u64
|
||||||
DATA_GASPRICE_UPDATE_FRACTION* = 2225652'u64
|
DATA_GASPRICE_UPDATE_FRACTION* = 2225652'u64
|
||||||
MAX_DATA_GAS_PER_BLOCK* = (1 shl 19).uint64 # 2^19
|
MAX_DATA_GAS_PER_BLOCK* = (1 shl 19).uint64 # 2^19
|
||||||
|
MaxAllowedBlob* = MAX_DATA_GAS_PER_BLOCK div DATA_GAS_PER_BLOB
|
||||||
|
|
||||||
# End
|
# End
|
||||||
|
|
|
@ -157,8 +157,8 @@ func validateEip4844Header*(
|
||||||
headerExcessDataGas = header.excessDataGas.get
|
headerExcessDataGas = header.excessDataGas.get
|
||||||
excessDataGas = calcExcessDataGas(parentHeader)
|
excessDataGas = calcExcessDataGas(parentHeader)
|
||||||
|
|
||||||
if dataGasUsed <= MAX_DATA_GAS_PER_BLOCK:
|
if dataGasUsed > MAX_DATA_GAS_PER_BLOCK:
|
||||||
return err("dataGasUsed should greater than MAX_DATA_GAS_PER_BLOCK: " & $dataGasUsed)
|
return err("dataGasUsed " & $dataGasUsed & " exceeds maximum allowance " & $MAX_DATA_GAS_PER_BLOCK)
|
||||||
|
|
||||||
if headerDataGasUsed != dataGasUsed:
|
if headerDataGasUsed != dataGasUsed:
|
||||||
return err("calculated dataGas not equal header.dataGasUsed")
|
return err("calculated dataGas not equal header.dataGasUsed")
|
||||||
|
|
|
@ -349,9 +349,9 @@ proc validateTransaction*(
|
||||||
if tx.versionedHashes.len == 0:
|
if tx.versionedHashes.len == 0:
|
||||||
return err("invalid tx: there must be at least one blob")
|
return err("invalid tx: there must be at least one blob")
|
||||||
|
|
||||||
if tx.versionedHashes.len > MAX_VERSIONED_HASHES_LIST_SIZE:
|
if tx.versionedHashes.len > MaxAllowedBlob.int:
|
||||||
return err("invalid tx: access list len exceeds MAX_VERSIONED_HASHES_LIST_SIZE. len=" &
|
return err("invalid tx: versioned hashes len exceeds MaxAllowedBlob=" & $MaxAllowedBlob &
|
||||||
$tx.versionedHashes.len)
|
". get=" & $tx.versionedHashes.len)
|
||||||
|
|
||||||
for i, bv in tx.versionedHashes:
|
for i, bv in tx.versionedHashes:
|
||||||
if bv.data[0] != BLOB_COMMITMENT_VERSION_KZG:
|
if bv.data[0] != BLOB_COMMITMENT_VERSION_KZG:
|
||||||
|
|
|
@ -139,7 +139,7 @@ proc validateTxEip4844(tx: Transaction) =
|
||||||
(acl.storageKeys.len <= MAX_ACCESS_LIST_STORAGE_KEYS)
|
(acl.storageKeys.len <= MAX_ACCESS_LIST_STORAGE_KEYS)
|
||||||
|
|
||||||
isValid = isValid and
|
isValid = isValid and
|
||||||
tx.versionedHashes.len <= MAX_VERSIONED_HASHES_LIST_SIZE
|
tx.versionedHashes.len <= MaxAllowedBlob.int
|
||||||
|
|
||||||
for bv in tx.versionedHashes:
|
for bv in tx.versionedHashes:
|
||||||
isValid = isValid and
|
isValid = isValid and
|
||||||
|
|
|
@ -475,6 +475,15 @@ const
|
||||||
output: T8nOutput(alloc: true, result: true),
|
output: T8nOutput(alloc: true, result: true),
|
||||||
expOut: "exp.json",
|
expOut: "exp.json",
|
||||||
),
|
),
|
||||||
|
TestSpec(
|
||||||
|
name : "Blobhash list bounds",
|
||||||
|
base : "testdata/00-518",
|
||||||
|
input : t8nInput(
|
||||||
|
"alloc.json", "txs.json", "env.json", "Cancun", "",
|
||||||
|
),
|
||||||
|
output: T8nOutput(alloc: true, result: true),
|
||||||
|
expOut: "exp.json",
|
||||||
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
proc main() =
|
proc main() =
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
{
|
||||||
|
"0x095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||||
|
"balance" : "0x0de0b6b3a7640000",
|
||||||
|
"code" : "0x600a4960005500",
|
||||||
|
"nonce" : "0x00",
|
||||||
|
"storage" : {}
|
||||||
|
},
|
||||||
|
"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||||
|
"balance" : "0x0de0b6b3a7640000",
|
||||||
|
"code" : "0x",
|
||||||
|
"nonce" : "0x00",
|
||||||
|
"storage" : {}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
{
|
||||||
|
"currentBaseFee" : "0x07",
|
||||||
|
"currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
|
||||||
|
"currentDifficulty" : null,
|
||||||
|
"currentGasLimit" : "0x1000000000",
|
||||||
|
"currentNumber" : "0x01",
|
||||||
|
"currentRandom" : "0x0000000000000000000000000000000000000000000000000000000000020000",
|
||||||
|
"currentTimestamp" : "0x03e8",
|
||||||
|
"parentDataGasUsed" : "0x2000",
|
||||||
|
"parentExcessDataGas" : "0x1000",
|
||||||
|
"previousHash" : "0x5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
|
||||||
|
"withdrawals": []
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
{
|
||||||
|
"alloc": {
|
||||||
|
"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b": {
|
||||||
|
"balance": "0xde0b6b3a7640000"
|
||||||
|
},
|
||||||
|
"0x095e7baea6a6c7c4c2dfeb977efac326af552d87": {
|
||||||
|
"code": "0x600a4960005500",
|
||||||
|
"balance": "0xde0b6b3a7640000"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"stateRoot": "0x538353a3893bdc8daa9eb125f6680804fc6f63e07ba1a1b65329614325528a54",
|
||||||
|
"txRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||||
|
"receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||||
|
"logsHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
|
||||||
|
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"receipts": [],
|
||||||
|
"currentDifficulty": null,
|
||||||
|
"gasUsed": "0x0",
|
||||||
|
"rejected": [
|
||||||
|
{
|
||||||
|
"index": 0,
|
||||||
|
"error": "invalid tx: versioned hashes len exceeds MaxAllowedBlob=4. get=20"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"currentBaseFee": "0x7",
|
||||||
|
"withdrawalsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||||
|
"dataGasUsed": "0x0",
|
||||||
|
"excessDataGas": "0x0"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,49 @@
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"accessList" : [
|
||||||
|
{
|
||||||
|
"address" : "0x095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||||
|
"storageKeys" : [
|
||||||
|
"0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"0x0000000000000000000000000000000000000000000000000000000000000001"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"blobVersionedHashes" : [
|
||||||
|
"0x01a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065f0001",
|
||||||
|
"0x01a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065f0002",
|
||||||
|
"0x01a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065f0003",
|
||||||
|
"0x01a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065f0004",
|
||||||
|
"0x01a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065f0005",
|
||||||
|
"0x01a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065f0006",
|
||||||
|
"0x01a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065f0007",
|
||||||
|
"0x01a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065f0008",
|
||||||
|
"0x01a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065f0009",
|
||||||
|
"0x01a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065f0010",
|
||||||
|
"0x01a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065f0011",
|
||||||
|
"0x01a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065f0012",
|
||||||
|
"0x01a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065f0013",
|
||||||
|
"0x01a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065f0014",
|
||||||
|
"0x01a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065f0015",
|
||||||
|
"0x01a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065f0016",
|
||||||
|
"0x01a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065f0017",
|
||||||
|
"0x01a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065f0018",
|
||||||
|
"0x01a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065f0019",
|
||||||
|
"0x01a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065f0020"
|
||||||
|
],
|
||||||
|
"chainId" : "0x01",
|
||||||
|
"input" : "0x00",
|
||||||
|
"gas" : "0x3d0900",
|
||||||
|
"maxFeePerDataGas" : "0x0a",
|
||||||
|
"maxFeePerGas" : "0x012a05f200",
|
||||||
|
"maxPriorityFeePerGas" : "0x02",
|
||||||
|
"nonce" : "0x00",
|
||||||
|
"r" : "0x7b67348718a49b5e7c6f882030873feb198315051ae4b257fbd99bcc14777f53",
|
||||||
|
"s" : "0x375219ba48b2694622d8aab97d44fc7eb2902678e51369bcc74fae65c4bab628",
|
||||||
|
"sender" : "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||||
|
"to" : "0x095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||||
|
"type" : "0x03",
|
||||||
|
"v" : "0x00",
|
||||||
|
"value" : "0x0186a0"
|
||||||
|
}
|
||||||
|
]
|
Loading…
Reference in New Issue