diff --git a/packages/isc/requestimpl.go b/packages/isc/requestimpl.go index 9f8c04ec13..787da9d613 100644 --- a/packages/isc/requestimpl.go +++ b/packages/isc/requestimpl.go @@ -22,6 +22,14 @@ const ( requestKindOffLedgerEVMCall ) +func IsOffledgerKind(b byte) bool { + switch RequestKind(b) { + case requestKindOffLedgerISC, requestKindOffLedgerEVMTx: + return true + } + return false +} + func RequestFromBytes(data []byte) (Request, error) { rr := rwutil.NewBytesReader(data) return RequestFromReader(rr), rr.Err diff --git a/packages/webapi/services/offledger.go b/packages/webapi/services/offledger.go index c9f149dc19..95449c8210 100644 --- a/packages/webapi/services/offledger.go +++ b/packages/webapi/services/offledger.go @@ -26,6 +26,10 @@ func NewOffLedgerService(chainService interfaces.ChainService, networkProvider p } func (c *OffLedgerService) ParseRequest(binaryRequest []byte) (isc.OffLedgerRequest, error) { + // check offledger kind (avoid deserialization otherwise) + if !isc.IsOffledgerKind(binaryRequest[0]) { + return nil, errors.New("error parsing request: off-ledger request expected") + } request, err := isc.RequestFromBytes(binaryRequest) if err != nil { return nil, errors.New("error parsing request from payload") diff --git a/tools/wasp-cli/chain/governance.go b/tools/wasp-cli/chain/governance.go index 5ef85f7ebd..6f40918e1e 100644 --- a/tools/wasp-cli/chain/governance.go +++ b/tools/wasp-cli/chain/governance.go @@ -81,7 +81,7 @@ func initDisableFeePolicyCmd() *cobra.Command { var chain string cmd := &cobra.Command{ - Use: "disable-gas-policy", + Use: "disable-feepolicy", Short: "set token charged by each gas to free.", Run: func(cmd *cobra.Command, args []string) { node = waspcmd.DefaultWaspNodeFallback(node)