* add FeeFields type
* use FeeFields with ::zero and try_into().unwrap()
* fixed tests
* avoid 0 accept_base_fee
* add aggregate_fee_fields method for transaction
* implement std::fmt::Display trait for FeeFields
* make base_fee argument non-optional in libtx::mod::tx_fee
* add global and thread local accept_fee_base; use to simplify tests
* set unusually high fee base for a change
* revert to optional base fee argument; default coming from either grin-{server,wallet}.toml
* remove optional base fee argument; can be set with global::set_local_accept_fee_base instead
* define constant global::DEFAULT_ACCEPT_FEE_BASE and set global value
* add Transaction::accept_fee() method and use
* Manual (de)ser impl on FeeFields
* fix comment bug
* Serialize FeeFields as int in tx
* allow feefields: u32:into() for tests
* try adding height args everywhere
* make FeeFields shift/fee methods height dependent
* prior to hf4 feefield testing
* rename selected fee_fields back to fee for serialization compatibility
* fix test_fee_fields test, merge conflict, and doctest use of obsolete fee_fields
* make accept_fee height dependent
* Accept any u64 in FeeFields deser
Co-authored-by: Jasper van der Maarel <j@sper.dev>
* HardFork4 initial commit
* HF4 obsoletes secondary_scale, which becomes an nonce extension 8->12 bytes
* fix TESTNET_FOURTH_HARD_FORK height
* improve predicted height for testnet fork on dec 8
* move local variable as suggested by antiochp
* Introduce CommitOnly variant of Inputs.
Introduce CommitWrapper so we can sort commit only inputs correctly.
* rememebr to resort if converting
* write inputs based on variant and protocol version
* read and write protocol version specific inputs
* store full blocks in local db in v3
convert to v2 when relaying to v2 peers
* add debug version_str for inputs
* no assumptions about spent index sort order
* add additional version debug logs
* fix ser/deser tests for proto v3
* cleanup coinbase maturity
* rework pool to better handle v2 conversion robustly
* cleanup txpool add_to_pool
* fix nrd kernel test
* move init conversion earlier
* cleanup
* cleanup based on PR feedback
* refactor output to have internal output identifier
refactor to use AsRef for output identifier
make the output MMR explicit in terms of output identifiers
* put the serde deser back for rangeproof
* add json test for transactions
* use mmr sizes in header to validate block weight given header only
* add global weight validaton to headers when reading them untrusted off the network
* fixup tests, one pending test
* add test for deserializing untrusted block header exceeeding weight limits
* validate header mmr sizes, must grow for each block
* remove redundant height check
* fix tests after rebase
block specific TooHeavy error
* variants for output_pos linked list entries (head/tail/middle/unique)
next and prev and Vec<u8> lmdb keys
* get_pos on enum
* break list and list entries out into separate enums
* track output features in the new output_pos index, so we can determine coinbase maturity
* push entry impl for none and unique
* some test coverage for output_pos_list
* commit
* wip - FooListEntry
* use instance of the index
* linked list of output_pos and commit_pos both now supported
* linked_list
* cleanup and rename
* rename
* peek_pos
* push some, peek some, pop some
* cleanup
* commit pos
cleanup
* split list and entry out into separate db prefixes
* cleanup and add placeholder for pop_back
* pop_pos_back (for popping off the back of the linked list)
test coverage for pop_pos_back
* wip
* placeholder for prune via a trait
pos must always increase in the index
* rewind kernel_pos_idx when calling rewind_single_block
* RewindableListIndex with rewind support.
* test coverage for rewindable list index
* test coverage for rewind back to 0
* rewind past end of list
* add tests for kernel_pos_idx with multiple commits
* commit
* cleanup
* hook NRD relative lock height validation into block processing and tx validation
* cleanup
* set local chain type for kernel_idx tests
* add test coverage for NRD rules in block processing
* NRD test coverage and cleanup
* NRD relative height 1 test
* test coverage for NRD kernels in block processing
* cleanup
* start of test coverage for txpool NRD kernel rules
* wip
* rework pool tests to use real chain (was mock chain) to better reflect reality (tx/block validation rules etc.)
* cleanup
* cleanup pruneable trait for kernel pos index
* add clear() to kernel_pos idx and test coverage
* hook kernel_pos rebuild into node startup, compaction and fast sync
* verify full NRD history on fast sync
* return early if nrd disabled
* fix header sync issue
* wip
* commit
* add block level validation rule around NRD kernels and HF3 block height
* wip
* test coverage for kernel ser/deser for NRD kernels
* add some type safety around ser/deser of nrd relative height
* cleanup
* cleanup tx sig handling and add tests around NRD kernel sig
* test coverage for chain apply block containing NRD kernel
* verify kernel variants when adding tx to pool
NRD kernels will not be accepted until HF3
* add txpool test for NRD kernel handling
* fix merge
* fix api for NRD kernels
* commit
* wip - feature flag for NRD kernel support
* wip
* global config and thread local feature flag for NRD kernel support
* add feature flag support for NRD kernels
default to false when starting up node
allow it to be set to true in context of individual tests
* feature flag
* explicit testing of NRD kernel via feature flag
* add chain_type and feature flag logging on startup
* PR feedback and cleanup
* PR feedback
* cleanup how we handle key splitting for transaction offset
add test to demonstrate a pair of transaction halves sharing same kernel excess
* cleanup
* cleanup
* Introduce GLOBAL_CHAIN_TYPE and make CHAIN_TYPE thread_local.
This makes testing more explicit and significantly more robust.
* set_local_chain_type() in tests
* cleanup - weird
* get pool tests working with explicit local chain_type config
* core tests working with explicit local chain_type
* p2p tests working with explicit local chain_type
* store tests working
* cleanup, feedback
Tx pool takes some parameters as trait objects. It's not an idiomatic Rust code, in this particular case we should use generic types. Trait object makes sense when we accept in runtime different concrete types which implement the trait as a value of the same field. It's not the case here. Trait objects come with a price - instead of method dispatch in compile time we have to accept runtime dispatch. My guess we did it to not clutter the code with type parameters, which is understandable but still suboptimal.