-
Notifications
You must be signed in to change notification settings - Fork 17
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
container: allow to iterate over container list #300
container: allow to iterate over container list #300
Conversation
@@ -93,6 +95,32 @@ func _deploy(data interface{}, isUpdate bool) { | |||
if isUpdate { | |||
args := data.([]interface{}) | |||
common.CheckVersion(args[len(args)-1].(int)) | |||
|
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.
There has to be some check for the current contract version here, if it's >= some
this migration is not needed.
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.
Our current policy is that we remove this code after release and update "min updating from" versions in common
package. This way we can update contract multiple times, but do not have complex logic in _deploy
.
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.
Not very user-friendly, upgrading contracts multiple times in no fun especially given that some node versions work fine with some contract versions and don't work with others.
container/container_contract.go
Outdated
} | ||
|
||
func getAllContainers(ctx storage.Context) [][]byte { | ||
var list [][]byte | ||
list := [][]byte{} |
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.
what's the byte code diff with that lines?
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.
Should be none, which means that the change is not needed.
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 think empty var list [][]byte
returns [{"type":"Any"}]
on stack, while list := [][]byte{}
returns [{"type":"Array","value":[]}]
. Not sure it is related to the code, but still.
tests/container_test.go
Outdated
} | ||
require.ElementsMatch(t, expected, actual) | ||
}) | ||
t.Run("check with `iterate`", func(t *testing.T) { |
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.
t.Run("check with `iterate`", func(t *testing.T) { | |
t.Run("check with `containersOf`", func(t *testing.T) { |
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.
Fixed
Signed-off-by: Evgenii Stratonikov <[email protected]>
* origin/support/v0.16: common: bump version, do netmap migrations pre-0.16.0 netmap: migrate candidate states for pre-0.16.0 netmap: fix infinite loop in pre-0.16.0 migration code [#300] container: Allow to iterate over container list [#293] container: Add IterateContainerSizes method [#296] container: Increase default expiration time [#291] Debian packaging
Signed-off-by: Evgenii Stratonikov [email protected]