Skip to content
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

core, orderwatch, meshdb: Implement a dynamically decreasing max expiration time for orders #450

Merged
merged 40 commits into from Oct 24, 2019
Merged
Changes from 3 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
3c2e9ea
Add expiration time index
albrow Oct 15, 2019
82d8c06
Implement and test TrimOrdersByExpirationTime
albrow Oct 15, 2019
b411e10
Integrate TrimOrdersByExpirationTime in OrderWatcher
albrow Oct 16, 2019
b957707
Add an env var for max orders in storage
albrow Oct 16, 2019
1dc6401
Reject orders with an expiration time greater than the current max
albrow Oct 16, 2019
7fc2f88
Change default max orders to 100k
albrow Oct 17, 2019
a09bc23
Update constants/constants.go
albrow Oct 17, 2019
065cb1f
Update zeroex/orderwatch/order_watcher.go
albrow Oct 17, 2019
10acf12
Remove in-memory state for orders removed due to expiration time
albrow Oct 17, 2019
6837d34
Clarify that UnlimitedExpirationTime = 2^256-1
albrow Oct 17, 2019
88874a0
Implement and test SlowCounter
albrow Oct 18, 2019
b1962dc
Use SlowCounter inside OrderWatcher to increase max expiration time
albrow Oct 18, 2019
ca40d1e
Add todo about loading max expiration time from db
albrow Oct 18, 2019
5a873e8
Use big.Float instead of big.Rat in SlowCounter
albrow Oct 18, 2019
dc8fa51
Add a configurable starting offset to SlowCounter
albrow Oct 18, 2019
75bd78c
Add test for SlowCounter.Reset
albrow Oct 18, 2019
5d0cdbb
Save MaxExpirationTime in database
albrow Oct 18, 2019
c218452
Check if we can increase max expiration time after an order is perman…
albrow Oct 18, 2019
ef33b0b
Handle some additional edge cases where the database could be empty
albrow Oct 19, 2019
45a2812
Simplify SlowCounter implementation and remove concept of "ticks"
albrow Oct 21, 2019
acc74b7
Ensure max expiration time is not in the past
albrow Oct 21, 2019
b8a767f
Add MaxExpirationTime to GetStats
albrow Oct 21, 2019
9229616
Start a separate loop inside OrderWatcher for increasing max exp time
albrow Oct 22, 2019
af7d71d
Add maxOrdersInStorage config option to TypeScript bindings
albrow Oct 22, 2019
a609ccb
Add note about default values to TypeScript bindings
albrow Oct 22, 2019
0969ef7
Add TODO in OrderWatcher about extending transaction
albrow Oct 22, 2019
607df23
Rename a function in OrderWatcher
albrow Oct 22, 2019
a9be34d
Add isMax boolean cache to SlowCounter
albrow Oct 22, 2019
fbd5531
Add test in order_watcher_test for max expiration time
albrow Oct 22, 2019
8d920b2
Rename REMOVED order event to STOPPED_WATCHING
albrow Oct 22, 2019
b2d7567
Add new maxExpirationTime field to docs/rpc_api.md
albrow Oct 22, 2019
a5bfe82
Update CHANGELOG
albrow Oct 22, 2019
ddf6777
Update zeroex/orderwatch/order_watcher.go
albrow Oct 24, 2019
7e63d30
Update zeroex/orderwatch/order_watcher.go
albrow Oct 24, 2019
34fb304
Update zeroex/orderwatch/slowcounter/slow_counter.go
albrow Oct 24, 2019
38e0b87
Return an error for missing config fields in orderwatch.New
albrow Oct 24, 2019
3957058
Merge branch 'feature/dynamic-max-expiration' of github.com:0xProject…
albrow Oct 24, 2019
30c9abb
Add hack in Watcher.Add for orders that suddenly expire too late
albrow Oct 24, 2019
e346f4d
Update zeroex/orderwatch/order_watcher.go
albrow Oct 24, 2019
437373b
Add STOPPED_WATCHING event and missing default for TypeScript bindings
albrow Oct 24, 2019
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -1190,7 +1190,7 @@ func (w *Watcher) increaseMaxExpirationTimeIfPossible() error {
return nil
}

// saveMaxExpirationTime save the new max expiration time in the database.
// saveMaxExpirationTime saves the new max expiration time in the database.
func (w *Watcher) saveMaxExpirationTime(maxExpirationTime *big.Int) {
if err := w.meshDB.UpdateMetadata(func(metadata meshdb.Metadata) meshdb.Metadata {
metadata.MaxExpirationTime = maxExpirationTime
@@ -44,7 +44,7 @@ type Config struct {
// counter will stop incrementing until reset.
MaxCount *big.Int

// maxCountFloat is CaxCount converted to a big.Float in order to make the
// maxCountFloat is MaxCount converted to a big.Float in order to make the
// math easier.
maxCountFloat *big.Float
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.