erigon-pulse/turbo/trie
Jason Yellick b21569ccc5
Backfill eth getproof tests (#7092)
This PR adds missing tests for eth_getProof and does some mild
refactoring with switching from strings to more strict types. It's
likely best/most easily reviewed commit by commit.

Note, the tests include quite a number of helper types and functions for
doing the proof validation. This is largely because unlike Geth,
Erigon's approach to trie computations only requires serializing the
trie nodes, not deserializing them. Consequently, it wasn't obvious how
to leverage the existing trie code for doing deserialization and proof
checks. I checked on Discord, but, there were no suggestions. Of course,
any feedback is welcome and I'd be happy to remove this code if it can
be avoided.

Additionally, I've opted to change the interface type for `GetProof` to
use a `common.Hash` for the storage keys instead of a `string`. I
_think_ this should be fairly safe, as until very recently it was
unimplemented. That being said, since it's an interface, it has the
potential to break other consumers, anyone who was generating mocks
against it etc. There's additionally a `GetStorageAt` that follows the
same parameter. I'd be happy to submit a PR modifying this one as well
if desired.

Also, as a small note, there is test code for checking storage proofs,
but, storage proofs aren't currently supported by the implementation. My
hope is to add storage proofs and historic proofs in a followup PR.

---------

Co-authored-by: Jason Yellick <jason@enya.ai>
2023-03-14 00:04:52 +00:00
..
vtree updated go-verkle (#6126) 2022-11-26 19:36:10 +01:00
.gitignore move ./trie to ./turbo/trie (#1114) 2020-09-14 11:33:39 +01:00
account_node_test.go reference hash, address, and chain config from lib (#6536) 2023-01-13 18:12:18 +00:00
debug_test.go reference hash, address, and chain config from lib (#6536) 2023-01-13 18:12:18 +00:00
debug.go reference hash, address, and chain config from lib (#6536) 2023-01-13 18:12:18 +00:00
delete_subrtee_test.go reference hash, address, and chain config from lib (#6536) 2023-01-13 18:12:18 +00:00
encoding_test.go rename (#1978) 2021-05-20 19:25:53 +01:00
encoding.go rename (#1978) 2021-05-20 19:25:53 +01:00
errors.go reference hash, address, and chain config from lib (#6536) 2023-01-13 18:12:18 +00:00
flatdb_sub_trie_loader_test.go reference hash, address, and chain config from lib (#6536) 2023-01-13 18:12:18 +00:00
gen_struct_step.go Partial EIP1186 eth_getProof implementation (#6560) 2023-03-09 03:04:09 +00:00
hack.go reference hash, address, and chain config from lib (#6536) 2023-01-13 18:12:18 +00:00
hashbuilder.go Backfill eth getproof tests (#7092) 2023-03-14 00:04:52 +00:00
hasher_test.go reference hash, address, and chain config from lib (#6536) 2023-01-13 18:12:18 +00:00
hasher.go reference hash, address, and chain config from lib (#6536) 2023-01-13 18:12:18 +00:00
intermediate_hash_receiver.go move ./trie to ./turbo/trie (#1114) 2020-09-14 11:33:39 +01:00
intermediate_hashes_test.go rename (#1978) 2021-05-20 19:25:53 +01:00
node.go reference hash, address, and chain config from lib (#6536) 2023-01-13 18:12:18 +00:00
proof.go rename (#1978) 2021-05-20 19:25:53 +01:00
retain_list.go reference hash, address, and chain config from lib (#6536) 2023-01-13 18:12:18 +00:00
stark_stats.go reference hash, address, and chain config from lib (#6536) 2023-01-13 18:12:18 +00:00
stream_test.go reference hash, address, and chain config from lib (#6536) 2023-01-13 18:12:18 +00:00
stream.go reference hash, address, and chain config from lib (#6536) 2023-01-13 18:12:18 +00:00
structural_branch_test.go reference hash, address, and chain config from lib (#6536) 2023-01-13 18:12:18 +00:00
structural_test.go reference hash, address, and chain config from lib (#6536) 2023-01-13 18:12:18 +00:00
sub_trie_loader.go reference hash, address, and chain config from lib (#6536) 2023-01-13 18:12:18 +00:00
trie_from_witness.go up version of uint256 lib (#2082) 2021-06-04 17:25:28 +01:00
trie_root.go Partial EIP1186 eth_getProof implementation (#6560) 2023-03-09 03:04:09 +00:00
trie_test.go move math big constants to erigon-lib (#6719) 2023-01-27 11:39:34 +07:00
trie_transform.go Aggregator22.Unwind() (#5039) 2022-08-13 18:51:25 +07:00
trie_witness.go move ./trie to ./turbo/trie (#1114) 2020-09-14 11:33:39 +01:00
trie.go reference hash, address, and chain config from lib (#6536) 2023-01-13 18:12:18 +00:00
utils.go Fix lints and remove more unused code (#1621) 2021-03-29 10:58:45 +07:00
visual.go reference hash, address, and chain config from lib (#6536) 2023-01-13 18:12:18 +00:00
witness_builder_test.go reference hash, address, and chain config from lib (#6536) 2023-01-13 18:12:18 +00:00
witness_builder.go reference hash, address, and chain config from lib (#6536) 2023-01-13 18:12:18 +00:00
witness_marshalling.go reference hash, address, and chain config from lib (#6536) 2023-01-13 18:12:18 +00:00
witness_operators_test.go move ./trie to ./turbo/trie (#1114) 2020-09-14 11:33:39 +01:00
witness_operators.go reference hash, address, and chain config from lib (#6536) 2023-01-13 18:12:18 +00:00
witness_stats.go move ./trie to ./turbo/trie (#1114) 2020-09-14 11:33:39 +01:00
witness_test.go reference hash, address, and chain config from lib (#6536) 2023-01-13 18:12:18 +00:00
witness.go Fixed get-payload and Hanging ForkChoice (#3575) 2022-02-22 14:47:23 +01:00