This is a significant PR that supports sharded storage via precompiled contracts. The major changes from the PR are
Add 0x33301 precompiled contract to deploy a system contract at a specific address.
Add 0x33302 precompiled contract to offer raw put/get operations to the underlying storage.
Add 0x3330001 system contract deployed using DecentralizedKV contract. This one is temporary and we will upgrade it to minable contract soon.
Add interfaces to StateDB to handle basic sharded storage read/write/commit (thread unsafe)
Add interfaces to trie.Database to handle basic sharded storage read/write/commit (thread safe)
How to test it?
Run sstorage under cmd/sstorage like ./sstorage create --filename ~/ss0.dat --kv_size=4096 --len=262144. This will create a data file containing 262144 entries (1G per shard at the moment)
Run geth with an additional command like --sstorage.shard=4k,0 --sstorage.file=4k,/Users/qizhou/ss0.dat to tell that the node will be responsible for shard 0 and the location of the data file.
Use remix and use compiled DecentralizedKV at 0x3330001. Then you could test put/get for large storage via remix.
This is a significant PR that supports sharded storage via precompiled contracts. The major changes from the PR are
StateDB
to handle basic sharded storage read/write/commit (thread unsafe)trie.Database
to handle basic sharded storage read/write/commit (thread safe)How to test it?
./sstorage create --filename ~/ss0.dat --kv_size=4096 --len=262144
. This will create a data file containing 262144 entries (1G per shard at the moment)--sstorage.shard=4k,0 --sstorage.file=4k,/Users/qizhou/ss0.dat
to tell that the node will be responsible for shard 0 and the location of the data file.Suggested code review path: