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

trie: export "Path" interface #3292

Merged
merged 2 commits into from
Feb 26, 2024
Merged

trie: export "Path" interface #3292

merged 2 commits into from
Feb 26, 2024

Conversation

ScottyPoi
Copy link
Contributor

Users of the @ethereumjs/trie library will see this error when using trie.findPath in their tooling, specifically when writing a function which returns the result of trie.findPath:

Return type of public method from exported class has or is using private name 'Path'.ts(4055)

This happens because the Path interface was not previously exported. Users were unable to import it directly from the Trie library to declare a return type for their functions. The Typescript compiler would also be unable to properly infer the return type for the user function, because the expected return type Path could not actually be found from the outside.

Fix:
interface Path {...} > export interface Path {...}

Copy link

codecov bot commented Feb 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.90%. Comparing base (e1221c9) to head (5e9afe4).

Additional details and impacted files

Impacted file tree graph

Flag Coverage Δ
block 88.34% <ø> (ø)
blockchain 91.61% <ø> (ø)
client 84.67% <ø> (ø)
common 98.25% <ø> (ø)
devp2p 82.12% <ø> (ø)
ethash ∅ <ø> (∅)
evm 74.33% <ø> (ø)
genesis 99.98% <ø> (ø)
statemanager 77.02% <ø> (ø)
trie 89.27% <100.00%> (+0.01%) ⬆️
tx 95.45% <ø> (ø)
util 89.13% <ø> (ø)
vm 80.20% <ø> (ø)
wallet 88.35% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Copy link
Member

@holgerd77 holgerd77 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR and the great explanation along! 🙂

I think we should then move the interface over to the types.ts file (have directly done) for consistency, otherwise looks good!

Will merge.

@holgerd77 holgerd77 merged commit 0e186fd into master Feb 26, 2024
46 checks passed
@holgerd77 holgerd77 deleted the export-path-type branch February 26, 2024 10:09
jochem-brouwer pushed a commit that referenced this pull request Mar 1, 2024
* trie: export "Path" interface

* Move over Path interface export to types for consistency

---------

Co-authored-by: Holger Drewes <Holger.Drewes@gmail.com>
jochem-brouwer added a commit that referenced this pull request Mar 1, 2024
* client: PreimageManager and Preimage storage in MetaDB

* common: add getAppliedKey method to StateManagerInterface

* evm: add preimage reporting

* statemanager: add getAppliedKey methods to the statemanager implementations

* vm: improve some types

* vm: implement preimage reporting

* client: add preimage saving

* evm: update to unprefixedHexToBytes

* vm: add reportPreimages test to runTx tests

* vm: pass down reportPreimages arg from block to tx

* client: pass down reportPreimages from client to vm through runBlock

* client: unify config options naming

* client: preimageManager test

* client: test preimage, wip

* common: add todo to gasPrices from 6800

* statemanager: fix type issues

* dev accessWitness class on the lines of geth impl

* integrate accesswitness in evm/vm/runtx flow

* plugin the gas schedule for tx origin and destination accesses

* complete, debug and fix the call and create access charges

* plug the access gas usage on the evm opcode runs

* debug and fix the code chunk accesses and the poststate setting

* implement access merging and accessed state tracking and traversing

* also provide chunkKey for easy reference

* decode raw accesses to structured ones and debug log them

* debug and add the missing accesses for coinbase, withdrawals

* stateManager: implement cache handling in the context of statelessness

* modify poststate to use accesses from the accesswitness to compare and fix mising chunkKey in returned accesses

* stateManager: getComputedValue

* fixes for the getcomputedval fn helper for the code

* correctly implement the getcontractcode with partial accessed segments available  and corresponding error handling in evm run

* statemanager: tentative fixes & improvements to code cache handling

* statemanager: checkpoint code cache

* fix the code chunk comparision in post state verification

* rename kaustinen2 local testnet data for

* fix pre and post state null chunks handling and corresponding get computed fixes

* setup the client to statelessly execute the verkle blocks randomly from anywhere the chain

* setup to statelessly run block13 of kaustinen2 in client test spec for easy debugging

* setup the client kaustinen2 stateless test to test and debug block 16

* improve the post state witness mismatch logging to be more comprehensible for debugging

* improve chunk verification tracking logging and fix post/prestate key coding from the witnesses

* debug and fix code accesses and overhaul/fix accesscharges on create/call

* add a more complete matching of generated and provided executed witnesses

* fix return

* debug, discuss and remove proof of absence charges for contract create for fixing the extra witnesses

* only charge code accesses if accessed from state and when code is written on contract creation

* handle bigint treeIndex for the bigint slot and debug/match the predersenhash with kauntinen2 usage

* client: fix kaustinen tests and migrate to new testing framework

* shift kaustinen 2 test to block 13

* client: remove stale kaustinen2 test data

* vm: adjust rewardAccount new common arg ordering and make it optional

* add block12 to the spec list

* move invalid opcode check outside jump analysis

* small cleanup in runtx

* add preimages spec

* build various block scenarios for preimages gen

* client: revert vmexecution preimages test

* client: remove unnecessary boolean explicit comparison

* client: remove unused import

* client: revert re-ordering

* stateManager: support non keccak256 applied keys

* debug and persist preimages on runWithoutSetHead as well

* add preimages for coinbase,withdrawals to the test and fix the spec to validate them

* client: fix preimage tests ts errors

* client: minor adjustments to preimage test

* client: save preimages helper

* vm: save preimages at the block level, new applyBlockResult type

* common: make getAppliedKey optional

* evm/vm: handle optional getAppliedKey

* client: add preimage doc

* trie: export "Path" interface (#3292)

* trie: export "Path" interface

* Move over Path interface export to types for consistency

---------

Co-authored-by: Holger Drewes <Holger.Drewes@gmail.com>

* Snap sync: use zero-element proof for checking validity of final, empty range result (#3047)

* Use no-elements proof for final check in account fetcher

* Use no-elements proof for final check in storage fetcher

* Check inputs after zero element proof code section

* Cleanup

* Reject peer if zero-element proof fails

* Add tests for zero-element proof

* Remove proofTrie usage

* Use hashing function in static version of verifyRangeProof

* Include useKeyHashing in call to fromProof so that hashing function is used in proof verification

* Use appliedKey for hashing function instead of the function directly passed in TrieOpts

* Pass in hashing function for use in static proof verification calls

* Fix static range proof verification errors

* Use custom hashing function from opts if available

* Add test to check if zero element range proof verification fails with remaining elements to the right

* Check if parameters are as expected for zero-element proof

* Fix linting issues

---------

Co-authored-by: Scotty <66335769+ScottyPoi@users.noreply.github.com>
Co-authored-by: Holger Drewes <Holger.Drewes@gmail.com>
Co-authored-by: Indigo Alpha <indigoalpha@indigos-mbp.mynetworksettings.com>

* Integrate `kzg-wasm` into monorepo (#3294)

* Update to official trusted setup

* Remove devnet6

* Add kzg-wasm

* Update block tests to use kzg-wasm

* Update tests

* Add more 4844 tests to browser run

* Initial integration of kzg-wasm on git

* Update kzg-wasm build

* Fix linter weirdness

* Move initKzg to `runTests`

* Fix tests

* More cleanup

* Goodbye c-kzg

* fix kzg references

* Replace c-kzg with kzg-wasm in package.json

* Update kzg wasm commit and vm tester config

* Update initKzg to createKZG

* fix copy pasta

* Fix more copy pasta

* update kzg-wasm to npm release

* One last bit of copy pasta

* Address feedback

* client: remove try/catch blocks createKZG() and remove the initKZG stale comment

---------

Co-authored-by: Jochem Brouwer <jochembrouwer96@gmail.com>

* Make trustedSetupPath in Util kzg module optional (#3296)

* client: add tx preimages to preimage test cases

---------

Co-authored-by: acolytec3 <17355484+acolytec3@users.noreply.github.com>
Co-authored-by: harkamal <gajinder@g11.in>
Co-authored-by: Jochem Brouwer <jochembrouwer96@gmail.com>
Co-authored-by: Scotty <66335769+ScottyPoi@users.noreply.github.com>
Co-authored-by: Holger Drewes <Holger.Drewes@gmail.com>
Co-authored-by: Scorbajio <indigophi@protonmail.com>
Co-authored-by: Indigo Alpha <indigoalpha@indigos-mbp.mynetworksettings.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants