@nomicfoundation/ethereumjs-statemanager
Advanced tools
Comparing version 1.0.0-rc.1 to 1.0.0-rc.2
@@ -6,3 +6,2 @@ /// <reference types="node" /> | ||
import type { Account, Address } from '@nomicfoundation/ethereumjs-util'; | ||
import type { Debugger } from 'debug'; | ||
/** | ||
@@ -21,3 +20,2 @@ * Abstract BaseStateManager class for the non-storage-backend | ||
export declare abstract class BaseStateManager { | ||
_debug: Debugger; | ||
_cache: Cache; | ||
@@ -24,0 +22,0 @@ /** |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.BaseStateManager = void 0; | ||
const debug_1 = require("debug"); | ||
/** | ||
@@ -35,3 +34,2 @@ * Abstract BaseStateManager class for the non-storage-backend | ||
} | ||
this._debug = (0, debug_1.debug)('statemanager:statemanager'); | ||
} | ||
@@ -52,5 +50,2 @@ /** | ||
async putAccount(address, account) { | ||
if (this.DEBUG) { | ||
this._debug(`Save account address=${address} nonce=${account.nonce} balance=${account.balance} contract=${account.isContract() ? 'yes' : 'no'} empty=${account.isEmpty() ? 'yes' : 'no'}`); | ||
} | ||
this._cache.put(address, account); | ||
@@ -78,5 +73,2 @@ } | ||
async deleteAccount(address) { | ||
if (this.DEBUG) { | ||
this._debug(`Delete account ${address}`); | ||
} | ||
this._cache.del(address); | ||
@@ -83,0 +75,0 @@ } |
@@ -82,5 +82,2 @@ "use strict"; | ||
await this._trie._db.put(key, value); | ||
if (this.DEBUG) { | ||
this._debug(`Update codeHash (-> ${(0, ethereumjs_util_1.short)(codeHash)}) for account ${address}`); | ||
} | ||
await this.modifyAccountFields(address, { codeHash }); | ||
@@ -193,5 +190,2 @@ } | ||
const encodedValue = Buffer.from(ethereumjs_rlp_1.RLP.encode(Uint8Array.from(value))); | ||
if (this.DEBUG) { | ||
this._debug(`Update contract storage for account ${address} to ${(0, ethereumjs_util_1.short)(value)}`); | ||
} | ||
await storageTrie.put(key, encodedValue); | ||
@@ -201,5 +195,2 @@ } | ||
// deleting a value | ||
if (this.DEBUG) { | ||
this._debug(`Delete contract storage for account`); | ||
} | ||
await storageTrie.del(key); | ||
@@ -206,0 +197,0 @@ } |
{ | ||
"name": "@nomicfoundation/ethereumjs-statemanager", | ||
"version": "1.0.0-rc.1", | ||
"version": "1.0.0-rc.2", | ||
"description": "An Ethereum statemanager implementation", | ||
@@ -43,10 +43,10 @@ "keywords": [ | ||
"dependencies": { | ||
"@nomicfoundation/ethereumjs-common": "3.0.0-rc.1", | ||
"@nomicfoundation/ethereumjs-rlp": "4.0.0-rc.1", | ||
"@nomicfoundation/ethereumjs-trie": "5.0.0-rc.1", | ||
"@nomicfoundation/ethereumjs-util": "8.0.0-rc.1", | ||
"@nomicfoundation/ethereumjs-common": "3.0.0-rc.2", | ||
"@nomicfoundation/ethereumjs-rlp": "4.0.0-rc.2", | ||
"@nomicfoundation/ethereumjs-trie": "5.0.0-rc.2", | ||
"@nomicfoundation/ethereumjs-util": "8.0.0-rc.2", | ||
"debug": "^4.3.3", | ||
"ethereum-cryptography": "^1.1.2", | ||
"ethereum-cryptography": "0.1.3", | ||
"functional-red-black-tree": "^1.0.1" | ||
} | ||
} |
@@ -1,3 +0,1 @@ | ||
import { debug as createDebugLogger } from 'debug' | ||
import type { Cache } from './cache' | ||
@@ -7,3 +5,2 @@ import type { AccountFields } from './interface' | ||
import type { Account, Address } from '@nomicfoundation/ethereumjs-util' | ||
import type { Debugger } from 'debug' | ||
@@ -23,3 +20,2 @@ /** | ||
export abstract class BaseStateManager { | ||
_debug: Debugger | ||
_cache!: Cache | ||
@@ -45,3 +41,2 @@ | ||
} | ||
this._debug = createDebugLogger('statemanager:statemanager') | ||
} | ||
@@ -64,9 +59,2 @@ | ||
async putAccount(address: Address, account: Account): Promise<void> { | ||
if (this.DEBUG) { | ||
this._debug( | ||
`Save account address=${address} nonce=${account.nonce} balance=${ | ||
account.balance | ||
} contract=${account.isContract() ? 'yes' : 'no'} empty=${account.isEmpty() ? 'yes' : 'no'}` | ||
) | ||
} | ||
this._cache.put(address, account) | ||
@@ -96,5 +84,2 @@ } | ||
async deleteAccount(address: Address) { | ||
if (this.DEBUG) { | ||
this._debug(`Delete account ${address}`) | ||
} | ||
this._cache.del(address) | ||
@@ -101,0 +86,0 @@ } |
@@ -144,5 +144,2 @@ import { RLP } from '@nomicfoundation/ethereumjs-rlp' | ||
if (this.DEBUG) { | ||
this._debug(`Update codeHash (-> ${short(codeHash)}) for account ${address}`) | ||
} | ||
await this.modifyAccountFields(address, { codeHash }) | ||
@@ -271,11 +268,5 @@ } | ||
const encodedValue = Buffer.from(RLP.encode(Uint8Array.from(value))) | ||
if (this.DEBUG) { | ||
this._debug(`Update contract storage for account ${address} to ${short(value)}`) | ||
} | ||
await storageTrie.put(key, encodedValue) | ||
} else { | ||
// deleting a value | ||
if (this.DEBUG) { | ||
this._debug(`Delete contract storage for account`) | ||
} | ||
await storageTrie.del(key) | ||
@@ -282,0 +273,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
0
118088
1875
+ Added@nomicfoundation/ethereumjs-common@3.0.0-rc.2(transitive)
+ Added@nomicfoundation/ethereumjs-rlp@4.0.0-rc.2(transitive)
+ Added@nomicfoundation/ethereumjs-trie@5.0.0-rc.2(transitive)
+ Added@nomicfoundation/ethereumjs-util@8.0.0-rc.2(transitive)
+ Added@types/node@22.9.0(transitive)
+ Added@types/pbkdf2@3.1.2(transitive)
+ Added@types/secp256k1@4.0.6(transitive)
+ Addedbase-x@3.0.10(transitive)
+ Addedblakejs@1.2.1(transitive)
+ Addedbn.js@4.12.1(transitive)
+ Addedbrorand@1.1.0(transitive)
+ Addedbrowserify-aes@1.2.0(transitive)
+ Addedbs58@4.0.1(transitive)
+ Addedbs58check@2.1.2(transitive)
+ Addedbuffer-xor@1.0.3(transitive)
+ Addedcipher-base@1.0.4(transitive)
+ Addedcreate-hash@1.2.0(transitive)
+ Addedcreate-hmac@1.1.7(transitive)
+ Addedelliptic@6.6.0(transitive)
+ Addedethereum-cryptography@0.1.3(transitive)
+ Addedevp_bytestokey@1.0.3(transitive)
+ Addedhash-base@3.1.0(transitive)
+ Addedhash.js@1.1.7(transitive)
+ Addedhmac-drbg@1.0.1(transitive)
+ Addedkeccak@3.0.4(transitive)
+ Addedmd5.js@1.3.5(transitive)
+ Addedminimalistic-assert@1.0.1(transitive)
+ Addedminimalistic-crypto-utils@1.0.1(transitive)
+ Addednode-addon-api@2.0.25.1.0(transitive)
+ Addednode-gyp-build@4.8.2(transitive)
+ Addedpbkdf2@3.1.2(transitive)
+ Addedrandombytes@2.1.0(transitive)
+ Addedripemd160@2.0.2(transitive)
+ Addedscrypt-js@3.0.1(transitive)
+ Addedsecp256k1@4.0.4(transitive)
+ Addedsetimmediate@1.0.5(transitive)
+ Addedsha.js@2.4.11(transitive)
+ Addedundici-types@6.19.8(transitive)
- Removed@noble/hashes@1.2.0(transitive)
- Removed@noble/secp256k1@1.7.1(transitive)
- Removed@nomicfoundation/ethereumjs-common@3.0.0-rc.1(transitive)
- Removed@nomicfoundation/ethereumjs-rlp@4.0.0-rc.1(transitive)
- Removed@nomicfoundation/ethereumjs-trie@5.0.0-rc.1(transitive)
- Removed@nomicfoundation/ethereumjs-util@8.0.0-rc.1(transitive)
- Removed@scure/base@1.1.9(transitive)
- Removed@scure/bip32@1.1.5(transitive)
- Removed@scure/bip39@1.1.1(transitive)
- Removedethereum-cryptography@1.2.0(transitive)
Updatedethereum-cryptography@0.1.3