diff --git a/nimbus/db/state_db.nim b/nimbus/db/state_db.nim index 53290064d..ff04a8045 100644 --- a/nimbus/db/state_db.nim +++ b/nimbus/db/state_db.nim @@ -46,17 +46,14 @@ proc setAccount(db: AccountStateDB, address: EthAddress, account: Account) = db.trie.put createRangeFromAddress(address), rlp.encode(account) proc getCodeHash*(db: AccountStateDB, address: EthAddress): Hash256 = - validateCanonicalAddress(address, title="Storage Address") let account = db.getAccount(address) result = account.codeHash proc getBalance*(db: AccountStateDB, address: EthAddress): UInt256 = - validateCanonicalAddress(address, title="Storage Address") let account = db.getAccount(address) account.balance proc setBalance*(db: var AccountStateDB, address: EthAddress, balance: UInt256) = - validateCanonicalAddress(address, title="Storage Address") var account = db.getAccount(address) account.balance = balance db.setAccount(address, account) @@ -77,7 +74,6 @@ proc setStorage*(db: var AccountStateDB, slot: UInt256, value: UInt256) = #validateGte(value, 0, title="Storage Value") #validateGte(slot, 0, title="Storage Slot") - validateCanonicalAddress(address, title="Storage Address") var account = db.getAccount(address) var accountTrie = initHexaryTrie(db.trie.db, account.storageRoot) @@ -93,7 +89,6 @@ proc setStorage*(db: var AccountStateDB, db.setAccount(address, account) proc getStorage*(db: AccountStateDB, address: EthAddress, slot: UInt256): (UInt256, bool) = - validateCanonicalAddress(address, title="Storage Address") #validateGte(slot, 0, title="Storage Slot") let @@ -110,7 +105,6 @@ proc getStorage*(db: AccountStateDB, address: EthAddress, slot: UInt256): (UInt2 result = (0.u256, false) proc setNonce*(db: var AccountStateDB, address: EthAddress, nonce: UInt256) = - validateCanonicalAddress(address, title="Storage Address") #validateGte(nonce, 0, title="Nonce") var account = db.getAccount(address) @@ -121,8 +115,6 @@ proc setNonce*(db: var AccountStateDB, address: EthAddress, nonce: UInt256) = proc getNonce*(db: AccountStateDB, address: EthAddress): UInt256 = # TODO it is very strange that we require a var param here - validateCanonicalAddress(address, title="Storage Address") - let account = db.getAccount(address) account.nonce @@ -132,7 +124,6 @@ proc toByteRange_Unnecessary*(h: KeccakHash): ByteRange = return s.toRange proc setCode*(db: var AccountStateDB, address: EthAddress, code: ByteRange) = - validateCanonicalAddress(address, title="Storage Address") var account = db.getAccount(address) account.codeHash = keccak256.digest code.toOpenArray diff --git a/nimbus/validation.nim b/nimbus/validation.nim index b8465e38f..50c49e0d1 100644 --- a/nimbus/validation.nim +++ b/nimbus/validation.nim @@ -9,10 +9,6 @@ import strformat, errors, constants, eth_common -template validateCanonicalAddress*(value: EthAddress, title: string = "Value") = - # TODO: This needs to be removed - discard - proc validateGte*(value: Int256 | int, minimum: int, title: string = "Value") = if value.i256 < minimum.i256: raise newException(ValidationError, diff --git a/nimbus/vm/computation.nim b/nimbus/vm/computation.nim index 3c90a8d8e..ca10a5ea6 100644 --- a/nimbus/vm/computation.nim +++ b/nimbus/vm/computation.nim @@ -85,8 +85,6 @@ proc outputHex*(c: BaseComputation): string = c.rawOutput.bytesToHex proc registerAccountForDeletion*(c: var BaseComputation, beneficiary: EthAddress) = - validateCanonicalAddress(beneficiary, title="self destruct beneficiary address") - if c.msg.storageAddress in c.accountsToDelete: raise newException(ValueError, "invariant: should be impossible for an account to be " & @@ -94,7 +92,6 @@ proc registerAccountForDeletion*(c: var BaseComputation, beneficiary: EthAddress c.accountsToDelete[c.msg.storageAddress] = beneficiary proc addLogEntry*(c: var BaseComputation, account: EthAddress, topics: seq[UInt256], data: seq[byte]) = - validateCanonicalAddress(account, title="log entry address") c.logEntries.add((account, topics, data)) # many methods are basically TODO, but they still return valid values diff --git a/nimbus/vm/message.nim b/nimbus/vm/message.nim index 74df93646..a764539d6 100644 --- a/nimbus/vm/message.nim +++ b/nimbus/vm/message.nim @@ -44,9 +44,6 @@ proc newMessage*( code: string, options: MessageOptions = newMessageOptions()): Message = - if to != CREATE_CONTRACT_ADDRESS: - validateCanonicalAddress(to, title="Message.to") - validateCanonicalAddress(sender, title="Message.sender") validateGte(options.depth, minimum=0, title="Message.depth") new(result)