-
Notifications
You must be signed in to change notification settings - Fork 589
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
Wasm hooks E2E test & change intermediary address prefix #3937
Conversation
// co up two levels | ||
projectDir := filepath.Dir(filepath.Dir(wd)) | ||
fmt.Println(wd, projectDir) |
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.
// co up two levels | |
projectDir := filepath.Dir(filepath.Dir(wd)) | |
fmt.Println(wd, projectDir) | |
// go up two levels | |
projectDir := filepath.Dir(filepath.Dir(wd)) |
// Using code_id 1 because this is the only contract right now. This may need to change if more contracts are added | ||
contracts, err := nodeA.QueryContractsFromId(chainA.LatestCodeId) |
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 this comment can be removed now right?
if len(balance) == 0 { | ||
return false | ||
} | ||
return balance[0].Amount.Int64() == 10 |
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.
Where does 10 come from? Can this be not hard coded or does it make the most sense to do it this way?
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 this is from the ibs transfer call up above. +1 to have a variable that we can format into the ibc transfer command and use here
amount := totalFunds.(map[string]interface{})["amount"].(string) | ||
denom := totalFunds.(map[string]interface{})["denom"].(string) | ||
// check if denom contains "uosmo" | ||
return err == nil && amount == "10" && strings.Contains(denom, "ibc") |
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.
same question about 10
@@ -34,7 +34,7 @@ So we detail where we want to get each of these fields from: | |||
* Sender: We cannot trust the sender of an IBC packet, the counterparty chain has full ability to lie about it. | |||
We cannot risk this sender being confused for a particular user or module address on Osmosis. | |||
So we replace the sender with an account to represent the sender prefixed by the channel and a wasm module prefix. | |||
This is done by setting the sender to `Bech32(Hash("ibc-memo-action" || channelID || sender))`, where the channelId is the channel id on the local chain. | |||
This is done by setting the sender to `Bech32(Hash("ibc-wasm-hook-intermediaryg" || channelID || sender))`, where the channelId is the channel id on the local chain. |
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 there is a typo in "wasm-hook-intermediary" with the g at the end
@@ -0,0 +1,56 @@ | |||
package cli |
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.
can we use osmocli for this instead?
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 started looking into that and realized I didn't know how to use osmocli 😅, so in the interest of time, I just went with what I knew
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.
LGTM
contractAddr := contracts[0] | ||
|
||
validatorAddr := nodeB.GetWallet(initialization.ValidatorWalletName) | ||
fmt.Println("validatorAddr", validatorAddr) |
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.
fmt.Println("validatorAddr", validatorAddr) |
if len(balance) == 0 { | ||
return false | ||
} | ||
return balance[0].Amount.Int64() == 10 |
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 this is from the ibs transfer call up above. +1 to have a variable that we can format into the ibc transfer command and use here
|
||
// sender wasm addr | ||
senderBech32, err := ibchookskeeper.DeriveIntermediateSender("channel-0", validatorAddr, "osmo") | ||
fmt.Println("sender", senderBech32) |
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.
nit: I'm not sure if prints are helpful for debugging purposes. If so, can we change them to be logs. Logs format lines and test case info, making it easier to debug and also don't bypass testing package's output buffering
fmt.Println("sender", senderBech32) | |
s.T().Log("sender", senderBech32) |
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.
prints were a leftover from when I was debugging. Can be removed (or logged)
15*time.Second, | ||
10*time.Millisecond, | ||
) | ||
fmt.Println("response", response) |
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.
fmt.Println("response", response) | |
s.T().Log("response", response) |
* initial setup for manual and e2e tests * added cli for calculating the sender * tidy * added cleaner flags and better checks at the end * proper checks * cleanup * initial e2e tests * debugging * cleanup * tidy * remove import cycle * test cleanup * updated prefix * fix go test (cherry picked from commit 637f3f3) # Conflicts: # go.mod # go.sum # go.work.sum # tests/ibc-hooks/ibc_middleware_test.go # x/ibc-hooks/README.md # x/ibc-hooks/wasm_hook.go
* initial setup for manual and e2e tests * added cli for calculating the sender * tidy * added cleaner flags and better checks at the end * proper checks * cleanup * initial e2e tests * debugging * cleanup * tidy * remove import cycle * test cleanup * updated prefix * fix go test
* Add sender to wasm hooks (#3879) * added sender to wasm hooks * cleaner transfer. The module doesn't need to get the funds at any point * wasmhooks doesn't need an account anymore * using ibc hooks from this branch * added comment for account from when the upgrade happened * getting the prefix from the config * using address with prefix * updated ibc-hooks hash * updated sum files * updated spec * updaed go.mod to match main (bad merge) * removed unnecessary include * updated go.mod * updated go.mod * ibc-hooks mod change * external change * Wasm hooks E2E test & change intermediary address prefix (#3937) * initial setup for manual and e2e tests * added cli for calculating the sender * tidy * added cleaner flags and better checks at the end * proper checks * cleanup * initial e2e tests * debugging * cleanup * tidy * remove import cycle * test cleanup * updated prefix * fix go test * internal go mod change * external go mod change * go sum * document manual test script
What is the purpose of the change
Adds an e2e test to wasm hooks
Brief Changelog
Adds an e2e test to wasm hooks
Testing and Verifying
att tests pass
Documentation and Release Note
Unreleased
section inCHANGELOG.md
? (yes / no)x/<module>/spec/
) / Osmosis docs repo / not documented)