-
Notifications
You must be signed in to change notification settings - Fork 825
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
[EVM] add wasmd
precompile
#1139
Conversation
for name, m := range newAbi.Methods { | ||
switch name { | ||
case "instantiate": | ||
p.InstantiateID = m.ID | ||
case "execute": | ||
p.ExecuteID = m.ID | ||
case "query": | ||
p.QueryID = m.ID | ||
} | ||
} |
Check warning
Code scanning / CodeQL
Iteration over map
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## evm #1139 +/- ##
==========================================
- Coverage 65.45% 65.34% -0.11%
==========================================
Files 323 325 +2
Lines 20578 20742 +164
==========================================
+ Hits 13469 13554 +85
- Misses 6417 6490 +73
- Partials 692 698 +6
|
@@ -193,46 +191,3 @@ func TestGetStorageAt(t *testing.T) { | |||
}) | |||
} | |||
} | |||
|
|||
func TestGetProof(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.
why was this deleted?
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 was a bug in how stores in tests were initialized that were fixed in this PR, and apparently GetProof would only work with the presence of that bug, so GetProof is in reality broken. I've added a comment in GetProof to fix it in a later PR given this one is already too large.
evmStoreKey := sdk.NewKVStoreKey(types.StoreKey) | ||
authStoreKey := sdk.NewKVStoreKey(authtypes.StoreKey) | ||
bankStoreKey := sdk.NewKVStoreKey(banktypes.StoreKey) | ||
stakingStoreKey := sdk.NewKVStoreKey(stakingtypes.StoreKey) | ||
keyParams := sdk.NewKVStoreKey(typesparams.StoreKey) | ||
tKeyParams := sdk.NewTransientStoreKey(typesparams.TStoreKey) |
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.
why are these no longer 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.
they are initialized more properly via testApp := Setup(false)
above
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.
very cool, LGTM!
return nil | ||
} | ||
|
||
// This function modifies global variable in `vm` module. It should only be called once |
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 we follow a singleton pattern here to ensure it's only initialized once (or something like baseapp.sealed where it panics if called multiple times)?
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.
made it panic if already initialized
require.Nil(t, err) | ||
require.Equal(t, 1, len(outputs)) | ||
require.Equal(t, "{\"message\":\"query test\"}", string(outputs[0].([]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.
thoughts on adding more test cases around failure/edge cases? Most of these look happy path, and the added tests would help ensure wasmd.go doesn't have different behavior when we modify
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.
yeah we should
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.
added
d0547aa
to
01d12c7
Compare
Describe your changes and provide context
Add a
wasmd
precompile that allows EVM contracts to access the following CosmWasm functions for any CW contract:instantiate
execute
query
Testing performed to validate your change
unit test