Skip to content

Commit

Permalink
Update contract' gas to Weight type
Browse files Browse the repository at this point in the history
  • Loading branch information
jasl committed Nov 8, 2022
1 parent 5c81e4f commit 4db1d78
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 56 deletions.
8 changes: 4 additions & 4 deletions packages/api-contract/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

import type { ApiBase } from '@polkadot/api/base';
import type { ApiTypes } from '@polkadot/api/types';
import type { Text, u64 } from '@polkadot/types';
import type { ContractExecResultResult, ContractSelector, StorageDeposit, WeightV2 } from '@polkadot/types/interfaces';
import type { Text } from '@polkadot/types';
import type { ContractExecResultResult, ContractSelector, StorageDeposit, Weight } from '@polkadot/types/interfaces';
import type { Codec, TypeDef } from '@polkadot/types/types';
import type { BN } from '@polkadot/util';
import type { Abi } from '.';
Expand Down Expand Up @@ -55,8 +55,8 @@ export interface InterfaceContractCalls {

export interface ContractCallOutcome {
debugMessage: Text;
gasConsumed: u64;
gasRequired: u64;
gasConsumed: Weight;
gasRequired: Weight;
output: Codec | null;
result: ContractExecResultResult;
storageDeposit: StorageDeposit;
Expand Down
52 changes: 26 additions & 26 deletions packages/types/src/interfaces/contracts/definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default {
origin: 'AccountId',
dest: 'AccountId',
value: 'Balance',
gasLimit: 'u64',
gasLimit: 'Weight',
storageDepositLimit: 'Option<Balance>',
inputData: 'Bytes'
},
Expand Down Expand Up @@ -81,8 +81,8 @@ export default {
result: 'ContractExecResultResult'
},
ContractExecResult: {
gasConsumed: 'u64',
gasRequired: 'u64',
gasConsumed: 'Weight',
gasRequired: 'Weight',
storageDeposit: 'StorageDeposit',
debugMessage: 'Text',
result: 'ContractExecResultResult'
Expand Down Expand Up @@ -117,7 +117,7 @@ export default {
flags: 'ContractReturnFlags',
data: 'Bytes'
},
Gas: 'u64',
Gas: 'Weight',
HostFnWeightsTo264: {
caller: 'Weight',
address: 'Weight',
Expand Down Expand Up @@ -222,7 +222,7 @@ export default {
InstantiateRequestV1: {
origin: 'AccountId',
value: 'Balance',
gasLimit: 'Gas',
gasLimit: 'u64',
code: 'Bytes',
data: 'Bytes',
salt: 'Bytes'
Expand Down Expand Up @@ -251,8 +251,8 @@ export default {
ContractInstantiateResultTo299: 'Result<InstantiateReturnValueOk, Null>',
ContractInstantiateResult: {
_fallback: 'ContractInstantiateResultTo299',
gasConsumed: 'u64',
gasRequired: 'u64',
gasConsumed: 'Weight',
gasRequired: 'Weight',
storageDeposit: 'StorageDeposit',
debugMessage: 'Text',
result: 'InstantiateReturnValue'
Expand Down Expand Up @@ -358,15 +358,15 @@ export default {
},
ScheduleTo212: {
version: 'u32',
putCodePerByteCost: 'Gas',
growMemCost: 'Gas',
regularOpCost: 'Gas',
returnDataPerByteCost: 'Gas',
eventDataPerByteCost: 'Gas',
eventPerTopicCost: 'Gas',
eventBaseCost: 'Gas',
sandboxDataReadCost: 'Gas',
sandboxDataWriteCost: 'Gas',
putCodePerByteCost: 'u64',
growMemCost: 'u64',
regularOpCost: 'u64',
returnDataPerByteCost: 'u64',
eventDataPerByteCost: 'u64',
eventPerTopicCost: 'u64',
eventBaseCost: 'u64',
sandboxDataReadCost: 'u64',
sandboxDataWriteCost: 'u64',
maxEventTopics: 'u32',
maxStackHeight: 'u32',
maxMemoryPages: 'u32',
Expand All @@ -375,16 +375,16 @@ export default {
},
ScheduleTo258: {
version: 'u32',
putCodePerByteCost: 'Gas',
growMemCost: 'Gas',
regularOpCost: 'Gas',
returnDataPerByteCost: 'Gas',
eventDataPerByteCost: 'Gas',
eventPerTopicCost: 'Gas',
eventBaseCost: 'Gas',
sandboxDataReadCost: 'Gas',
sandboxDataWriteCost: 'Gas',
transferCost: 'Gas',
putCodePerByteCost: 'u64',
growMemCost: 'u64',
regularOpCost: 'u64',
returnDataPerByteCost: 'u64',
eventDataPerByteCost: 'u64',
eventPerTopicCost: 'u64',
eventBaseCost: 'u64',
sandboxDataReadCost: 'u64',
sandboxDataWriteCost: 'u64',
transferCost: 'u64',
maxEventTopics: 'u32',
maxStackHeight: 'u32',
maxMemoryPages: 'u32',
Expand Down
52 changes: 26 additions & 26 deletions packages/types/src/interfaces/contracts/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ export interface ContractCallRequest extends Struct {
readonly origin: AccountId;
readonly dest: AccountId;
readonly value: Balance;
readonly gasLimit: u64;
readonly gasLimit: Gas;
readonly storageDepositLimit: Option<Balance>;
readonly inputData: Bytes;
}

/** @name ContractExecResult */
export interface ContractExecResult extends Struct {
readonly gasConsumed: u64;
readonly gasRequired: u64;
readonly gasConsumed: Gas;
readonly gasRequired: Gas;
readonly storageDeposit: StorageDeposit;
readonly debugMessage: Text;
readonly result: ContractExecResultResult;
Expand Down Expand Up @@ -139,8 +139,8 @@ export interface ContractInfo extends Enum {

/** @name ContractInstantiateResult */
export interface ContractInstantiateResult extends Struct {
readonly gasConsumed: u64;
readonly gasRequired: u64;
readonly gasConsumed: Gas;
readonly gasRequired: Gas;
readonly storageDeposit: StorageDeposit;
readonly debugMessage: Text;
readonly result: InstantiateReturnValue;
Expand Down Expand Up @@ -181,7 +181,7 @@ export interface ExecReturnValue extends Struct {
}

/** @name Gas */
export interface Gas extends u64 {}
export interface Gas extends Weight {}

/** @name HostFnWeights */
export interface HostFnWeights extends Struct {
Expand Down Expand Up @@ -303,7 +303,7 @@ export interface InstantiateRequest extends Struct {
export interface InstantiateRequestV1 extends Struct {
readonly origin: AccountId;
readonly value: Balance;
readonly gasLimit: Gas;
readonly gasLimit: u64;
readonly code: Bytes;
readonly data: Bytes;
readonly salt: Bytes;
Expand Down Expand Up @@ -452,15 +452,15 @@ export interface Schedule extends Struct {
/** @name ScheduleTo212 */
export interface ScheduleTo212 extends Struct {
readonly version: u32;
readonly putCodePerByteCost: Gas;
readonly growMemCost: Gas;
readonly regularOpCost: Gas;
readonly returnDataPerByteCost: Gas;
readonly eventDataPerByteCost: Gas;
readonly eventPerTopicCost: Gas;
readonly eventBaseCost: Gas;
readonly sandboxDataReadCost: Gas;
readonly sandboxDataWriteCost: Gas;
readonly putCodePerByteCost: u64;
readonly growMemCost: u64;
readonly regularOpCost: u64;
readonly returnDataPerByteCost: u64;
readonly eventDataPerByteCost: u64;
readonly eventPerTopicCost: u64;
readonly eventBaseCost: u64;
readonly sandboxDataReadCost: u64;
readonly sandboxDataWriteCost: u64;
readonly maxEventTopics: u32;
readonly maxStackHeight: u32;
readonly maxMemoryPages: u32;
Expand All @@ -471,16 +471,16 @@ export interface ScheduleTo212 extends Struct {
/** @name ScheduleTo258 */
export interface ScheduleTo258 extends Struct {
readonly version: u32;
readonly putCodePerByteCost: Gas;
readonly growMemCost: Gas;
readonly regularOpCost: Gas;
readonly returnDataPerByteCost: Gas;
readonly eventDataPerByteCost: Gas;
readonly eventPerTopicCost: Gas;
readonly eventBaseCost: Gas;
readonly sandboxDataReadCost: Gas;
readonly sandboxDataWriteCost: Gas;
readonly transferCost: Gas;
readonly putCodePerByteCost: u64;
readonly growMemCost: u64;
readonly regularOpCost: u64;
readonly returnDataPerByteCost: u64;
readonly eventDataPerByteCost: u64;
readonly eventPerTopicCost: u64;
readonly eventBaseCost: u64;
readonly sandboxDataReadCost: u64;
readonly sandboxDataWriteCost: u64;
readonly transferCost: u64;
readonly maxEventTopics: u32;
readonly maxStackHeight: u32;
readonly maxMemoryPages: u32;
Expand Down

0 comments on commit 4db1d78

Please sign in to comment.