Closed lrettig closed 1 year ago
remove reference to NextNonce(); change inequality (validity predicate) to compare >= current account nonce Set account nonce to tx nonce
this suggestion doesn't work. if you set account nonce to tx nonce, then the validity predicate will not exclude other txs with the same nonce.
i think what should be done is to change validity predicate to tx.Nonce >= account.NextNonce() and leave everything else as is
@pigmej I think this is "refined" and ready for implementation
startNonce needs to be refactored. it should only contain the current nonce.
@lrettig what does current nonce
mean? startNonce is the next nonce usable for this account.
startNonce needs to be refactored. it should only contain the current nonce.
@lrettig what does
current nonce
mean? startNonce is the next nonce usable for this account.
removed this. I spent some time looking over the conservative cache code. I don't fully understand 100% of it. My gut feeling is that the number of required changes in small, but some of the changes will be subtle and hard to find. Will leave it to you to figure out how much needs to be refactored. txsByNonce
is indexed by "nonce offset" (distance from next nonce?) - this logic is a little confusing - but I think this data structure is more or less okay if there are gaps. The logic around moreInDB
will need to change a little to allow for gaps.
The logic around moreInDB will need to change a little to allow for gaps.
moreInDB
was meant for 3 use cases
with gap, we can eliminate scenario 2.
update. moving the last issue out of this PM issue as it's a genera database bug
See #104
For genesis we are implementing a simple "counter with gaps" nonce scheme: we use simple, ordered uint nonces, no bitfield, and nonces must be monotonically increasing but we allow gaps. (Note that we plan to upgrade to a more complex, generalized scheme later; see this forum thread for more information.)
Here's the straightforward specification for the scheme, including the four required algorithms:
ParsePayload
template method returns a uint64 nonce value (note that, in general, the nonce will be included explicitly in the tx, and may be compressed as a varint, but that in future some templates may choose to calculate the nonce some other way; none of this matters from the perspective of go-spacemesh)dev task breakdown: