import std/[tables], eth/keys, stew/endians2, nimcrypto/sha2, chronicles, ./engine_client, ../../../nimbus/transaction, ../../../nimbus/common, ../../../nimbus/utils/utils type BaseTx* = object of RootObj recipient*: Option[EthAddress] gasLimit* : GasInt amount* : UInt256 payload* : seq[byte] txType* : Option[TxType] BigInitcodeTx* = object of BaseTx initcodeLength*: int padByte* : uint8 initcode* : seq[byte] TestAccount = object key : PrivateKey address: EthAddress index : int TxSender* = ref object accounts: seq[TestAccount] nonceMap: Table[EthAddress, uint64] txSent : int chainId : ChainID MakeTxParams* = object chainId*: ChainID key* : PrivateKey nonce* : AccountNonce const TestAccountCount = 1000 func toAddress(key: PrivateKey): EthAddress = toKeyPair(key).pubkey.toCanonicalAddress() proc createAccount(idx: int): TestAccount = let seed = toBytesBE(idx.uint64) seedHash = sha256.digest(seed) result.index = idx result.key = PrivateKey.fromRaw(seedHash.data).valueOr: echo error quit(QuitFailure) result.address = toAddress(result.key) proc createAccounts(sender: TxSender) = for i in 0..