Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@nomicfoundation/ethereumjs-statemanager

Package Overview
Dependencies
Maintainers
2
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nomicfoundation/ethereumjs-statemanager - npm Package Compare versions

Comparing version 1.0.0-rc.3 to 1.0.0

38

dist/cache.js

@@ -41,3 +41,3 @@ "use strict";

const it = this._cache.find(keyStr);
if ((0, ethereumjs_util_1.isTruthy)(it.node)) {
if (it.node !== null) {
const rlp = it.value.val;

@@ -56,3 +56,3 @@ const account = ethereumjs_util_1.Account.fromRlpSerializedAccount(rlp);

const it = this._cache.find(keyStr);
if ((0, ethereumjs_util_1.isTruthy)(it.node)) {
if (it.node !== null) {
return it.value.deleted;

@@ -90,24 +90,18 @@ }

while (next) {
if ((0, ethereumjs_util_1.isTruthy)(it.value) && (0, ethereumjs_util_1.isTruthy)(it.value.modified) && (0, ethereumjs_util_1.isFalsy)(it.value.deleted)) {
if (it.value?.modified === true) {
it.value.modified = false;
const accountRlp = it.value.val;
const keyBuf = Buffer.from(it.key, 'hex');
await this._putCb(keyBuf, accountRlp);
next = it.hasNext;
it.next();
if (it.value.deleted === false) {
const accountRlp = it.value.val;
await this._putCb(keyBuf, accountRlp);
}
else {
it.value.deleted = true;
it.value.virtual = true;
it.value.val = new ethereumjs_util_1.Account().serialize();
await this._deleteCb(keyBuf);
}
}
else if ((0, ethereumjs_util_1.isTruthy)(it.value) && (0, ethereumjs_util_1.isTruthy)(it.value.modified) && (0, ethereumjs_util_1.isTruthy)(it.value.deleted)) {
it.value.modified = false;
it.value.deleted = true;
it.value.virtual = true;
it.value.val = new ethereumjs_util_1.Account().serialize();
const keyBuf = Buffer.from(it.key, 'hex');
await this._deleteCb(keyBuf);
next = it.hasNext;
it.next();
}
else {
next = it.hasNext;
it.next();
}
next = it.hasNext;
it.next();
}

@@ -160,3 +154,3 @@ }

const val = value.serialize();
if ((0, ethereumjs_util_1.isTruthy)(it.node)) {
if (it.node !== null) {
this._cache = it.update({ val, modified, deleted, virtual });

@@ -163,0 +157,0 @@ }

@@ -127,3 +127,3 @@ "use strict";

let storageTrie = this._storageTries[addressHex];
if ((0, ethereumjs_util_1.isFalsy)(storageTrie)) {
if (storageTrie === undefined || storageTrie === null) {
// lookup from state

@@ -190,3 +190,3 @@ storageTrie = await this._lookupStorageTrie(address);

await this._modifyContractStorage(address, async (storageTrie, done) => {
if ((0, ethereumjs_util_1.isTruthy)(value) && value.length) {
if (Buffer.isBuffer(value) && value.length) {
// format input

@@ -401,3 +401,3 @@ const encodedValue = Buffer.from(ethereumjs_rlp_1.RLP.encode(Uint8Array.from(value)));

async hasStateRoot(root) {
return await this._trie.checkRoot(root);
return this._trie.checkRoot(root);
}

@@ -411,3 +411,5 @@ /**

const account = this._cache.lookup(address);
if (account && (0, ethereumjs_util_1.isFalsy)(account.virtual) && !this._cache.keyIsDeleted(address)) {
if (account &&
(account.virtual === undefined || account.virtual === false) &&
!this._cache.keyIsDeleted(address)) {
return true;

@@ -414,0 +416,0 @@ }

{
"name": "@nomicfoundation/ethereumjs-statemanager",
"version": "1.0.0-rc.3",
"version": "1.0.0",
"description": "An Ethereum statemanager implementation",

@@ -43,6 +43,6 @@ "keywords": [

"dependencies": {
"@nomicfoundation/ethereumjs-common": "3.0.0-rc.3",
"@nomicfoundation/ethereumjs-rlp": "4.0.0-rc.3",
"@nomicfoundation/ethereumjs-trie": "5.0.0-rc.3",
"@nomicfoundation/ethereumjs-util": "8.0.0-rc.3",
"@nomicfoundation/ethereumjs-common": "^3.0.0",
"@nomicfoundation/ethereumjs-rlp": "^4.0.0",
"@nomicfoundation/ethereumjs-trie": "^5.0.0",
"@nomicfoundation/ethereumjs-util": "^8.0.0",
"debug": "^4.3.3",

@@ -49,0 +49,0 @@ "ethereum-cryptography": "0.1.3",

@@ -1,2 +0,2 @@

import { Account, isFalsy, isTruthy } from '@nomicfoundation/ethereumjs-util'
import { Account } from '@nomicfoundation/ethereumjs-util'

@@ -63,3 +63,3 @@ import type { Address } from '@nomicfoundation/ethereumjs-util'

const it = this._cache.find(keyStr)
if (isTruthy(it.node)) {
if (it.node !== null) {
const rlp = it.value.val

@@ -79,3 +79,3 @@ const account = Account.fromRlpSerializedAccount(rlp)

const it = this._cache.find(keyStr)
if (isTruthy(it.node)) {
if (it.node !== null) {
return it.value.deleted

@@ -116,22 +116,18 @@ }

while (next) {
if (isTruthy(it.value) && isTruthy(it.value.modified) && isFalsy(it.value.deleted)) {
if (it.value?.modified === true) {
it.value.modified = false
const accountRlp = it.value.val
const keyBuf = Buffer.from(it.key, 'hex')
await this._putCb(keyBuf, accountRlp)
next = it.hasNext
it.next()
} else if (isTruthy(it.value) && isTruthy(it.value.modified) && isTruthy(it.value.deleted)) {
it.value.modified = false
it.value.deleted = true
it.value.virtual = true
it.value.val = new Account().serialize()
const keyBuf = Buffer.from(it.key, 'hex')
await this._deleteCb(keyBuf)
next = it.hasNext
it.next()
} else {
next = it.hasNext
it.next()
if (it.value.deleted === false) {
const accountRlp = it.value.val
await this._putCb(keyBuf, accountRlp)
} else {
it.value.deleted = true
it.value.virtual = true
it.value.val = new Account().serialize()
await this._deleteCb(keyBuf)
}
}
next = it.hasNext
it.next()
}

@@ -196,3 +192,3 @@ }

const val = value.serialize()
if (isTruthy(it.node)) {
if (it.node !== null) {
this._cache = it.update({ val, modified, deleted, virtual })

@@ -199,0 +195,0 @@ } else {

@@ -9,4 +9,2 @@ import { RLP } from '@nomicfoundation/ethereumjs-rlp'

bufferToHex,
isFalsy,
isTruthy,
setLengthLeft,

@@ -193,3 +191,3 @@ short,

let storageTrie = this._storageTries[addressHex]
if (isFalsy(storageTrie)) {
if (storageTrie === undefined || storageTrie === null) {
// lookup from state

@@ -269,3 +267,3 @@ storageTrie = await this._lookupStorageTrie(address)

await this._modifyContractStorage(address, async (storageTrie, done) => {
if (isTruthy(value) && value.length) {
if (Buffer.isBuffer(value) && value.length) {
// format input

@@ -508,3 +506,3 @@ const encodedValue = Buffer.from(RLP.encode(Uint8Array.from(value)))

async hasStateRoot(root: Buffer): Promise<boolean> {
return await this._trie.checkRoot(root)
return this._trie.checkRoot(root)
}

@@ -519,3 +517,7 @@

const account = this._cache.lookup(address)
if (account && isFalsy((account as any).virtual) && !this._cache.keyIsDeleted(address)) {
if (
account &&
((account as any).virtual === undefined || (account as any).virtual === false) &&
!this._cache.keyIsDeleted(address)
) {
return true

@@ -522,0 +524,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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc