-
Notifications
You must be signed in to change notification settings - Fork 9
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: apply the wasm module of lbm-sdk #1
Conversation
app/app.go
Outdated
for acc := range maccPerms { | ||
blockedAddrs[authtypes.NewModuleAddress(acc).String()] = !allowedReceivingModAcc[acc] | ||
} |
Check warning
Code scanning / CodeQL
Iteration over map
@@ -239,9 +306,9 @@ | |||
} | |||
|
|||
func (k Keeper) instantiate(ctx sdk.Context, codeID uint64, creator, admin sdk.AccAddress, initMsg []byte, label string, deposit sdk.Coins, authZ AuthorizationPolicy) (sdk.AccAddress, []byte, error) { | |||
defer telemetry.MeasureSince(time.Now(), "wasm", "contract", "instantiate") | |||
defer func(begin time.Time) { k.metrics.InstantiateElapsedTimes.Observe(time.Since(begin).Seconds()) }(time.Now()) |
Check warning
Code scanning / CodeQL
Calling the system time
@@ -336,13 +404,16 @@ | |||
|
|||
// Execute executes the contract instance | |||
func (k Keeper) execute(ctx sdk.Context, contractAddress sdk.AccAddress, caller sdk.AccAddress, msg []byte, coins sdk.Coins) ([]byte, error) { | |||
defer telemetry.MeasureSince(time.Now(), "wasm", "contract", "execute") | |||
defer func(begin time.Time) { k.metrics.ExecuteElapsedTimes.Observe(time.Since(begin).Seconds()) }(time.Now()) |
Check warning
Code scanning / CodeQL
Calling the system time
@@ -378,14 +450,17 @@ | |||
} | |||
|
|||
func (k Keeper) migrate(ctx sdk.Context, contractAddress sdk.AccAddress, caller sdk.AccAddress, newCodeID uint64, msg []byte, authZ AuthorizationPolicy) ([]byte, error) { | |||
defer telemetry.MeasureSince(time.Now(), "wasm", "contract", "migrate") | |||
migrateSetupCosts := k.gasRegister.InstantiateContractCosts(k.IsPinnedCode(ctx, newCodeID), len(msg)) | |||
defer func(begin time.Time) { k.metrics.MigrateElapsedTimes.Observe(time.Since(begin).Seconds()) }(time.Now()) |
Check warning
Code scanning / CodeQL
Calling the system time
@@ -451,21 +527,22 @@ | |||
// another native Go module directly, or on-chain governance (if sudo proposals are enabled). Thus, the keeper doesn't | |||
// place any access controls on it, that is the responsibility or the app developer (who passes the wasm.Keeper in app.go) | |||
func (k Keeper) Sudo(ctx sdk.Context, contractAddress sdk.AccAddress, msg []byte) ([]byte, error) { | |||
defer telemetry.MeasureSince(time.Now(), "wasm", "contract", "sudo") | |||
defer func(begin time.Time) { k.metrics.SudoElapsedTimes.Observe(time.Since(begin).Seconds()) }(time.Now()) |
Check warning
Code scanning / CodeQL
Calling the system time
@@ -607,7 +688,7 @@ | |||
|
|||
// QuerySmart queries the smart contract itself. | |||
func (k Keeper) QuerySmart(ctx sdk.Context, contractAddr sdk.AccAddress, req []byte) ([]byte, error) { | |||
defer telemetry.MeasureSince(time.Now(), "wasm", "contract", "query-smart") | |||
defer func(begin time.Time) { k.metrics.QuerySmartElapsedTimes.Observe(time.Since(begin).Seconds()) }(time.Now()) |
Check warning
Code scanning / CodeQL
Calling the system time
@@ -661,7 +743,7 @@ | |||
|
|||
// QueryRaw returns the contract's state for give key. Returns `nil` when key is `nil`. | |||
func (k Keeper) QueryRaw(ctx sdk.Context, contractAddress sdk.AccAddress, key []byte) []byte { | |||
defer telemetry.MeasureSince(time.Now(), "wasm", "contract", "query-raw") | |||
defer func(begin time.Time) { k.metrics.QueryRawElapsedTimes.Observe(time.Since(begin).Seconds()) }(time.Now()) |
Check warning
Code scanning / CodeQL
Calling the system time
ef4308e
to
f26c9ce
Compare
70ec1ff
to
485fef4
Compare
.github/workflows/lint.yml
Outdated
version: v1.50.1 | ||
args: --timeout 10m | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
if: env.GIT_DIFF |
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.
want a new line in the tail
.github/workflows/test.yml
Outdated
run: | | ||
cd ./benchmarks | ||
go test -bench . | ||
if: env.GIT_DIFF |
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.
want a new line in the tail
|
||
message EvidenceList { | ||
repeated Evidence evidence = 1 [(gogoproto.nullable) = false]; | ||
} |
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: no new line at end of file
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 added.
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
Apply all the wasm modules changes of lbm-sdk.
The
x/wasm
module is copied from the3bdcb6ffe01c81615bedb777ca0e039cc46ef00c
commit hash in lbm-sdk. And some parts is modified to fit properly. The modified part can be seen in the differences below.The difference with lbm-sdk/x/wasm
flagProposalType
andcli.FlagProposal
in gov tx cli (x/wasm/client/cli/gov_tx.go
). This flags was added in cosmwasm/wasmd.ProposalStoreCodeCmd()
ProposalInstantiateContractCmd()
ProposalMigrateContractCmd()
ProposalExecuteContractCmd()
ProposalSudoContractCmd()
ProposalUpdateContractAdminCmd()
ProposalClearContractAdminCmd()
ProposalPinCodesCmd()
ProposalUnpinCodesCmd()
ProposalUpdateInstantiateConfigCmd()
ReadFileWithSizeLimit
function of lbm-sdk's internal file underx/wasm/client/cli/os
directory. This is because functions insideinternal
directory cannot be imported.Update process
x/wasm
in lbm-sdk. This lbm-sdk's PR imports current PR temporary and replaceline/wasmd
after merging current PR.line/wasmd
fromzemyblue/lbm-sdk
toline/lbm-sdk
(via another PR in this repo)