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

new coreum_wasm_sdk features (version upgrade) and integration tests #536

Merged
merged 25 commits into from
Jun 29, 2023

Conversation

keyleu
Copy link
Collaborator

@keyleu keyleu commented Jun 26, 2023

This change is Reviewable

@keyleu keyleu requested a review from a team as a code owner June 26, 2023 14:21
@keyleu keyleu requested review from dzmitryhil, vertex451, miladz68 and ysv and removed request for a team June 26, 2023 14:21
Copy link
Contributor

@dzmitryhil dzmitryhil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 27 files reviewed, 1 unresolved discussion (waiting on @keyleu, @miladz68, @silverspase, and @ysv)


integration-tests/modules/testdata/wasm/ft/package/coreum-wasm-sdk/.gitignore line 1 at r1 (raw file):

.idea

It's possible to import the crate from the git, that's how you can tests that the SDK is valid. Could you please do it and remove the copy, since not clear now what will be left.

Copy link
Contributor

@dzmitryhil dzmitryhil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 27 files reviewed, 2 unresolved discussions (waiting on @keyleu, @miladz68, @silverspase, and @ysv)

a discussion (no related file):
IMO it's a bad idea to mix up those 2 PRs. Not it is'n clear what to review :-(
It would be nice to separate them.


Copy link
Collaborator Author

@keyleu keyleu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 27 files reviewed, 2 unresolved discussions (waiting on @dzmitryhil, @miladz68, @silverspase, and @ysv)

a discussion (no related file):

Previously, dzmitryhil (Dzmitry Hil) wrote…

IMO it's a bad idea to mix up those 2 PRs. Not it is'n clear what to review :-(
It would be nice to separate them.

base64 is only like 2 lines of code in query.go



integration-tests/modules/testdata/wasm/ft/package/coreum-wasm-sdk/.gitignore line 1 at r1 (raw file):

Previously, dzmitryhil (Dzmitry Hil) wrote…

It's possible to import the crate from the git, that's how you can tests that the SDK is valid. Could you please do it and remove the copy, since not clear now what will be left.

ok will do that

Copy link
Collaborator Author

@keyleu keyleu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 27 files reviewed, 2 unresolved discussions (waiting on @dzmitryhil, @miladz68, @silverspase, and @ysv)

a discussion (no related file):

Previously, keyleu (Keyne) wrote…

base64 is only like 2 lines of code in query.go

still want me to separate them?


Copy link
Contributor

@dzmitryhil dzmitryhil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 27 files reviewed, 2 unresolved discussions (waiting on @keyleu, @miladz68, @silverspase, and @ysv)

a discussion (no related file):

Previously, keyleu (Keyne) wrote…

still want me to separate them?

But better to split it anyways, for the git history and PRs consistency.


@keyleu keyleu changed the title base64 changes to read / write from wasm handler and integration tests for new coreum_wasm_sdk features new coreum_wasm_sdk features (version upgrade) and integration tests Jun 27, 2023
Copy link
Collaborator Author

@keyleu keyleu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 27 files reviewed, 2 unresolved discussions (waiting on @dzmitryhil, @miladz68, @silverspase, and @ysv)

a discussion (no related file):

Previously, dzmitryhil (Dzmitry Hil) wrote…

But better to split it anyways, for the git history and PRs consistency.

done, removed the base64 changes from here and separated in different PR


Copy link
Contributor

@dzmitryhil dzmitryhil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 27 files reviewed, 6 unresolved discussions (waiting on @keyleu, @miladz68, @silverspase, and @ysv)


integration-tests/modules/contract.go line 1 at r3 (raw file):

package modules

This file make sence, only if it's located in the modules/testdata/wasm, but if you do it that way update it for IBC tests as well. But not sure that this file is needed at all.


integration-tests/modules/contract.go line 14 at r3 (raw file):

	//nolint
	//go:embed testdata/wasm/ft/artifacts/ft.wasm
	FTWASM []byte

Why the FT is uppercase but bft is lower?


integration-tests/modules/wasm_test.go line 1172 at r3 (raw file):

	royaltyRate := sdk.MustNewDecFromStr("0.1")
	dataString := "data"
	databytes, err := base64.StdEncoding.DecodeString(dataString)

Rename that var plz to dataBase64Bytes or similar since it collides with the dataBytes variable.


integration-tests/modules/wasm_test.go line 1172 at r3 (raw file):

	royaltyRate := sdk.MustNewDecFromStr("0.1")
	dataString := "data"
	databytes, err := base64.StdEncoding.DecodeString(dataString)

Not clear why do you need to Decode the string here. If the fix with the decode/encode on the handler level is correct no extra decoding is needed. Right?

Copy link
Collaborator Author

@keyleu keyleu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 28 files reviewed, 6 unresolved discussions (waiting on @dzmitryhil, @miladz68, @silverspase, and @ysv)


integration-tests/modules/contract.go line 1 at r3 (raw file):

Previously, dzmitryhil (Dzmitry Hil) wrote…

This file make sence, only if it's located in the modules/testdata/wasm, but if you do it that way update it for IBC tests as well. But not sure that this file is needed at all.

Will modify as agreed


integration-tests/modules/contract.go line 14 at r3 (raw file):

Previously, dzmitryhil (Dzmitry Hil) wrote…

Why the FT is uppercase but bft is lower?

like we discussed, it's for upgrades.


integration-tests/modules/wasm_test.go line 1172 at r3 (raw file):

Previously, dzmitryhil (Dzmitry Hil) wrote…

Rename that var plz to dataBase64Bytes or similar since it collides with the dataBytes variable.

will move to the other PR and rename


integration-tests/modules/wasm_test.go line 1172 at r3 (raw file):

Previously, dzmitryhil (Dzmitry Hil) wrote…

Not clear why do you need to Decode the string here. If the fix with the decode/encode on the handler level is correct no extra decoding is needed. Right?

It's for the test class that we compare with, like discussed.

dzmitryhil
dzmitryhil previously approved these changes Jun 27, 2023
Copy link
Contributor

@dzmitryhil dzmitryhil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 29 files reviewed, all discussions resolved (waiting on @miladz68, @silverspase, and @ysv)

Copy link
Collaborator Author

@keyleu keyleu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @miladz68, @silverspase, @wojtek-coreum, and @ysv)


integration-tests/upgrade/ft.go line 28 at r8 (raw file):

Previously, wojtek-coreum (Wojtek) wrote…

this comment might be removed

done

wojtek-coreum
wojtek-coreum previously approved these changes Jun 28, 2023
Copy link
Collaborator

@wojtek-coreum wojtek-coreum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 1 files at r9, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @miladz68, @silverspase, and @ysv)

Copy link
Contributor

@miladz68 miladz68 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 3 of 4 files at r7, 4 of 5 files at r8, 3 of 4 files at r10, all commit messages.
Reviewable status: 31 of 32 files reviewed, 3 unresolved discussions (waiting on @silverspase, @wojtek-coreum, and @ysv)

miladz68
miladz68 previously approved these changes Jun 28, 2023
Copy link
Contributor

@miladz68 miladz68 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 4 files at r10.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @silverspase and @ysv)

dzmitryhil
dzmitryhil previously approved these changes Jun 28, 2023
Copy link
Contributor

@dzmitryhil dzmitryhil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 8 of 27 files at r1, 10 of 12 files at r2, 1 of 1 files at r3, 2 of 5 files at r5, 3 of 4 files at r7, 4 of 5 files at r8, 4 of 4 files at r10, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @silverspase and @ysv)

wojtek-coreum
wojtek-coreum previously approved these changes Jun 28, 2023
Copy link
Collaborator

@wojtek-coreum wojtek-coreum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 4 of 4 files at r10, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @silverspase and @ysv)

* Base64 encoding/decoding

* Move data

* Add data to compare decode for tests

* Encode before

* Added data generation
@keyleu keyleu dismissed stale reviews from wojtek-coreum, miladz68, and dzmitryhil via dfbb3df June 28, 2023 16:05
Copy link
Contributor

@dzmitryhil dzmitryhil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 28 of 32 files reviewed, 1 unresolved discussion (waiting on @keyleu, @miladz68, @silverspase, @wojtek-coreum, and @ysv)


integration-tests/modules/wasm_test.go line 1177 at r11 (raw file):

		data[i] = uint8(i)
	}
	encodedData := base64.StdEncoding.EncodeToString(data)

You don't need the for. Why you do the make([]byte, 256) it will fill the bytes slice with the default byte values.

Copy link
Contributor

@dzmitryhil dzmitryhil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 28 of 32 files reviewed, all discussions resolved (waiting on @miladz68, @silverspase, @wojtek-coreum, and @ysv)

Copy link
Collaborator

@wojtek-coreum wojtek-coreum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 4 of 4 files at r11, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @keyleu, @silverspase, and @ysv)


integration-tests/upgrade/ft.go line 170 at r11 (raw file):

		},
		BurnRate:           burnRate.String(),
		SendCommissionRate: sendCommissionRate.String(),

I don't think it should be needed. We have many unit and integration tests where those values are skipped and they work.


integration-tests/upgrade/ft.go line 212 at r11 (raw file):

		InitialAmount:      issuanceAmount.String(),
		Description:        "my wasm fungible token",
		BurnRate:           burnRate.String(),

ditto

Copy link
Collaborator Author

@keyleu keyleu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @silverspase, @wojtek-coreum, and @ysv)


integration-tests/upgrade/ft.go line 170 at r11 (raw file):

Previously, wojtek-coreum (Wojtek) wrote…

I don't think it should be needed. We have many unit and integration tests where those values are skipped and they work.

If you don't add them you get an error, they are not optional.


integration-tests/upgrade/ft.go line 212 at r11 (raw file):

Previously, wojtek-coreum (Wojtek) wrote…

ditto

same as above

Copy link
Collaborator Author

@keyleu keyleu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @silverspase, @wojtek-coreum, and @ysv)


integration-tests/modules/wasm_test.go line 1177 at r11 (raw file):

Previously, dzmitryhil (Dzmitry Hil) wrote…

You don't need the for. Why you do the make([]byte, 256) it will fill the bytes slice with the default byte values.

without the for it provides the same byte value for each element in the vector (0x0). What I want is all the possible byte values.

Copy link
Collaborator Author

@keyleu keyleu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @silverspase, @wojtek-coreum, and @ysv)


integration-tests/upgrade/ft.go line 170 at r11 (raw file):

Previously, keyleu (Keyne) wrote…

If you don't add them you get an error, they are not optional.

The error comes from the wasm handler. It throws an ABCI error.

Copy link
Contributor

@miladz68 miladz68 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 4 of 4 files at r11, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @silverspase, @wojtek-coreum, and @ysv)

Copy link
Collaborator

@wojtek-coreum wojtek-coreum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @silverspase and @ysv)


integration-tests/upgrade/ft.go line 170 at r11 (raw file):

Previously, keyleu (Keyne) wrote…

The error comes from the wasm handler. It throws an ABCI error.

ah I see, because we pass that message to smart contract to be executed from there. Okay.

Copy link
Collaborator

@wojtek-coreum wojtek-coreum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @silverspase and @ysv)

@keyleu keyleu merged commit 0891258 into master Jun 29, 2023
@keyleu keyleu deleted the keyne/wasm-token-upgrade-and-base64-decode-and-encode branch June 29, 2023 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants