-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wctl refactoring: Concrete data structures and code cleanup #319
Closed
Closed
Changes from all commits
Commits
Show all changes
155 commits
Select commit
Hold shift + click to select a range
07e1ffe
Remove gossip mechanism. (#276)
e78a1ec
[WIP] Remove transaction creator and graph. (#277)
ce9e286
ledger: fix a nil pointer error
82ae4ab
Implement pulling transactions with bloom filter (#278)
6572405
ledger, graph: remove graph, and nop
0353f41
ledger: remove FinalizedRounds()
8d65d95
wavelet: implement block proposal
e731f91
wavelet: fix bloom filter rebuild
6f7ceea
utils: remove unused method
2cf75cf
ledger, collapse, mempool: move BloomFilter into Mempool, refactor Me…
5955b0a
testutil: temporarily comment out test code
6444707
protocol: fix response not using mempool
9153d02
Merge branch 'himitsu' of github.com:perlin-network/wavelet into himitsu
a60938c
Merge branch 'himitsu' of github.com:perlin-network/wavelet into himitsu
de831af
all: replace [blake2b.Size256]byte with BlockID or TransactionID
80159bb
collapse, ledger: replace [32]byte with TransactionID
b91ff99
round: remove files related to round vote: remove unused import
a98fb15
block: replace variadic with slice
9138c32
wavelet: fix state syncing to use mempool and blocks
057d548
wavelet: fix rebase
27da56a
wavelet: improve mempool pruning
699671f
protocol, rpc: update CheckOutOfSync protocol
6f07f28
Merge branch 'himitsu' of github.com:perlin-network/wavelet into himitsu
c9469f1
wavelet: remove unused variable
3017126
ledger, round, rounds, vote, protocol, collapse, common: remove entir…
iwasaki-kenta d006449
Merge remote-tracking branch 'origin/himitsu' into himitsu
iwasaki-kenta cb205bd
ledgeR: rename RoundIndex to BlockIndex for OutOfSyncRequest
iwasaki-kenta efb83f2
ledger: rename RoundIndex to BlockIndex for OutOfSyncRequest
iwasaki-kenta c0d08b1
ledger, vote: refactor query to extract the tally calculation
35fede1
block, genesis, ledger: replace variadic parameter with slice, fix co…
0accdd3
vote: remove commented function
1b8ccae
tx, log, api: remove parent ids, parent seeds, seed, seed length, pre…
iwasaki-kenta 567ca4f
Merge remote-tracking branch 'origin/himitsu' into himitsu
iwasaki-kenta 0b735cc
cmd/wavelet, ledger, mempool: cleanup mempool and implement/document …
iwasaki-kenta 59a687b
ledger: remove LatestBlockID and LatestBlockIndex funcs, and instead …
iwasaki-kenta 1ba2717
wavelet: add comments to mempool
e972c63
wavelet: refactor mempool
08ab6ce
wavelet: remove redundant method
5650cec
ledger, protocol, rpc: rename DownloadMissingTx to PullTransactions
iwasaki-kenta fb8144c
Merge remote-tracking branch 'origin/himitsu' into himitsu
iwasaki-kenta b8b8742
ledger: fix deadlock in FinalizeBlocks
iwasaki-kenta 6fc0add
protocol: simplify bloom filter instantiation to prevent allocs
iwasaki-kenta 64ce2da
tx: remove AttachSenderToTransaction and modify NewTransaction to tak…
iwasaki-kenta 19a48d5
tx: add check that the tag is correct on unmarshal
iwasaki-kenta 3b3f46c
metrics, tx/json, ledger, protocol, collapse, conf, cmd/wavelet: repl…
iwasaki-kenta f4df3b7
ledger: remove further trace of rounds
iwasaki-kenta f14fa04
tx/applier, db, collapse, cmd/wavelet: replace further traces of roun…
iwasaki-kenta 61d6d82
ledger, protocol, snowball, vote: make two different snowball impleme…
57410c9
wavelet: implement block finalization
3179a5c
vote, snowball, protocol, ledger: refactor snowball to support both s…
b15aa8a
api, cmd/wavelet: fix build errors
c5c73b4
conf/test: fix tests
iwasaki-kenta b8e822b
ledger: check if block proposed is nil
iwasaki-kenta f9bbe2f
tx, protocol: fix logging message intent, and also fix transaction un…
iwasaki-kenta 470ad1a
ledger: fix deadlock
23058e3
ledger: collapse transactions when proposing and querying block
39aa4ef
ledger, protocol, snowball, vote: refactor snowball and vote calculat…
7846aab
ledger: fix mempool is reshuffled before collapse. only call collapse…
a245a95
mempool: fix reshuffle does not delete the block's transactions
95d98dc
mempool: update reshuffle comment
50dfb9a
tx, actions: add block index to transaction
iwasaki-kenta a7c9389
api: fix compile error
1301951
ledger, mempool, protocol: don't delete tx in the map during shufflin…
fe634c4
mempool, ledger: rename some of the methods to make it more descriptive
2ff4db6
ledger: as an experiment, have the entire mempool proposed as a block
iwasaki-kenta a7d21cf
ledger: fix filter finalization vote
521f167
vote: add comments
5b2e3a0
vote: fix voteID of syncVote
a5a2282
ledger: calculate merkle root when proposing block
036b139
ledger: check merkle root before ticking snowball
dae7d2e
Merge branch 'himitsu' of github.com:perlin-network/wavelet into himitsu
cddb1c8
block: fix block marshaling
c4e1af0
protocol: refactor query response for readability
80d75a7
wavelet: remove ignored tx count
446b6b9
wavelet: keep track of actual tx count in block
798fb33
block: preallocate the buffer
40234ac
Merge branch 'himitsu' of github.com:perlin-network/wavelet into himitsu
d3a13ac
ledger: add debug logs
d801b81
ledger: fix wrong block index check
aba340a
ledger: add missing checks after collapse
ba9ec0b
block: increase preallocated buffer
c0ac1cc
collapse: add context to error missing transaction
3e62db3
ledger, vote: use pointer type for finalizationVote
1f3c40e
ledger, vote: use pointer type for syncVote
8624d3a
snowball: modify snowball to be same as simulator
fb8e4f3
ledger: temporarily disable sync
16d6a91
ledger: add more debug logs
2d6d2ab
wavelet: reenable syncing
471edd0
ledger: temporarily disable pruning
acecd85
protocol: don't log zero transactions
3a898ff
vote/test: fix tests
ded13e7
Merge branch 'himitsu' of github.com:perlin-network/wavelet into himitsu
0f82171
ledger: remove unused code
cc29d11
ledger: change type finalizationVote to pointer. remove unused import
1cf43be
cmd/wavelet: uncomment preferred id
daefd7c
wavelet, conf: fix transactions not being pulled
6e56d4a
cmd/benchmark, wavelet: add block_finalized metric
c2ad888
ledger: use first quarter of mempool for block proposal
73849fa
ledger: fix goroutine not stopped
da85900
ledger: fix missing waitgroup add
10f53b8
ledger: use SelectPeers for PullTransactions, and propose only 1/3rd …
iwasaki-kenta 259434f
conf: increase snowball beta to 150
iwasaki-kenta c0c127d
[himitsu] Refactor transactions in Mempool (#282)
d070f01
ledger: increase period in which transactions are pulled
iwasaki-kenta 97bafe2
cmd/benchmark: only send 1 transaction
iwasaki-kenta cf747ba
actions: initial workflow
iwasaki-kenta 1f69de3
actions; rename to yml
iwasaki-kenta b47f985
db, tx: improve bytes.Buffer performance by setting the buffer capaci…
342b8f3
Send list of tx id instead of bloom filter for pulling transactions (…
b9ed376
ledger: refactor query() to make it easier to understand, and remove …
c7b7143
ledger: reduce the calling of conf.GetSnowballK()
819dcfc
ledger: fix PullTransactions() to pull from K peers instead of just one
675324b
Minor fix for a panic on failed pulls (#285)
rkeene 5a0ce05
Nonce checking and support. (#286)
iwasaki-kenta 2f14556
cmd/benchmark: remove local command
iwasaki-kenta fbd96a9
Remove mempool, and cleanup locks around transactions with helper met…
iwasaki-kenta 19c3eb9
tx/test: fix test errors (#289)
iwasaki-kenta a514455
api/msg: remove redundant type checks for SendTransactionRequest unma…
iwasaki-kenta 414adff
transactions: implement a missing transactions index, which indexes i…
iwasaki-kenta 60a2c49
ledger, transactions: have tx manager keep track of the latest block …
iwasaki-kenta 46154db
transactions: create off-by-one error tests for pruning, tests for pr…
iwasaki-kenta 634f2d4
Initial work for having client SDKs maintain local nonce and block he…
8c3dd2a
Properly increment nonce and block height in wctl client (#294)
3f88743
cmd/wavelet: fix build errors
63cf42d
Add more debug info into cmd/wavelet, and make what transactions are…
iwasaki-kenta 2b9cb54
wavelet: update noise version (#298)
46f5421
Minor cleanup over transactions, and fix off-by-one error in wctl. (#…
iwasaki-kenta 9ac8d68
Logging fixes. (#300)
a-urth 65ed06d
cmd/benchmark: add comment to easiyl switch from benchmarking stake t…
iwasaki-kenta 8808768
events, wctl, ledger: log num transactions pruned upon finalizing a b…
iwasaki-kenta aa52ab1
Refactor Snowball and add unit tests (#304)
fba3936
Merge API refactor commit
diamondburned 824deca
Minor refactor
diamondburned 09fd9bf
WIP api refactor
diamondburned e04daf6
Refactored API
diamondburned cc966e9
WIP
diamondburned e8fbb01
WIP Loggable interface, finished UnmarshalValue
diamondburned 98a7d2c
WIP logget
diamondburned b4f33ec
WIP
diamondburned ffbd851
WIP
diamondburned 98d48be
Added MiniLog, added Value marshals, WIP wctl callbacks
diamondburned 13c0228
Simplified even more the logging API, removed old chunky callback system
diamondburned fc1c436
Improvements, now compile
diamondburned f3e0b05
Everything except cmd/wavelet builds
diamondburned ffca591
Stable-ish state
diamondburned bb86bf9
Fixed ValueHex
diamondburned 72fb3fb
WIP merge
diamondburned c322527
made wavelet compile again, merged fully with master
diamondburned ccd1325
Completed merging, CLI test mostly passes
diamondburned 7e3505c
Integration test for CLI now fully passes
diamondburned 27ab9da
API test now passes
diamondburned b97aa36
Cleaned up wctl even further
diamondburned 9e5b44a
Fixed api unit tests
diamondburned 88ee1bb
Fixed api integration tests
diamondburned cd14617
Removed redundant things
diamondburned File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
package wavelet | ||
|
||
import ( | ||
"github.com/perlin-network/wavelet/log" | ||
"github.com/rs/zerolog" | ||
"github.com/valyala/fastjson" | ||
) | ||
|
||
// Balance Update | ||
|
||
// balance_updated | ||
type AccountBalanceUpdated struct { | ||
AccountID AccountID `json:"account_id"` | ||
Balance uint64 `json:"balance"` | ||
} | ||
|
||
var _ log.Loggable = (*AccountBalanceUpdated)(nil) | ||
|
||
func (a AccountBalanceUpdated) MarshalEvent(ev *zerolog.Event) { | ||
marshalAccountIDandUint64(ev, a.AccountID, "balance", a.Balance, "balance") | ||
} | ||
|
||
func (a *AccountBalanceUpdated) UnmarshalValue(v *fastjson.Value) error { | ||
return unmarshalAccountIDandUint64(v, a.AccountID, "balance", &a.Balance) | ||
} | ||
|
||
// Gas Balance update | ||
|
||
// gas_balance_updated | ||
type AccountGasBalanceUpdated struct { | ||
AccountID AccountID `json:"account_id"` | ||
GasBalance uint64 `json:"gas_balance"` | ||
} | ||
|
||
var _ log.Loggable = (*AccountGasBalanceUpdated)(nil) | ||
|
||
func (a AccountGasBalanceUpdated) MarshalEvent(ev *zerolog.Event) { | ||
marshalAccountIDandUint64(ev, a.AccountID, "gas_balance", a.GasBalance, "gas balance") | ||
} | ||
|
||
func (a *AccountGasBalanceUpdated) UnmarshalValue(v *fastjson.Value) error { | ||
return unmarshalAccountIDandUint64(v, a.AccountID, "gas_balance", &a.GasBalance) | ||
} | ||
|
||
// Num Pages update | ||
|
||
// num_pages_updated | ||
type AccountNumPagesUpdated struct { | ||
AccountID AccountID `json:"account_id"` | ||
NumPages uint64 `json:"num_pages"` | ||
} | ||
|
||
var _ log.Loggable = (*AccountNumPagesUpdated)(nil) | ||
|
||
func (a AccountNumPagesUpdated) MarshalEvent(ev *zerolog.Event) { | ||
marshalAccountIDandUint64(ev, a.AccountID, "num_pages", a.NumPages, "pages") | ||
} | ||
|
||
func (a *AccountNumPagesUpdated) UnmarshalValue(v *fastjson.Value) error { | ||
return unmarshalAccountIDandUint64(v, a.AccountID, "num_pages", &a.NumPages) | ||
} | ||
|
||
// Stake update | ||
|
||
// stake_updated | ||
type AccountStakeUpdated struct { | ||
AccountID AccountID `json:"account_id"` | ||
Stake uint64 `json:"stake"` | ||
} | ||
|
||
var _ log.Loggable = (*AccountStakeUpdated)(nil) | ||
|
||
func (a AccountStakeUpdated) MarshalEvent(ev *zerolog.Event) { | ||
marshalAccountIDandUint64(ev, a.AccountID, "stake", a.Stake, "stake") | ||
} | ||
|
||
func (a *AccountStakeUpdated) UnmarshalValue(v *fastjson.Value) error { | ||
return unmarshalAccountIDandUint64(v, a.AccountID, "stake", &a.Stake) | ||
} | ||
|
||
// Reward update | ||
|
||
// reward_updated | ||
type AccountRewardUpdated struct { | ||
AccountID AccountID `json:"account_id"` | ||
Reward uint64 `json:"reward"` | ||
} | ||
|
||
var _ log.Loggable = (*AccountRewardUpdated)(nil) | ||
|
||
func (a AccountRewardUpdated) MarshalEvent(ev *zerolog.Event) { | ||
marshalAccountIDandUint64(ev, a.AccountID, "reward", a.Reward, "reward") | ||
} | ||
|
||
func (a *AccountRewardUpdated) UnmarshalValue(v *fastjson.Value) error { | ||
return unmarshalAccountIDandUint64(v, a.AccountID, "reward", &a.Reward) | ||
} | ||
|
||
func marshalAccountIDandUint64(ev *zerolog.Event, id AccountID, ukey string, u uint64, updated string) { | ||
ev.Hex("account_id", id[:]) | ||
ev.Uint64(ukey, u) | ||
ev.Msg("Updated account " + updated + ".") | ||
} | ||
|
||
// yes, I know this is a terrible function name, it can't be helped | ||
func unmarshalAccountIDandUint64(v *fastjson.Value, id AccountID, ukey string, u *uint64) error { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it definitely should be renamed at least to something containing |
||
if err := log.ValueHex(v, id[:], "account_id"); err != nil { | ||
return err | ||
} | ||
|
||
*u = v.GetUint64(ukey) | ||
return nil | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i don't think this comment is necessary.