Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

statemanager: cache and other refactors #3569

Merged
merged 27 commits into from
Aug 12, 2024
Merged
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
fa3c2ec
Revert "statemanager: refactor logic into capabilities (#3554)"
gabrocheleau Aug 7, 2024
bd1f237
statemanager: refactor modifyAccountFields
gabrocheleau Aug 7, 2024
d5aaf30
statemanager: adjust return statements
gabrocheleau Aug 7, 2024
533fa8c
statemanager: refactor separate caches into caches class
gabrocheleau Aug 9, 2024
31c94af
chore: merge with master
gabrocheleau Aug 9, 2024
bba928b
statemanager: fix shallow copy logic
gabrocheleau Aug 9, 2024
a04158d
client: fix vmexecution statemanager cache opts
gabrocheleau Aug 9, 2024
2431594
statemanager: refactor some capabilities to caches methods
gabrocheleau Aug 9, 2024
814b9f7
statemanager: fix tests
gabrocheleau Aug 9, 2024
2439219
statemanager: refactor caches into optional opt passed in directly to…
gabrocheleau Aug 9, 2024
4c6240f
statemanager: adjust tests with refactored caches
gabrocheleau Aug 9, 2024
5e1666d
client: adjust vm execution with update cache
gabrocheleau Aug 9, 2024
c754eac
vm: fix vm tests
gabrocheleau Aug 9, 2024
5d4895c
vm: adjust test runners with non-default caches
gabrocheleau Aug 9, 2024
888b20e
statemanager: simplify handling of deactivate
gabrocheleau Aug 9, 2024
905a52e
statemanager: remove redundant checks
gabrocheleau Aug 9, 2024
f30288a
statemanager: remove non null asesertion
gabrocheleau Aug 9, 2024
ba00837
statemanager: remove cache opt from key naming
gabrocheleau Aug 10, 2024
c037ae2
statemanager: refactor rpc state manager to use caches
gabrocheleau Aug 11, 2024
fdcdb36
statemanager: fix rpc state manager tests
gabrocheleau Aug 11, 2024
3d93587
client: vmexecution cache stats refactor
gabrocheleau Aug 11, 2024
48baee3
Merge remote-tracking branch 'origin/master' into statemanager/capabi…
acolytec3 Aug 12, 2024
f0b66bf
Merge branch 'master' into statemanager/capabilities-refactor
acolytec3 Aug 12, 2024
5f4c253
statemanageR: updategetproof json-rpc call format
gabrocheleau Aug 12, 2024
7fe21fd
statemanager: remove deactivate from caches
gabrocheleau Aug 12, 2024
4864383
client: remove deactivate from vm execution instantiation
gabrocheleau Aug 12, 2024
b6ee97b
Merge branch 'statemanager/capabilities-refactor' of https://github.c…
gabrocheleau Aug 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
statemanager: fix rpc state manager tests
gabrocheleau committed Aug 11, 2024
commit fdcdb36523ef31746e6bd8ae5cc3a09d5b52250d
24 changes: 8 additions & 16 deletions packages/statemanager/test/rpcStateManager.spec.ts
Original file line number Diff line number Diff line change
@@ -47,18 +47,10 @@ describe('RPC State Manager initialization tests', async () => {
it('should work', () => {
let state = new RPCStateManager({ provider, blockTag: 1n })
assert.ok(state instanceof RPCStateManager, 'was able to instantiate state manager')
assert.equal(
(state as any)._blockTag,
'0x1',
'State manager starts with default block tag of 1',
)
assert.equal(state['_blockTag'], '0x1', 'State manager starts with default block tag of 1')

state = new RPCStateManager({ provider, blockTag: 1n })
assert.equal(
(state as any)._blockTag,
'0x1',
'State Manager instantiated with predefined blocktag',
)
assert.equal(state['_blockTag'], '0x1', 'State Manager instantiated with predefined blocktag')

state = new RPCStateManager({ provider: 'https://google.com', blockTag: 1n })
assert.ok(
@@ -87,7 +79,7 @@ describe('RPC State Manager API tests', () => {
await state.putAccount(vitalikDotEth, account!)

const retrievedVitalikAccount = createAccountFromRLP(
(state as any)._accountCache.get(vitalikDotEth)!.accountRLP,
state['_caches'].account?.get(vitalikDotEth)?.accountRLP!,
)

assert.ok(retrievedVitalikAccount.nonce > 0n, 'Vitalik.eth is stored in cache')
@@ -106,7 +98,7 @@ describe('RPC State Manager API tests', () => {

await state.putCode(UNIerc20ContractAddress, UNIContractCode)
assert.ok(
typeof (state as any)._contractCache.get(UNIerc20ContractAddress.toString()) !== 'undefined',
state['_caches'].code?.get(UNIerc20ContractAddress) !== undefined,
'UNI ERC20 contract code was found in cache',
)

@@ -219,16 +211,16 @@ describe('RPC State Manager API tests', () => {
}

assert.equal(
(state as any)._contractCache.get(UNIerc20ContractAddress),
state['_caches'].account?.get(UNIerc20ContractAddress),
undefined,
'should not have any code for contract after cache is reverted',
)

assert.equal((state as any)._blockTag, '0x1', 'blockTag defaults to 1')
assert.equal(state['_blockTag'], '0x1', 'blockTag defaults to 1')
state.setBlockTag(5n)
assert.equal((state as any)._blockTag, '0x5', 'blockTag set to 0x5')
assert.equal(state['_blockTag'], '0x5', 'blockTag set to 0x5')
state.setBlockTag('earliest')
assert.equal((state as any)._blockTag, 'earliest', 'blockTag set to earliest')
assert.equal(state['_blockTag'], 'earliest', 'blockTag set to earliest')

await state.checkpoint()
})