-
Notifications
You must be signed in to change notification settings - Fork 11
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
feat: Filtering implementation with support for None
filter type
#280
Conversation
f1d8e00
to
c95129c
Compare
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.
Apart from Franklin's comments, I want to add that you have duplicated commits in the PR.
1fedb88
to
33dcc8b
Compare
x/wasm-storage/keeper/filter.go
Outdated
//stdFilter struct { | ||
// Algo uint | ||
// JSONPath string | ||
// MaxSigma uint64 | ||
// NumberType uint8 | ||
//} |
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.
Remove unused code?
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.
We will implement std filter very soon. So left it here. If you feel we should remove it now and then reintroduce, please let me know.
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 missed some testing for the mode filtering.
x/wasm-storage/keeper/filter.go
Outdated
const ( | ||
None = iota | ||
Mode | ||
StdDeviation | ||
) |
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.
Let's create a type FilterType
?
type FilterType byte
const (
None FilterType = iota
Mode
StdDev
)
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.
Do we have any use case of the new type Filtertype as of now? If not, we don't have to complicate by introducing another type.
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 see what you are saying. I converted it to byte so that we can compare the first byte of tally inputs directly to these.
if tt.wantErr != nil { | ||
require.ErrorIs(t, err, tt.wantErr) | ||
return | ||
} |
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.
This only checks for an error when we expect an error
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.
And I think there is in fact an error here.
c015652
to
52973d4
Compare
x/wasm-storage/keeper/filter.go
Outdated
var rlpAsList []any | ||
if err := rlp.DecodeBytes(filterInput, &rlpAsList); err != nil { | ||
return nil, false, err | ||
} | ||
filteringAlgo, ok := rlpAsList[0].([]uint) | ||
if !ok || len(filteringAlgo) != 1 { | ||
return nil, false, errors.New("can not RLP decode algo type from filter input") | ||
} |
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.
Was confused about these lines. Why did you use RLP decoding here? I changed the code so that it just looks at the first byte. Let me know what you think.
return outliers, true, nil | ||
|
||
case filterMode: | ||
// TODO: Reactivate mode filter |
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.
Removed this for now - let's address this in a separate PR cc @DeshErBojhaa
None
filter type
Motivation
Filtering fro data request wasm reveals.
Explanation of Changes
Right now only NONE and MODE are implemented.
Testing
Unit test included.