NDRS-74: integrate the existing consensus code with the Consensus component#18
NDRS-74: integrate the existing consensus code with the Consensus component#18Fraser999 merged 9 commits intocasper-network:masterfrom
Conversation
afck
left a comment
There was a problem hiding this comment.
No blockers from my side, but I was unsure which parts to review. I assume pothole and highway_core don't have any nontrivial changes?
How about consensus_service and consensus_protocol/synchronizer?
| #[derive(Debug, Clone, Serialize, Deserialize)] | ||
| pub(crate) struct ConsensusMessage { | ||
| era_id: EraId, | ||
| payload: Vec<u8>, |
There was a problem hiding this comment.
I'm always unsure about this:
Would it be better to make this generic in the protocol's message type, to avoid "serializing twice"?
Especially if we treat the protocol message as more than a binary blob anyway, e.g. to find out whether it contains any deploy hashes.
There was a problem hiding this comment.
I did it this way currently to fit the MessageWireFormat in consensus_service, but I agree in general. That could be a part of a next task.
| /// in consensus-agnostic layers. | ||
| type Message; | ||
|
|
||
| type ConsensusValue: Hash + PartialEq + Eq; |
There was a problem hiding this comment.
Will that be required, though? I think the trait bounds should be as relaxed as possible. We can always add this when the need arises, though.
| } | ||
|
|
||
| /// An API for a single instance of the consensus. | ||
| pub(crate) trait ConsensusProtocol<Ctx: ConsensusContext> { |
There was a problem hiding this comment.
Would it be easier to merge ConsensusContext and ConsensusProtocol?
There was a problem hiding this comment.
That might indeed be a good idea. What do you think @goral09 ? (Asking because you originally designed it this way, maybe you had a good reason.)
There was a problem hiding this comment.
What do you mean by merge? Every instance of the ConsensusProtocol could in theory have different ConsensusContext.
There was a problem hiding this comment.
They could have different ConsensusValues, which we could make a type parameter instead of an associated type. But they would have the same Message type, wouldn't they (maybe also generic in the consensus value)?
There was a problem hiding this comment.
If we run different consensus protocols then probably not?
| fn values(&self) -> Vec<C>; | ||
| } | ||
|
|
||
| pub(crate) trait ProtocolState<VertexId, Vertex> { |
There was a problem hiding this comment.
I imagine that any implementation of ProtocolState will use a fixed vertex type (generic in C). Should VertexId and Vertex: Vertex<C, Self::VertexId> be associated types instead, and only C a parameter?
There was a problem hiding this comment.
I'll defer to @goral09 again ;) Looks like a reasonable idea to me, though.
There was a problem hiding this comment.
This encoding of the ProtocolState can be turned into what you propose on the definition side but not the other way around.
There was a problem hiding this comment.
Also, if ProtocolState has to integrate with the synchronizer it is easier to have these types as type parameters rather than associated types.
There was a problem hiding this comment.
This encoding of the
ProtocolStatecan be turned into what you propose on the definition side but not the other way around.
Sure, but is it plausible that we'd ever need or be able to use this level of generality? Anything that implements a concrete protocol state will also implement a concrete vertex type; it'll never implement ProtocolState<VId1, V1> and ProtocolSTate<VId2, V2>, will it?
I don't understand why it makes integration with the synchonizer easier either.
Anyway, I'm happy to keep these as they are for now; if we want to try changing them, we can do that in a separate PR.
There was a problem hiding this comment.
The ProtocolState abstraction doesn't have to know about the Context type bound so it shouldn't be there IMO.
Anything that implements a concrete protocol state will also implement a concrete vertex type; it'll never implement
ProtocolState<VId1, V1>andProtocolSTate<VId2, V2>, will it?
Sure, but that's true only on per-era basis.
I don't understand why it makes integration with the synchonizer easier either.
Synchronizer is also parameterized by the vertex type as a type parameter (not associated type) so it should be easier for the compiler to infer correct types. For associated types we would have to do it explicitly, right?
There was a problem hiding this comment.
For the synchronizer it makes sense to me: That should be able to deal with any kind of vertex.
I guess I would just have made it generic in the (consensus value and the) protocol state, not just the context:
struct Synchronizer<C, PS: ProtocolState<C>> {
some_maps: HashMap<PS::VertexId, PS::Vertex>,
}Anyway, I'm not sure that's much better either. We don't have to decide that in this PR.
There was a problem hiding this comment.
I don't understand you now, lets postpone it for later.
| #[derive(Clone, Debug)] | ||
| struct EraConfig { | ||
| era_length: Duration, | ||
| //TODO: Are these necessary for every consensus protocol? |
There was a problem hiding this comment.
booking_duration is: We do need to know the validator set in advance so they can connect to each other.
Regarding entropy_duration, it's complicated:
https://casperlabs.atlassian.net/wiki/spaces/EN/pages/521470045/How+to+produce+the+random+bits
|
Adding |
| InvalidIncomingMessage(Ctx::Message, anyhow::Error), | ||
| ScheduleTimer(Instant, TimerId), | ||
| CreateNewBlock, | ||
| FinalizedBlock(Ctx::ConsensusValue), |
There was a problem hiding this comment.
Why single consensus value? It's always a vector. I would even go as far as say that FInalizedBLock should contain the block hash.
There was a problem hiding this comment.
I'm more and more convinced that it shouldn't be a vector: It will not only contain a list of deploy hashes, but also a list of slashing instructions, a random bit and maybe more information in the future.
There was a problem hiding this comment.
It would be strange to have consensus value be a single deploy hash in one place (highway-core) and a whole set of deploy hashes in another (here). We should be consistent.
There was a problem hiding this comment.
I agree: I'd make it a whole set (plus instructions plus random bit) in highway-core then, too, and remove the Vecs again.
Fraser999
left a comment
There was a problem hiding this comment.
No real blockers as such.
I realise my comments are likely highlighting things already in the CasperLabs codebase, and I don't want to hold up this huge PR, so I'm happy to approve as long as the comments can be addressed in an upcoming PR.
| @@ -0,0 +1,135 @@ | |||
| use std::collections::{HashMap, HashSet}; | |||
|
|
|||
| // TODO: temporary type, probably will get replaced with something with more structure | |||
There was a problem hiding this comment.
You probably already saw this, but in case not, there's a Deploy and BlockHash in crate::types. These types still need to be developed further, at least the Deploy for sure.
| //! protocol instance whenever the set of validators changes. | ||
|
|
||
| // This is to suppress warnings originating in the test macros | ||
| #![allow(unused_qualifications)] |
There was a problem hiding this comment.
Can't the scope of this be reduced - possibly to inside the body of the macros?
There was a problem hiding this comment.
I tried, that doesn't seem to work.
I think a macro itself isn't an item, so the attribute can't be applied to it. And attributes on expressions is an unstable feature?
But maybe we should just put #[allow(unused_qualifications)] on all mod tests where the macros are used?
There was a problem hiding this comment.
Well, minimising the scope would be good, but if it's a lot of effort, I'm fine with leaving as is. It's a style lint really, so not a big deal.
There was a problem hiding this comment.
No, you're right, and I think it'll be just three places; I'll do that in my follow-up PR as well. 👍
|
|
||
| /// A list of tallies by block height. The tally at each height contains only the votes that point | ||
| /// directly to a block at that height, not at a descendant. | ||
| #[derive(Deref, DerefMut)] |
There was a problem hiding this comment.
I don't have a problem personally with implementing Deref(Mut) for things like this, but we had a policy of disallowing this as per the docs:
Because of this,
Derefshould only be implemented for smart pointers to avoid confusion.
There was a problem hiding this comment.
My bad! (Everything in highway_core.)
I'll make a follow-up PR once this is merged, and try to address your comments.
|
I'd like to see this merged before sprint exit. |
|
I agree. From my side it's ready to be merged. |
2263: Fix feature set on casper-contract r=Fraser999 a=Fraser999 This PR fixes an accidental breaking change in the Rust features of the `casper-contract` crate, introduced in the 1.4.0 version. The previous 1.3.x behavior has been reinstated, whereby if the `std` feature is enabled, `casper-contract` does not provide the `wee-alloc` allocator, and instead explicitly imports the std library with its allocator. There is also a regression test added in the form of a test contract which enables the `std` feature of `casper-contract`. Furthermore these changes were tested against the [Payment Contract Example](https://github.com/casper-ecosystem/payment-example) and [Casper Keys Manager](https://github.com/casper-ecosystem/keys-manager) with their recent changes ([#3](https://github.com/casper-ecosystem/payment-example/pull/3/files) and [#18](https://github.com/casper-ecosystem/keys-manager/pull/18/files) respectively) reverted. Closes #2261. Co-authored-by: Fraser Hutchison <fraser@casperlabs.io>
Porting std feature revert.
Spicy fixes 2
…ints-2 Migrate entry points 2
* Initial commit * Update README.md * Fuel VM in Rust merging files from original repo refactor impl ethcall completed todos refactor program into interpreter mod carry create2 programs through callframes impl create2 impl codesize based on callframes impl fuel tx init and data handling refactor update init code width impl eth ops impl fuel ops define eth and fuel ops Adding init field to eth tx format define eth account and tx types impl rotate ops sign extend from u16 to u64 impl subi op Sign extend imm val for arithmetic op fix and style impl of srav and sra impl of sltiu and sltu remove unnecessary refs working tx handler define op for data ld and test for tx exec first step of tx execution impl impl addtl tx types minor refactor initial tx format moving from usize to u8 for size types defining serder of eth opcodes advancing notes updating notes cleaner style base impl for all opcodes implement malloc/free, local var, and stack opcodes working call and return architecture improving architecture and execution some code improvements improved stack handling thru mutable references intermediate commit with some types and methods and cleanup intermediate commit for stackframes initial stack impl using values in registers for computations Run programs in loop to completion Update notes Adding tests for u32 bit manipulation Change opcode instructions to 32 bits wide change immediate values to 16-bit wide minor edits tidy completing a few opcode implementations including beq bug fix for tuple return Starting to implement opcodes intermediate commit with opcode deser intermediate commit with opcode ser Update status Adding simple unit tests to memory after execution Working simple execution with memory dump Removing unused const updating notes updating notes refactor u64 funcs to file applying unit tests to serder initial working serder of ADD opcode in program AND serialization and refactoring minor cleanup Adding some indexed methods Initial bit manipulation for opcode ser Intermediate commit to opcode serder Starting trait impl for Opcodes Implement bit manipulation for u64 Enable basic architecture for tests intermediate commit with restructured types for vm components Working memory with hi register splitting out base types adding binary that matches Cargo.toml adding binary that matches Cargo.toml running instance, more cleanup pending next step towards initial commit next step towards initial commit Fuel VM in Rust * Adding new tx format based on FuelLabs/fuel-specs#6 * lifting utxo_id into parent struct * working base ftx test * working new tx format * Adding `stateWitnessIndex` to OutputContract * Working extended Fuel tx contract subtype * impl sha256 Set $of flag in div and mod by 0 Rename of uf flags Rename of uf flags j jr tests xor xori tests sub subi tests sll sllv srl srlv tests or ori tests mult multi test updates to match spec #0d39f49 impl kecakk op Add convenience functions * jump ops memory copy and compare ops impl state opcodes using hashmap refactor overflow into distinct register impl sha256 Set $of flag in div and mod by 0 Rename of uf flags Rename of uf flags j jr tests xor xori tests sub subi tests sll sllv srl srlv tests or ori tests mult multi test updates to match spec #0d39f49 impl kecakk op Add convenience functions * cleanup jnzi test jnz test jump ops memory copy and compare ops impl state opcodes using hashmap refactor overflow into distinct register impl sha256 Set $of flag in div and mod by 0 Rename of uf flags Rename of uf flags j jr tests xor xori tests sub subi tests sll sllv srl srlv tests or ori tests mult multi test updates to match spec #0d39f49 impl kecakk op Add convenience functions * slight adjustment to hashmap access * added very basic gas * ecrecover op * Cfe and Cfs callframe stack opcodes * Add test and format CI (#12) * Add test and format CI. * fmt * Remove test suite unneeded. * Update test CI (#13) * Add private keys for dependencies. * Use minimal toolchain profile. * Use nightly toolchain. * Update opcodes list (#9) * Update opcodes list The opcodes list was outdated and needed to be resync with the specs. https://github.com/FuelLabs/fuel-specs/blob/master/specs/vm/opcodes.md Also, the previous implementation didn't consider the different sizes of immediate values, treating everything as u16. The API still need to improve to prevent users from allocating invalid register values with overflow. Resolves #8 * Update interpreter to latest specs The interpreter is not fully sync with the specs. Also, the functionality scope can be split into different modules to facilitate maintenance of the routines. * Implement interpreter mem and crypto functions Some of the functions contains particularities such as the ecrecover that uses a special encoding regarding the recovery id. These are not native to the public libraries and must be manually handled. * Add test case for keccak256 This new test case is symmetric to the sha256 test case with the crypto primitive as difference. * Add Transaction structure The transaction will define the VM initialization as well as the underlying input/output/contract types. * Implement recoverable secp256k1 signature The EcRecover scheme may benefit from a compression that can save an additional byte of storage. This crypto primitive is implemented using rusk-secp256k1 as backend. * Add MemClearI operation * Rename 32-byte storage ops to "quad word" * Rename opcodes to fit in 4 chars * Add serialization for all tx types * Change VM init to copy tx to stack The initialization of the VM should copy the hash of the transaction, its size and the serialized bytes to the stack area so the execution of the program can access it when required. * Update IO according to specs The specs points that every number should be stored as u64 and the arrays of bytes should be padded to multiples of 8. * Change `crypto::hash` to encapsulate primitive The underlying default hash function of the crypto module should not impact the API and any change in the primitive should be transparent to the users of the interpreter. * Add Log opcode This opcode will perform a naive dump of the selected registers ignoring the zeroed indices. This is a primitive implementation to a more complex log/event/topic tracing system. * Add binary interpreter This binary executes transactions and output the log opcodes. * Add tracing to interpreter execution * Add debug to registers The mutated registers should be print if the log level is set to debug. * Update memcopy to non-overlapping THe `MCP` operation should fail if the memory segments are overlapping. This will allow the internals to benefit from `memcopy` instead of `memmove`. * Add `is_valid` function for all transaction types * Add Tx validation to VM initialization The VM initialization must validate the transaction before the registers and memory are prepared for execution. The TX validation is critical and most of the edge cases must have test coverage. * Optimize code and remove redundant checks * Add Call, CallFrame and MemoryRange The memory range tuples in the VM are expected to behave as start/size pairs. However, Rust uses start/end patterns. The `MemoryRange` type is an abstraction to interface with the values provided by the bytecode operations and Rust memory scheme. The `Call` and `CallFrame` structures will heavily depend on that because they have internal references to owned memory regions. * Add Call opcode implementation The call frames structure and the reflection of a call in the registers and memory is critical to the system and must be broadly tested. This commit introduces the update of the program counter. * Update dependencies to use fuel-* libs The transaction and opcode structs were split into their own libraries. This commit introduces the usage of these libraries as dependencies. * Update ECR to clear err In case of failure, ECRecover should set the recovered public-key to `0` and turn the `err` flag on. In case of success, `$rA` will be set with the recovered public-key and the error flag will be cleared. * Add predicate verification for tx create coin * Add predicate verification Predicate verification should initialize the VM in a special state and execute the opcodes under special constraints defined in the specs. * Remove Travis config. (#14) * Add helper methods for VM executors (#17) * Change LW and SW to multiple of a Word immediate (#16) To maintain consistency with the high-level language, the LW and SW immediate values will be used as word-multiple values instead of raw memory addresses. * Mint and burn (#18) * Add CALL and CCP implementation Both call and ccp relies on contract deployment over the blockchain. These should be included with a refactor over the call frames structure to correctly point to a contract code after a call frame is pushed to the stack. * Fix memory boundaries ownership check The memory ranges are exclusive in the upper bound. This way, the ownership check must reflect that standard for range checks. * Add Mint and Burn opcode execution * Update SW and LW to take imm as words * Update LW and SW to mul word imm with explicit op * Add function to encapsulate external const check * Rename crate to `fuel-core` (#19) `fuel-vm-rust` don't reflect the repo name and this may be confusing under certain contexts. Also, there is no particular reason on why these two names should diverge. * Add data backend traits The VM must be agnostic to the data backend, and this should comply only with a non-restrictive trait. This commit introduces the `Storage` trait. Some of the interpreter functionality will specify implementation requirements for a given Key/Value concrete pair. * Use wrapper type for key structs * Rename to fuel-vm Co-authored-by: John Adler <adlerjohn@users.noreply.github.com> Co-authored-by: Shahan Khatchadourian <shahan.k.code@gmail.com>
The mint operation is returning `NotEnoughBalance` if there is an arithmetic overflow operation while trying to add the balance. Resolves #12
Creating a new feature will cause an unnecessary breaking change The new std/no-std scheme can trivially be used with a different feature set that will be an extension of the previous one
Hasher is a cryptographic secure hasher and is allowed to produce signature inputs. Signatures are secure only if the input is pre-image checked and non-malleable; this is a hard requirement for any signature protocol.
* Initial commit * Add test and format CI. (#2) * Feature: Initial Binary Merkle Tree Implementation (#1) * Initial Merkle Tree Implementation * Delete verify.rs * Remove unimplemented asmut * Unpin dependencies * Remove mod verify * Add default implementation * Remove IDE specifics from gitfile * Pin minimum versions in dependencies * Fix format with fmt * Feature: Binary Merkle proof set and Verify (#3) * Initial Merkle Tree Implementation * Delete verify.rs * Remove IDE specifics from gitfile * Proof set * Remove unused line * fmt * Implement proof and tests * Refactor * Simplify loop * Update merkle_tree.rs * Convert next_height and next_data to return options * Refactor proof set * Clippy * Verify * Format fix * Update merkle_tree.rs * Update verify.rs * Semver for Bytes * Clean up tests * Format * Tests * Refactor tests * Update toolchain to stable in cargo_test.yml (#9) * Remove license. (#13) * Chore: Refactor binary hash functions into separate file (#11) * Refactor hash functions into separate file for BMT * Update merkle_tree.rs * Refactor NODE and LEAF as u8 * Remove generics * Remove commented line * Update mod.rs * Remove deprecated files * Lazy static empty sum * Update Cargo.toml * Update Cargo.toml * Update hash.rs * Return ref to empty sum * Feat: Position struct and tests (#18) * Position struct and tests * Comment * Update table comment * Document * Update position.rs * Update comments * Update comment again * Fix tests * Update position.rs * `Storage` trait and concrete `StorageMap` struct (#20) * `Storage` trait and concrete `StorageMap` struct * Remodel trait after fuel-vm store trait * Revert names to storage and storage_map * Change Storage's Key to require `Clone` instead of `Copy` * Feat: use `fuel-data` `storage` trait for `storage_map` (#27) * Use fuel-data storage trait * Update storagemap impl * Update storage_map against updated storage trait * Update cargo_test.yml * Fetch with cli in CI * Chore: Switch `fuel-data` to `fuel-storage` (#33) * Refactor: move `binary` directory with BMT implementation to `test-helpers` (#30) * Refactor `binary` to `tests` * Cleanup Test imports * Convert to internal crate `fuel-merkle-test-helpers` * Format * Add helper tests to CI * Update cargo_test.yml * Fix Run helper tests args * Clean up test-helpers dependencies * Update test_data.rs * Feat: Binary Merkle Tree with Storage Backing (#23) * Replace ProofSet wrapper with Vec (#34) * Feat: Path iterator, MSB, and node traits (#39) * Path iterator * Create node.rs * Add node to common * Refactor SZ to SIZE * Minor adjustment to comments * Remove unnecessary Debug req for AsPathIterator * Feedback * Msb get_bit_at_index_from_msb returns option * Feat: SMT `node` struct (#40) * Sparse node and hash * Add hex to cargo.toml * Derive `StorageError clone` * Run cargo sort on workspace (#43) * Create LICENSE (#47) * Feat: `Position` methods for `left_child` and `right_child` (#48) * Position methods for left and right child * Update position.rs * Use constants for left and right child directions * Update comment * Bump bytes from ~1.0 to ~1.1 (#49) * Bump bytes from ~1.0 to ~1.1 * Update Cargo.toml Co-authored-by: John Adler <adlerjohn@users.noreply.github.com> Co-authored-by: John Adler <adlerjohn@users.noreply.github.com> * Update manifest (#50) * Update author. * Add more fields. * Update author. * Crates.io publishing (#52) * crates.io workflow * Fix overly restrictive semver requirements (#53) make bytes dep compatible with async-graphql * Remove cargo git fetch from CI (#54) * Feat: Binary Merkle Sum Tree root calculation (#44) * Binary Merkle Sum * Clean up * Format * Update verify.rs * Replace Hash struct and impl with template functions * Update hash.rs * refactor * Refactor join_data_pair to accept fee before data * Format * Remove generics from Merkle sum tree * Refactor join_data_pair and split_data_pair * White space * assert sizes in join and split data pair * BMST lazy static empty sum * Update lib.rs * Update to use storage backing * Path iterator for sum node (WIP) * Node fmt * Isolate `root` logic * Remove unused code * Refactor * Simplify lifetimes * u64 (8 byte) fee * Remove extraneous variables * Consolidate on `common` types * Simplify * Cosmetic * Remove unnecessary references to hash * Fix node fmt * Update node.rs * Update node.rs * Include leaf fee in leaf sum calculation * update hash comment * Update sum Node `left_child` and `right_child` to return `Result` * Remove unused lifetime param * Return fee in BMST `root` call * Remove unused `StorageNode` * Feat: Add `PositionPath` and `PositionPathIter` to calculate the path and side positions from root to leaf (#55) * Path set * Add `height` to `common::Node` interface, add `Position::path_set` * Position path_set tests * Move position_iter to new file * Clean up use statements * Move position_iter to position_path * Comments * Update comments * Update comments * PR feedback * Refactor binary node interface (#58) * Feat: BMT prove uses position path (#61) * BMT prove uses position path * Format * Remove unnecessary storage inserts * Remove unnecessary mut from Node::create_node * Remove unnecessary functions * Update version for breaking change * Change unnecessary `node_mut()` to `node()` in `join_subtrees()` * Revert "Update version for breaking change" This reverts commit db3460510b6861805b5e4a2f3b5eb24d704b10f4. * Feat: Binary merkle tree load from storage (#62) * Implement `load` for BMT * Move p2_under to common * Format * Build tree from leaf nodes * Test load error * Alphabetical order for errors * remove unnecessary mut * Simplify * Remove unnecessary cast * Feat: Add height to sparse node (#64) * Add height to sparse node * Update tests * Fix: Remove hashing from leaf keys in SMT Node (#69) * Remove hashing from leaf keys * Format * Revert height change * Revert changes unrelated to leaf keys! * Undo change * Refactor: Add method to SMT node to set prefix (#70) * Minor SMT node refactor * Undo assert change * Feat: Add height to SMT node debug (#71) * Add height to SMT node debug * Traits * Minor refactor * Fix: SMT Node `left_child` and `right_child` return placeholder when key is zero sum (#72) * Return placeholder when key is zero sum * Tests * Set height to be the greater height of left and right children (#73) * Docs: Create Sparse Merkle Tree test spec (#66) * Create sparse_merkle_tree_tests.md * Typo * Remove language hints for pseudocode * Additional tests * Additional tests * Abstract * Wording * Wording * Update test pseudocode * Correction to Update 2 Delete 1 * Additional test and revisions * Update sparse_merkle_tree_tests.md * Clean up spec * Add last test to TOC * Update sparse_merkle_tree_tests.md * Typos * Convert key inputs to 32 byte keys * Remove deprecated description * Specify big endian * Missed characters * Docs: Fix expected root in SMT root test pseudocode example (#74) * Fix expected root in pseudocode example * Date * White space * Create nightly-cargo-audit.yml (#75) * Feat: Sparse Merkle Tree with `Update` and `Delete` (#41) * Squashed commit of the following: commit 22daac34b6932a71841d76fa91be36896b42d5b4 Author: Brandon Vrooman <brandon.vrooman@gmail.com> Date: Sun Nov 14 20:52:23 2021 -0500 Comment out test commit de2bcadcdda2c6b83639584f4b6340ec8a219b7f Author: Brandon Vrooman <brandon.vrooman@gmail.com> Date: Fri Nov 12 01:06:59 2021 -0500 Path iterator comments commit 5de45ab00ea22f93582158e8b9d2f3b162283b42 Author: Brandon Vrooman <brandon.vrooman@gmail.com> Date: Fri Nov 5 17:40:13 2021 -0400 Minor refactor commit 6d8c4d60f1f0e7a60dc846d69b93239fb2603aa8 Author: Brandon Vrooman <brandon.vrooman@gmail.com> Date: Fri Nov 5 17:32:04 2021 -0400 Update Cargo.toml commit ac570d6e97b98d42a112a2fae3111c998749e218 Author: Brandon Vrooman <brandon.vrooman@gmail.com> Date: Fri Nov 5 17:28:19 2021 -0400 SMT delete commit 66c858a118ece81ea24fc09358c72d338d9f8024 Author: Brandon Vrooman <brandon.vrooman@gmail.com> Date: Thu Nov 4 12:49:12 2021 -0400 Comments commit 0594a9948b8bf4565e905f50317549914020e269 Author: Brandon Vrooman <brandon.vrooman@gmail.com> Date: Wed Nov 3 14:50:15 2021 -0400 Use 0 as zero buffer commit 4993aba67c61d7ab2ed2791f746e1f23d87f5b34 Author: Brandon Vrooman <brandon.vrooman@gmail.com> Date: Wed Nov 3 14:41:49 2021 -0400 Typo commit 57cfda43e3be393088b82b756c4b4dca5e1216df Author: Brandon Vrooman <brandon.vrooman@gmail.com> Date: Wed Nov 3 14:36:42 2021 -0400 Update path iter comments commit 933810c982d410888a948a6b016a735b18042dc3 Author: Brandon Vrooman <brandon.vrooman@gmail.com> Date: Wed Nov 3 14:32:45 2021 -0400 Update path iter comments commit b1dd4f22668881994764b9deed07781f408db5be Author: Brandon Vrooman <brandon.vrooman@gmail.com> Date: Wed Nov 3 14:25:14 2021 -0400 Format commit c43371247d99d94439693b643460457fedcc762a Author: Brandon Vrooman <brandon.vrooman@gmail.com> Date: Wed Nov 3 14:11:57 2021 -0400 Minor refactor commit 69b1fe602f086ec7ed60dd65c0ff7f64494c6c96 Author: Brandon Vrooman <brandon.vrooman@gmail.com> Date: Wed Nov 3 13:51:18 2021 -0400 Update comment commit a9aaf740a3ed4b7c1dafcdaa714c2ee1e05be221 Author: Brandon Vrooman <brandon.vrooman@gmail.com> Date: Wed Nov 3 13:40:56 2021 -0400 Fix node leaf_key commit 07485e4be36735d95000561875120139894db033 Author: Brandon Vrooman <brandon.vrooman@gmail.com> Date: Mon Nov 1 17:15:54 2021 -0400 Tests commit d77365dcf1150946cfe32cf32bc83c9a39bb0a14 Author: Brandon Vrooman <brandon.vrooman@gmail.com> Date: Mon Nov 1 10:45:39 2021 -0400 Remove unused subtree code commit 29af99b9c852a9f6936a9924ef742d24b79dc494 Author: Brandon Vrooman <brandon.vrooman@gmail.com> Date: Mon Nov 1 10:44:25 2021 -0400 SMT update with path nodes and side nodes WIP commit a6d3ac21a14037fde9e23e3287b44482abdb3742 Author: Brandon Vrooman <brandon.vrooman@gmail.com> Date: Mon Nov 1 10:36:21 2021 -0400 Simplify commit 3089439afc957385fb3e6ac86332638358fa63e2 Author: Brandon Vrooman <brandon.vrooman@gmail.com> Date: Mon Nov 1 00:15:38 2021 -0400 Update node commit d652f79ffea7b7bf8d3dfc0b952ddad9f92a4fd2 Author: Brandon Vrooman <brandon.vrooman@gmail.com> Date: Sun Oct 31 18:35:14 2021 -0400 Impl node trait for sparse Node commit 3309c740cd2f5da247ef46287288d63008dcd09f Author: Brandon Vrooman <brandon.vrooman@gmail.com> Date: Sun Oct 31 18:34:56 2021 -0400 MSB and iterator tests commit 59e415e0b3dd1dbfbd0e82530ed7ab24fa725641 Author: Brandon Vrooman <brandon.vrooman@gmail.com> Date: Thu Oct 28 15:19:41 2021 -0400 Refactor tests commit c4daa9d639f7368a1273a89650279772c0b363f9 Author: Brandon Vrooman <brandon.vrooman@gmail.com> Date: Wed Oct 27 01:33:24 2021 -0400 Typo commit da341056398ad947b6b7d69b3dbdca0e9d93c835 Author: Brandon Vrooman <brandon.vrooman@gmail.com> Date: Wed Oct 27 01:29:54 2021 -0400 Refactor test commit 4791a65519512b2e64a6637ea472f35e08b9168f Author: Brandon Vrooman <brandon.vrooman@gmail.com> Date: Wed Oct 27 01:14:15 2021 -0400 Update commit f0d3911ffbbfe0dce6afc8e3acccebc264e200f2 Author: Brandon Vrooman <brandon.vrooman@gmail.com> Date: Wed Oct 27 01:10:06 2021 -0400 Comments commit 33935daa7f475aa1c68bdbf703ed40d54f139707 Author: Brandon Vrooman <brandon.vrooman@gmail.com> Date: Wed Oct 27 00:55:53 2021 -0400 Tests commit 7b5c330d5a4be4f50762e82edd0851ba1ea9ab4b Author: Brandon Vrooman <brandon.vrooman@gmail.com> Date: Mon Oct 25 22:06:44 2021 -0400 Format commit 4e2a5c64d4b0752f4bc17cca9c6aa77c8af4e318 Author: Brandon Vrooman <brandon.vrooman@gmail.com> Date: Mon Oct 25 12:25:00 2021 -0400 SMT update_for_root commit 751339ee9ffc43ba15b74a1a9cbaee7d21e8ba68 Author: Brandon Vrooman <brandon.vrooman@gmail.com> Date: Fri Oct 22 17:05:10 2021 -0400 Lookup prefix size using size_of Bytes1 commit a690029bff909ef780228f6b942ca3eb40c3afea Author: Brandon Vrooman <brandon.vrooman@gmail.com> Date: Fri Oct 22 17:02:13 2021 -0400 Fix formatting commit e57c2389a1583cd049c1bbd95c755458b204342e Author: Brandon Vrooman <brandon.vrooman@gmail.com> Date: Fri Oct 22 17:00:08 2021 -0400 Node tests commit 3715bb8d5b55fe1a29bd3db3486999a069ea9774 Author: Brandon Vrooman <brandon.vrooman@gmail.com> Date: Thu Oct 21 23:34:10 2021 -0400 Test update commit a2515ca1facc3ee66c3951991245238b0e379474 Author: Brandon Vrooman <brandon.vrooman@gmail.com> Date: Thu Oct 21 19:50:00 2021 -0400 Clean up commit 2e9c36eadd5fa0133580af888f588ef0d68fce2b Author: Brandon Vrooman <brandon.vrooman@gmail.com> Date: Thu Oct 21 19:40:49 2021 -0400 Generic key types commit 648648fa57272664aaa4267c556ef635834f0aac Author: Brandon Vrooman <brandon.vrooman@gmail.com> Date: Thu Oct 21 19:10:15 2021 -0400 Update common.rs commit ac4ab42a931d0324cbf4fc19b7668ec8671ed72f Author: Brandon Vrooman <brandon.vrooman@gmail.com> Date: Thu Oct 21 18:49:30 2021 -0400 Add panic test for msb commit c99ce9c49bd6b251b4b2a18b6848d0f85ea9735d Author: Brandon Vrooman <brandon.vrooman@gmail.com> Date: Thu Oct 21 18:37:50 2021 -0400 Clean up commit 1049b770ad10d03b60c4be679e1421fc3c52e89f Author: Brandon Vrooman <brandon.vrooman@gmail.com> Date: Thu Oct 21 17:36:38 2021 -0400 Update sparse node commit c535ebab613c7d4378d89e29e9a8d2bcce6e1151 Author: Brandon Vrooman <brandon.vrooman@gmail.com> Date: Thu Oct 21 01:06:53 2021 -0400 Sparse node iterator commit 3ac3f89d47448f63ed76415227c6475aad4c7638 Author: Brandon Vrooman <brandon.vrooman@gmail.com> Date: Wed Oct 20 12:47:33 2021 -0400 Const BUFFER_SZ commit 93b7ea918474154a424b670082560cf27c166b4f Author: Brandon Vrooman <brandon.vrooman@gmail.com> Date: Wed Oct 20 12:38:55 2021 -0400 Sparse node commit ba893daf3b40fdcf3fdcf849dc9022211cafb4d3 Author: Brandon Vrooman <brandon.vrooman@gmail.com> Date: Wed Oct 20 12:38:49 2021 -0400 Path iterator commit 557e6755000094e9a5300f8131d7618956b11ac9 Author: Brandon Vrooman <brandon.vrooman@gmail.com> Date: Mon Oct 18 12:57:34 2021 -0400 Sparse node commit 32e1a48e34702fd4365a8e48c848347d064dd6b9 Author: Brandon Vrooman <brandon.vrooman@gmail.com> Date: Wed Oct 13 13:24:36 2021 -0400 Format commit a1387caad401604b9a8a0796a748c46096075040 Author: Brandon Vrooman <brandon.vrooman@gmail.com> Date: Wed Oct 13 13:21:05 2021 -0400 Generic path iterator commit 8616e701bf72e68a76e506fcffda3f32c6a0fc5f Author: Brandon Vrooman <brandon.vrooman@gmail.com> Date: Tue Oct 12 16:58:36 2021 -0400 Update leaf.rs commit 8fe009b1022b78764a79ba85518e0db590852a14 Author: Brandon Vrooman <brandon.vrooman@gmail.com> Date: Tue Oct 12 15:54:56 2021 -0400 Additional `position` methods and tests commit 274744b317969b20b5212fbc28f1487013de71ca Author: Brandon Vrooman <brandon.vrooman@gmail.com> Date: Tue Oct 12 12:35:33 2021 -0400 Format commit ab95d7f24d529e89636c515212ac690e16f9a7d5 Author: Brandon Vrooman <brandon.vrooman@gmail.com> Date: Tue Oct 12 11:51:19 2021 -0400 Update comments commit 71f590c0f72f9f6d6b12fb048e6cba7676bf164f Author: Brandon Vrooman <brandon.vrooman@gmail.com> Date: Mon Oct 11 18:26:00 2021 -0400 Expand documentation commit aa6847c61c76314f180ce63b109e3fea89871b4b Author: Brandon Vrooman <brandon.vrooman@gmail.com> Date: Mon Oct 11 17:43:28 2021 -0400 Updated position comments commit cbf5269c7152936e8d1c87ecdba2b85ef8d2ed2c Author: Brandon Vrooman <brandon.vrooman@gmail.com> Date: Fri Oct 8 13:55:24 2021 -0400 Sparse Merkle Tree skeleton * Revert position changes * Incorporate upstream changes * Format * Update tests * Update merkle_tree.rs * Add leaf node buffer on update to storage * Undo bad conflict fix * Format after merge * Update to new node interface * Fix tests * Format * Remove println statement * Use results * SMT new returns Result * Format * Remove comment * Additional tests * Return empty sum to sparse module * Format * Revert delete comment * Format tests * Remove `let _` from tests * Additional tests and simplifications * Format * Move leaf key hashing to client side * Format * Rearrange sum calls on test keys * Update tests to match spec * Fix expected root string * Refactor: Simplify SMT algorithms (#76) * Merge * Merge fix * Update merkle_tree.rs * Update comments based on feedback * Feat: smt data driven test framework (#79) * Data driven test framework * Impl ToString for Test to generate test names * revert unrelated change * Stable * Format * Data test stable * undo change to smt * Use `?` instead of `unwrap` * Reorder dependencies * Use constants and enums for actions and encodings (#82) * Load SMT from storage and root (#83) * Feat: Refactor BMT and SMT interfaces to use `anyhow::Result` (#86) * Add anyhow to cargo * Update SMT interface to use anyhow Result * Update BMT to use anyhow result * Chore: Refactor comment length to maximum of 80 (#87) * path_iterator * Update position.rs * Update position_path.rs * Update merkle_tree.rs * Update node.rs * Update verify.rs * Add no-std support (#88) It is desirable to have no-std support so the consumers will have more flexibility of use with this library, provided an appropriate storage backend. This functionality will support the usage of contracts in fuel-tx, since its id is calculated with a binary merkle tree, according to fuel specs. * Bump to v0.2.0 (#90) * Debt: Refactor Merkle tree error propagation and handling (#94) * Refactor error handling * Format * Support for no std config * Fix storage error display attribute * Fix warnings * Remove commented out code * Remove commented out code * Refactor sparse `StorageNode` error * Use `hashbrown::hashmap` (#96) * Use infallible error for `StorageMap` error type (#98) * Run tests without std during CI (#99) * Run tests without std during CI * Remove lazy static from test-helpers * Rearrange ci workflows * Update ci.yml * Update ci.yml * Feat: Infallible in-memory SMT (#100) * In memory SMT * Format * In memory SMT tests * Tree ptr * Use Option for delayed SMT initialization * Use alloc box * Strongly typed self as Pin in interface * Use core phantompinned * Format * Use in-memory Merkle tree for data driven tests * Remove block * Relax constraint on Storage (#101) * Relax constraint on Storage * sum tree, and cleanup * relax storage for binary Co-authored-by: rakita <rakita@users.noreply.github.com> * cargo clippy lints (#103) * cargo clippy lints * nit comment * Feat: In-memory binary Merkle tree (#104) * In memory binary merkle tree * Add `prove` to in memory binary merkle tree * Format * No-std compat * Use `Option` instead of `Result` in `prove` * Update test names * Feat: Implement Default for in-memory Merkle trees (#105) * Impl Default for in-memory Merkle trees * Formatting * Add clippy job to CI (#106) * Add clippy job to CI * Formatting * Update clippy args * Release 0.3.0 (#108) Create Release 0.3.0 * Use `check` in CI (#109) * Use `check` in CI * Clippy warnings * Refactored usage of storage traits (#111) * Refactored usage of storage traits. * Make clippy happy=) * Changed `fuel-storage` to ues release `0.3` * Removed redundant lifetime from impl. * Proper naming for the tables. Added detailed description * Apply suggestions from code review Co-authored-by: Brandon Vrooman <brandon.vrooman@gmail.com> * Renamed table description for tests * Update src/binary/merkle_tree.rs Co-authored-by: Brandon Vrooman <brandon.vrooman@gmail.com> Co-authored-by: Brandon Vrooman <brandon.vrooman@gmail.com> * Bump version to 0.4.0 (#112) * debt: Remove first leaf from BMT proof set (#115) Remove first leaf from BMT proof set * Revert #115 (#116) Revert "debt: Remove first leaf from BMT proof se] t (#115)" This reverts commit bf201991ae06353259d980f2633ba764a17980f2. * feat: BMT integration tests (#36) * Replace ProofSet wrapper with Vec * Initial integration test folder * BMT `root` and `proof` tests * Storage integration tests * binary merkle tree integration test struct * Revert "debt: Remove first leaf from BMT proof set (#115)" This reverts commit bf201991ae06353259d980f2633ba764a17980f2. * Revert changes to proof set * Whitespace * chore: Minor clean up (#121) * Clean up comments and code * Additional comment format * Minor comment formatting * Update comment text * Simplify test storage maps * Simplify sparse test storage maps * feat: Load BMT from MMR peaks (#123) * WIP * Simplify * Clean up * Replace unwraps with error * Remove unused code * Fix test import * Refactor BMT integration tests * BMT build inline docs * Update inline comment for consistency * Update test imports * Minor refactor * Update src/common/position_path.rs Co-authored-by: Green Baneling <XgreenX9999@gmail.com> * Refactor and add test * Appease clippy Co-authored-by: Green Baneling <XgreenX9999@gmail.com> * Release 0.4.1 (#127) * Clippy and dependency upgrades (#130) * Cliipy * Dep Upgrades * feat: Data-driven BMT test generation and framework (#125) * BMT data tests * Additional tests * Fixed rand seed for test data gen * Update test pass fail return * Additional negative tests * Update test cases * Manual cargo fmt * Remove unused roottest struct * Use verifyDigest * Update binary.rs * Upgrade serde yaml * fix warning * Use serialized enums over strings * Rename tests * Add test descriptions * refactor into separate fns * Update tests * refactor: Add `Prefix` enum and buffer error checking (#131) * Prefix enum * Simplify * Revert accidental change * Clippy * impl AsRef * Update prefix.rs * Error handling * Error checks * Collapse use statements * Manual impl From StorageError * Manual from prefix error * Update node.rs * Revert renaming Internal to Node * Update binary_proofs.rs * Revert "Update binary_proofs.rs" This reverts commit d9996de6072072d73e6b5c0fd7d6fcfe939cf625. * Update node.rs * feat: ParentNode fallible interface (#133) * ParentNode fallible interface Merge * ChildReturn alias * Warnings * Refactor * Update node.rs * Clean up * Remove unnecessary trait restrictions * Update path_iterator.rs * Comments and test * Rename to child error * ChildError * Add Key to ChildError * Simplify * Simplify * Update merkle_tree.rs * Refactor * StroageNodeError * NodeIsLeaf error for leaf nodes * thiserror for StorageNodeError and ChildError * Minor refactor common use statements * Remove extern crate core * Clean up use statements * Update path_iterator.rs * Update path_iterator.rs * refactor: Introduce `Path` trait and `Instruction` (#134) * Add path trait and instruction * Comparable path * Appease Lord Clippy * Update msb.rs * Simplify * feat: BMT node buffer and table definition update (#136) * BMT Node buffer * Refactor buffer, add buffer views * Simplify Node interface * Clippy * Remove unnecessary node clones * Add safety comments * Cosmetic * Return hash as ref * Replace Schema with constants * Update safety notes in BMT buffer * Replace Buffer with Primitive * Remove Primitive trait * Refactor primitive * Simplify * Make node members private * Use as ref * feat: SMT node primitive update (#137) * BMT Node buffer * Refactor buffer, add buffer views * Simplify Node interface * Clippy * Remove unnecessary node clones * Add safety comments * SMT node buffer update * Simplify * Minor * Simplify * Simplify * Fix warning * Simplify * Return references instead of copies * Cosmetic * Return hash as ref * Replace Schema with constants * Replace Schema with constants * Update safety notes in BMT buffer * Replace Buffer with Primitive * Replace Buffer with Primitive (WIP) * Passing tests * cliipy * clippy for real tho * Remove Primitive trait * Refactor primitive * Refactor primitive * Simplify * Simplify * Clean up * Make node members private * Make Node members private * Use as ref * revert * Rename uses of buffer to primitive * Rename uses of buffer to primitive in tests * Use into for insertion in test * feat: Configurable storage table for BMTs and SMTs (#129) * Configurable storage table * refactor sum tree * Minor * Update Cargo.toml * Update position.rs * Update storage_map.rs * Refactor nodes tables * Update binary.rs * Fmt * Use core over std * Update binary_proofs.rs * Revert "Update binary_proofs.rs" This reverts commit ba38107c6cff3462041b3dbe8b6255431b056dc8. * Merge fixes * Fix warnings * Clean up * Clean up * Update merkle_tree.rs * consistency * Use match over if else * Revert "Use match over if else" This reverts commit c74337a448f48c9eec89d7b436aa03a80e00e886. * Rearrangement * BMT Node buffer * Refactor buffer, add buffer views * Simplify Node interface * Clippy * Remove unnecessary node clones * Add safety comments * SMT node buffer update * Simplify * Minor * Simplify * Simplify * Fix warning * Simplify * Return references instead of copies * Cosmetic * Return hash as ref * Use Binary node buffer for tables * Replace Schema with constants * Replace Schema with constants * Remove serde feature * Update lib exports * Clean up * Update safety notes in BMT buffer * Replace Buffer with Primitive * Replace Buffer with Primitive (WIP) * Passing tests * cliipy * clippy for real tho * Remove Primitive trait * Refactor primitive * Refactor primitive * Simplify * Simplify * Clean up * Make node members private * Make Node members private * Use as ref * Replace uses of Buffer with Primitive * revert * Rename uses of buffer to primitive * Rename uses of buffer to primitive in tests * Use into for insertion in test * Fix imports * Use hex values in test * chore: Update test table names (#139) Update table names * Fix import * Fix merge side effects * feat: Make BMT `root` available to immutable trees (#141) * Refactor * Refactor * Infallible storage trait and impl * Parallel trait usage for getting side nodes * nostd compliance * Clippy * Infallible root * Add comment docs to root_node * Fix root_node doc line breaks * Whitespace * Fix typo * Whitespace again * Remove returned assigned values * fix ci for fuel-merkle * fmt merkle * toml lint * toml lint * toml lint * version bump * fix lifetime issues * Revert "version bump" This reverts commit df268a976f03b31f5366f522ebfc67101baac096. * Use `{ workspace = true }` * clippy fixes * always enable alloc in fuel-merkle to support all targets * Revert "always enable alloc in fuel-merkle to support all targets" This reverts commit 7afdd79e234d13f1f50d7a5faa8bdb254043251b. * Revert "clippy fixes" This reverts commit 83acb2108b1af51c2af8bb4b3f90f91b69c26f40. * Remove lifetime from the `Mappable::Key` (#319) * Removed `'a` lifetime from `Mappable::Key`. Renamed `GetValue` with `OwnedValue`. Added the same `OwnedKey` for `Key` to unblock: ```rust type Key = Self::OwnedKey; type OwnedKey = u64; type Value = Self::OwnedValue; type OwnedValue = Primitive; ``` Defined two double storage key for `ContractsAssets` and `ContractsState`. Replaced `(&'a ContractId, &'a AssetId)` with corresponding double storage keys. * Make clippy happy * Make clippy happy * Make clippy happy * Fix `no_std` compilation * Remove `AsRef` and `From` for `$first` and `$second` * remove unused ci folder from fuel-merkle Co-authored-by: John Adler <adlerjohn@users.noreply.github.com> Co-authored-by: Brandon Vrooman <brandon.vrooman@gmail.com> Co-authored-by: rakita <rakita@users.noreply.github.com> Co-authored-by: Brandon Kite <brandonkite92@gmail.com> Co-authored-by: Elliot <eyaghoobia@gmail.com> Co-authored-by: Victor Lopes <vhrlopes@gmail.com> Co-authored-by: GreenBaneling | Supercolony <XgreenX9999@gmail.com> Co-authored-by: Brandon Vrooman <brandon.vrooman@fuel.sh> Co-authored-by: Tom <tomrgowan@gmail.com>
# This is the 1st commit message: Initial wip # The commit message #2 will be skipped: # Basic case working. Pre-fixture tests # The commit message #3 will be skipped: # Initial fixture tests passing # The commit message #4 will be skipped: # Test case passing for disabled versions # The commit message #5 will be skipped: # EE tests passing # The commit message #6 will be skipped: # Additional fixture tests and PR prep # The commit message #7 will be skipped: # Run make format # The commit message #8 will be skipped: # X # The commit message #9 will be skipped: # X # The commit message casper-network#10 will be skipped: # X # The commit message casper-network#11 will be skipped: # X # The commit message casper-network#12 will be skipped: # Add flag to engine config to return error # The commit message casper-network#13 will be skipped: # Add flag to chainspec.toml # The commit message casper-network#14 will be skipped: # Address CI issues # The commit message casper-network#15 will be skipped: # Add contract runtime tests # The commit message casper-network#16 will be skipped: # rebasing with darthsiroftardis/change-package-version-calls # The commit message casper-network#17 will be skipped: # fmt fix # The commit message casper-network#18 will be skipped: # fmt fix # The commit message casper-network#19 will be skipped: # fmt fix
# This is the 1st commit message: Initial wip # The commit message #2 will be skipped: # Basic case working. Pre-fixture tests # The commit message #3 will be skipped: # Initial fixture tests passing # The commit message #4 will be skipped: # Test case passing for disabled versions # The commit message #5 will be skipped: # EE tests passing # The commit message #6 will be skipped: # Additional fixture tests and PR prep # The commit message #7 will be skipped: # Run make format # The commit message #8 will be skipped: # X # The commit message #9 will be skipped: # X # The commit message casper-network#10 will be skipped: # X # The commit message casper-network#11 will be skipped: # X # The commit message casper-network#12 will be skipped: # Add flag to engine config to return error # The commit message casper-network#13 will be skipped: # Add flag to chainspec.toml # The commit message casper-network#14 will be skipped: # Address CI issues # The commit message casper-network#15 will be skipped: # Add contract runtime tests # The commit message casper-network#16 will be skipped: # rebasing with darthsiroftardis/change-package-version-calls # The commit message casper-network#17 will be skipped: # fmt fix # The commit message casper-network#18 will be skipped: # fmt fix # The commit message casper-network#19 will be skipped: # fmt fix # The commit message casper-network#20 will be skipped: # refactoring put_key contract # The commit message casper-network#21 will be skipped: # refactoring put_key contract # The commit message casper-network#22 will be skipped: # X
# This is the 1st commit message: rebasing # The commit message #2 will be skipped: # WIP # The commit message #3 will be skipped: # WIP # The commit message #4 will be skipped: # wip # The commit message #5 will be skipped: # wip # The commit message #6 will be skipped: # wip # The commit message #7 will be skipped: # wip # The commit message #8 will be skipped: # wip # The commit message #9 will be skipped: # wip # The commit message casper-network#10 will be skipped: # wip # The commit message casper-network#11 will be skipped: # wip # The commit message casper-network#12 will be skipped: # wip # The commit message casper-network#13 will be skipped: # rebasing # The commit message casper-network#14 will be skipped: # wip # The commit message casper-network#15 will be skipped: # wip # The commit message casper-network#16 will be skipped: # wip # The commit message casper-network#17 will be skipped: # wip # The commit message casper-network#18 will be skipped: # wip # The commit message casper-network#19 will be skipped: # wip
# This is the 1st commit message: rebasing # The commit message #2 will be skipped: # WIP # The commit message #3 will be skipped: # WIP # The commit message #4 will be skipped: # wip # The commit message #5 will be skipped: # wip # The commit message #6 will be skipped: # wip # The commit message #7 will be skipped: # wip # The commit message #8 will be skipped: # wip # The commit message #9 will be skipped: # wip # The commit message casper-network#10 will be skipped: # wip # The commit message casper-network#11 will be skipped: # wip # The commit message casper-network#12 will be skipped: # wip # The commit message casper-network#13 will be skipped: # rebasing # The commit message casper-network#14 will be skipped: # wip # The commit message casper-network#15 will be skipped: # wip # The commit message casper-network#16 will be skipped: # wip # The commit message casper-network#17 will be skipped: # wip # The commit message casper-network#18 will be skipped: # wip # The commit message casper-network#19 will be skipped: # wip # The commit message casper-network#20 will be skipped: # rebasing # The commit message casper-network#21 will be skipped: # wip # The commit message casper-network#22 will be skipped: # wip # The commit message casper-network#23 will be skipped: # wip
# This is the 1st commit message: rebasing # The commit message #2 will be skipped: # WIP # The commit message #3 will be skipped: # WIP # The commit message #4 will be skipped: # wip # The commit message #5 will be skipped: # wip # The commit message #6 will be skipped: # wip # The commit message #7 will be skipped: # wip # The commit message #8 will be skipped: # wip # The commit message #9 will be skipped: # wip # The commit message casper-network#10 will be skipped: # wip # The commit message casper-network#11 will be skipped: # wip # The commit message casper-network#12 will be skipped: # wip # The commit message casper-network#13 will be skipped: # rebasing # The commit message casper-network#14 will be skipped: # wip # The commit message casper-network#15 will be skipped: # wip # The commit message casper-network#16 will be skipped: # wip # The commit message casper-network#17 will be skipped: # wip # The commit message casper-network#18 will be skipped: # wip # The commit message casper-network#19 will be skipped: # wip # The commit message casper-network#20 will be skipped: # rebasing # The commit message casper-network#21 will be skipped: # wip # The commit message casper-network#22 will be skipped: # wip # The commit message casper-network#23 will be skipped: # wip # The commit message casper-network#24 will be skipped: # wip # The commit message casper-network#25 will be skipped: # wip # The commit message casper-network#26 will be skipped: # wip # The commit message casper-network#27 will be skipped: # wip # The commit message casper-network#28 will be skipped: # wip # The commit message casper-network#29 will be skipped: # wip
# This is the 1st commit message: rebasing # The commit message #2 will be skipped: # WIP # The commit message #3 will be skipped: # WIP # The commit message #4 will be skipped: # wip # The commit message #5 will be skipped: # wip # The commit message #6 will be skipped: # wip # The commit message #7 will be skipped: # wip # The commit message #8 will be skipped: # wip # The commit message #9 will be skipped: # wip # The commit message casper-network#10 will be skipped: # wip # The commit message casper-network#11 will be skipped: # wip # The commit message casper-network#12 will be skipped: # wip # The commit message casper-network#13 will be skipped: # rebasing # The commit message casper-network#14 will be skipped: # wip # The commit message casper-network#15 will be skipped: # wip # The commit message casper-network#16 will be skipped: # wip # The commit message casper-network#17 will be skipped: # wip # The commit message casper-network#18 will be skipped: # wip # The commit message casper-network#19 will be skipped: # wip # The commit message casper-network#20 will be skipped: # rebasing # The commit message casper-network#21 will be skipped: # wip # The commit message casper-network#22 will be skipped: # wip # The commit message casper-network#23 will be skipped: # wip # The commit message casper-network#24 will be skipped: # wip # The commit message casper-network#25 will be skipped: # wip # The commit message casper-network#26 will be skipped: # wip # The commit message casper-network#27 will be skipped: # wip # The commit message casper-network#28 will be skipped: # wip # The commit message casper-network#29 will be skipped: # wip # The commit message casper-network#30 will be skipped: # wip # The commit message casper-network#31 will be skipped: # wip # The commit message casper-network#32 will be skipped: # wip
# This is the 1st commit message: rebasing # The commit message #2 will be skipped: # WIP # The commit message #3 will be skipped: # WIP # The commit message #4 will be skipped: # wip # The commit message #5 will be skipped: # wip # The commit message #6 will be skipped: # wip # The commit message #7 will be skipped: # wip # The commit message #8 will be skipped: # wip # The commit message #9 will be skipped: # wip # The commit message casper-network#10 will be skipped: # wip # The commit message casper-network#11 will be skipped: # wip # The commit message casper-network#12 will be skipped: # wip # The commit message casper-network#13 will be skipped: # rebasing # The commit message casper-network#14 will be skipped: # wip # The commit message casper-network#15 will be skipped: # wip # The commit message casper-network#16 will be skipped: # wip # The commit message casper-network#17 will be skipped: # wip # The commit message casper-network#18 will be skipped: # wip # The commit message casper-network#19 will be skipped: # wip # The commit message casper-network#20 will be skipped: # rebasing # The commit message casper-network#21 will be skipped: # wip # The commit message casper-network#22 will be skipped: # wip # The commit message casper-network#23 will be skipped: # wip # The commit message casper-network#24 will be skipped: # wip # The commit message casper-network#25 will be skipped: # wip # The commit message casper-network#26 will be skipped: # wip # The commit message casper-network#27 will be skipped: # wip # The commit message casper-network#28 will be skipped: # wip # The commit message casper-network#29 will be skipped: # wip # The commit message casper-network#30 will be skipped: # wip # The commit message casper-network#31 will be skipped: # wip # The commit message casper-network#32 will be skipped: # wip # The commit message casper-network#33 will be skipped: # wip # The commit message casper-network#34 will be skipped: # wip # The commit message casper-network#35 will be skipped: # wip # The commit message casper-network#36 will be skipped: # wip # The commit message casper-network#37 will be skipped: # wip # The commit message casper-network#38 will be skipped: # wip # The commit message casper-network#39 will be skipped: # wip # The commit message casper-network#40 will be skipped: # rebasing
This brings all of the consensus code from the
CasperLabsrepo into this one and introduces some initial integration.The integration is basically this:
Consensuscomponent inconsensus.rsnow contains aconsensus_service::EraSupervisorEraSupervisorand passed onThere are still a lot of missing parts here:
consensus_protocolhas its own idea of what aNodeIdis, and the rest of the reactor has its own idea. There will need to be some kind of a mapping for converting one into the other, or we'll have to get rid of theconsensus_protocol's NodeId type (I would currently favor the latter, personally, but for now I included a stub of a conversion function).EraSupervisoris really just some scaffolding, so it does nothing and a lot of code is unused. It could be a whole separate task to actually implement some basic functionality for it, like spawning an initial era and passing the messages and effects between the consumer and the consensus protocol.consensus.rsnow). We might have to discuss whether we continue with what we have, or whether we might want to ditch parts of it and write it differently now that we have a better idea of what the whole thing (node, reactor etc.) will look like.So, please bear the above points in mind when reviewing the PR 😉
EDIT:
In order to make the reviews a bit easier, here is a quick summary of the changes.
CasperLabs. The main files (lib.rs) of what used to be crates are moved to become main module files (consensus/synchronizer.rs,consensus/pothole.rs,consensus/highway_core.rsetc.).pubitems were changed intopub(crate)items, as they won't be exposed outside ofcasperlabs-nodecrate::into something likesuper::super::super::- wouldcrate::components::consensus::...be better?)The above are the trivial changes, and this covers most of the diff in this PR. There are also some nontrivial changes in the files listed below:
src/components/consensus.rssrc/components/consensus/consensus_service/consensus_service.rssrc/components/consensus/highway_core/test_macros.rs(import paths again, they cause warnings)src/components/consensus/protocols/pothole.rs(the TryFrom and From implementations on the bottom)src/reactor/validator.rs(actually also rather trivial)