Uh oh!
There was an error while loading. Please reload this page.
Block store - #42
Conversation
611ba4d to
40d3c2fCompare99a1705 to
2ad7280Compare2ad7280 to
d93c7baCompare622366d to
2f19fd6Compare| func TestBootstrapping(t *testing.T) { | ||
| log.SetLogLevel("dht", "INFO") | ||
| _ = log.SetLogLevel("dht", "INFO") | ||
| //log.SetDebugLogging() |
There was a problem hiding this comment.
I am not sure if we need to keep that logging/debugging code in master actually. I usually remove that code before merging and put it back for local usage only without committing
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| } | ||
| func (bs *DefaultBlockStore) SaveBlock(block *types.Block) error { | ||
| // TODO(tzdybal): proper serialization & hashing |
There was a problem hiding this comment.
Why not make it proper already?
If we building things from scratch here, sticking with easy and performant solutions like sha256-simd from the beginning makes sense.
There was a problem hiding this comment.
Goal of this PR is to introduce block store that works. Using sha256-simd actually makes sense as it's drop-in replacement. By this comment I mostly mean that the serialization and hashing code will definitely be modified in the future.
That is not specified yet. It will be different from lazyledger-core for sure. If you want to write an ADR for that, that would be more than welcome. But remember that after an aggregator proposes a block, its data will also be available on LL and can be downloaded by anyone once this feature lands: https://github.com/lazyledger/lazyledger-core/issues/221 (cc @Wondertan). |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| // TODO(tzdybal): any better way to convert slice to array? | ||
| var h [32]byte | ||
| copy(h[:], hash) |
There was a problem hiding this comment.
I think that is the most common way. You could add a helper method (or methods) if you have to convert back and forth.
Uh oh!
There was an error while loading. Please reload this page.
| return &block, nil | ||
| } | ||
| // TODO(tzdybal): replace with proper hashing mechanism |
There was a problem hiding this comment.
It would be good to decide on all cryptographic primitives in ADR I think.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| getRandomBlock(4, 100), | ||
| getRandomBlock(5, 10), | ||
| getRandomBlock(1, 10), | ||
| }}, |
This PR introduces Block store.
Depends on: #40, #41.