Compare commits
3 Commits
6b68ff92d3
...
6a10dfd0fe
Author | SHA1 | Date |
---|---|---|
andri lim | 6a10dfd0fe | |
Jacek Sieka | 9521582005 | |
andri lim | 99ff8dc876 |
|
@ -21,6 +21,7 @@ import
|
||||||
../../evm/state,
|
../../evm/state,
|
||||||
../../evm/types,
|
../../evm/types,
|
||||||
../../constants,
|
../../constants,
|
||||||
|
../eip4844,
|
||||||
../validate
|
../validate
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
@ -92,6 +93,12 @@ proc processTransactionImpl(
|
||||||
|
|
||||||
vmState.gasPool -= tx.gasLimit
|
vmState.gasPool -= tx.gasLimit
|
||||||
|
|
||||||
|
let blobGasUsed = tx.getTotalBlobGas
|
||||||
|
if vmState.blobGasUsed + blobGasUsed > MAX_BLOB_GAS_PER_BLOCK:
|
||||||
|
return err("blobGasUsed " & $blobGasUsed &
|
||||||
|
" exceeds maximum allowance " & $MAX_BLOB_GAS_PER_BLOCK)
|
||||||
|
vmState.blobGasUsed += blobGasUsed
|
||||||
|
|
||||||
# Actually, the eip-1559 reference does not mention an early exit.
|
# Actually, the eip-1559 reference does not mention an early exit.
|
||||||
#
|
#
|
||||||
# Even though database was not changed yet but, a `persist()` directive
|
# Even though database was not changed yet but, a `persist()` directive
|
||||||
|
|
|
@ -22,7 +22,7 @@ import
|
||||||
../../../common/common,
|
../../../common/common,
|
||||||
../../../utils/utils,
|
../../../utils/utils,
|
||||||
../../../constants,
|
../../../constants,
|
||||||
"../.."/[dao, executor, validate, eip4844, casper],
|
"../.."/[dao, executor, validate, casper],
|
||||||
../../../transaction/call_evm,
|
../../../transaction/call_evm,
|
||||||
../../../transaction,
|
../../../transaction,
|
||||||
../../../evm/state,
|
../../../evm/state,
|
||||||
|
@ -39,7 +39,6 @@ type
|
||||||
tr: CoreDbMptRef
|
tr: CoreDbMptRef
|
||||||
cleanState: bool
|
cleanState: bool
|
||||||
balance: UInt256
|
balance: UInt256
|
||||||
blobGasUsed: uint64
|
|
||||||
numBlobPerBlock: int
|
numBlobPerBlock: int
|
||||||
|
|
||||||
const
|
const
|
||||||
|
@ -131,10 +130,6 @@ proc runTxCommit(pst: TxPackerStateRef; item: TxItemRef; gasBurned: GasInt)
|
||||||
vmState.cumulativeGasUsed += gasBurned
|
vmState.cumulativeGasUsed += gasBurned
|
||||||
vmState.receipts[inx] = vmState.makeReceipt(item.tx.txType)
|
vmState.receipts[inx] = vmState.makeReceipt(item.tx.txType)
|
||||||
|
|
||||||
# EIP-4844, count blobGasUsed
|
|
||||||
if item.tx.txType >= TxEip4844:
|
|
||||||
pst.blobGasUsed += item.tx.getTotalBlobGas
|
|
||||||
|
|
||||||
# Update txRoot
|
# Update txRoot
|
||||||
pst.tr.merge(rlp.encode(inx), rlp.encode(item.tx)).isOkOr:
|
pst.tr.merge(rlp.encode(inx), rlp.encode(item.tx)).isOkOr:
|
||||||
raiseAssert "runTxCommit(): merge failed, " & $$error
|
raiseAssert "runTxCommit(): merge failed, " & $$error
|
||||||
|
@ -262,7 +257,7 @@ proc vmExecCommit(pst: TxPackerStateRef)
|
||||||
if vmState.com.forkGTE(Cancun):
|
if vmState.com.forkGTE(Cancun):
|
||||||
# EIP-4844
|
# EIP-4844
|
||||||
xp.chain.excessBlobGas = Opt.some(vmState.blockCtx.excessBlobGas)
|
xp.chain.excessBlobGas = Opt.some(vmState.blockCtx.excessBlobGas)
|
||||||
xp.chain.blobGasUsed = Opt.some(pst.blobGasUsed)
|
xp.chain.blobGasUsed = Opt.some(vmState.blobGasUsed)
|
||||||
|
|
||||||
proc balanceDelta: UInt256 =
|
proc balanceDelta: UInt256 =
|
||||||
let postBalance = vmState.readOnlyStateDB.getBalance(xp.chain.feeRecipient)
|
let postBalance = vmState.readOnlyStateDB.getBalance(xp.chain.feeRecipient)
|
||||||
|
|
|
@ -183,20 +183,19 @@ func toVoidRc[T](
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
# Private `MPT` call back functions
|
# Private `MPT` call back functions
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
proc mptMethods(): CoreDbMptFns =
|
||||||
|
# These templates are a hack to remove a closure environment that was using
|
||||||
|
# hundreds of mb of memory to have this syntactic convenience
|
||||||
|
# TODO remove methods / abstraction entirely - it is no longer needed
|
||||||
|
template base: untyped = cMpt.base
|
||||||
|
template db: untyped = base.parent # Ditto
|
||||||
|
template api: untyped = base.api # Ditto
|
||||||
|
template mpt: untyped = base.ctx.mpt # Ditto
|
||||||
|
|
||||||
proc mptMethods(cMpt: AristoCoreDbMptRef): CoreDbMptFns =
|
proc mptBackend(cMpt: AristoCoreDbMptRef): CoreDbMptBackendRef =
|
||||||
## Generic columns database handlers
|
|
||||||
let
|
|
||||||
cMpt = cMpt # So it can savely be captured
|
|
||||||
base = cMpt.base # Will not change and can be captured
|
|
||||||
db = base.parent # Ditto
|
|
||||||
api = base.api # Ditto
|
|
||||||
mpt = base.ctx.mpt # Ditto
|
|
||||||
|
|
||||||
proc mptBackend(): CoreDbMptBackendRef =
|
|
||||||
db.bless AristoCoreDbMptBE(adb: mpt)
|
db.bless AristoCoreDbMptBE(adb: mpt)
|
||||||
|
|
||||||
proc mptColFn(): CoreDbColRef =
|
proc mptColFn(cMpt: AristoCoreDbMptRef): CoreDbColRef =
|
||||||
if cMpt.mptRoot.distinctBase < LEAST_FREE_VID:
|
if cMpt.mptRoot.distinctBase < LEAST_FREE_VID:
|
||||||
return db.bless(AristoColRef(
|
return db.bless(AristoColRef(
|
||||||
base: base,
|
base: base,
|
||||||
|
@ -219,7 +218,7 @@ proc mptMethods(cMpt: AristoCoreDbMptRef): CoreDbMptFns =
|
||||||
stoRoot: cMpt.mptRoot,
|
stoRoot: cMpt.mptRoot,
|
||||||
stoAddr: cMpt.address)
|
stoAddr: cMpt.address)
|
||||||
|
|
||||||
proc mptFetch(key: openArray[byte]): CoreDbRc[Blob] =
|
proc mptFetch(cMpt: AristoCoreDbMptRef, key: openArray[byte]): CoreDbRc[Blob] =
|
||||||
const info = "fetchFn()"
|
const info = "fetchFn()"
|
||||||
|
|
||||||
let rc = block:
|
let rc = block:
|
||||||
|
@ -241,7 +240,7 @@ proc mptMethods(cMpt: AristoCoreDbMptRef): CoreDbMptFns =
|
||||||
else:
|
else:
|
||||||
err(rc.error.toError(base, info, MptNotFound))
|
err(rc.error.toError(base, info, MptNotFound))
|
||||||
|
|
||||||
proc mptMerge(k: openArray[byte]; v: openArray[byte]): CoreDbRc[void] =
|
proc mptMerge(cMpt: AristoCoreDbMptRef, k: openArray[byte]; v: openArray[byte]): CoreDbRc[void] =
|
||||||
const info = "mergeFn()"
|
const info = "mergeFn()"
|
||||||
|
|
||||||
if cMpt.accPath.isValid:
|
if cMpt.accPath.isValid:
|
||||||
|
@ -257,7 +256,7 @@ proc mptMethods(cMpt: AristoCoreDbMptRef): CoreDbMptFns =
|
||||||
|
|
||||||
ok()
|
ok()
|
||||||
|
|
||||||
proc mptDelete(key: openArray[byte]): CoreDbRc[void] =
|
proc mptDelete(cMpt: AristoCoreDbMptRef, key: openArray[byte]): CoreDbRc[void] =
|
||||||
const info = "deleteFn()"
|
const info = "deleteFn()"
|
||||||
|
|
||||||
let rc = block:
|
let rc = block:
|
||||||
|
@ -281,7 +280,7 @@ proc mptMethods(cMpt: AristoCoreDbMptRef): CoreDbMptFns =
|
||||||
|
|
||||||
ok()
|
ok()
|
||||||
|
|
||||||
proc mptHasPath(key: openArray[byte]): CoreDbRc[bool] =
|
proc mptHasPath(cMpt: AristoCoreDbMptRef, key: openArray[byte]): CoreDbRc[bool] =
|
||||||
const info = "hasPathFn()"
|
const info = "hasPathFn()"
|
||||||
|
|
||||||
let rc = block:
|
let rc = block:
|
||||||
|
@ -295,52 +294,50 @@ proc mptMethods(cMpt: AristoCoreDbMptRef): CoreDbMptFns =
|
||||||
return err(rc.error.toError(base, info))
|
return err(rc.error.toError(base, info))
|
||||||
ok(rc.value)
|
ok(rc.value)
|
||||||
|
|
||||||
|
## Generic columns database handlers
|
||||||
CoreDbMptFns(
|
CoreDbMptFns(
|
||||||
backendFn: proc(): CoreDbMptBackendRef =
|
backendFn: proc(cMpt: CoreDbMptRef): CoreDbMptBackendRef =
|
||||||
mptBackend(),
|
mptBackend(AristoCoreDbMptRef(cMpt)),
|
||||||
|
|
||||||
fetchFn: proc(k: openArray[byte]): CoreDbRc[Blob] =
|
fetchFn: proc(cMpt: CoreDbMptRef, k: openArray[byte]): CoreDbRc[Blob] =
|
||||||
mptFetch(k),
|
mptFetch(AristoCoreDbMptRef(cMpt), k),
|
||||||
|
|
||||||
deleteFn: proc(k: openArray[byte]): CoreDbRc[void] =
|
deleteFn: proc(cMpt: CoreDbMptRef, k: openArray[byte]): CoreDbRc[void] =
|
||||||
mptDelete(k),
|
mptDelete(AristoCoreDbMptRef(cMpt), k),
|
||||||
|
|
||||||
mergeFn: proc(k: openArray[byte]; v: openArray[byte]): CoreDbRc[void] =
|
mergeFn: proc(cMpt: CoreDbMptRef, k: openArray[byte]; v: openArray[byte]): CoreDbRc[void] =
|
||||||
mptMerge(k, v),
|
mptMerge(AristoCoreDbMptRef(cMpt), k, v),
|
||||||
|
|
||||||
hasPathFn: proc(k: openArray[byte]): CoreDbRc[bool] =
|
hasPathFn: proc(cMpt: CoreDbMptRef, k: openArray[byte]): CoreDbRc[bool] =
|
||||||
mptHasPath(k),
|
mptHasPath(AristoCoreDbMptRef(cMpt), k),
|
||||||
|
|
||||||
getColFn: proc(): CoreDbColRef =
|
getColFn: proc(cMpt: CoreDbMptRef): CoreDbColRef =
|
||||||
mptColFn())
|
mptColFn(AristoCoreDbMptRef(cMpt)))
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
# Private account call back functions
|
# Private account call back functions
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
proc accMethods(cAcc: AristoCoreDbAccRef): CoreDbAccFns =
|
proc accMethods(): CoreDbAccFns =
|
||||||
## Account columns database handlers
|
## Account columns database handlers
|
||||||
let
|
template base: untyped = cAcc.base
|
||||||
cAcc = cAcc # So it can savely be captured
|
template db: untyped = base.parent
|
||||||
base = cAcc.base # Will not change and can be captured
|
template api: untyped = base.api
|
||||||
db = base.parent # Ditto
|
template mpt: untyped = base.ctx.mpt
|
||||||
api = base.api # Ditto
|
|
||||||
mpt = base.ctx.mpt # Ditto
|
|
||||||
|
|
||||||
proc getColFn(): CoreDbColRef =
|
proc getColFn(cAcc: AristoCoreDbAccRef): CoreDbColRef =
|
||||||
db.bless AristoColRef(
|
db.bless AristoColRef(
|
||||||
base: base,
|
base: base,
|
||||||
colType: CtAccounts)
|
colType: CtAccounts)
|
||||||
|
|
||||||
proc accCloneMpt(): CoreDbRc[CoreDbMptRef] =
|
proc accCloneMpt(cAcc: AristoCoreDbAccRef): CoreDbRc[CoreDbMptRef] =
|
||||||
var xpt = AristoCoreDbMptRef(
|
var xpt = AristoCoreDbMptRef(
|
||||||
base: base,
|
base: base,
|
||||||
mptRoot: AccountsVID)
|
mptRoot: AccountsVID)
|
||||||
xpt.methods = xpt.mptMethods
|
xpt.methods = mptMethods()
|
||||||
ok(db.bless xpt)
|
ok(db.bless xpt)
|
||||||
|
|
||||||
proc accFetch(address: EthAddress): CoreDbRc[CoreDbAccount] =
|
proc accFetch(cAcc: AristoCoreDbAccRef, address: EthAddress): CoreDbRc[CoreDbAccount] =
|
||||||
const info = "acc/fetchFn()"
|
const info = "acc/fetchFn()"
|
||||||
|
|
||||||
let
|
let
|
||||||
|
@ -352,7 +349,7 @@ proc accMethods(cAcc: AristoCoreDbAccRef): CoreDbAccFns =
|
||||||
|
|
||||||
ok cAcc.toCoreDbAccount(acc, address)
|
ok cAcc.toCoreDbAccount(acc, address)
|
||||||
|
|
||||||
proc accMerge(account: CoreDbAccount): CoreDbRc[void] =
|
proc accMerge(cAcc: AristoCoreDbAccRef, account: CoreDbAccount): CoreDbRc[void] =
|
||||||
const info = "acc/mergeFn()"
|
const info = "acc/mergeFn()"
|
||||||
|
|
||||||
let
|
let
|
||||||
|
@ -363,7 +360,7 @@ proc accMethods(cAcc: AristoCoreDbAccRef): CoreDbAccFns =
|
||||||
return err(rc.error.toError(base, info))
|
return err(rc.error.toError(base, info))
|
||||||
ok()
|
ok()
|
||||||
|
|
||||||
proc accDelete(address: EthAddress): CoreDbRc[void] =
|
proc accDelete(cAcc: AristoCoreDbAccRef, address: EthAddress): CoreDbRc[void] =
|
||||||
const info = "acc/deleteFn()"
|
const info = "acc/deleteFn()"
|
||||||
|
|
||||||
let key = address.keccakHash.data
|
let key = address.keccakHash.data
|
||||||
|
@ -374,7 +371,7 @@ proc accMethods(cAcc: AristoCoreDbAccRef): CoreDbAccFns =
|
||||||
|
|
||||||
ok()
|
ok()
|
||||||
|
|
||||||
proc accStoDelete(address: EthAddress): CoreDbRc[void] =
|
proc accStoDelete(cAcc: AristoCoreDbAccRef, address: EthAddress): CoreDbRc[void] =
|
||||||
const info = "stoDeleteFn()"
|
const info = "stoDeleteFn()"
|
||||||
|
|
||||||
let rc = api.deleteStorageTree(mpt, address.to(PathID))
|
let rc = api.deleteStorageTree(mpt, address.to(PathID))
|
||||||
|
@ -383,7 +380,7 @@ proc accMethods(cAcc: AristoCoreDbAccRef): CoreDbAccFns =
|
||||||
|
|
||||||
ok()
|
ok()
|
||||||
|
|
||||||
proc accHasPath(address: EthAddress): CoreDbRc[bool] =
|
proc accHasPath(cAcc: AristoCoreDbAccRef, address: EthAddress): CoreDbRc[bool] =
|
||||||
const info = "hasPathFn()"
|
const info = "hasPathFn()"
|
||||||
|
|
||||||
let
|
let
|
||||||
|
@ -394,40 +391,39 @@ proc accMethods(cAcc: AristoCoreDbAccRef): CoreDbAccFns =
|
||||||
|
|
||||||
|
|
||||||
CoreDbAccFns(
|
CoreDbAccFns(
|
||||||
getMptFn: proc(): CoreDbRc[CoreDbMptRef] =
|
getMptFn: proc(cAcc: CoreDbAccRef): CoreDbRc[CoreDbMptRef] =
|
||||||
accCloneMpt(),
|
accCloneMpt(AristoCoreDbAccRef(cAcc)),
|
||||||
|
|
||||||
fetchFn: proc(address: EthAddress): CoreDbRc[CoreDbAccount] =
|
fetchFn: proc(cAcc: CoreDbAccRef, address: EthAddress): CoreDbRc[CoreDbAccount] =
|
||||||
accFetch(address),
|
accFetch(AristoCoreDbAccRef(cAcc), address),
|
||||||
|
|
||||||
deleteFn: proc(address: EthAddress): CoreDbRc[void] =
|
deleteFn: proc(cAcc: CoreDbAccRef, address: EthAddress): CoreDbRc[void] =
|
||||||
accDelete(address),
|
accDelete(AristoCoreDbAccRef(cAcc), address),
|
||||||
|
|
||||||
stoDeleteFn: proc(address: EthAddress): CoreDbRc[void] =
|
stoDeleteFn: proc(cAcc: CoreDbAccRef, address: EthAddress): CoreDbRc[void] =
|
||||||
accStoDelete(address),
|
accStoDelete(AristoCoreDbAccRef(cAcc), address),
|
||||||
|
|
||||||
mergeFn: proc(acc: CoreDbAccount): CoreDbRc[void] =
|
mergeFn: proc(cAcc: CoreDbAccRef, acc: CoreDbAccount): CoreDbRc[void] =
|
||||||
accMerge(acc),
|
accMerge(AristoCoreDbAccRef(cAcc), acc),
|
||||||
|
|
||||||
hasPathFn: proc(address: EthAddress): CoreDbRc[bool] =
|
hasPathFn: proc(cAcc: CoreDbAccRef, address: EthAddress): CoreDbRc[bool] =
|
||||||
accHasPath(address),
|
accHasPath(AristoCoreDbAccRef(cAcc), address),
|
||||||
|
|
||||||
getColFn: proc(): CoreDbColRef =
|
getColFn: proc(cAcc: CoreDbAccRef): CoreDbColRef =
|
||||||
getColFn())
|
getColFn(AristoCoreDbAccRef(cAcc)))
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
# Private context call back functions
|
# Private context call back functions
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
proc ctxMethods(cCtx: AristoCoreDbCtxRef): CoreDbCtxFns =
|
proc ctxMethods(cCtx: AristoCoreDbCtxRef): CoreDbCtxFns =
|
||||||
let
|
template base: untyped = cCtx.base
|
||||||
cCtx = cCtx # So it can savely be captured
|
template db: untyped = base.parent
|
||||||
base = cCtx.base # Will not change and can be captured
|
template api: untyped = base.api
|
||||||
db = base.parent # Ditto
|
template mpt: untyped = cCtx.mpt
|
||||||
api = base.api # Ditto
|
|
||||||
mpt = cCtx.mpt # Ditto
|
|
||||||
|
|
||||||
proc ctxNewCol(
|
proc ctxNewCol(
|
||||||
|
cCtx: AristoCoreDbCtxRef,
|
||||||
colType: CoreDbColType;
|
colType: CoreDbColType;
|
||||||
colState: Hash256;
|
colState: Hash256;
|
||||||
address: Opt[EthAddress];
|
address: Opt[EthAddress];
|
||||||
|
@ -463,7 +459,7 @@ proc ctxMethods(cCtx: AristoCoreDbCtxRef): CoreDbCtxFns =
|
||||||
err(aristo.GenericError.toError(base, info, RootNotFound))
|
err(aristo.GenericError.toError(base, info, RootNotFound))
|
||||||
|
|
||||||
|
|
||||||
proc ctxGetMpt(col: CoreDbColRef): CoreDbRc[CoreDbMptRef] =
|
proc ctxGetMpt(cCtx: AristoCoreDbCtxRef, col: CoreDbColRef): CoreDbRc[CoreDbMptRef] =
|
||||||
const
|
const
|
||||||
info = "ctx/getMptFn()"
|
info = "ctx/getMptFn()"
|
||||||
let
|
let
|
||||||
|
@ -505,10 +501,10 @@ proc ctxMethods(cCtx: AristoCoreDbCtxRef): CoreDbCtxFns =
|
||||||
col.reset = false
|
col.reset = false
|
||||||
|
|
||||||
newMpt.base = base
|
newMpt.base = base
|
||||||
newMpt.methods = newMpt.mptMethods()
|
newMpt.methods = mptMethods()
|
||||||
ok(db.bless newMpt)
|
ok(db.bless newMpt)
|
||||||
|
|
||||||
proc ctxGetAcc(col: CoreDbColRef): CoreDbRc[CoreDbAccRef] =
|
proc ctxGetAcc(cCtx: AristoCoreDbCtxRef, col: CoreDbColRef): CoreDbRc[CoreDbAccRef] =
|
||||||
const info = "getAccFn()"
|
const info = "getAccFn()"
|
||||||
|
|
||||||
let col = AristoColRef(col)
|
let col = AristoColRef(col)
|
||||||
|
@ -517,31 +513,32 @@ proc ctxMethods(cCtx: AristoCoreDbCtxRef): CoreDbCtxFns =
|
||||||
return err(error.toError(base, info, RootUnacceptable))
|
return err(error.toError(base, info, RootUnacceptable))
|
||||||
|
|
||||||
let acc = AristoCoreDbAccRef(base: base)
|
let acc = AristoCoreDbAccRef(base: base)
|
||||||
acc.methods = acc.accMethods()
|
acc.methods = accMethods()
|
||||||
|
|
||||||
ok(db.bless acc)
|
ok(db.bless acc)
|
||||||
|
|
||||||
proc ctxForget() =
|
proc ctxForget(cCtx: AristoCoreDbCtxRef) =
|
||||||
api.forget(mpt).isOkOr:
|
api.forget(mpt).isOkOr:
|
||||||
raiseAssert "forgetFn(): " & $error
|
raiseAssert "forgetFn(): " & $error
|
||||||
|
|
||||||
|
|
||||||
CoreDbCtxFns(
|
CoreDbCtxFns(
|
||||||
newColFn: proc(
|
newColFn: proc(
|
||||||
|
cCtx: CoreDbCtxRef;
|
||||||
col: CoreDbColType;
|
col: CoreDbColType;
|
||||||
colState: Hash256;
|
colState: Hash256;
|
||||||
address: Opt[EthAddress];
|
address: Opt[EthAddress];
|
||||||
): CoreDbRc[CoreDbColRef] =
|
): CoreDbRc[CoreDbColRef] =
|
||||||
ctxNewCol(col, colState, address),
|
ctxNewCol(AristoCoreDbCtxRef(cCtx), col, colState, address),
|
||||||
|
|
||||||
getMptFn: proc(col: CoreDbColRef): CoreDbRc[CoreDbMptRef] =
|
getMptFn: proc(cCtx: CoreDbCtxRef, col: CoreDbColRef): CoreDbRc[CoreDbMptRef] =
|
||||||
ctxGetMpt(col),
|
ctxGetMpt(AristoCoreDbCtxRef(cCtx), col),
|
||||||
|
|
||||||
getAccFn: proc(col: CoreDbColRef): CoreDbRc[CoreDbAccRef] =
|
getAccFn: proc(cCtx: CoreDbCtxRef, col: CoreDbColRef): CoreDbRc[CoreDbAccRef] =
|
||||||
ctxGetAcc(col),
|
ctxGetAcc(AristoCoreDbCtxRef(cCtx), col),
|
||||||
|
|
||||||
forgetFn: proc() =
|
forgetFn: proc(cCtx: CoreDbCtxRef) =
|
||||||
ctxForget())
|
ctxForget(AristoCoreDbCtxRef(cCtx)))
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
# Public handlers and helpers
|
# Public handlers and helpers
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
{.push raises: [].}
|
{.push raises: [].}
|
||||||
|
|
||||||
import
|
import
|
||||||
chronicles,
|
|
||||||
eth/common,
|
eth/common,
|
||||||
"../.."/[constants, errors],
|
"../.."/[constants, errors],
|
||||||
./base/[api_tracking, base_desc]
|
./base/[api_tracking, base_desc]
|
||||||
|
@ -205,13 +204,20 @@ proc parent*[T: CoreDbKvtRef |
|
||||||
##
|
##
|
||||||
result = child.parent
|
result = child.parent
|
||||||
|
|
||||||
proc backend*(dsc: CoreDbKvtRef | CoreDbMptRef): auto =
|
proc backend*(dsc: CoreDbKvtRef): auto =
|
||||||
## Getter, retrieves the *raw* backend object for special/localised support.
|
## Getter, retrieves the *raw* backend object for special/localised support.
|
||||||
##
|
##
|
||||||
dsc.setTrackNewApi AnyBackendFn
|
dsc.setTrackNewApi AnyBackendFn
|
||||||
result = dsc.methods.backendFn()
|
result = dsc.methods.backendFn()
|
||||||
dsc.ifTrackNewApi: debug newApiTxt, api, elapsed
|
dsc.ifTrackNewApi: debug newApiTxt, api, elapsed
|
||||||
|
|
||||||
|
proc backend*(mpt: CoreDbMptRef): auto =
|
||||||
|
## Getter, retrieves the *raw* backend object for special/localised support.
|
||||||
|
##
|
||||||
|
mpt.setTrackNewApi AnyBackendFn
|
||||||
|
result = mpt.methods.backendFn(mpt)
|
||||||
|
mpt.ifTrackNewApi: debug newApiTxt, api, elapsed
|
||||||
|
|
||||||
proc finish*(db: CoreDbRef; eradicate = false) =
|
proc finish*(db: CoreDbRef; eradicate = false) =
|
||||||
## Database destructor. If the argument `eradicate` is set `false`, the
|
## Database destructor. If the argument `eradicate` is set `false`, the
|
||||||
## database is left as-is and only the in-memory handlers are cleaned up.
|
## database is left as-is and only the in-memory handlers are cleaned up.
|
||||||
|
@ -337,7 +343,7 @@ proc forget*(ctx: CoreDbCtxRef) =
|
||||||
## context. This function fails if `ctx` is the default context.
|
## context. This function fails if `ctx` is the default context.
|
||||||
##
|
##
|
||||||
ctx.setTrackNewApi CtxForgetFn
|
ctx.setTrackNewApi CtxForgetFn
|
||||||
ctx.methods.forgetFn()
|
ctx.methods.forgetFn(ctx)
|
||||||
ctx.ifTrackNewApi: debug newApiTxt, api, elapsed
|
ctx.ifTrackNewApi: debug newApiTxt, api, elapsed
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
@ -381,7 +387,7 @@ proc newColumn*(
|
||||||
## db.getAcc col
|
## db.getAcc col
|
||||||
##
|
##
|
||||||
ctx.setTrackNewApi CtxNewColFn
|
ctx.setTrackNewApi CtxNewColFn
|
||||||
result = ctx.methods.newColFn(colType, colState, address)
|
result = ctx.methods.newColFn(ctx, colType, colState, address)
|
||||||
ctx.ifTrackNewApi:
|
ctx.ifTrackNewApi:
|
||||||
debug newApiTxt, api, elapsed, colType, colState, address, result
|
debug newApiTxt, api, elapsed, colType, colState, address, result
|
||||||
|
|
||||||
|
@ -393,7 +399,7 @@ proc newColumn*(
|
||||||
## Shortcut for `ctx.newColumn(CtStorage,colState,some(address))`.
|
## Shortcut for `ctx.newColumn(CtStorage,colState,some(address))`.
|
||||||
##
|
##
|
||||||
ctx.setTrackNewApi CtxNewColFn
|
ctx.setTrackNewApi CtxNewColFn
|
||||||
result = ctx.methods.newColFn(CtStorage, colState, Opt.some(address))
|
result = ctx.methods.newColFn(ctx, CtStorage, colState, Opt.some(address))
|
||||||
ctx.ifTrackNewApi: debug newApiTxt, api, elapsed, colState, address, result
|
ctx.ifTrackNewApi: debug newApiTxt, api, elapsed, colState, address, result
|
||||||
|
|
||||||
proc newColumn*(
|
proc newColumn*(
|
||||||
|
@ -406,7 +412,7 @@ proc newColumn*(
|
||||||
##
|
##
|
||||||
ctx.setTrackNewApi CtxNewColFn
|
ctx.setTrackNewApi CtxNewColFn
|
||||||
result = ctx.methods.newColFn(
|
result = ctx.methods.newColFn(
|
||||||
CtStorage, EMPTY_ROOT_HASH, Opt.some(address)).valueOr:
|
ctx, CtStorage, EMPTY_ROOT_HASH, Opt.some(address)).valueOr:
|
||||||
raiseAssert error.prettyText()
|
raiseAssert error.prettyText()
|
||||||
ctx.ifTrackNewApi: debug newApiTxt, api, elapsed, address, result
|
ctx.ifTrackNewApi: debug newApiTxt, api, elapsed, address, result
|
||||||
|
|
||||||
|
@ -474,7 +480,7 @@ proc getMpt*(
|
||||||
## function `getColumn()`.
|
## function `getColumn()`.
|
||||||
##
|
##
|
||||||
ctx.setTrackNewApi CtxGetMptFn
|
ctx.setTrackNewApi CtxGetMptFn
|
||||||
result = ctx.methods.getMptFn col
|
result = ctx.methods.getMptFn(ctx, col)
|
||||||
ctx.ifTrackNewApi: debug newApiTxt, api, elapsed, col, result
|
ctx.ifTrackNewApi: debug newApiTxt, api, elapsed, col, result
|
||||||
|
|
||||||
proc getMpt*(
|
proc getMpt*(
|
||||||
|
@ -487,8 +493,8 @@ proc getMpt*(
|
||||||
## return a non-nil descriptor or throw an exception.
|
## return a non-nil descriptor or throw an exception.
|
||||||
##
|
##
|
||||||
ctx.setTrackNewApi CtxGetMptFn
|
ctx.setTrackNewApi CtxGetMptFn
|
||||||
let col = ctx.methods.newColFn(colType, EMPTY_ROOT_HASH, address).value
|
let col = ctx.methods.newColFn(ctx, colType, EMPTY_ROOT_HASH, address).value
|
||||||
result = ctx.methods.getMptFn(col).valueOr:
|
result = ctx.methods.getMptFn(ctx, col).valueOr:
|
||||||
raiseAssert error.prettyText()
|
raiseAssert error.prettyText()
|
||||||
ctx.ifTrackNewApi: debug newApiTxt, api, colType, elapsed
|
ctx.ifTrackNewApi: debug newApiTxt, api, colType, elapsed
|
||||||
|
|
||||||
|
@ -500,7 +506,7 @@ proc getMpt*(acc: CoreDbAccRef): CoreDbMptRef =
|
||||||
## argument.
|
## argument.
|
||||||
##
|
##
|
||||||
acc.setTrackNewApi AccToMptFn
|
acc.setTrackNewApi AccToMptFn
|
||||||
result = acc.methods.getMptFn().valueOr:
|
result = acc.methods.getMptFn(acc).valueOr:
|
||||||
raiseAssert error.prettyText()
|
raiseAssert error.prettyText()
|
||||||
acc.ifTrackNewApi:
|
acc.ifTrackNewApi:
|
||||||
let colState = result.methods.getColFn()
|
let colState = result.methods.getColFn()
|
||||||
|
@ -526,7 +532,7 @@ proc getAcc*(
|
||||||
## This function works similar to `getMpt()` for handling accounts.
|
## This function works similar to `getMpt()` for handling accounts.
|
||||||
##
|
##
|
||||||
ctx.setTrackNewApi CtxGetAccFn
|
ctx.setTrackNewApi CtxGetAccFn
|
||||||
result = ctx.methods.getAccFn col
|
result = ctx.methods.getAccFn(ctx, col)
|
||||||
ctx.ifTrackNewApi: debug newApiTxt, api, elapsed, col, result
|
ctx.ifTrackNewApi: debug newApiTxt, api, elapsed, col, result
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
@ -537,14 +543,14 @@ proc getColumn*(acc: CoreDbAccRef): CoreDbColRef =
|
||||||
## Getter, result is not `nil`
|
## Getter, result is not `nil`
|
||||||
##
|
##
|
||||||
acc.setTrackNewApi AccGetColFn
|
acc.setTrackNewApi AccGetColFn
|
||||||
result = acc.methods.getColFn()
|
result = acc.methods.getColFn(acc)
|
||||||
acc.ifTrackNewApi: debug newApiTxt, api, elapsed, result
|
acc.ifTrackNewApi: debug newApiTxt, api, elapsed, result
|
||||||
|
|
||||||
proc getColumn*(mpt: CoreDbMptRef): CoreDbColRef =
|
proc getColumn*(mpt: CoreDbMptRef): CoreDbColRef =
|
||||||
## Variant of `getColumn()`
|
## Variant of `getColumn()`
|
||||||
##
|
##
|
||||||
mpt.setTrackNewApi MptGetColFn
|
mpt.setTrackNewApi MptGetColFn
|
||||||
result = mpt.methods.getColFn()
|
result = mpt.methods.getColFn(mpt)
|
||||||
mpt.ifTrackNewApi: debug newApiTxt, api, elapsed, result
|
mpt.ifTrackNewApi: debug newApiTxt, api, elapsed, result
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
@ -556,9 +562,9 @@ proc fetch*(mpt: CoreDbMptRef; key: openArray[byte]): CoreDbRc[Blob] =
|
||||||
## non-empty `Blob` or an error code.
|
## non-empty `Blob` or an error code.
|
||||||
##
|
##
|
||||||
mpt.setTrackNewApi MptFetchFn
|
mpt.setTrackNewApi MptFetchFn
|
||||||
result = mpt.methods.fetchFn key
|
result = mpt.methods.fetchFn(mpt, key)
|
||||||
mpt.ifTrackNewApi:
|
mpt.ifTrackNewApi:
|
||||||
let col = mpt.methods.getColFn()
|
let col = mpt.methods.getColFn(mpt)
|
||||||
debug newApiTxt, api, elapsed, col, key=key.toStr, result
|
debug newApiTxt, api, elapsed, col, key=key.toStr, result
|
||||||
|
|
||||||
proc fetchOrEmpty*(mpt: CoreDbMptRef; key: openArray[byte]): CoreDbRc[Blob] =
|
proc fetchOrEmpty*(mpt: CoreDbMptRef; key: openArray[byte]): CoreDbRc[Blob] =
|
||||||
|
@ -566,16 +572,16 @@ proc fetchOrEmpty*(mpt: CoreDbMptRef; key: openArray[byte]): CoreDbRc[Blob] =
|
||||||
## on the database.
|
## on the database.
|
||||||
##
|
##
|
||||||
mpt.setTrackNewApi MptFetchOrEmptyFn
|
mpt.setTrackNewApi MptFetchOrEmptyFn
|
||||||
result = mpt.methods.fetchFn key
|
result = mpt.methods.fetchFn(mpt, key)
|
||||||
if result.isErr and result.error.error == MptNotFound:
|
if result.isErr and result.error.error == MptNotFound:
|
||||||
result = CoreDbRc[Blob].ok(EmptyBlob)
|
result = CoreDbRc[Blob].ok(EmptyBlob)
|
||||||
mpt.ifTrackNewApi:
|
mpt.ifTrackNewApi:
|
||||||
let col = mpt.methods.getColFn()
|
let col = mpt.methods.getColFn(mpt)
|
||||||
debug newApiTxt, api, elapsed, col, key=key.toStr, result
|
debug newApiTxt, api, elapsed, col, key=key.toStr, result
|
||||||
|
|
||||||
proc delete*(mpt: CoreDbMptRef; key: openArray[byte]): CoreDbRc[void] =
|
proc delete*(mpt: CoreDbMptRef; key: openArray[byte]): CoreDbRc[void] =
|
||||||
mpt.setTrackNewApi MptDeleteFn
|
mpt.setTrackNewApi MptDeleteFn
|
||||||
result = mpt.methods.deleteFn key
|
result = mpt.methods.deleteFn(mpt, key)
|
||||||
mpt.ifTrackNewApi:
|
mpt.ifTrackNewApi:
|
||||||
let col = mpt.methods.getColFn()
|
let col = mpt.methods.getColFn()
|
||||||
debug newApiTxt, api, elapsed, col, key=key.toStr, result
|
debug newApiTxt, api, elapsed, col, key=key.toStr, result
|
||||||
|
@ -586,9 +592,9 @@ proc merge*(
|
||||||
val: openArray[byte];
|
val: openArray[byte];
|
||||||
): CoreDbRc[void] =
|
): CoreDbRc[void] =
|
||||||
mpt.setTrackNewApi MptMergeFn
|
mpt.setTrackNewApi MptMergeFn
|
||||||
result = mpt.methods.mergeFn(key, val)
|
result = mpt.methods.mergeFn(mpt, key, val)
|
||||||
mpt.ifTrackNewApi:
|
mpt.ifTrackNewApi:
|
||||||
let col = mpt.methods.getColFn()
|
let col = mpt.methods.getColFn(mpt)
|
||||||
debug newApiTxt, api, elapsed, col, key=key.toStr, val=val.toLenStr, result
|
debug newApiTxt, api, elapsed, col, key=key.toStr, val=val.toLenStr, result
|
||||||
|
|
||||||
proc hasPath*(mpt: CoreDbMptRef; key: openArray[byte]): CoreDbRc[bool] =
|
proc hasPath*(mpt: CoreDbMptRef; key: openArray[byte]): CoreDbRc[bool] =
|
||||||
|
@ -596,9 +602,9 @@ proc hasPath*(mpt: CoreDbMptRef; key: openArray[byte]): CoreDbRc[bool] =
|
||||||
## than a `Result[]`.
|
## than a `Result[]`.
|
||||||
##
|
##
|
||||||
mpt.setTrackNewApi MptHasPathFn
|
mpt.setTrackNewApi MptHasPathFn
|
||||||
result = mpt.methods.hasPathFn key
|
result = mpt.methods.hasPathFn(mpt, key)
|
||||||
mpt.ifTrackNewApi:
|
mpt.ifTrackNewApi:
|
||||||
let col = mpt.methods.getColFn()
|
let col = mpt.methods.getColFn(mpt)
|
||||||
debug newApiTxt, api, elapsed, col, key=key.toStr, result
|
debug newApiTxt, api, elapsed, col, key=key.toStr, result
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
@ -609,7 +615,7 @@ proc fetch*(acc: CoreDbAccRef; address: EthAddress): CoreDbRc[CoreDbAccount] =
|
||||||
## Fetch data from the argument `acc`.
|
## Fetch data from the argument `acc`.
|
||||||
##
|
##
|
||||||
acc.setTrackNewApi AccFetchFn
|
acc.setTrackNewApi AccFetchFn
|
||||||
result = acc.methods.fetchFn address
|
result = acc.methods.fetchFn(acc, address)
|
||||||
acc.ifTrackNewApi:
|
acc.ifTrackNewApi:
|
||||||
let storage = if result.isErr: "n/a" else: result.value.storage.prettyText()
|
let storage = if result.isErr: "n/a" else: result.value.storage.prettyText()
|
||||||
debug newApiTxt, api, elapsed, address, storage, result
|
debug newApiTxt, api, elapsed, address, storage, result
|
||||||
|
@ -617,7 +623,7 @@ proc fetch*(acc: CoreDbAccRef; address: EthAddress): CoreDbRc[CoreDbAccount] =
|
||||||
|
|
||||||
proc delete*(acc: CoreDbAccRef; address: EthAddress): CoreDbRc[void] =
|
proc delete*(acc: CoreDbAccRef; address: EthAddress): CoreDbRc[void] =
|
||||||
acc.setTrackNewApi AccDeleteFn
|
acc.setTrackNewApi AccDeleteFn
|
||||||
result = acc.methods.deleteFn address
|
result = acc.methods.deleteFn(acc, address)
|
||||||
acc.ifTrackNewApi: debug newApiTxt, api, elapsed, address, result
|
acc.ifTrackNewApi: debug newApiTxt, api, elapsed, address, result
|
||||||
|
|
||||||
proc stoDelete*(acc: CoreDbAccRef; address: EthAddress): CoreDbRc[void] =
|
proc stoDelete*(acc: CoreDbAccRef; address: EthAddress): CoreDbRc[void] =
|
||||||
|
@ -632,7 +638,7 @@ proc stoDelete*(acc: CoreDbAccRef; address: EthAddress): CoreDbRc[void] =
|
||||||
## backend.
|
## backend.
|
||||||
##
|
##
|
||||||
acc.setTrackNewApi AccStoDeleteFn
|
acc.setTrackNewApi AccStoDeleteFn
|
||||||
result = acc.methods.stoDeleteFn address
|
result = acc.methods.stoDeleteFn(acc, address)
|
||||||
acc.ifTrackNewApi: debug newApiTxt, api, elapsed, address, result
|
acc.ifTrackNewApi: debug newApiTxt, api, elapsed, address, result
|
||||||
|
|
||||||
|
|
||||||
|
@ -641,7 +647,7 @@ proc merge*(
|
||||||
account: CoreDbAccount;
|
account: CoreDbAccount;
|
||||||
): CoreDbRc[void] =
|
): CoreDbRc[void] =
|
||||||
acc.setTrackNewApi AccMergeFn
|
acc.setTrackNewApi AccMergeFn
|
||||||
result = acc.methods.mergeFn account
|
result = acc.methods.mergeFn(acc, account)
|
||||||
acc.ifTrackNewApi:
|
acc.ifTrackNewApi:
|
||||||
let address = account.address
|
let address = account.address
|
||||||
debug newApiTxt, api, elapsed, address, result
|
debug newApiTxt, api, elapsed, address, result
|
||||||
|
@ -651,7 +657,7 @@ proc hasPath*(acc: CoreDbAccRef; address: EthAddress): CoreDbRc[bool] =
|
||||||
## Would be named `contains` if it returned `bool` rather than `Result[]`.
|
## Would be named `contains` if it returned `bool` rather than `Result[]`.
|
||||||
##
|
##
|
||||||
acc.setTrackNewApi AccHasPathFn
|
acc.setTrackNewApi AccHasPathFn
|
||||||
result = acc.methods.hasPathFn address
|
result = acc.methods.hasPathFn(acc, address)
|
||||||
acc.ifTrackNewApi: debug newApiTxt, api, elapsed, address, result
|
acc.ifTrackNewApi: debug newApiTxt, api, elapsed, address, result
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -160,16 +160,14 @@ type
|
||||||
# --------------------------------------------------
|
# --------------------------------------------------
|
||||||
# Sub-descriptor: MPT context methods
|
# Sub-descriptor: MPT context methods
|
||||||
# --------------------------------------------------
|
# --------------------------------------------------
|
||||||
CoreDbCtxFromTxFn* =
|
|
||||||
proc(root: Hash256; kind: CoreDbColType): CoreDbRc[CoreDbCtxRef] {.noRaise.}
|
|
||||||
CoreDbCtxNewColFn* = proc(
|
CoreDbCtxNewColFn* = proc(
|
||||||
colType: CoreDbColType; colState: Hash256; address: Opt[EthAddress];
|
cCtx: CoreDbCtxRef; colType: CoreDbColType; colState: Hash256; address: Opt[EthAddress];
|
||||||
): CoreDbRc[CoreDbColRef] {.noRaise.}
|
): CoreDbRc[CoreDbColRef] {.noRaise.}
|
||||||
CoreDbCtxGetMptFn* = proc(
|
CoreDbCtxGetMptFn* = proc(
|
||||||
root: CoreDbColRef): CoreDbRc[CoreDbMptRef] {.noRaise.}
|
cCtx: CoreDbCtxRef; root: CoreDbColRef): CoreDbRc[CoreDbMptRef] {.noRaise.}
|
||||||
CoreDbCtxGetAccFn* = proc(
|
CoreDbCtxGetAccFn* = proc(
|
||||||
root: CoreDbColRef): CoreDbRc[CoreDbAccRef] {.noRaise.}
|
cCtx: CoreDbCtxRef; root: CoreDbColRef): CoreDbRc[CoreDbAccRef] {.noRaise.}
|
||||||
CoreDbCtxForgetFn* = proc() {.noRaise.}
|
CoreDbCtxForgetFn* = proc(cCtx: CoreDbCtxRef) {.noRaise.}
|
||||||
|
|
||||||
CoreDbCtxFns* = object
|
CoreDbCtxFns* = object
|
||||||
## Methods for context maniulation
|
## Methods for context maniulation
|
||||||
|
@ -181,20 +179,20 @@ type
|
||||||
# --------------------------------------------------
|
# --------------------------------------------------
|
||||||
# Sub-descriptor: generic Mpt/hexary trie methods
|
# Sub-descriptor: generic Mpt/hexary trie methods
|
||||||
# --------------------------------------------------
|
# --------------------------------------------------
|
||||||
CoreDbMptBackendFn* = proc(): CoreDbMptBackendRef {.noRaise.}
|
CoreDbMptBackendFn* = proc(cMpt: CoreDbMptRef): CoreDbMptBackendRef {.noRaise.}
|
||||||
CoreDbMptFetchFn* =
|
CoreDbMptFetchFn* =
|
||||||
proc(k: openArray[byte]): CoreDbRc[Blob] {.noRaise.}
|
proc(cMpt: CoreDbMptRef, k: openArray[byte]): CoreDbRc[Blob] {.noRaise.}
|
||||||
CoreDbMptFetchAccountFn* =
|
CoreDbMptFetchAccountFn* =
|
||||||
proc(k: openArray[byte]): CoreDbRc[CoreDbAccount] {.noRaise.}
|
proc(cMpt: CoreDbMptRef, k: openArray[byte]): CoreDbRc[CoreDbAccount] {.noRaise.}
|
||||||
CoreDbMptDeleteFn* =
|
CoreDbMptDeleteFn* =
|
||||||
proc(k: openArray[byte]): CoreDbRc[void] {.noRaise.}
|
proc(cMpt: CoreDbMptRef, k: openArray[byte]): CoreDbRc[void] {.noRaise.}
|
||||||
CoreDbMptMergeFn* =
|
CoreDbMptMergeFn* =
|
||||||
proc(k: openArray[byte]; v: openArray[byte]): CoreDbRc[void] {.noRaise.}
|
proc(cMpt: CoreDbMptRef, k: openArray[byte]; v: openArray[byte]): CoreDbRc[void] {.noRaise.}
|
||||||
CoreDbMptMergeAccountFn* =
|
CoreDbMptMergeAccountFn* =
|
||||||
proc(k: openArray[byte]; v: CoreDbAccount): CoreDbRc[void] {.noRaise.}
|
proc(cMpt: CoreDbMptRef, k: openArray[byte]; v: CoreDbAccount): CoreDbRc[void] {.noRaise.}
|
||||||
CoreDbMptHasPathFn* = proc(k: openArray[byte]): CoreDbRc[bool] {.noRaise.}
|
CoreDbMptHasPathFn* = proc(cMpt: CoreDbMptRef, k: openArray[byte]): CoreDbRc[bool] {.noRaise.}
|
||||||
CoreDbMptGetColFn* = proc(): CoreDbColRef {.noRaise.}
|
CoreDbMptGetColFn* = proc(cMpt: CoreDbMptRef): CoreDbColRef {.noRaise.}
|
||||||
CoreDbMptForgetFn* = proc(): CoreDbRc[void] {.noRaise.}
|
CoreDbMptForgetFn* = proc(cMpt: CoreDbMptRef): CoreDbRc[void] {.noRaise.}
|
||||||
|
|
||||||
CoreDbMptFns* = object
|
CoreDbMptFns* = object
|
||||||
## Methods for trie objects
|
## Methods for trie objects
|
||||||
|
@ -209,14 +207,13 @@ type
|
||||||
# ----------------------------------------------------
|
# ----------------------------------------------------
|
||||||
# Sub-descriptor: Mpt/hexary trie methods for accounts
|
# Sub-descriptor: Mpt/hexary trie methods for accounts
|
||||||
# ------------------------------------------------------
|
# ------------------------------------------------------
|
||||||
CoreDbAccGetMptFn* = proc(): CoreDbRc[CoreDbMptRef] {.noRaise.}
|
CoreDbAccGetMptFn* = proc(cAcc: CoreDbAccRef): CoreDbRc[CoreDbMptRef] {.noRaise.}
|
||||||
CoreDbAccFetchFn* = proc(k: EthAddress): CoreDbRc[CoreDbAccount] {.noRaise.}
|
CoreDbAccFetchFn* = proc(cAcc: CoreDbAccRef, k: EthAddress): CoreDbRc[CoreDbAccount] {.noRaise.}
|
||||||
CoreDbAccDeleteFn* = proc(k: EthAddress): CoreDbRc[void] {.noRaise.}
|
CoreDbAccDeleteFn* = proc(cAcc: CoreDbAccRef, k: EthAddress): CoreDbRc[void] {.noRaise.}
|
||||||
CoreDbAccStoDeleteFn* = proc(k: EthAddress): CoreDbRc[void] {.noRaise.}
|
CoreDbAccStoDeleteFn* = proc(cAcc: CoreDbAccRef,k: EthAddress): CoreDbRc[void] {.noRaise.}
|
||||||
CoreDbAccMergeFn* = proc(v: CoreDbAccount): CoreDbRc[void] {.noRaise.}
|
CoreDbAccMergeFn* = proc(cAcc: CoreDbAccRef, v: CoreDbAccount): CoreDbRc[void] {.noRaise.}
|
||||||
CoreDbAccHasPathFn* = proc(k: EthAddress): CoreDbRc[bool] {.noRaise.}
|
CoreDbAccHasPathFn* = proc(cAcc: CoreDbAccRef, k: EthAddress): CoreDbRc[bool] {.noRaise.}
|
||||||
CoreDbAccGetColFn* = proc(): CoreDbColRef {.noRaise.}
|
CoreDbAccGetColFn* = proc(cAcc: CoreDbAccRef): CoreDbColRef {.noRaise.}
|
||||||
CoreDbAccForgetFn* = proc(): CoreDbRc[void] {.noRaise.}
|
|
||||||
|
|
||||||
CoreDbAccFns* = object
|
CoreDbAccFns* = object
|
||||||
## Methods for trie objects
|
## Methods for trie objects
|
||||||
|
|
|
@ -97,7 +97,7 @@ const
|
||||||
#
|
#
|
||||||
# to pick right function when <op> is a variable . Using
|
# to pick right function when <op> is a variable . Using
|
||||||
#
|
#
|
||||||
# VmOpHandlers[fork][op].exec.run
|
# VmOpHandlers[fork][op].exec
|
||||||
#
|
#
|
||||||
# only works when <op> is a constant. There seems to be some optimisation
|
# only works when <op> is a constant. There seems to be some optimisation
|
||||||
# that garbles the <exec> sub-structures elements <prep>, <run>, and <post>.
|
# that garbles the <exec> sub-structures elements <prep>, <run>, and <post>.
|
||||||
|
@ -113,7 +113,7 @@ const
|
||||||
for op in Op:
|
for op in Op:
|
||||||
rc[fork][op].name = tab[op].name
|
rc[fork][op].name = tab[op].name
|
||||||
rc[fork][op].info = tab[op].info
|
rc[fork][op].info = tab[op].info
|
||||||
rc[fork][op].run = tab[op].exec.run
|
rc[fork][op].run = tab[op].exec
|
||||||
rc
|
rc
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
|
@ -290,179 +290,157 @@ const
|
||||||
forks: VmOpAllForks,
|
forks: VmOpAllForks,
|
||||||
name: "add",
|
name: "add",
|
||||||
info: "Addition operation",
|
info: "Addition operation",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: VmOpFn addOp),
|
||||||
run: VmOpFn addOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: Mul, ## 0x02, Multiplication
|
(opCode: Mul, ## 0x02, Multiplication
|
||||||
forks: VmOpAllForks,
|
forks: VmOpAllForks,
|
||||||
name: "mul",
|
name: "mul",
|
||||||
info: "Multiplication operation",
|
info: "Multiplication operation",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: mulOp),
|
||||||
run: mulOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: Sub, ## 0x03, Subtraction
|
(opCode: Sub, ## 0x03, Subtraction
|
||||||
forks: VmOpAllForks,
|
forks: VmOpAllForks,
|
||||||
name: "sub",
|
name: "sub",
|
||||||
info: "Subtraction operation",
|
info: "Subtraction operation",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: subOp),
|
||||||
run: subOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: Div, ## 0x04, Division
|
(opCode: Div, ## 0x04, Division
|
||||||
forks: VmOpAllForks,
|
forks: VmOpAllForks,
|
||||||
name: "divide",
|
name: "divide",
|
||||||
info: "Integer division operation",
|
info: "Integer division operation",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: divideOp),
|
||||||
run: divideOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: Sdiv, ## 0x05, Signed division
|
(opCode: Sdiv, ## 0x05, Signed division
|
||||||
forks: VmOpAllForks,
|
forks: VmOpAllForks,
|
||||||
name: "sdiv",
|
name: "sdiv",
|
||||||
info: "Signed integer division operation (truncated)",
|
info: "Signed integer division operation (truncated)",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: sdivOp),
|
||||||
run: sdivOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: Mod, ## 0x06, Modulo
|
(opCode: Mod, ## 0x06, Modulo
|
||||||
forks: VmOpAllForks,
|
forks: VmOpAllForks,
|
||||||
name: "modulo",
|
name: "modulo",
|
||||||
info: "Modulo remainder operation",
|
info: "Modulo remainder operation",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: moduloOp),
|
||||||
run: moduloOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: Smod, ## 0x07, Signed modulo
|
(opCode: Smod, ## 0x07, Signed modulo
|
||||||
forks: VmOpAllForks,
|
forks: VmOpAllForks,
|
||||||
name: "smod",
|
name: "smod",
|
||||||
info: "Signed modulo remainder operation",
|
info: "Signed modulo remainder operation",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: smodOp),
|
||||||
run: smodOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: Addmod, ## 0x08, Modulo addition, Intermediate
|
(opCode: Addmod, ## 0x08, Modulo addition, Intermediate
|
||||||
## computations do not roll over at 2^256
|
## computations do not roll over at 2^256
|
||||||
forks: VmOpAllForks,
|
forks: VmOpAllForks,
|
||||||
name: "addmod",
|
name: "addmod",
|
||||||
info: "Modulo addition operation",
|
info: "Modulo addition operation",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: addmodOp),
|
||||||
run: addmodOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: Mulmod, ## 0x09, Modulo multiplication, Intermediate
|
(opCode: Mulmod, ## 0x09, Modulo multiplication, Intermediate
|
||||||
## computations do not roll over at 2^256
|
## computations do not roll over at 2^256
|
||||||
forks: VmOpAllForks,
|
forks: VmOpAllForks,
|
||||||
name: "mulmod",
|
name: "mulmod",
|
||||||
info: "Modulo multiplication operation",
|
info: "Modulo multiplication operation",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: mulmodOp),
|
||||||
run: mulmodOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: Exp, ## 0x0a, Exponentiation
|
(opCode: Exp, ## 0x0a, Exponentiation
|
||||||
forks: VmOpAllForks,
|
forks: VmOpAllForks,
|
||||||
name: "exp",
|
name: "exp",
|
||||||
info: "Exponentiation operation",
|
info: "Exponentiation operation",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: expOp),
|
||||||
run: expOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: SignExtend, ## 0x0b, Extend 2's complemet length
|
(opCode: SignExtend, ## 0x0b, Extend 2's complemet length
|
||||||
forks: VmOpAllForks,
|
forks: VmOpAllForks,
|
||||||
name: "signExtend",
|
name: "signExtend",
|
||||||
info: "Extend length of two’s complement signed integer",
|
info: "Extend length of two’s complement signed integer",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: signExtendOp),
|
||||||
run: signExtendOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: Lt, ## 0x10, Less-than
|
(opCode: Lt, ## 0x10, Less-than
|
||||||
forks: VmOpAllForks,
|
forks: VmOpAllForks,
|
||||||
name: "lt",
|
name: "lt",
|
||||||
info: "Less-than comparison",
|
info: "Less-than comparison",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: ltOp),
|
||||||
run: ltOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: Gt, ## 0x11, Greater-than
|
(opCode: Gt, ## 0x11, Greater-than
|
||||||
forks: VmOpAllForks,
|
forks: VmOpAllForks,
|
||||||
name: "gt",
|
name: "gt",
|
||||||
info: "Greater-than comparison",
|
info: "Greater-than comparison",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: gtOp),
|
||||||
run: gtOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: Slt, ## 0x12, Signed less-than
|
(opCode: Slt, ## 0x12, Signed less-than
|
||||||
forks: VmOpAllForks,
|
forks: VmOpAllForks,
|
||||||
name: "slt",
|
name: "slt",
|
||||||
info: "Signed less-than comparison",
|
info: "Signed less-than comparison",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: sltOp),
|
||||||
run: sltOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: Sgt, ## 0x13, Signed greater-than
|
(opCode: Sgt, ## 0x13, Signed greater-than
|
||||||
forks: VmOpAllForks,
|
forks: VmOpAllForks,
|
||||||
name: "sgt",
|
name: "sgt",
|
||||||
info: "Signed greater-than comparison",
|
info: "Signed greater-than comparison",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: sgtOp),
|
||||||
run: sgtOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: Eq, ## 0x14, Equality
|
(opCode: Eq, ## 0x14, Equality
|
||||||
forks: VmOpAllForks,
|
forks: VmOpAllForks,
|
||||||
name: "eq",
|
name: "eq",
|
||||||
info: "Equality comparison",
|
info: "Equality comparison",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: eqOp),
|
||||||
run: eqOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: IsZero, ## 0x15, Not operator
|
(opCode: IsZero, ## 0x15, Not operator
|
||||||
forks: VmOpAllForks,
|
forks: VmOpAllForks,
|
||||||
name: "isZero",
|
name: "isZero",
|
||||||
info: "Simple not operator (Note: real Yellow Paper description)",
|
info: "Simple not operator (Note: real Yellow Paper description)",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: isZeroOp),
|
||||||
run: isZeroOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: And, ## 0x16, AND
|
(opCode: And, ## 0x16, AND
|
||||||
forks: VmOpAllForks,
|
forks: VmOpAllForks,
|
||||||
name: "andOp",
|
name: "andOp",
|
||||||
info: "Bitwise AND operation",
|
info: "Bitwise AND operation",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: andOp),
|
||||||
run: andOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: Or, ## 0x17, OR
|
(opCode: Or, ## 0x17, OR
|
||||||
forks: VmOpAllForks,
|
forks: VmOpAllForks,
|
||||||
name: "orOp",
|
name: "orOp",
|
||||||
info: "Bitwise OR operation",
|
info: "Bitwise OR operation",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: orOp),
|
||||||
run: orOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: Xor, ## 0x18, XOR
|
(opCode: Xor, ## 0x18, XOR
|
||||||
forks: VmOpAllForks,
|
forks: VmOpAllForks,
|
||||||
name: "xorOp",
|
name: "xorOp",
|
||||||
info: "Bitwise XOR operation",
|
info: "Bitwise XOR operation",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: xorOp),
|
||||||
run: xorOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: Not, ## 0x19, NOT
|
(opCode: Not, ## 0x19, NOT
|
||||||
forks: VmOpAllForks,
|
forks: VmOpAllForks,
|
||||||
name: "notOp",
|
name: "notOp",
|
||||||
info: "Bitwise NOT operation",
|
info: "Bitwise NOT operation",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: notOp),
|
||||||
run: notOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: Byte, ## 0x1a, Retrieve byte
|
(opCode: Byte, ## 0x1a, Retrieve byte
|
||||||
forks: VmOpAllForks,
|
forks: VmOpAllForks,
|
||||||
name: "byteOp",
|
name: "byteOp",
|
||||||
info: "Retrieve single byte from word",
|
info: "Retrieve single byte from word",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: byteOp),
|
||||||
run: byteOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
# Constantinople's new opcodes
|
# Constantinople's new opcodes
|
||||||
|
|
||||||
|
@ -470,25 +448,21 @@ const
|
||||||
forks: VmOpConstantinopleAndLater,
|
forks: VmOpConstantinopleAndLater,
|
||||||
name: "shlOp",
|
name: "shlOp",
|
||||||
info: "Shift left",
|
info: "Shift left",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: shlOp),
|
||||||
run: shlOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: Shr, ## 0x1c, Shift right logical
|
(opCode: Shr, ## 0x1c, Shift right logical
|
||||||
forks: VmOpConstantinopleAndLater,
|
forks: VmOpConstantinopleAndLater,
|
||||||
name: "shrOp",
|
name: "shrOp",
|
||||||
info: "Logical shift right",
|
info: "Logical shift right",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: shrOp),
|
||||||
run: shrOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: Sar, ## 0x1d, Shift right arithmetic
|
(opCode: Sar, ## 0x1d, Shift right arithmetic
|
||||||
forks: VmOpConstantinopleAndLater,
|
forks: VmOpConstantinopleAndLater,
|
||||||
name: "sarOp",
|
name: "sarOp",
|
||||||
info: "Arithmetic shift right",
|
info: "Arithmetic shift right",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: sarOp)]
|
||||||
run: sarOp,
|
|
||||||
post: VmOpIgnore))]
|
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
# End
|
# End
|
||||||
|
|
|
@ -100,89 +100,77 @@ const
|
||||||
forks: VmOpAllForks,
|
forks: VmOpAllForks,
|
||||||
name: "blockhash",
|
name: "blockhash",
|
||||||
info: "Get the hash of one of the 256 most recent complete blocks",
|
info: "Get the hash of one of the 256 most recent complete blocks",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: blockhashOp),
|
||||||
run: blockhashOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: Coinbase, ## 0x41, Beneficiary address
|
(opCode: Coinbase, ## 0x41, Beneficiary address
|
||||||
forks: VmOpAllForks,
|
forks: VmOpAllForks,
|
||||||
name: "coinbase",
|
name: "coinbase",
|
||||||
info: "Get the block's beneficiary address",
|
info: "Get the block's beneficiary address",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: coinBaseOp),
|
||||||
run: coinBaseOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: Timestamp, ## 0x42, Block timestamp.
|
(opCode: Timestamp, ## 0x42, Block timestamp.
|
||||||
forks: VmOpAllForks,
|
forks: VmOpAllForks,
|
||||||
name: "timestamp",
|
name: "timestamp",
|
||||||
info: "Get the block's timestamp",
|
info: "Get the block's timestamp",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: timestampOp),
|
||||||
run: timestampOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: Number, ## 0x43, Block number
|
(opCode: Number, ## 0x43, Block number
|
||||||
forks: VmOpAllForks,
|
forks: VmOpAllForks,
|
||||||
name: "blockNumber",
|
name: "blockNumber",
|
||||||
info: "Get the block's number",
|
info: "Get the block's number",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: blocknumberOp),
|
||||||
run: blocknumberOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: Difficulty, ## 0x44, Block difficulty
|
(opCode: Difficulty, ## 0x44, Block difficulty
|
||||||
forks: VmOpAllForks,
|
forks: VmOpAllForks,
|
||||||
name: "difficulty",
|
name: "difficulty",
|
||||||
info: "Get the block's difficulty",
|
info: "Get the block's difficulty",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: difficultyOp),
|
||||||
run: difficultyOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: GasLimit, ## 0x45, Block gas limit
|
(opCode: GasLimit, ## 0x45, Block gas limit
|
||||||
forks: VmOpAllForks,
|
forks: VmOpAllForks,
|
||||||
name: "gasLimit",
|
name: "gasLimit",
|
||||||
info: "Get the block's gas limit",
|
info: "Get the block's gas limit",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: gasLimitOp),
|
||||||
run: gasLimitOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: ChainIdOp, ## 0x46, EIP-155 chain identifier
|
(opCode: ChainIdOp, ## 0x46, EIP-155 chain identifier
|
||||||
forks: VmOpIstanbulAndLater,
|
forks: VmOpIstanbulAndLater,
|
||||||
name: "chainId",
|
name: "chainId",
|
||||||
info: "Get current chain’s EIP-155 unique identifier",
|
info: "Get current chain’s EIP-155 unique identifier",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: chainIdOp),
|
||||||
run: chainIdOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: SelfBalance, ## 0x47, Contract balance.
|
(opCode: SelfBalance, ## 0x47, Contract balance.
|
||||||
forks: VmOpIstanbulAndLater,
|
forks: VmOpIstanbulAndLater,
|
||||||
name: "selfBalance",
|
name: "selfBalance",
|
||||||
info: "Get current contract's balance",
|
info: "Get current contract's balance",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: selfBalanceOp),
|
||||||
run: selfBalanceOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: BaseFee, ## 0x48, EIP-1559 Block base fee.
|
(opCode: BaseFee, ## 0x48, EIP-1559 Block base fee.
|
||||||
forks: VmOpLondonAndLater,
|
forks: VmOpLondonAndLater,
|
||||||
name: "baseFee",
|
name: "baseFee",
|
||||||
info: "Get current block's EIP-1559 base fee",
|
info: "Get current block's EIP-1559 base fee",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: baseFeeOp),
|
||||||
run: baseFeeOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: BlobHash, ## 0x49, EIP-4844 Transaction versioned hash
|
(opCode: BlobHash, ## 0x49, EIP-4844 Transaction versioned hash
|
||||||
forks: VmOpCancunAndLater,
|
forks: VmOpCancunAndLater,
|
||||||
name: "blobHash",
|
name: "blobHash",
|
||||||
info: "Get current transaction's EIP-4844 versioned hash",
|
info: "Get current transaction's EIP-4844 versioned hash",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: blobHashOp),
|
||||||
run: blobHashOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: BlobBaseFee, ## 0x4a, EIP-7516 Returns the current data-blob base-fee
|
(opCode: BlobBaseFee, ## 0x4a, EIP-7516 Returns the current data-blob base-fee
|
||||||
forks: VmOpCancunAndLater,
|
forks: VmOpCancunAndLater,
|
||||||
name: "blobBaseFee",
|
name: "blobBaseFee",
|
||||||
info: "Returns the current data-blob base-fee",
|
info: "Returns the current data-blob base-fee",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: blobBaseFeeOp)]
|
||||||
run: blobBaseFeeOp,
|
|
||||||
post: VmOpIgnore))]
|
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
# End
|
# End
|
||||||
|
|
|
@ -514,34 +514,29 @@ const
|
||||||
forks: VmOpAllForks,
|
forks: VmOpAllForks,
|
||||||
name: "call",
|
name: "call",
|
||||||
info: "Message-Call into an account",
|
info: "Message-Call into an account",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: callOp),
|
||||||
run: callOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: CallCode, ## 0xf2, Message-Call with alternative code
|
(opCode: CallCode, ## 0xf2, Message-Call with alternative code
|
||||||
forks: VmOpAllForks,
|
forks: VmOpAllForks,
|
||||||
name: "callCode",
|
name: "callCode",
|
||||||
info: "Message-call into this account with alternative account's code",
|
info: "Message-call into this account with alternative account's code",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: callCodeOp),
|
||||||
run: callCodeOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: DelegateCall, ## 0xf4, CallCode with persisting sender and value
|
(opCode: DelegateCall, ## 0xf4, CallCode with persisting sender and value
|
||||||
forks: VmOpHomesteadAndLater,
|
forks: VmOpHomesteadAndLater,
|
||||||
name: "delegateCall",
|
name: "delegateCall",
|
||||||
info: "Message-call into this account with an alternative account's " &
|
info: "Message-call into this account with an alternative account's " &
|
||||||
"code but persisting the current values for sender and value.",
|
"code but persisting the current values for sender and value.",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: delegateCallOp),
|
||||||
run: delegateCallOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: StaticCall, ## 0xfa, Static message-call into an account
|
(opCode: StaticCall, ## 0xfa, Static message-call into an account
|
||||||
forks: VmOpByzantiumAndLater,
|
forks: VmOpByzantiumAndLater,
|
||||||
name: "staticCall",
|
name: "staticCall",
|
||||||
info: "Static message-call into an account",
|
info: "Static message-call into an account",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: staticCallOp)]
|
||||||
run: staticCallOp,
|
|
||||||
post: VmOpIgnore))]
|
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
# End
|
# End
|
||||||
|
|
|
@ -255,17 +255,14 @@ const
|
||||||
forks: VmOpAllForks,
|
forks: VmOpAllForks,
|
||||||
name: "create",
|
name: "create",
|
||||||
info: "Create a new account with associated code",
|
info: "Create a new account with associated code",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: createOp),
|
||||||
run: createOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: Create2, ## 0xf5, Create using keccak256
|
(opCode: Create2, ## 0xf5, Create using keccak256
|
||||||
forks: VmOpConstantinopleAndLater,
|
forks: VmOpConstantinopleAndLater,
|
||||||
name: "create2",
|
name: "create2",
|
||||||
info: "Behaves identically to CREATE, except using keccak256",
|
info: "Behaves identically to CREATE, except using keccak256",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: create2Op)]
|
||||||
run: create2Op,
|
|
||||||
post: VmOpIgnore))]
|
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
# End
|
# End
|
||||||
|
|
|
@ -28,20 +28,12 @@ type
|
||||||
## back via argument descriptor ``k``
|
## back via argument descriptor ``k``
|
||||||
proc(k: var VmCtx): EvmResultVoid {.nimcall, gcsafe, raises:[].}
|
proc(k: var VmCtx): EvmResultVoid {.nimcall, gcsafe, raises:[].}
|
||||||
|
|
||||||
|
|
||||||
VmOpHanders* = tuple ## three step op code execution, typically
|
|
||||||
## only the ``run`` entry is activated
|
|
||||||
prep: VmOpFn
|
|
||||||
run: VmOpFn
|
|
||||||
post: VmOpFn
|
|
||||||
|
|
||||||
|
|
||||||
VmOpExec* = tuple ## op code handler entry
|
VmOpExec* = tuple ## op code handler entry
|
||||||
opCode: Op ## index back-reference
|
opCode: Op ## index back-reference
|
||||||
forks: set[EVMFork] ## forks applicable for this operation
|
forks: set[EVMFork] ## forks applicable for this operation
|
||||||
name: string ## handler name
|
name: string ## handler name
|
||||||
info: string ## handter info, explainer
|
info: string ## handter info, explainer
|
||||||
exec: VmOpHanders
|
exec: VmOpFn
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
# Public
|
# Public
|
||||||
|
|
|
@ -253,163 +253,142 @@ const
|
||||||
forks: VmOpAllForks,
|
forks: VmOpAllForks,
|
||||||
name: "address",
|
name: "address",
|
||||||
info: "Get address of currently executing account",
|
info: "Get address of currently executing account",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: VmOpFn addressOp),
|
||||||
run: VmOpFn addressOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: Balance, ## 0x31, Balance
|
(opCode: Balance, ## 0x31, Balance
|
||||||
forks: VmOpAllForks - VmOpBerlinAndLater,
|
forks: VmOpAllForks - VmOpBerlinAndLater,
|
||||||
name: "balance",
|
name: "balance",
|
||||||
info: "Get balance of the given account",
|
info: "Get balance of the given account",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: balanceOp),
|
||||||
run: balanceOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: Balance, ## 0x31, Balance for Berlin and later
|
(opCode: Balance, ## 0x31, Balance for Berlin and later
|
||||||
forks: VmOpBerlinAndLater,
|
forks: VmOpBerlinAndLater,
|
||||||
name: "balanceEIP2929",
|
name: "balanceEIP2929",
|
||||||
info: "EIP2929: Get balance of the given account",
|
info: "EIP2929: Get balance of the given account",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: balanceEIP2929Op),
|
||||||
run: balanceEIP2929Op,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: Origin, ## 0x32, Origination address
|
(opCode: Origin, ## 0x32, Origination address
|
||||||
forks: VmOpAllForks,
|
forks: VmOpAllForks,
|
||||||
name: "origin",
|
name: "origin",
|
||||||
info: "Get execution origination address",
|
info: "Get execution origination address",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: originOp),
|
||||||
run: originOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: Caller, ## 0x33, Caller address
|
(opCode: Caller, ## 0x33, Caller address
|
||||||
forks: VmOpAllForks,
|
forks: VmOpAllForks,
|
||||||
name: "caller",
|
name: "caller",
|
||||||
info: "Get caller address",
|
info: "Get caller address",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: callerOp),
|
||||||
run: callerOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: CallValue, ## 0x34, Execution deposited value
|
(opCode: CallValue, ## 0x34, Execution deposited value
|
||||||
forks: VmOpAllForks,
|
forks: VmOpAllForks,
|
||||||
name: "callValue",
|
name: "callValue",
|
||||||
info: "Get deposited value by the instruction/transaction " &
|
info: "Get deposited value by the instruction/transaction " &
|
||||||
"responsible for this execution",
|
"responsible for this execution",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: callValueOp),
|
||||||
run: callValueOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: CallDataLoad, ## 0x35, Input data
|
(opCode: CallDataLoad, ## 0x35, Input data
|
||||||
forks: VmOpAllForks,
|
forks: VmOpAllForks,
|
||||||
name: "callDataLoad",
|
name: "callDataLoad",
|
||||||
info: "Get input data of current environment",
|
info: "Get input data of current environment",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: callDataLoadOp),
|
||||||
run: callDataLoadOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: CallDataSize, ## 0x36, Size of input data
|
(opCode: CallDataSize, ## 0x36, Size of input data
|
||||||
forks: VmOpAllForks,
|
forks: VmOpAllForks,
|
||||||
name: "callDataSize",
|
name: "callDataSize",
|
||||||
info: "Get size of input data in current environment",
|
info: "Get size of input data in current environment",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: callDataSizeOp),
|
||||||
run: callDataSizeOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: CallDataCopy, ## 0x37, Copy input data to memory.
|
(opCode: CallDataCopy, ## 0x37, Copy input data to memory.
|
||||||
forks: VmOpAllForks,
|
forks: VmOpAllForks,
|
||||||
name: "callDataCopy",
|
name: "callDataCopy",
|
||||||
info: "Copy input data in current environment to memory",
|
info: "Copy input data in current environment to memory",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: callDataCopyOp),
|
||||||
run: callDataCopyOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: CodeSize, ## 0x38, Size of code
|
(opCode: CodeSize, ## 0x38, Size of code
|
||||||
forks: VmOpAllForks,
|
forks: VmOpAllForks,
|
||||||
name: "codeSize",
|
name: "codeSize",
|
||||||
info: "Get size of code running in current environment",
|
info: "Get size of code running in current environment",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: codeSizeOp),
|
||||||
run: codeSizeOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: CodeCopy, ## 0x39, Copy code to memory.
|
(opCode: CodeCopy, ## 0x39, Copy code to memory.
|
||||||
forks: VmOpAllForks,
|
forks: VmOpAllForks,
|
||||||
name: "codeCopy",
|
name: "codeCopy",
|
||||||
info: "Copy code running in current environment to memory",
|
info: "Copy code running in current environment to memory",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: codeCopyOp),
|
||||||
run: codeCopyOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: GasPrice, ## 0x3a, Gas price
|
(opCode: GasPrice, ## 0x3a, Gas price
|
||||||
forks: VmOpAllForks,
|
forks: VmOpAllForks,
|
||||||
name: "gasPrice",
|
name: "gasPrice",
|
||||||
info: "Get price of gas in current environment",
|
info: "Get price of gas in current environment",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: gasPriceOp),
|
||||||
run: gasPriceOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: ExtCodeSize, ## 0x3b, Account code size
|
(opCode: ExtCodeSize, ## 0x3b, Account code size
|
||||||
forks: VmOpAllForks - VmOpBerlinAndLater,
|
forks: VmOpAllForks - VmOpBerlinAndLater,
|
||||||
name: "extCodeSize",
|
name: "extCodeSize",
|
||||||
info: "Get size of an account's code",
|
info: "Get size of an account's code",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: extCodeSizeOp),
|
||||||
run: extCodeSizeOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: ExtCodeSize, ## 0x3b, Account code size for Berlin and later
|
(opCode: ExtCodeSize, ## 0x3b, Account code size for Berlin and later
|
||||||
forks: VmOpBerlinAndLater,
|
forks: VmOpBerlinAndLater,
|
||||||
name: "extCodeSizeEIP2929",
|
name: "extCodeSizeEIP2929",
|
||||||
info: "EIP2929: Get size of an account's code",
|
info: "EIP2929: Get size of an account's code",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: extCodeSizeEIP2929Op),
|
||||||
run: extCodeSizeEIP2929Op,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: ExtCodeCopy, ## 0x3c, Account code copy to memory.
|
(opCode: ExtCodeCopy, ## 0x3c, Account code copy to memory.
|
||||||
forks: VmOpAllForks - VmOpBerlinAndLater,
|
forks: VmOpAllForks - VmOpBerlinAndLater,
|
||||||
name: "extCodeCopy",
|
name: "extCodeCopy",
|
||||||
info: "Copy an account's code to memory",
|
info: "Copy an account's code to memory",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: extCodeCopyOp),
|
||||||
run: extCodeCopyOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: ExtCodeCopy, ## 0x3c, Account Code-copy for Berlin and later
|
(opCode: ExtCodeCopy, ## 0x3c, Account Code-copy for Berlin and later
|
||||||
forks: VmOpBerlinAndLater,
|
forks: VmOpBerlinAndLater,
|
||||||
name: "extCodeCopyEIP2929",
|
name: "extCodeCopyEIP2929",
|
||||||
info: "EIP2929: Copy an account's code to memory",
|
info: "EIP2929: Copy an account's code to memory",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: extCodeCopyEIP2929Op),
|
||||||
run: extCodeCopyEIP2929Op,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: ReturnDataSize, ## 0x3d, Previous call output data size
|
(opCode: ReturnDataSize, ## 0x3d, Previous call output data size
|
||||||
forks: VmOpByzantiumAndLater,
|
forks: VmOpByzantiumAndLater,
|
||||||
name: "returnDataSize",
|
name: "returnDataSize",
|
||||||
info: "Get size of output data from the previous call " &
|
info: "Get size of output data from the previous call " &
|
||||||
"from the current environment",
|
"from the current environment",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: returnDataSizeOp),
|
||||||
run: returnDataSizeOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: ReturnDataCopy, ## 0x3e, Previous call output data copy to memory
|
(opCode: ReturnDataCopy, ## 0x3e, Previous call output data copy to memory
|
||||||
forks: VmOpByzantiumAndLater,
|
forks: VmOpByzantiumAndLater,
|
||||||
name: "returnDataCopy",
|
name: "returnDataCopy",
|
||||||
info: "Copy output data from the previous call to memory",
|
info: "Copy output data from the previous call to memory",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: returnDataCopyOp),
|
||||||
run: returnDataCopyOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: ExtCodeHash, ## 0x3f, Contract hash
|
(opCode: ExtCodeHash, ## 0x3f, Contract hash
|
||||||
forks: VmOpConstantinopleAndLater - VmOpBerlinAndLater,
|
forks: VmOpConstantinopleAndLater - VmOpBerlinAndLater,
|
||||||
name: "extCodeHash",
|
name: "extCodeHash",
|
||||||
info: "Returns the keccak256 hash of a contract’s code",
|
info: "Returns the keccak256 hash of a contract’s code",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: extCodeHashOp),
|
||||||
run: extCodeHashOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: ExtCodeHash, ## 0x3f, Contract hash for berlin and later
|
(opCode: ExtCodeHash, ## 0x3f, Contract hash for berlin and later
|
||||||
forks: VmOpBerlinAndLater,
|
forks: VmOpBerlinAndLater,
|
||||||
name: "extCodeHashEIP2929",
|
name: "extCodeHashEIP2929",
|
||||||
info: "EIP2929: Returns the keccak256 hash of a contract’s code",
|
info: "EIP2929: Returns the keccak256 hash of a contract’s code",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: extCodeHashEIP2929Op)]
|
||||||
run: extCodeHashEIP2929Op,
|
|
||||||
post: VmOpIgnore))]
|
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
# End
|
# End
|
||||||
|
|
|
@ -99,10 +99,7 @@ macro genOphList*(runHandler: static[OphNumToTextFn];
|
||||||
"info".asText(n.handlerInfo),
|
"info".asText(n.handlerInfo),
|
||||||
nnkExprColonExpr.newTree(
|
nnkExprColonExpr.newTree(
|
||||||
newIdentNode("exec"),
|
newIdentNode("exec"),
|
||||||
nnkPar.newTree(
|
newIdentNode(n.runHandler)))
|
||||||
"prep".asIdent("VmOpIgnore"),
|
|
||||||
"run".asIdent(n.runHandler),
|
|
||||||
"post".asIdent("VmOpIgnore"))))
|
|
||||||
|
|
||||||
# => const <varName>*: seq[VmOpExec] = @[ <records> ]
|
# => const <varName>*: seq[VmOpExec] = @[ <records> ]
|
||||||
result = nnkStmtList.newTree(
|
result = nnkStmtList.newTree(
|
||||||
|
|
|
@ -62,9 +62,7 @@ const
|
||||||
forks: VmOpAllForks,
|
forks: VmOpAllForks,
|
||||||
name: "sha3",
|
name: "sha3",
|
||||||
info: "Compute Keccak-256 hash",
|
info: "Compute Keccak-256 hash",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: sha3Op)]
|
||||||
run: sha3Op,
|
|
||||||
post: VmOpIgnore))]
|
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
# End
|
# End
|
||||||
|
|
|
@ -324,164 +324,143 @@ const
|
||||||
forks: VmOpAllForks,
|
forks: VmOpAllForks,
|
||||||
name: "pop",
|
name: "pop",
|
||||||
info: "Remove item from stack",
|
info: "Remove item from stack",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: VmOpFn popOp),
|
||||||
run: VmOpFn popOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: Mload, ## 0x51, Load word from memory
|
(opCode: Mload, ## 0x51, Load word from memory
|
||||||
forks: VmOpAllForks,
|
forks: VmOpAllForks,
|
||||||
name: "mload",
|
name: "mload",
|
||||||
info: "Load word from memory",
|
info: "Load word from memory",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: mloadOp),
|
||||||
run: mloadOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: Mstore, ## 0x52, Save word to memory
|
(opCode: Mstore, ## 0x52, Save word to memory
|
||||||
forks: VmOpAllForks,
|
forks: VmOpAllForks,
|
||||||
name: "mstore",
|
name: "mstore",
|
||||||
info: "Save word to memory",
|
info: "Save word to memory",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: mstoreOp),
|
||||||
run: mstoreOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: Mstore8, ## 0x53, Save byte to memory
|
(opCode: Mstore8, ## 0x53, Save byte to memory
|
||||||
forks: VmOpAllForks,
|
forks: VmOpAllForks,
|
||||||
name: "mstore8",
|
name: "mstore8",
|
||||||
info: "Save byte to memory",
|
info: "Save byte to memory",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: mstore8Op),
|
||||||
run: mstore8Op,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: Sload, ## 0x54, Load word from storage
|
(opCode: Sload, ## 0x54, Load word from storage
|
||||||
forks: VmOpAllForks - VmOpBerlinAndLater,
|
forks: VmOpAllForks - VmOpBerlinAndLater,
|
||||||
name: "sload",
|
name: "sload",
|
||||||
info: "Load word from storage",
|
info: "Load word from storage",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: sloadOp),
|
||||||
run: sloadOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: Sload, ## 0x54, sload for Berlin and later
|
(opCode: Sload, ## 0x54, sload for Berlin and later
|
||||||
forks: VmOpBerlinAndLater,
|
forks: VmOpBerlinAndLater,
|
||||||
name: "sloadEIP2929",
|
name: "sloadEIP2929",
|
||||||
info: "EIP2929: sload for Berlin and later",
|
info: "EIP2929: sload for Berlin and later",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: sloadEIP2929Op),
|
||||||
run: sloadEIP2929Op,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: Sstore, ## 0x55, Save word
|
(opCode: Sstore, ## 0x55, Save word
|
||||||
forks: VmOpAllForks - VmOpConstantinopleAndLater,
|
forks: VmOpAllForks - VmOpConstantinopleAndLater,
|
||||||
name: "sstore",
|
name: "sstore",
|
||||||
info: "Save word to storage",
|
info: "Save word to storage",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: sstoreOp),
|
||||||
run: sstoreOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: Sstore, ## 0x55, sstore for Constantinople and later
|
(opCode: Sstore, ## 0x55, sstore for Constantinople and later
|
||||||
forks: VmOpConstantinopleAndLater - VmOpPetersburgAndLater,
|
forks: VmOpConstantinopleAndLater - VmOpPetersburgAndLater,
|
||||||
name: "sstoreEIP1283",
|
name: "sstoreEIP1283",
|
||||||
info: "EIP1283: sstore for Constantinople and later",
|
info: "EIP1283: sstore for Constantinople and later",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: sstoreEIP1283Op),
|
||||||
run: sstoreEIP1283Op,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: Sstore, ## 0x55, sstore for Petersburg and later
|
(opCode: Sstore, ## 0x55, sstore for Petersburg and later
|
||||||
forks: VmOpPetersburgAndLater - VmOpIstanbulAndLater,
|
forks: VmOpPetersburgAndLater - VmOpIstanbulAndLater,
|
||||||
name: "sstore",
|
name: "sstore",
|
||||||
info: "sstore for Constantinople and later",
|
info: "sstore for Constantinople and later",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: sstoreOp),
|
||||||
run: sstoreOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: Sstore, ## 0x55, sstore for Istanbul and later
|
(opCode: Sstore, ## 0x55, sstore for Istanbul and later
|
||||||
forks: VmOpIstanbulAndLater - VmOpBerlinAndLater,
|
forks: VmOpIstanbulAndLater - VmOpBerlinAndLater,
|
||||||
name: "sstoreEIP2200",
|
name: "sstoreEIP2200",
|
||||||
info: "EIP2200: sstore for Istanbul and later",
|
info: "EIP2200: sstore for Istanbul and later",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: sstoreEIP2200Op),
|
||||||
run: sstoreEIP2200Op,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: Sstore, ## 0x55, sstore for Berlin and later
|
(opCode: Sstore, ## 0x55, sstore for Berlin and later
|
||||||
forks: VmOpBerlinAndLater,
|
forks: VmOpBerlinAndLater,
|
||||||
name: "sstoreEIP2929",
|
name: "sstoreEIP2929",
|
||||||
info: "EIP2929: sstore for Istanbul and later",
|
info: "EIP2929: sstore for Istanbul and later",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: sstoreEIP2929Op),
|
||||||
run: sstoreEIP2929Op,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: Jump, ## 0x56, Jump
|
(opCode: Jump, ## 0x56, Jump
|
||||||
forks: VmOpAllForks,
|
forks: VmOpAllForks,
|
||||||
name: "jump",
|
name: "jump",
|
||||||
info: "Alter the program counter",
|
info: "Alter the program counter",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: jumpOp),
|
||||||
run: jumpOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: JumpI, ## 0x57, Conditional jump
|
(opCode: JumpI, ## 0x57, Conditional jump
|
||||||
forks: VmOpAllForks,
|
forks: VmOpAllForks,
|
||||||
name: "jumpI",
|
name: "jumpI",
|
||||||
info: "Conditionally alter the program counter",
|
info: "Conditionally alter the program counter",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: jumpIOp),
|
||||||
run: jumpIOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: Pc, ## 0x58, Program counter prior to instruction
|
(opCode: Pc, ## 0x58, Program counter prior to instruction
|
||||||
forks: VmOpAllForks,
|
forks: VmOpAllForks,
|
||||||
name: "pc",
|
name: "pc",
|
||||||
info: "Get the value of the program counter prior to the increment "&
|
info: "Get the value of the program counter prior to the increment "&
|
||||||
"corresponding to this instruction",
|
"corresponding to this instruction",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: pcOp),
|
||||||
run: pcOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: Msize, ## 0x59, Memory size
|
(opCode: Msize, ## 0x59, Memory size
|
||||||
forks: VmOpAllForks,
|
forks: VmOpAllForks,
|
||||||
name: "msize",
|
name: "msize",
|
||||||
info: "Get the size of active memory in bytes",
|
info: "Get the size of active memory in bytes",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: msizeOp),
|
||||||
run: msizeOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: Gas, ## 0x5a, Get available gas
|
(opCode: Gas, ## 0x5a, Get available gas
|
||||||
forks: VmOpAllForks,
|
forks: VmOpAllForks,
|
||||||
name: "gas",
|
name: "gas",
|
||||||
info: "Get the amount of available gas, including the corresponding "&
|
info: "Get the amount of available gas, including the corresponding "&
|
||||||
"reduction for the cost of this instruction",
|
"reduction for the cost of this instruction",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: gasOp),
|
||||||
run: gasOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: JumpDest, ## 0x5b, Mark jump target. This operation has no effect
|
(opCode: JumpDest, ## 0x5b, Mark jump target. This operation has no effect
|
||||||
## on machine state during execution
|
## on machine state during execution
|
||||||
forks: VmOpAllForks,
|
forks: VmOpAllForks,
|
||||||
name: "jumpDest",
|
name: "jumpDest",
|
||||||
info: "Mark a valid destination for jumps",
|
info: "Mark a valid destination for jumps",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: jumpDestOp),
|
||||||
run: jumpDestOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: Tload, ## 0x5c, Load word from transient storage.
|
(opCode: Tload, ## 0x5c, Load word from transient storage.
|
||||||
forks: VmOpCancunAndLater,
|
forks: VmOpCancunAndLater,
|
||||||
name: "tLoad",
|
name: "tLoad",
|
||||||
info: "Load word from transient storage",
|
info: "Load word from transient storage",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: tloadOp),
|
||||||
run: tloadOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: Tstore, ## 0x5d, Save word to transient storage.
|
(opCode: Tstore, ## 0x5d, Save word to transient storage.
|
||||||
forks: VmOpCancunAndLater,
|
forks: VmOpCancunAndLater,
|
||||||
name: "tStore",
|
name: "tStore",
|
||||||
info: "Save word to transient storage",
|
info: "Save word to transient storage",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: tstoreOp),
|
||||||
run: tstoreOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: Mcopy, ## 0x5e, Copy memory
|
(opCode: Mcopy, ## 0x5e, Copy memory
|
||||||
forks: VmOpCancunAndLater,
|
forks: VmOpCancunAndLater,
|
||||||
name: "MCopy",
|
name: "MCopy",
|
||||||
info: "Copy memory",
|
info: "Copy memory",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: mCopyOp)]
|
||||||
run: mCopyOp,
|
|
||||||
post: VmOpIgnore))]
|
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
# End
|
# End
|
||||||
|
|
|
@ -76,9 +76,7 @@ const
|
||||||
forks: VmOpShanghaiAndLater,
|
forks: VmOpShanghaiAndLater,
|
||||||
name: "Push0",
|
name: "Push0",
|
||||||
info: "Push 0 on the stack",
|
info: "Push 0 on the stack",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: push0Op)]
|
||||||
run: push0Op,
|
|
||||||
post: VmOpIgnore))]
|
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
# End
|
# End
|
||||||
|
|
|
@ -164,58 +164,50 @@ const
|
||||||
forks: VmOpAllForks,
|
forks: VmOpAllForks,
|
||||||
name: "returnOp",
|
name: "returnOp",
|
||||||
info: "Halt execution returning output data",
|
info: "Halt execution returning output data",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: returnOp),
|
||||||
run: returnOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: Revert, ## 0xfd, Halt and revert state changes
|
(opCode: Revert, ## 0xfd, Halt and revert state changes
|
||||||
forks: VmOpByzantiumAndLater,
|
forks: VmOpByzantiumAndLater,
|
||||||
name: "revert",
|
name: "revert",
|
||||||
info: "Halt execution reverting state changes but returning data " &
|
info: "Halt execution reverting state changes but returning data " &
|
||||||
"and remaining gas",
|
"and remaining gas",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: revertOp),
|
||||||
run: revertOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: Invalid, ## 0xfe, invalid instruction.
|
(opCode: Invalid, ## 0xfe, invalid instruction.
|
||||||
forks: VmOpAllForks,
|
forks: VmOpAllForks,
|
||||||
name: "invalidInstruction",
|
name: "invalidInstruction",
|
||||||
info: "Designated invalid instruction",
|
info: "Designated invalid instruction",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: invalidOp),
|
||||||
run: invalidOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: SelfDestruct, ## 0xff, Halt execution, prep for later deletion
|
(opCode: SelfDestruct, ## 0xff, Halt execution, prep for later deletion
|
||||||
forks: VmOpAllForks - VmOpTangerineAndLater,
|
forks: VmOpAllForks - VmOpTangerineAndLater,
|
||||||
name: "selfDestruct",
|
name: "selfDestruct",
|
||||||
info: "Halt execution and register account for later deletion",
|
info: "Halt execution and register account for later deletion",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: selfDestructOp),
|
||||||
run: selfDestructOp,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: SelfDestruct, ## 0xff, EIP150: self destruct, Tangerine
|
(opCode: SelfDestruct, ## 0xff, EIP150: self destruct, Tangerine
|
||||||
forks: VmOpTangerineAndLater - VmOpSpuriousAndLater,
|
forks: VmOpTangerineAndLater - VmOpSpuriousAndLater,
|
||||||
name: "selfDestructEIP150",
|
name: "selfDestructEIP150",
|
||||||
info: "EIP150: Halt execution and register account for later deletion",
|
info: "EIP150: Halt execution and register account for later deletion",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: selfDestructEIP150Op),
|
||||||
run: selfDestructEIP150Op,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: SelfDestruct, ## 0xff, EIP161: self destruct, Spurious and later
|
(opCode: SelfDestruct, ## 0xff, EIP161: self destruct, Spurious and later
|
||||||
forks: VmOpSpuriousAndLater - VmOpBerlinAndLater,
|
forks: VmOpSpuriousAndLater - VmOpBerlinAndLater,
|
||||||
name: "selfDestructEIP161",
|
name: "selfDestructEIP161",
|
||||||
info: "EIP161: Halt execution and register account for later deletion",
|
info: "EIP161: Halt execution and register account for later deletion",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: selfDestructEIP161Op),
|
||||||
run: selfDestructEIP161Op,
|
|
||||||
post: VmOpIgnore)),
|
|
||||||
|
|
||||||
(opCode: SelfDestruct, ## 0xff, EIP2929: self destruct, Berlin and later
|
(opCode: SelfDestruct, ## 0xff, EIP2929: self destruct, Berlin and later
|
||||||
forks: VmOpBerlinAndLater,
|
forks: VmOpBerlinAndLater,
|
||||||
name: "selfDestructEIP2929",
|
name: "selfDestructEIP2929",
|
||||||
info: "EIP2929: Halt execution and register account for later deletion",
|
info: "EIP2929: Halt execution and register account for later deletion",
|
||||||
exec: (prep: VmOpIgnore,
|
exec: selfDestructEIP2929Op)]
|
||||||
run: selfDestructEIP2929Op,
|
|
||||||
post: VmOpIgnore))]
|
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
# End
|
# End
|
||||||
|
|
|
@ -36,6 +36,7 @@ proc init(
|
||||||
self.tracer = tracer
|
self.tracer = tracer
|
||||||
self.stateDB = ac
|
self.stateDB = ac
|
||||||
self.flags = flags
|
self.flags = flags
|
||||||
|
self.blobGasUsed = 0'u64
|
||||||
|
|
||||||
func blockCtx(com: CommonRef, header: BlockHeader):
|
func blockCtx(com: CommonRef, header: BlockHeader):
|
||||||
BlockContext =
|
BlockContext =
|
||||||
|
|
|
@ -66,6 +66,7 @@ type
|
||||||
receipts* : seq[Receipt]
|
receipts* : seq[Receipt]
|
||||||
cumulativeGasUsed*: GasInt
|
cumulativeGasUsed*: GasInt
|
||||||
gasCosts* : GasCosts
|
gasCosts* : GasCosts
|
||||||
|
blobGasUsed* : uint64
|
||||||
|
|
||||||
Computation* = ref object
|
Computation* = ref object
|
||||||
# The execution computation
|
# The execution computation
|
||||||
|
|
|
@ -21,6 +21,9 @@ import
|
||||||
./db/era1_db,
|
./db/era1_db,
|
||||||
beacon_chain/era_db
|
beacon_chain/era_db
|
||||||
|
|
||||||
|
declareGauge nec_import_block_number,
|
||||||
|
"Latest imported block number"
|
||||||
|
|
||||||
declareCounter nec_imported_blocks,
|
declareCounter nec_imported_blocks,
|
||||||
"Blocks processed during import"
|
"Blocks processed during import"
|
||||||
|
|
||||||
|
@ -105,6 +108,8 @@ proc importBlocks*(conf: NimbusConf, com: CommonRef) =
|
||||||
if csv != nil:
|
if csv != nil:
|
||||||
close(csv)
|
close(csv)
|
||||||
|
|
||||||
|
nec_import_block_number.set(start.int64)
|
||||||
|
|
||||||
template blockNumber(): uint64 =
|
template blockNumber(): uint64 =
|
||||||
start + imported
|
start + imported
|
||||||
|
|
||||||
|
@ -155,6 +160,7 @@ proc importBlocks*(conf: NimbusConf, com: CommonRef) =
|
||||||
avgMGps = f(gas.float / 1000000 / diff0),
|
avgMGps = f(gas.float / 1000000 / diff0),
|
||||||
elapsed = shortLog(time2 - time0, 3)
|
elapsed = shortLog(time2 - time0, 3)
|
||||||
|
|
||||||
|
metrics.set(nec_import_block_number, int64(blockNumber))
|
||||||
nec_imported_blocks.inc(blocks.len)
|
nec_imported_blocks.inc(blocks.len)
|
||||||
nec_imported_transactions.inc(statsRes[].txs)
|
nec_imported_transactions.inc(statsRes[].txs)
|
||||||
nec_imported_gas.inc(statsRes[].gas)
|
nec_imported_gas.inc(statsRes[].gas)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Nimbus
|
# Nimbus
|
||||||
# Copyright (c) 2022 Status Research & Development GmbH
|
# Copyright (c) 2022-2024 Status Research & Development GmbH
|
||||||
# Licensed under either of
|
# Licensed under either of
|
||||||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0)
|
# http://www.apache.org/licenses/LICENSE-2.0)
|
||||||
|
@ -569,6 +569,15 @@ const
|
||||||
output: T8nOutput(trace: true, result: true),
|
output: T8nOutput(trace: true, result: true),
|
||||||
expOut: "istanbul.txt",
|
expOut: "istanbul.txt",
|
||||||
),
|
),
|
||||||
|
TestSpec(
|
||||||
|
name : "Blob gas used exceeds max allowance",
|
||||||
|
base : "testdata/00-523",
|
||||||
|
input : t8nInput(
|
||||||
|
"alloc.json", "txs.rlp", "env.json", "Cancun", "0",
|
||||||
|
),
|
||||||
|
output: T8nOutput(result: true),
|
||||||
|
expOut: "exp.json",
|
||||||
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
proc main() =
|
proc main() =
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
{
|
||||||
|
"0x000f3df6d732807ef1319fb7b8bb8522d0beac02": {
|
||||||
|
"balance": "0x00",
|
||||||
|
"code": "0x3373fffffffffffffffffffffffffffffffffffffffe14604d57602036146024575f5ffd5b5f35801560495762001fff810690815414603c575f5ffd5b62001fff01545f5260205ff35b5f5ffd5b62001fff42064281555f359062001fff015500",
|
||||||
|
"nonce": "0x01",
|
||||||
|
"storage": {
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b": {
|
||||||
|
"balance": "0x1db38f",
|
||||||
|
"code": "0x",
|
||||||
|
"nonce": "0x00",
|
||||||
|
"storage": {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
{
|
||||||
|
"blockHashes": {
|
||||||
|
"0": "0x142abad1cb1f9c8a277d59f52cc29560472cf7bf4c46e12bfca8cf6b728acee2",
|
||||||
|
"1": "0x13af3033e1f55060b7d587ab559289599c74454c74403f3d8f05c6e237bb619e"
|
||||||
|
},
|
||||||
|
"currentBaseFee": "0x7",
|
||||||
|
"currentBlobGasUsed": "0xe0000",
|
||||||
|
"currentCoinbase": "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
|
||||||
|
"currentDifficulty": "0x0",
|
||||||
|
"currentExcessBlobGas": "0xe0000",
|
||||||
|
"currentGasLimit": "0x16345785d8a0000",
|
||||||
|
"currentNumber": "0x1",
|
||||||
|
"currentRandom": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"currentTimestamp": "0xc",
|
||||||
|
"parentBaseFee": "0x7",
|
||||||
|
"parentBeaconBlockRoot": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"parentBlobGasUsed": "0x0",
|
||||||
|
"parentDifficulty": "0x0",
|
||||||
|
"parentExcessBlobGas": "0x140000",
|
||||||
|
"parentGasLimit": "0x16345785d8a0000",
|
||||||
|
"parentGasUsed": "0x0",
|
||||||
|
"parentTimestamp": "0x0",
|
||||||
|
"parentUncleHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
|
||||||
|
"withdrawals": [
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,101 @@
|
||||||
|
{
|
||||||
|
"result": {
|
||||||
|
"stateRoot": "0x2d5a3738dc0d76c5d1625b96d1597549c4cd218934167a672be4cc364646bdfc",
|
||||||
|
"txRoot": "0x3836ad4f15ec36789c84c94fb8342a0e5765d80446986c417b22954d1c9a5e8b",
|
||||||
|
"receiptsRoot": "0xc88bbb6ffab5658b295a44086ed7e77d4526e07e4025496e68a55042b24c81be",
|
||||||
|
"logsHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
|
||||||
|
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"receipts": [
|
||||||
|
{
|
||||||
|
"root": "0x",
|
||||||
|
"status": "0x1",
|
||||||
|
"cumulativeGasUsed": "0x5208",
|
||||||
|
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"logs": null,
|
||||||
|
"transactionHash": "0x2f68a5bb6b843147e9ef8628047b6c5d5a0df834dc572007af7d4fce8e644c20",
|
||||||
|
"contractAddress": "0x0000000000000000000000000000000000000000",
|
||||||
|
"gasUsed": "0x5208",
|
||||||
|
"blockHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"transactionIndex": "0x0",
|
||||||
|
"type": "0x3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"root": "0x",
|
||||||
|
"status": "0x1",
|
||||||
|
"cumulativeGasUsed": "0xa410",
|
||||||
|
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"logs": null,
|
||||||
|
"transactionHash": "0xfd836af5a833b60c4b07612a7d77f4fc9d9412841c03f94c6eef90ab2e716bf6",
|
||||||
|
"contractAddress": "0x0000000000000000000000000000000000000000",
|
||||||
|
"gasUsed": "0x5208",
|
||||||
|
"blockHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"transactionIndex": "0x1",
|
||||||
|
"type": "0x3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"root": "0x",
|
||||||
|
"status": "0x1",
|
||||||
|
"cumulativeGasUsed": "0xf618",
|
||||||
|
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"logs": null,
|
||||||
|
"transactionHash": "0xa15a612ac2c6c92a62da1c8e8431a0335ad67066f078ea0434ee6bd48243caa5",
|
||||||
|
"contractAddress": "0x0000000000000000000000000000000000000000",
|
||||||
|
"gasUsed": "0x5208",
|
||||||
|
"blockHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"transactionIndex": "0x2",
|
||||||
|
"type": "0x3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"root": "0x",
|
||||||
|
"status": "0x1",
|
||||||
|
"cumulativeGasUsed": "0x14820",
|
||||||
|
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"logs": null,
|
||||||
|
"transactionHash": "0x53402f0a35345a4a4b6d47eb19fedfcaa21ba2239ed3997a080e317377f1b777",
|
||||||
|
"contractAddress": "0x0000000000000000000000000000000000000000",
|
||||||
|
"gasUsed": "0x5208",
|
||||||
|
"blockHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"transactionIndex": "0x3",
|
||||||
|
"type": "0x3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"root": "0x",
|
||||||
|
"status": "0x1",
|
||||||
|
"cumulativeGasUsed": "0x19a28",
|
||||||
|
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"logs": null,
|
||||||
|
"transactionHash": "0x5bd89296bd9454785bed316caeba5e6381552ed1f24f8386ee4774e390d6823e",
|
||||||
|
"contractAddress": "0x0000000000000000000000000000000000000000",
|
||||||
|
"gasUsed": "0x5208",
|
||||||
|
"blockHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"transactionIndex": "0x4",
|
||||||
|
"type": "0x3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"root": "0x",
|
||||||
|
"status": "0x1",
|
||||||
|
"cumulativeGasUsed": "0x1ec30",
|
||||||
|
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"logs": null,
|
||||||
|
"transactionHash": "0xdbb3a1b212d44a97f43b0b9f0db7e47d91c3d8baf3745accffe16b607901eba7",
|
||||||
|
"contractAddress": "0x0000000000000000000000000000000000000000",
|
||||||
|
"gasUsed": "0x5208",
|
||||||
|
"blockHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"transactionIndex": "0x5",
|
||||||
|
"type": "0x3"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"currentDifficulty": null,
|
||||||
|
"gasUsed": "0x1ec30",
|
||||||
|
"rejected": [
|
||||||
|
{
|
||||||
|
"index": 6,
|
||||||
|
"error": "blobGasUsed 917504 exceeds maximum allowance 786432"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"currentBaseFee": "0x7",
|
||||||
|
"withdrawalsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||||
|
"currentExcessBlobGas": "0xe0000",
|
||||||
|
"blobGasUsed": "0xe0000"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
"0xf903c6b88803f885018080078252089400000000000000000000000000000000000001000180c001e1a0010000000000000000000000000000000000000000000000000000000000000001a0a8f4757869fbb831ba4ed3a7c8f868b0e2e0c1eda97937aab035560fffdedf3ca019d9b041540e3d6f5f56dc29deb8834a08171e92037cf567b922357e70f8e54ab88803f885010180078252089400000000000000000000000000000000000001000180c001e1a0010000000000000000000000000000000000000000000000000000000000000001a0ef4c93a2afbe03bc2f31334b5c42654f2b88f3d1526e2719454638d2c87f3eaaa06234b91bfba07b555f8e11d44486319ef599f61fdb70bd5ec02085a41ff8e2ccb88803f885010280078252089400000000000000000000000000000000000001000180c001e1a0010000000000000000000000000000000000000000000000000000000000000080a0fe46a6659784d1c49e66bfe79f53c9282521940f406d321a953600d3297498e1a011d6bd31ffcfc37bd89923bd565eca3df245ab923b95799811f227502a95a429b88803f885010380078252089400000000000000000000000000000000000001000180c001e1a0010000000000000000000000000000000000000000000000000000000000000001a05d87fd0644fda3b8ae7c840519b0a51c86e54097b63c394a8ebfb13f0212da78a07054fc9d2468c15c2d8257a54e42419e6a53fe0d4568ccf95ecd4414e3481cdeb88803f885010480078252089400000000000000000000000000000000000001000180c001e1a0010000000000000000000000000000000000000000000000000000000000000001a0903154f2ee69dbdc29f7369ac4270a31d32b8af6c28959d5c6b2b2ba696e9e7da06989cf772024d3efa30b4b99bc1e1dee27813964f39448d07377537a2681d139b88803f885010580078252089400000000000000000000000000000000000001000180c001e1a0010000000000000000000000000000000000000000000000000000000000000080a07efec980ef3b40c74b2de3dee9e9f081b9b4ae4ae1732d64ba0e9553aaf08dc4a0464e6720d2d74b4d68f37f339608278be3a16802b61a46dc9895b898a70939eab88803f885010680078252089400000000000000000000000000000000000001000180c001e1a0010000000000000000000000000000000000000000000000000000000000000001a02145ded5025c6144b8f5ae446db8b617c5ff760eb7c17fa439dedb576ada3ab3a03a15f5307cc6a12f853f6f3732a1d2598d117a387256ab0f8f49d9431caf43bf"
|
|
@ -234,7 +234,6 @@ proc exec(ctx: var TransContext,
|
||||||
vmState.processBeaconBlockRoot(ctx.env.parentBeaconBlockRoot.get).isOkOr:
|
vmState.processBeaconBlockRoot(ctx.env.parentBeaconBlockRoot.get).isOkOr:
|
||||||
raise newError(ErrorConfig, error)
|
raise newError(ErrorConfig, error)
|
||||||
|
|
||||||
var blobGasUsed = 0'u64
|
|
||||||
for txIndex, txRes in txList:
|
for txIndex, txRes in txList:
|
||||||
if txRes.isErr:
|
if txRes.isErr:
|
||||||
rejected.add RejectedTx(
|
rejected.add RejectedTx(
|
||||||
|
@ -274,7 +273,6 @@ proc exec(ctx: var TransContext,
|
||||||
rec, tx, sender, txIndex, gasUsed
|
rec, tx, sender, txIndex, gasUsed
|
||||||
)
|
)
|
||||||
includedTx.add tx
|
includedTx.add tx
|
||||||
blobGasUsed += tx.getTotalBlobGas
|
|
||||||
|
|
||||||
# Add mining reward? (-1 means rewards are disabled)
|
# Add mining reward? (-1 means rewards are disabled)
|
||||||
if stateReward.isSome and stateReward.get >= 0:
|
if stateReward.isSome and stateReward.get >= 0:
|
||||||
|
@ -323,7 +321,7 @@ proc exec(ctx: var TransContext,
|
||||||
)
|
)
|
||||||
|
|
||||||
if fork >= FkCancun:
|
if fork >= FkCancun:
|
||||||
result.result.blobGasUsed = Opt.some blobGasUsed
|
result.result.blobGasUsed = Opt.some vmState.blobGasUsed
|
||||||
if ctx.env.currentExcessBlobGas.isSome:
|
if ctx.env.currentExcessBlobGas.isSome:
|
||||||
result.result.currentExcessBlobGas = ctx.env.currentExcessBlobGas
|
result.result.currentExcessBlobGas = ctx.env.currentExcessBlobGas
|
||||||
elif ctx.env.parentExcessBlobGas.isSome and ctx.env.parentBlobGasUsed.isSome:
|
elif ctx.env.parentExcessBlobGas.isSome and ctx.env.parentBlobGasUsed.isSome:
|
||||||
|
|
Loading…
Reference in New Issue