bump submodules
This commit is contained in:
parent
11bb33d0bc
commit
67aaf92c1d
|
@ -222,3 +222,8 @@
|
||||||
url = https://github.com/libtom/libtommath
|
url = https://github.com/libtom/libtommath
|
||||||
ignore = untracked
|
ignore = untracked
|
||||||
branch = develop
|
branch = develop
|
||||||
|
[submodule "vendor/nim-kzg4844"]
|
||||||
|
path = vendor/nim-kzg4844
|
||||||
|
url = https://github.com/status-im/nim-kzg4844
|
||||||
|
ignore = untracked
|
||||||
|
branch = master
|
||||||
|
|
1
Makefile
1
Makefile
|
@ -49,6 +49,7 @@ EXCLUDED_NIM_PACKAGES := \
|
||||||
vendor/nimbus-eth2/vendor/nim-libp2p \
|
vendor/nimbus-eth2/vendor/nim-libp2p \
|
||||||
vendor/nimbus-eth2/vendor/nim-presto \
|
vendor/nimbus-eth2/vendor/nim-presto \
|
||||||
vendor/nimbus-eth2/vendor/nim-zxcvbn \
|
vendor/nimbus-eth2/vendor/nim-zxcvbn \
|
||||||
|
vendor/nimbus-eth2/vendor/nim-kzg4844 \
|
||||||
vendor/nimbus-eth2/vendor/nimbus-security-resources
|
vendor/nimbus-eth2/vendor/nimbus-security-resources
|
||||||
|
|
||||||
# we don't want an error here, so we can handle things later, in the ".DEFAULT" target
|
# we don't want an error here, so we can handle things later, in the ".DEFAULT" target
|
||||||
|
|
|
@ -146,3 +146,7 @@ if defined(windows) and defined(i386):
|
||||||
# avoid undefined reference to 'sqrx_mont_384x' when compiling in 32 bit mode
|
# avoid undefined reference to 'sqrx_mont_384x' when compiling in 32 bit mode
|
||||||
# without actually using __BLST_PORTABLE__ or __BLST_NO_ASM__
|
# without actually using __BLST_PORTABLE__ or __BLST_NO_ASM__
|
||||||
switch("define", "BLS_FORCE_BACKEND:miracl")
|
switch("define", "BLS_FORCE_BACKEND:miracl")
|
||||||
|
|
||||||
|
# nim-kzg shipping their own blst, nimbus-eth1 too.
|
||||||
|
# disable nim-kzg's blst
|
||||||
|
switch("define", "kzgExternalBlst")
|
||||||
|
|
|
@ -35,7 +35,7 @@ proc loadNetworkData*(
|
||||||
try:
|
try:
|
||||||
template genesisData(): auto = metadata.genesisData
|
template genesisData(): auto = metadata.genesisData
|
||||||
newClone(readSszForkedHashedBeaconState(
|
newClone(readSszForkedHashedBeaconState(
|
||||||
metadata.cfg, genesisData.toOpenArrayByte(genesisData.low, genesisData.high)))
|
metadata.cfg, genesisData.toOpenArray(genesisData.low, genesisData.high)))
|
||||||
except CatchableError as err:
|
except CatchableError as err:
|
||||||
raiseAssert "Invalid baked-in state: " & err.msg
|
raiseAssert "Invalid baked-in state: " & err.msg
|
||||||
|
|
||||||
|
|
|
@ -183,7 +183,7 @@ func encode*(receipts: seq[Receipt]): seq[byte] =
|
||||||
# TODO: Failures on validation and perhaps deserialisation should be punished
|
# TODO: Failures on validation and perhaps deserialisation should be punished
|
||||||
# for if/when peer scoring/banning is added.
|
# for if/when peer scoring/banning is added.
|
||||||
|
|
||||||
proc calcRootHash(items: Transactions | PortalReceipts| Withdrawals): Hash256 =
|
proc calcRootHash(items: Transactions | PortalReceipts | Withdrawals): Hash256 =
|
||||||
var tr = initHexaryTrie(newMemoryDB())
|
var tr = initHexaryTrie(newMemoryDB())
|
||||||
for i, item in items:
|
for i, item in items:
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -49,7 +49,7 @@ procSuite "Portal Beacon Light Client":
|
||||||
try:
|
try:
|
||||||
template genesisData(): auto = metadata.genesisData
|
template genesisData(): auto = metadata.genesisData
|
||||||
newClone(readSszForkedHashedBeaconState(
|
newClone(readSszForkedHashedBeaconState(
|
||||||
metadata.cfg, genesisData.toOpenArrayByte(genesisData.low, genesisData.high)))
|
metadata.cfg, genesisData.toOpenArray(genesisData.low, genesisData.high)))
|
||||||
except CatchableError as err:
|
except CatchableError as err:
|
||||||
raiseAssert "Invalid baked-in state: " & err.msg
|
raiseAssert "Invalid baked-in state: " & err.msg
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ import
|
||||||
# for `BlockHeader`.
|
# for `BlockHeader`.
|
||||||
eth/common/eth_types as etypes,
|
eth/common/eth_types as etypes,
|
||||||
eth/common/eth_types_rlp,
|
eth/common/eth_types_rlp,
|
||||||
beacon_chain/eth1/eth1_monitor,
|
beacon_chain/el/el_manager,
|
||||||
beacon_chain/gossip_processing/optimistic_processor,
|
beacon_chain/gossip_processing/optimistic_processor,
|
||||||
beacon_chain/networking/topic_params,
|
beacon_chain/networking/topic_params,
|
||||||
beacon_chain/spec/beaconstate,
|
beacon_chain/spec/beaconstate,
|
||||||
|
@ -247,7 +247,8 @@ proc asPortalBlockData*(
|
||||||
nonce: default(BlockNonce),
|
nonce: default(BlockNonce),
|
||||||
fee: some(payload.baseFeePerGas),
|
fee: some(payload.baseFeePerGas),
|
||||||
withdrawalsRoot: withdrawalsRoot,
|
withdrawalsRoot: withdrawalsRoot,
|
||||||
excessDataGas: options.none(UInt256)
|
dataGasUsed: options.none(uint64),
|
||||||
|
excessDataGas: options.none(uint64)
|
||||||
)
|
)
|
||||||
|
|
||||||
headerWithProof = BlockHeaderWithProof(
|
headerWithProof = BlockHeaderWithProof(
|
||||||
|
@ -291,7 +292,8 @@ proc asPortalBlockData*(
|
||||||
nonce: default(BlockNonce),
|
nonce: default(BlockNonce),
|
||||||
fee: some(payload.baseFeePerGas),
|
fee: some(payload.baseFeePerGas),
|
||||||
withdrawalsRoot: withdrawalsRoot,
|
withdrawalsRoot: withdrawalsRoot,
|
||||||
excessDataGas: options.none(UInt256) # TODO: adjust later according to deneb fork
|
dataGasUsed: options.none(uint64),
|
||||||
|
excessDataGas: options.none(uint64) # TODO: adjust later according to deneb fork
|
||||||
)
|
)
|
||||||
|
|
||||||
headerWithProof = BlockHeaderWithProof(
|
headerWithProof = BlockHeaderWithProof(
|
||||||
|
@ -401,7 +403,7 @@ proc run(config: BeaconBridgeConf) {.raises: [CatchableError].} =
|
||||||
try:
|
try:
|
||||||
template genesisData(): auto = metadata.genesisData
|
template genesisData(): auto = metadata.genesisData
|
||||||
newClone(readSszForkedHashedBeaconState(
|
newClone(readSszForkedHashedBeaconState(
|
||||||
cfg, genesisData.toOpenArrayByte(genesisData.low, genesisData.high)))
|
cfg, genesisData.toOpenArray(genesisData.low, genesisData.high)))
|
||||||
except CatchableError as err:
|
except CatchableError as err:
|
||||||
raiseAssert "Invalid baked-in state: " & err.msg
|
raiseAssert "Invalid baked-in state: " & err.msg
|
||||||
|
|
||||||
|
|
|
@ -11,8 +11,7 @@ import
|
||||||
std/os,
|
std/os,
|
||||||
json_serialization/std/net,
|
json_serialization/std/net,
|
||||||
beacon_chain/light_client,
|
beacon_chain/light_client,
|
||||||
beacon_chain/conf,
|
beacon_chain/conf
|
||||||
json_rpc/rpcproxy
|
|
||||||
|
|
||||||
export net, conf
|
export net, conf
|
||||||
|
|
||||||
|
|
|
@ -104,7 +104,7 @@ proc fromHex(c: char): int =
|
||||||
else: -1
|
else: -1
|
||||||
|
|
||||||
proc readValue(reader: var JsonReader, value: var UInt256)
|
proc readValue(reader: var JsonReader, value: var UInt256)
|
||||||
{.gcsafe, raises: [CatchableError].} =
|
{.gcsafe, raises: [SerializationError, IOError].} =
|
||||||
## Mixin for `Json.loadFile()`. Note that this driver applies the same
|
## Mixin for `Json.loadFile()`. Note that this driver applies the same
|
||||||
## to `BlockNumber` fields as well as generic `UInt265` fields like the
|
## to `BlockNumber` fields as well as generic `UInt265` fields like the
|
||||||
## account `balance`.
|
## account `balance`.
|
||||||
|
@ -148,36 +148,54 @@ proc readValue(reader: var JsonReader, value: var UInt256)
|
||||||
reader.lexer.next()
|
reader.lexer.next()
|
||||||
|
|
||||||
proc readValue(reader: var JsonReader, value: var ChainId)
|
proc readValue(reader: var JsonReader, value: var ChainId)
|
||||||
{.gcsafe, raises: [CatchableError].} =
|
{.gcsafe, raises: [SerializationError, IOError].} =
|
||||||
value = reader.readValue(int).ChainId
|
value = reader.readValue(int).ChainId
|
||||||
|
|
||||||
proc readValue(reader: var JsonReader, value: var Hash256)
|
proc readValue(reader: var JsonReader, value: var Hash256)
|
||||||
{.gcsafe, raises: [CatchableError].} =
|
{.gcsafe, raises: [SerializationError, IOError].} =
|
||||||
value = Hash256.fromHex(reader.readValue(string))
|
value = Hash256.fromHex(reader.readValue(string))
|
||||||
|
|
||||||
proc readValue(reader: var JsonReader, value: var BlockNonce)
|
proc readValue(reader: var JsonReader, value: var BlockNonce)
|
||||||
{.gcsafe, raises: [CatchableError].} =
|
{.gcsafe, raises: [SerializationError, IOError].} =
|
||||||
|
try:
|
||||||
value = fromHex[uint64](reader.readValue(string)).toBlockNonce
|
value = fromHex[uint64](reader.readValue(string)).toBlockNonce
|
||||||
|
except ValueError as ex:
|
||||||
|
reader.raiseUnexpectedValue(ex.msg)
|
||||||
|
|
||||||
proc readValue(reader: var JsonReader, value: var EthTime)
|
proc readValue(reader: var JsonReader, value: var EthTime)
|
||||||
{.gcsafe, raises: [CatchableError].} =
|
{.gcsafe, raises: [SerializationError, IOError].} =
|
||||||
|
try:
|
||||||
value = fromHex[int64](reader.readValue(string)).fromUnix
|
value = fromHex[int64](reader.readValue(string)).fromUnix
|
||||||
|
except ValueError as ex:
|
||||||
|
reader.raiseUnexpectedValue(ex.msg)
|
||||||
|
|
||||||
proc readValue(reader: var JsonReader, value: var seq[byte])
|
proc readValue(reader: var JsonReader, value: var seq[byte])
|
||||||
{.gcsafe, raises: [CatchableError].} =
|
{.gcsafe, raises: [SerializationError, IOError].} =
|
||||||
|
try:
|
||||||
value = hexToSeqByte(reader.readValue(string))
|
value = hexToSeqByte(reader.readValue(string))
|
||||||
|
except ValueError as ex:
|
||||||
|
reader.raiseUnexpectedValue(ex.msg)
|
||||||
|
|
||||||
proc readValue(reader: var JsonReader, value: var GasInt)
|
proc readValue(reader: var JsonReader, value: var GasInt)
|
||||||
{.gcsafe, raises: [CatchableError].} =
|
{.gcsafe, raises: [SerializationError, IOError].} =
|
||||||
|
try:
|
||||||
value = fromHex[GasInt](reader.readValue(string))
|
value = fromHex[GasInt](reader.readValue(string))
|
||||||
|
except ValueError as ex:
|
||||||
|
reader.raiseUnexpectedValue(ex.msg)
|
||||||
|
|
||||||
proc readValue(reader: var JsonReader, value: var EthAddress)
|
proc readValue(reader: var JsonReader, value: var EthAddress)
|
||||||
{.gcsafe, raises: [CatchableError].} =
|
{.gcsafe, raises: [SerializationError, IOError].} =
|
||||||
|
try:
|
||||||
value = parseAddress(reader.readValue(string))
|
value = parseAddress(reader.readValue(string))
|
||||||
|
except ValueError as ex:
|
||||||
|
reader.raiseUnexpectedValue(ex.msg)
|
||||||
|
|
||||||
proc readValue(reader: var JsonReader, value: var AccountNonce)
|
proc readValue(reader: var JsonReader, value: var AccountNonce)
|
||||||
{.gcsafe, raises: [CatchableError].} =
|
{.gcsafe, raises: [SerializationError, IOError].} =
|
||||||
|
try:
|
||||||
value = fromHex[uint64](reader.readValue(string))
|
value = fromHex[uint64](reader.readValue(string))
|
||||||
|
except ValueError as ex:
|
||||||
|
reader.raiseUnexpectedValue(ex.msg)
|
||||||
|
|
||||||
template to(a: string, b: type EthAddress): EthAddress =
|
template to(a: string, b: type EthAddress): EthAddress =
|
||||||
# json_serialization decode table stuff
|
# json_serialization decode table stuff
|
||||||
|
|
|
@ -21,7 +21,7 @@ proc prepare*(ctx: CasperRef, header: var BlockHeader) =
|
||||||
header.prevRandao = ctx.prevRandao
|
header.prevRandao = ctx.prevRandao
|
||||||
header.difficulty = DifficultyInt.zero
|
header.difficulty = DifficultyInt.zero
|
||||||
|
|
||||||
proc prepareForSeal*(ctx: CasperRef, header: var BlockHeader) {.gcsafe, raises:[RlpError].} =
|
proc prepareForSeal*(ctx: CasperRef, header: var BlockHeader) {.gcsafe, raises:[].} =
|
||||||
header.nonce = default(BlockNonce)
|
header.nonce = default(BlockNonce)
|
||||||
header.extraData = @[] # TODO: probably this should be configurable by user?
|
header.extraData = @[] # TODO: probably this should be configurable by user?
|
||||||
# this repetition, assigning prevRandao is because how txpool works
|
# this repetition, assigning prevRandao is because how txpool works
|
||||||
|
|
|
@ -436,8 +436,7 @@ import
|
||||||
chronicles,
|
chronicles,
|
||||||
eth/keys,
|
eth/keys,
|
||||||
stew/[keyed_queue, results],
|
stew/[keyed_queue, results],
|
||||||
../common/common,
|
../common/common
|
||||||
./casper
|
|
||||||
|
|
||||||
export
|
export
|
||||||
TxItemRef,
|
TxItemRef,
|
||||||
|
|
|
@ -91,7 +91,7 @@ proc prepareHeader(dh: TxChainRef; parent: BlockHeader, timestamp: EthTime)
|
||||||
of ConsensusType.POS:
|
of ConsensusType.POS:
|
||||||
dh.com.pos.prepare(dh.prepHeader)
|
dh.com.pos.prepare(dh.prepHeader)
|
||||||
|
|
||||||
proc prepareForSeal(dh: TxChainRef; header: var BlockHeader) {.gcsafe, raises: [RlpError].} =
|
proc prepareForSeal(dh: TxChainRef; header: var BlockHeader) {.gcsafe, raises: [].} =
|
||||||
case dh.com.consensus
|
case dh.com.consensus
|
||||||
of ConsensusType.POW:
|
of ConsensusType.POW:
|
||||||
# do nothing, tx pool was designed with POW in mind
|
# do nothing, tx pool was designed with POW in mind
|
||||||
|
|
|
@ -11,7 +11,7 @@ The points of these two files are:
|
||||||
|
|
||||||
import
|
import
|
||||||
chronicles,
|
chronicles,
|
||||||
eth/[common, rlp],
|
eth/[common],
|
||||||
eth/trie/[hexary, db, trie_defs],
|
eth/trie/[hexary, db, trie_defs],
|
||||||
storage_types,
|
storage_types,
|
||||||
./values_from_bytes,
|
./values_from_bytes,
|
||||||
|
|
|
@ -24,6 +24,7 @@ when defined(legacy_eth66_enabled):
|
||||||
|
|
||||||
from ../../../rpc/rpc_utils import toHash
|
from ../../../rpc/rpc_utils import toHash
|
||||||
from web3 import Web3, BlockHash, BlockObject, FixedBytes, Address, ProofResponse, StorageProof, newWeb3, fromJson, fromHex, eth_getBlockByHash, eth_getBlockByNumber, eth_getCode, eth_getProof, blockId, `%`
|
from web3 import Web3, BlockHash, BlockObject, FixedBytes, Address, ProofResponse, StorageProof, newWeb3, fromJson, fromHex, eth_getBlockByHash, eth_getBlockByNumber, eth_getCode, eth_getProof, blockId, `%`
|
||||||
|
from web3/ethtypes import Quantity
|
||||||
#from ../../../premix/downloader import request
|
#from ../../../premix/downloader import request
|
||||||
#from ../../../premix/parser import prefixHex, parseBlockHeader, parseReceipt, parseTransaction
|
#from ../../../premix/parser import prefixHex, parseBlockHeader, parseReceipt, parseTransaction
|
||||||
|
|
||||||
|
@ -32,7 +33,6 @@ from eth/common import BlockHeader
|
||||||
# Trying to do things the new web3 way:
|
# Trying to do things the new web3 way:
|
||||||
from ../../../nimbus_verified_proxy/validate_proof import getAccountFromProof
|
from ../../../nimbus_verified_proxy/validate_proof import getAccountFromProof
|
||||||
|
|
||||||
|
|
||||||
export AsyncOperationFactory, AsyncDataSource
|
export AsyncOperationFactory, AsyncDataSource
|
||||||
|
|
||||||
|
|
||||||
|
@ -84,6 +84,12 @@ proc makeAnRpcClient*(web3Url: string): Future[RpcClient] {.async.} =
|
||||||
excessDataGas*: Option[UInt256] # EIP-4844
|
excessDataGas*: Option[UInt256] # EIP-4844
|
||||||
]#
|
]#
|
||||||
|
|
||||||
|
func fromQty(x: Option[Quantity]): Option[uint64] =
|
||||||
|
if x.isSome:
|
||||||
|
some(x.get().uint64)
|
||||||
|
else:
|
||||||
|
none(uint64)
|
||||||
|
|
||||||
func blockHeaderFromBlockObject(o: BlockObject): BlockHeader =
|
func blockHeaderFromBlockObject(o: BlockObject): BlockHeader =
|
||||||
let nonce: BlockNonce = if o.nonce.isSome: distinctBase(o.nonce.get) else: default(BlockNonce)
|
let nonce: BlockNonce = if o.nonce.isSome: distinctBase(o.nonce.get) else: default(BlockNonce)
|
||||||
BlockHeader(
|
BlockHeader(
|
||||||
|
@ -104,7 +110,8 @@ func blockHeaderFromBlockObject(o: BlockObject): BlockHeader =
|
||||||
nonce: nonce,
|
nonce: nonce,
|
||||||
fee: o.baseFeePerGas,
|
fee: o.baseFeePerGas,
|
||||||
withdrawalsRoot: o.withdrawalsRoot.map(toHash),
|
withdrawalsRoot: o.withdrawalsRoot.map(toHash),
|
||||||
excessDataGas: o.excessDataGas
|
dataGasUsed: fromQty(o.dataGasUsed),
|
||||||
|
excessDataGas: fromQty(o.excessDataGas)
|
||||||
)
|
)
|
||||||
|
|
||||||
proc fetchBlockHeaderWithHash*(rpcClient: RpcClient, h: Hash256): Future[BlockHeader] {.async.} =
|
proc fetchBlockHeaderWithHash*(rpcClient: RpcClient, h: Hash256): Future[BlockHeader] {.async.} =
|
||||||
|
@ -287,8 +294,8 @@ proc fetchCode(client: RpcClient, p: CodeFetchingInfo): Future[seq[byte]] {.asyn
|
||||||
|
|
||||||
proc verifyFetchedCode(fetchedCode: seq[byte], desiredCodeHash: Hash256): Result[void, Hash256] =
|
proc verifyFetchedCode(fetchedCode: seq[byte], desiredCodeHash: Hash256): Result[void, Hash256] =
|
||||||
let fetchedCodeHash = keccakHash(fetchedCode)
|
let fetchedCodeHash = keccakHash(fetchedCode)
|
||||||
if (desiredCodeHash == fetchedCodeHash):
|
if desiredCodeHash == fetchedCodeHash:
|
||||||
ok[void]()
|
ok()
|
||||||
else:
|
else:
|
||||||
err(fetchedCodeHash)
|
err(fetchedCodeHash)
|
||||||
|
|
||||||
|
@ -371,7 +378,7 @@ proc verifyFetchedBlockHeader(fetchedHeader: BlockHeader, desiredBlockNumber: Bl
|
||||||
# *Can* we do anything to verify this header, given that all we know
|
# *Can* we do anything to verify this header, given that all we know
|
||||||
# is the desiredBlockNumber and we want to run statelessly so we don't
|
# is the desiredBlockNumber and we want to run statelessly so we don't
|
||||||
# know what block hash we want?
|
# know what block hash we want?
|
||||||
ok[void]()
|
ok()
|
||||||
|
|
||||||
proc storeBlockHeader(chainDB: ChainDBRef, header: BlockHeader) =
|
proc storeBlockHeader(chainDB: ChainDBRef, header: BlockHeader) =
|
||||||
chainDB.persistHeaderToDbWithoutSetHeadOrScore(header)
|
chainDB.persistHeaderToDbWithoutSetHeadOrScore(header)
|
||||||
|
|
|
@ -6,9 +6,8 @@
|
||||||
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
||||||
|
|
||||||
import
|
import
|
||||||
sequtils,
|
|
||||||
chronicles, eth/common/eth_types,
|
chronicles, eth/common/eth_types,
|
||||||
../errors, ./validation,
|
./validation,
|
||||||
./interpreter/utils/utils_numeric
|
./interpreter/utils/utils_numeric
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
|
@ -169,8 +169,6 @@ proc getTxCount(ctx: GraphqlContextRef, txRoot: Hash256): RespResult =
|
||||||
ok(resp(getTransactionCount(ctx.chainDB, txRoot)))
|
ok(resp(getTransactionCount(ctx.chainDB, txRoot)))
|
||||||
except CatchableError as e:
|
except CatchableError as e:
|
||||||
err("can't get txcount: " & e.msg)
|
err("can't get txcount: " & e.msg)
|
||||||
except Exception as em:
|
|
||||||
err("can't get txcount: " & em.msg)
|
|
||||||
|
|
||||||
proc longNode(val: uint64 | int64): RespResult =
|
proc longNode(val: uint64 | int64): RespResult =
|
||||||
ok(Node(kind: nkInt, intVal: $val, pos: Pos()))
|
ok(Node(kind: nkInt, intVal: $val, pos: Pos()))
|
||||||
|
@ -228,8 +226,6 @@ proc getOmmerCount(ctx: GraphqlContextRef, ommersHash: Hash256): RespResult =
|
||||||
ok(resp(getUnclesCount(ctx.chainDB, ommersHash)))
|
ok(resp(getUnclesCount(ctx.chainDB, ommersHash)))
|
||||||
except CatchableError as e:
|
except CatchableError as e:
|
||||||
err("can't get ommers count: " & e.msg)
|
err("can't get ommers count: " & e.msg)
|
||||||
except Exception as em:
|
|
||||||
err("can't get ommers count: " & em.msg)
|
|
||||||
|
|
||||||
proc getOmmers(ctx: GraphqlContextRef, ommersHash: Hash256): RespResult =
|
proc getOmmers(ctx: GraphqlContextRef, ommersHash: Hash256): RespResult =
|
||||||
try:
|
try:
|
||||||
|
@ -281,8 +277,6 @@ proc getTxs(ctx: GraphqlContextRef, header: BlockHeader): RespResult =
|
||||||
ok(list)
|
ok(list)
|
||||||
except CatchableError as e:
|
except CatchableError as e:
|
||||||
err("can't get transactions: " & e.msg)
|
err("can't get transactions: " & e.msg)
|
||||||
except Exception as em:
|
|
||||||
err("can't get transactions: " & em.msg)
|
|
||||||
|
|
||||||
proc getTxAt(ctx: GraphqlContextRef, header: BlockHeader, index: int): RespResult =
|
proc getTxAt(ctx: GraphqlContextRef, header: BlockHeader, index: int): RespResult =
|
||||||
try:
|
try:
|
||||||
|
@ -315,8 +309,6 @@ proc getTxByHash(ctx: GraphqlContextRef, hash: Hash256): RespResult =
|
||||||
getTxAt(ctx, header, index)
|
getTxAt(ctx, header, index)
|
||||||
except CatchableError as e:
|
except CatchableError as e:
|
||||||
err("can't get transaction by hash '$1': $2" % [hash.data.toHex, e.msg])
|
err("can't get transaction by hash '$1': $2" % [hash.data.toHex, e.msg])
|
||||||
except Exception as em:
|
|
||||||
err("can't get transaction by hash '$1': $2" % [hash.data.toHex, em.msg])
|
|
||||||
|
|
||||||
proc accountNode(ctx: GraphqlContextRef, header: BlockHeader, address: EthAddress): RespResult =
|
proc accountNode(ctx: GraphqlContextRef, header: BlockHeader, address: EthAddress): RespResult =
|
||||||
try:
|
try:
|
||||||
|
@ -999,7 +991,7 @@ proc blockCall(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.
|
||||||
try:
|
try:
|
||||||
let callData = toCallData(param)
|
let callData = toCallData(param)
|
||||||
ctx.makeCall(callData, h.header)
|
ctx.makeCall(callData, h.header)
|
||||||
except Exception as em:
|
except CatchableError as em:
|
||||||
err("call error: " & em.msg)
|
err("call error: " & em.msg)
|
||||||
|
|
||||||
proc blockEstimateGas(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} =
|
proc blockEstimateGas(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} =
|
||||||
|
@ -1011,7 +1003,7 @@ proc blockEstimateGas(ud: RootRef, params: Args, parent: Node): RespResult {.api
|
||||||
# TODO: DEFAULT_RPC_GAS_CAP should configurable
|
# TODO: DEFAULT_RPC_GAS_CAP should configurable
|
||||||
let gasUsed = rpcEstimateGas(callData, h.header, ctx.com, DEFAULT_RPC_GAS_CAP)
|
let gasUsed = rpcEstimateGas(callData, h.header, ctx.com, DEFAULT_RPC_GAS_CAP)
|
||||||
longNode(gasUsed)
|
longNode(gasUsed)
|
||||||
except Exception as em:
|
except CatchableError as em:
|
||||||
err("estimateGas error: " & em.msg)
|
err("estimateGas error: " & em.msg)
|
||||||
|
|
||||||
proc blockBaseFeePerGas(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} =
|
proc blockBaseFeePerGas(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} =
|
||||||
|
@ -1214,7 +1206,7 @@ proc queryGasPrice(ud: RootRef, params: Args, parent: Node): RespResult {.apiPra
|
||||||
let ctx = GraphqlContextRef(ud)
|
let ctx = GraphqlContextRef(ud)
|
||||||
try:
|
try:
|
||||||
bigIntNode(calculateMedianGasPrice(ctx.chainDB))
|
bigIntNode(calculateMedianGasPrice(ctx.chainDB))
|
||||||
except Exception as em:
|
except CatchableError as em:
|
||||||
err("can't get gasPrice: " & em.msg)
|
err("can't get gasPrice: " & em.msg)
|
||||||
|
|
||||||
proc queryProtocolVersion(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} =
|
proc queryProtocolVersion(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} =
|
||||||
|
@ -1260,8 +1252,8 @@ proc sendRawTransaction(ud: RootRef, params: Args, parent: Node): RespResult {.a
|
||||||
let _ = decodeTx(data) # we want to know if it is a valid tx blob
|
let _ = decodeTx(data) # we want to know if it is a valid tx blob
|
||||||
let txHash = keccakHash(data)
|
let txHash = keccakHash(data)
|
||||||
resp(txHash)
|
resp(txHash)
|
||||||
except Exception as em:
|
except CatchableError as em:
|
||||||
return err("failed to process raw transaction")
|
return err("failed to process raw transaction: " & em.msg)
|
||||||
|
|
||||||
const mutationProcs = {
|
const mutationProcs = {
|
||||||
"sendRawTransaction": sendRawTransaction
|
"sendRawTransaction": sendRawTransaction
|
||||||
|
|
|
@ -171,7 +171,7 @@ proc setupP2P(nimbus: NimbusNode, conf: NimbusConf,
|
||||||
block:
|
block:
|
||||||
let
|
let
|
||||||
exCtrlFile = if conf.syncCtrlFile.isNone: none(string)
|
exCtrlFile = if conf.syncCtrlFile.isNone: none(string)
|
||||||
else: some(conf.syncCtrlFile.get.string)
|
else: some(conf.syncCtrlFile.get)
|
||||||
tickerOK = conf.logLevel in {
|
tickerOK = conf.logLevel in {
|
||||||
LogLevel.INFO, LogLevel.DEBUG, LogLevel.TRACE}
|
LogLevel.INFO, LogLevel.DEBUG, LogLevel.TRACE}
|
||||||
case conf.syncMode:
|
case conf.syncMode:
|
||||||
|
|
|
@ -1,29 +1,22 @@
|
||||||
import
|
import
|
||||||
chronos,
|
chronos,
|
||||||
options,
|
options,
|
||||||
sequtils,
|
|
||||||
times,
|
times,
|
||||||
nimcrypto,
|
nimcrypto,
|
||||||
os,
|
|
||||||
stew/byteutils,
|
|
||||||
stew/results,
|
stew/results,
|
||||||
json_rpc/rpcclient,
|
json_rpc/rpcclient,
|
||||||
eth/[rlp, common/eth_types, p2p],
|
eth/[common/eth_types, p2p],
|
||||||
core/chain/[chain_desc, persist_blocks],
|
core/chain/[chain_desc],
|
||||||
core/executor/process_block,
|
core/executor/process_block,
|
||||||
db/[db_chain, select_backend, storage_types, distinct_tries, incomplete_db, accounts_cache],
|
db/[db_chain, select_backend, accounts_cache],
|
||||||
eth/trie/[db, trie_defs],
|
eth/trie/[db, trie_defs],
|
||||||
rpc/rpc_utils,
|
|
||||||
evm/async/[data_sources, operations, data_sources/json_rpc_data_source],
|
evm/async/[data_sources, operations, data_sources/json_rpc_data_source],
|
||||||
./vm_state, ./vm_types,
|
./vm_state, ./vm_types,
|
||||||
./sync/stateless,
|
|
||||||
chronicles
|
chronicles
|
||||||
|
|
||||||
from strutils import parseInt, startsWith
|
from strutils import parseInt, startsWith
|
||||||
from common/chain_config import MainNet, networkParams
|
|
||||||
from common/common import initializeEmptyDb
|
from common/common import initializeEmptyDb
|
||||||
|
|
||||||
|
|
||||||
proc coinbasesOfThisBlockAndUncles(header: BlockHeader, body: BlockBody): seq[EthAddress] =
|
proc coinbasesOfThisBlockAndUncles(header: BlockHeader, body: BlockBody): seq[EthAddress] =
|
||||||
result.add header.coinbase
|
result.add header.coinbase
|
||||||
for uncle in body.uncles:
|
for uncle in body.uncles:
|
||||||
|
@ -118,7 +111,7 @@ proc statelesslyRunTransaction*(asyncDataSource: AsyncDataSource, com: CommonRef
|
||||||
# FIXME-Adam: this doesn't feel like the right place for this; where should it go?
|
# FIXME-Adam: this doesn't feel like the right place for this; where should it go?
|
||||||
com.db.db.put(emptyRlpHash.data, emptyRlp)
|
com.db.db.put(emptyRlpHash.data, emptyRlp)
|
||||||
|
|
||||||
let blockHash: Hash256 = header.blockHash
|
#let blockHash: Hash256 = header.blockHash
|
||||||
|
|
||||||
let transaction = com.db.db.beginTransaction()
|
let transaction = com.db.db.beginTransaction()
|
||||||
defer: transaction.rollback() # intentionally throwing away the result of this execution
|
defer: transaction.rollback() # intentionally throwing away the result of this execution
|
||||||
|
|
|
@ -11,11 +11,10 @@
|
||||||
{.push raises: [].}
|
{.push raises: [].}
|
||||||
|
|
||||||
import
|
import
|
||||||
eth/[common, p2p],
|
eth/[p2p],
|
||||||
chronicles,
|
chronicles,
|
||||||
chronos,
|
stew/[interval_set],
|
||||||
stew/[interval_set, sorted_set],
|
"."/[sync_desc]
|
||||||
"."/[sync_desc, sync_sched, protocol]
|
|
||||||
|
|
||||||
logScope:
|
logScope:
|
||||||
topics = "stateless-sync"
|
topics = "stateless-sync"
|
||||||
|
|
|
@ -49,8 +49,10 @@ proc debug*(h: BlockHeader): string =
|
||||||
result.add "fee : " & $h.fee.get() & "\n"
|
result.add "fee : " & $h.fee.get() & "\n"
|
||||||
if h.withdrawalsRoot.isSome:
|
if h.withdrawalsRoot.isSome:
|
||||||
result.add "withdrawalsRoot: " & $h.withdrawalsRoot.get() & "\n"
|
result.add "withdrawalsRoot: " & $h.withdrawalsRoot.get() & "\n"
|
||||||
|
if h.dataGasUsed.isSome:
|
||||||
|
result.add "dataGasUsed : " & $h.dataGasUsed.get() & "\n"
|
||||||
if h.excessDataGas.isSome:
|
if h.excessDataGas.isSome:
|
||||||
result.add "excessDataGas: " & $h.excessDataGas.get() & "\n"
|
result.add "excessDataGas : " & $h.excessDataGas.get() & "\n"
|
||||||
result.add "blockHash : " & $blockHash(h) & "\n"
|
result.add "blockHash : " & $blockHash(h) & "\n"
|
||||||
|
|
||||||
proc dumpAccount(stateDB: AccountsCache, address: EthAddress): JsonNode =
|
proc dumpAccount(stateDB: AccountsCache, address: EthAddress): JsonNode =
|
||||||
|
|
|
@ -12,12 +12,12 @@ import
|
||||||
chronicles, chronicles/chronos_tools, chronos, confutils,
|
chronicles, chronicles/chronos_tools, chronos, confutils,
|
||||||
eth/keys,
|
eth/keys,
|
||||||
json_rpc/rpcproxy,
|
json_rpc/rpcproxy,
|
||||||
beacon_chain/eth1/eth1_monitor,
|
beacon_chain/el/el_manager,
|
||||||
beacon_chain/gossip_processing/optimistic_processor,
|
beacon_chain/gossip_processing/optimistic_processor,
|
||||||
beacon_chain/networking/topic_params,
|
beacon_chain/networking/topic_params,
|
||||||
beacon_chain/spec/beaconstate,
|
beacon_chain/spec/beaconstate,
|
||||||
beacon_chain/spec/datatypes/[phase0, altair, bellatrix],
|
beacon_chain/spec/datatypes/[phase0, altair, bellatrix],
|
||||||
beacon_chain/[light_client, nimbus_binary_common, version],
|
beacon_chain/[light_client,nimbus_binary_common, version],
|
||||||
../nimbus/rpc/cors,
|
../nimbus/rpc/cors,
|
||||||
"."/rpc/[rpc_eth_api, rpc_utils],
|
"."/rpc/[rpc_eth_api, rpc_utils],
|
||||||
./nimbus_verified_proxy_conf,
|
./nimbus_verified_proxy_conf,
|
||||||
|
@ -63,7 +63,7 @@ proc run(config: VerifiedProxyConf) {.raises: [CatchableError].} =
|
||||||
try:
|
try:
|
||||||
template genesisData(): auto = metadata.genesisData
|
template genesisData(): auto = metadata.genesisData
|
||||||
newClone(readSszForkedHashedBeaconState(
|
newClone(readSszForkedHashedBeaconState(
|
||||||
cfg, genesisData.toOpenArrayByte(genesisData.low, genesisData.high)))
|
cfg, genesisData.toOpenArray(genesisData.low, genesisData.high)))
|
||||||
except CatchableError as err:
|
except CatchableError as err:
|
||||||
raiseAssert "Invalid baked-in state: " & err.msg
|
raiseAssert "Invalid baked-in state: " & err.msg
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
import
|
import
|
||||||
std/os,
|
std/os,
|
||||||
json_serialization/std/net,
|
json_serialization/std/net,
|
||||||
beacon_chain/light_client,
|
beacon_chain/conf_light_client,
|
||||||
beacon_chain/conf,
|
beacon_chain/conf,
|
||||||
json_rpc/[rpcproxy]
|
json_rpc/[rpcproxy]
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ import
|
||||||
eth/common/eth_types as etypes,
|
eth/common/eth_types as etypes,
|
||||||
web3,
|
web3,
|
||||||
web3/[ethhexstrings, ethtypes],
|
web3/[ethhexstrings, ethtypes],
|
||||||
beacon_chain/eth1/eth1_monitor,
|
beacon_chain/el/el_manager,
|
||||||
beacon_chain/networking/network_metadata,
|
beacon_chain/networking/network_metadata,
|
||||||
beacon_chain/spec/forks,
|
beacon_chain/spec/forks,
|
||||||
./rpc_utils,
|
./rpc_utils,
|
||||||
|
|
|
@ -139,7 +139,7 @@ proc asBlockObject*(
|
||||||
receiptsRoot: p.receiptsRoot,
|
receiptsRoot: p.receiptsRoot,
|
||||||
miner: p.feeRecipient,
|
miner: p.feeRecipient,
|
||||||
difficulty: UInt256.zero,
|
difficulty: UInt256.zero,
|
||||||
extraData: fromHex(DynamicBytes[0, 32], p.extraData.toHex),
|
extraData: fromHex(DynamicBytes[0, 4096], p.extraData.toHex),
|
||||||
gasLimit: p.gasLimit,
|
gasLimit: p.gasLimit,
|
||||||
gasUsed: p.gasUsed,
|
gasUsed: p.gasUsed,
|
||||||
timestamp: p.timestamp,
|
timestamp: p.timestamp,
|
||||||
|
|
|
@ -56,7 +56,8 @@ proc pp*(h: BlockHeader; sep = " "): string =
|
||||||
&"stateRoot={h.stateRoot.pp}{sep}" &
|
&"stateRoot={h.stateRoot.pp}{sep}" &
|
||||||
&"baseFee={h.baseFee}{sep}" &
|
&"baseFee={h.baseFee}{sep}" &
|
||||||
&"withdrawalsRoot={h.withdrawalsRoot.get(EMPTY_ROOT_HASH)}{sep}" &
|
&"withdrawalsRoot={h.withdrawalsRoot.get(EMPTY_ROOT_HASH)}{sep}" &
|
||||||
&"excessDataGas={h.excessDataGas.get(0.u256)}"
|
&"dataGasUsed={h.dataGasUsed.get(0'u64)}" &
|
||||||
|
&"excessDataGas={h.excessDataGas.get(0'u64)}"
|
||||||
|
|
||||||
proc pp*(g: Genesis; sep = " "): string =
|
proc pp*(g: Genesis; sep = " "): string =
|
||||||
"" &
|
"" &
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 1322d860a838c175cbe753a29441e66c98b9efd6
|
Subproject commit c1d640184bffa38714974e883f9a9f856779fefa
|
|
@ -1 +1 @@
|
||||||
Subproject commit 1e6350870855541b381d77d4659688bc0d2c4227
|
Subproject commit af31ca2157ed5c65ed339a0bbe5bed6faa033502
|
|
@ -1 +1 @@
|
||||||
Subproject commit e05d2f8e9648e17b9a71bf5e909a79241c067c8b
|
Subproject commit 2ef34c7339c5d8e59f212d7af72a06e0d3e8327c
|
|
@ -1 +1 @@
|
||||||
Subproject commit 6c6ff76cb38a3d4fa369a2757769220f2ecf4e64
|
Subproject commit 1f3acaf6e968ea8e4ec3eec177aebd50eef1040c
|
|
@ -1 +1 @@
|
||||||
Subproject commit 91b2b9d2ed6daa14107c9ee84ffac71c2ccd5dd4
|
Subproject commit c608426d03167ff44a90ab6864c3b57eddb5512d
|
|
@ -1 +1 @@
|
||||||
Subproject commit 3576a15f131367d8a36ffb5627b84bb59728b339
|
Subproject commit 583974782f1d5487e16cc72289cd97e8897bc894
|
|
@ -1 +1 @@
|
||||||
Subproject commit af1276443618974a95dd3c83e57a1ecd70df2c5e
|
Subproject commit f79be14c997092e29ba1edf706bb15a238fb37a5
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit f8b78edcc8296f412c2593e6d60f47c77aa421c5
|
|
@ -1 +1 @@
|
||||||
Subproject commit 18837545f3234f2eae187b2fd1ea24477398775e
|
Subproject commit 35652ed19ccbbf042e95941bc2f8bab39e3f6030
|
|
@ -1 +1 @@
|
||||||
Subproject commit 67fdc87e2521f7e021fd521c41d3228810a183d0
|
Subproject commit 7b4c9407f29075d3206123c1a2d87fa74af40fd0
|
|
@ -1 +1 @@
|
||||||
Subproject commit 610dda642c3d7e5b0f50bba5457f0da490219001
|
Subproject commit 7a835d71683cd60f111b8de4ff047068e4fbda0e
|
|
@ -1 +1 @@
|
||||||
Subproject commit 6c0d756d54998cf30edd1678cbf121c8052a378a
|
Subproject commit d358aa67cbacc22e77773f4af9fa2aa641f57efc
|
Loading…
Reference in New Issue