Skip to content

Commit a334a98

Browse files
jacogrwoss
authored andcommitted
Update Scheduler (polkadot-js#2696)
1 parent 5b0f52f commit a334a98

File tree

4 files changed

+118
-96
lines changed

4 files changed

+118
-96
lines changed

packages/api/src/augment/tx.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ declare module '@polkadot/api/types/submittable' {
175175
*
176176
* The schedule must have a greater version than the stored schedule.
177177
**/
178-
updateSchedule: AugmentedSubmittable<(schedule: Schedule | { version?: any; opCostGrowMem?: any; opCostRegular?: any; apiCostCaller?: any; apiCostAddress?: any; apiCostGasLeft?: any; apiCostBalance?: any; apiCostValueTransferred?: any; apiCostMinimumBalance?: any; apiCostTombstoneDeposit?: any; apiCostRentAllowance?: any; apiCostBlockNumber?: any; apiCostNow?: any; apiCostWeightToFee?: any; apiCostGas?: any; apiCostInput?: any; apiCostInputPerByte?: any; apiCostReturn?: any; apiCostReturnPerByte?: any; apiCostTerminate?: any; apiCostRestoreTo?: any; apiCostRestoreToPer_delta?: any; apiCostRandom?: any; apiCostDepositEvent?: any; apiCostDepositEventPerTopic?: any; apiCostDepositEventPerByte?: any; apiCostSetRentAllowance?: any; apiCostSetStorage?: any; apiCostSetStoragePerByte?: any; apiCostClearStorage?: any; apiCostGetStorage?: any; apiCostGetStoragePerByte?: any; apiCostTransfer?: any; apiCostCall?: any; apiCostCallTransferSurcharge?: any; apiCostCallPerInputByte?: any; apiCostCallPerOutputByte?: any; apiCostInstantiate?: any; apiCostInstantiatePerInputByte?: any; apiCostInstantiatePerOutputByte?: any; apiCostHashSha2256?: any; apiCostHashSha2256PerByte?: any; apiCostHashKeccak256?: any; apiCostHashKeccak256PerByte?: any; apiCostHashBlake2256?: any; apiCostHashBlake2256PerByte?: any; apiCostHashBlake2128?: any; apiCostHashBlake2128PerByte?: any; enablePrintln?: any; maxEventTopics?: any; maxStackHeight?: any; maxMemoryPages?: any; maxTableSize?: any; maxSubjectLen?: any; maxCodeSize?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
178+
updateSchedule: AugmentedSubmittable<(schedule: Schedule | { version?: any; instructionWeights?: any; hostFnWeights?: any; enablePrintln?: any; maxEventTopics?: any; maxStackHeight?: any; maxMemoryPages?: any; maxTableSize?: any; maxSubjectLen?: any; maxCodeSize?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
179179
};
180180
council: {
181181
[key: string]: SubmittableExtrinsicFunction<ApiType>;

packages/types/src/augment/registry.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { PrefixedStorageKey } from '@polkadot/types/interfaces/childstate';
1414
import { EthereumAddress, StatementKind } from '@polkadot/types/interfaces/claims';
1515
import { CollectiveOrigin, MemberCount, ProposalIndex, Votes, VotesTo230 } from '@polkadot/types/interfaces/collective';
1616
import { AuthorityId, RawVRFOutput } from '@polkadot/types/interfaces/consensus';
17-
import { AliveContractInfo, CodeHash, ContractCallRequest, ContractExecResult, ContractExecResultSuccess, ContractExecResultSuccessTo255, ContractExecResultTo255, ContractInfo, ContractStorageKey, Gas, PrefabWasmModule, PrefabWasmModuleReserved, Schedule, ScheduleTo212, ScheduleTo258, SeedOf, TombstoneContractInfo, TrieId } from '@polkadot/types/interfaces/contracts';
17+
import { AliveContractInfo, CodeHash, ContractCallRequest, ContractExecResult, ContractExecResultSuccess, ContractExecResultSuccessTo255, ContractExecResultTo255, ContractInfo, ContractStorageKey, Gas, HostFnWeights, InstructionWeights, PrefabWasmModule, PrefabWasmModuleReserved, Schedule, ScheduleTo212, ScheduleTo258, SeedOf, TombstoneContractInfo, TrieId } from '@polkadot/types/interfaces/contracts';
1818
import { AccountVote, AccountVoteSplit, AccountVoteStandard, Conviction, Delegations, PreimageStatus, PreimageStatusAvailable, PriorLock, PropIndex, Proposal, ProxyState, ReferendumIndex, ReferendumInfo, ReferendumInfoFinished, ReferendumInfoTo239, ReferendumStatus, Tally, Voting, VotingDelegating, VotingDirect, VotingDirectVote } from '@polkadot/types/interfaces/democracy';
1919
import { ApprovalFlag, DefunctVoter, Renouncing, SetIndex, Vote, VoteIndex, VoteThreshold, VoterInfo } from '@polkadot/types/interfaces/elections';
2020
import { CreatedBlock, ImportedAux } from '@polkadot/types/interfaces/engine';
@@ -498,6 +498,12 @@ declare module '@polkadot/types/types/registry' {
498498
'Compact<Gas>': Compact<Gas>;
499499
'Option<Gas>': Option<Gas>;
500500
'Vec<Gas>': Vec<Gas>;
501+
HostFnWeights: HostFnWeights;
502+
'Option<HostFnWeights>': Option<HostFnWeights>;
503+
'Vec<HostFnWeights>': Vec<HostFnWeights>;
504+
InstructionWeights: InstructionWeights;
505+
'Option<InstructionWeights>': Option<InstructionWeights>;
506+
'Vec<InstructionWeights>': Vec<InstructionWeights>;
501507
PrefabWasmModule: PrefabWasmModule;
502508
'Option<PrefabWasmModule>': Option<PrefabWasmModule>;
503509
'Vec<PrefabWasmModule>': Vec<PrefabWasmModule>;

packages/types/src/interfaces/contracts/definitions.ts

Lines changed: 53 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,57 @@ export default {
107107
},
108108
ContractStorageKey: '[u8; 32]',
109109
Gas: 'u64',
110+
HostFnWeights: {
111+
caller: 'Weight',
112+
address: 'Weight',
113+
gasLeft: 'Weight',
114+
balance: 'Weight',
115+
valueTransferred: 'Weight',
116+
minimumBalance: 'Weight',
117+
tombstoneDeposit: 'Weight',
118+
rentAllowance: 'Weight',
119+
blockNumber: 'Weight',
120+
now: 'Weight',
121+
weightToFee: 'Weight',
122+
gas: 'Weight',
123+
input: 'Weight',
124+
inputPerByte: 'Weight',
125+
return: 'Weight',
126+
returnPerByte: 'Weight',
127+
terminate: 'Weight',
128+
restoreTo: 'Weight',
129+
restoreToPerDelta: 'Weight',
130+
random: 'Weight',
131+
depositEvent: 'Weight',
132+
depositEventPerTopic: 'Weight',
133+
depositEventPerByte: 'Weight',
134+
setRentAllowance: 'Weight',
135+
setStorage: 'Weight',
136+
setStoragePerByte: 'Weight',
137+
clearStorage: 'Weight',
138+
getStorage: 'Weight',
139+
getStoragePerByte: 'Weight',
140+
transfer: 'Weight',
141+
call: 'Weight',
142+
callTransferSurcharge: 'Weight',
143+
callPerInputByte: 'Weight',
144+
callPerOutputByte: 'Weight',
145+
instantiate: 'Weight',
146+
instantiatePerInputByte: 'Weight',
147+
instantiatePerOutputByte: 'Weight',
148+
hashSha2256: 'Weight',
149+
hashSha2256PerByte: 'Weight',
150+
hashKeccak256: 'Weight',
151+
hashKeccak256PerByte: 'Weight',
152+
hashBlake2256: 'Weight',
153+
hashBlake2256PerByte: 'Weight',
154+
hashBlake2128: 'Weight',
155+
hashBlake2128PerByte: 'Weight'
156+
},
157+
InstructionWeights: {
158+
growMem: 'Weight',
159+
regular: 'Weight'
160+
},
110161
PrefabWasmModule: {
111162
scheduleVersion: 'Compact<u32>',
112163
initial: 'Compact<u32>',
@@ -152,53 +203,8 @@ export default {
152203
},
153204
Schedule: {
154205
version: 'u32',
155-
opCostGrowMem: 'Weight',
156-
opCostRegular: 'Weight',
157-
apiCostCaller: 'Weight',
158-
apiCostAddress: 'Weight',
159-
apiCostGasLeft: 'Weight',
160-
apiCostBalance: 'Weight',
161-
apiCostValueTransferred: 'Weight',
162-
apiCostMinimumBalance: 'Weight',
163-
apiCostTombstoneDeposit: 'Weight',
164-
apiCostRentAllowance: 'Weight',
165-
apiCostBlockNumber: 'Weight',
166-
apiCostNow: 'Weight',
167-
apiCostWeightToFee: 'Weight',
168-
apiCostGas: 'Weight',
169-
apiCostInput: 'Weight',
170-
apiCostInputPerByte: 'Weight',
171-
apiCostReturn: 'Weight',
172-
apiCostReturnPerByte: 'Weight',
173-
apiCostTerminate: 'Weight',
174-
apiCostRestoreTo: 'Weight',
175-
apiCostRestoreToPer_delta: 'Weight',
176-
apiCostRandom: 'Weight',
177-
apiCostDepositEvent: 'Weight',
178-
apiCostDepositEventPerTopic: 'Weight',
179-
apiCostDepositEventPerByte: 'Weight',
180-
apiCostSetRentAllowance: 'Weight',
181-
apiCostSetStorage: 'Weight',
182-
apiCostSetStoragePerByte: 'Weight',
183-
apiCostClearStorage: 'Weight',
184-
apiCostGetStorage: 'Weight',
185-
apiCostGetStoragePerByte: 'Weight',
186-
apiCostTransfer: 'Weight',
187-
apiCostCall: 'Weight',
188-
apiCostCallTransferSurcharge: 'Weight',
189-
apiCostCallPerInputByte: 'Weight',
190-
apiCostCallPerOutputByte: 'Weight',
191-
apiCostInstantiate: 'Weight',
192-
apiCostInstantiatePerInputByte: 'Weight',
193-
apiCostInstantiatePerOutputByte: 'Weight',
194-
apiCostHashSha2256: 'Weight',
195-
apiCostHashSha2256PerByte: 'Weight',
196-
apiCostHashKeccak256: 'Weight',
197-
apiCostHashKeccak256PerByte: 'Weight',
198-
apiCostHashBlake2256: 'Weight',
199-
apiCostHashBlake2256PerByte: 'Weight',
200-
apiCostHashBlake2128: 'Weight',
201-
apiCostHashBlake2128PerByte: 'Weight',
206+
instructionWeights: 'InstructionWeights',
207+
hostFnWeights: 'HostFnWeights',
202208
enablePrintln: 'bool',
203209
maxEventTopics: 'u32',
204210
maxStackHeight: 'u32',

packages/types/src/interfaces/contracts/types.ts

Lines changed: 57 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,61 @@ export interface ContractStorageKey extends U8aFixed {}
6868
/** @name Gas */
6969
export interface Gas extends u64 {}
7070

71+
/** @name HostFnWeights */
72+
export interface HostFnWeights extends Struct {
73+
readonly caller: Weight;
74+
readonly address: Weight;
75+
readonly gasLeft: Weight;
76+
readonly balance: Weight;
77+
readonly valueTransferred: Weight;
78+
readonly minimumBalance: Weight;
79+
readonly tombstoneDeposit: Weight;
80+
readonly rentAllowance: Weight;
81+
readonly blockNumber: Weight;
82+
readonly now: Weight;
83+
readonly weightToFee: Weight;
84+
readonly gas: Weight;
85+
readonly input: Weight;
86+
readonly inputPerByte: Weight;
87+
readonly return: Weight;
88+
readonly returnPerByte: Weight;
89+
readonly terminate: Weight;
90+
readonly restoreTo: Weight;
91+
readonly restoreToPerDelta: Weight;
92+
readonly random: Weight;
93+
readonly depositEvent: Weight;
94+
readonly depositEventPerTopic: Weight;
95+
readonly depositEventPerByte: Weight;
96+
readonly setRentAllowance: Weight;
97+
readonly setStorage: Weight;
98+
readonly setStoragePerByte: Weight;
99+
readonly clearStorage: Weight;
100+
readonly getStorage: Weight;
101+
readonly getStoragePerByte: Weight;
102+
readonly transfer: Weight;
103+
readonly call: Weight;
104+
readonly callTransferSurcharge: Weight;
105+
readonly callPerInputByte: Weight;
106+
readonly callPerOutputByte: Weight;
107+
readonly instantiate: Weight;
108+
readonly instantiatePerInputByte: Weight;
109+
readonly instantiatePerOutputByte: Weight;
110+
readonly hashSha2256: Weight;
111+
readonly hashSha2256PerByte: Weight;
112+
readonly hashKeccak256: Weight;
113+
readonly hashKeccak256PerByte: Weight;
114+
readonly hashBlake2256: Weight;
115+
readonly hashBlake2256PerByte: Weight;
116+
readonly hashBlake2128: Weight;
117+
readonly hashBlake2128PerByte: Weight;
118+
}
119+
120+
/** @name InstructionWeights */
121+
export interface InstructionWeights extends Struct {
122+
readonly growMem: Weight;
123+
readonly regular: Weight;
124+
}
125+
71126
/** @name PrefabWasmModule */
72127
export interface PrefabWasmModule extends Struct {
73128
readonly scheduleVersion: Compact<u32>;
@@ -83,53 +138,8 @@ export interface PrefabWasmModuleReserved extends Option<Null> {}
83138
/** @name Schedule */
84139
export interface Schedule extends Struct {
85140
readonly version: u32;
86-
readonly opCostGrowMem: Weight;
87-
readonly opCostRegular: Weight;
88-
readonly apiCostCaller: Weight;
89-
readonly apiCostAddress: Weight;
90-
readonly apiCostGasLeft: Weight;
91-
readonly apiCostBalance: Weight;
92-
readonly apiCostValueTransferred: Weight;
93-
readonly apiCostMinimumBalance: Weight;
94-
readonly apiCostTombstoneDeposit: Weight;
95-
readonly apiCostRentAllowance: Weight;
96-
readonly apiCostBlockNumber: Weight;
97-
readonly apiCostNow: Weight;
98-
readonly apiCostWeightToFee: Weight;
99-
readonly apiCostGas: Weight;
100-
readonly apiCostInput: Weight;
101-
readonly apiCostInputPerByte: Weight;
102-
readonly apiCostReturn: Weight;
103-
readonly apiCostReturnPerByte: Weight;
104-
readonly apiCostTerminate: Weight;
105-
readonly apiCostRestoreTo: Weight;
106-
readonly apiCostRestoreToPer_delta: Weight;
107-
readonly apiCostRandom: Weight;
108-
readonly apiCostDepositEvent: Weight;
109-
readonly apiCostDepositEventPerTopic: Weight;
110-
readonly apiCostDepositEventPerByte: Weight;
111-
readonly apiCostSetRentAllowance: Weight;
112-
readonly apiCostSetStorage: Weight;
113-
readonly apiCostSetStoragePerByte: Weight;
114-
readonly apiCostClearStorage: Weight;
115-
readonly apiCostGetStorage: Weight;
116-
readonly apiCostGetStoragePerByte: Weight;
117-
readonly apiCostTransfer: Weight;
118-
readonly apiCostCall: Weight;
119-
readonly apiCostCallTransferSurcharge: Weight;
120-
readonly apiCostCallPerInputByte: Weight;
121-
readonly apiCostCallPerOutputByte: Weight;
122-
readonly apiCostInstantiate: Weight;
123-
readonly apiCostInstantiatePerInputByte: Weight;
124-
readonly apiCostInstantiatePerOutputByte: Weight;
125-
readonly apiCostHashSha2256: Weight;
126-
readonly apiCostHashSha2256PerByte: Weight;
127-
readonly apiCostHashKeccak256: Weight;
128-
readonly apiCostHashKeccak256PerByte: Weight;
129-
readonly apiCostHashBlake2256: Weight;
130-
readonly apiCostHashBlake2256PerByte: Weight;
131-
readonly apiCostHashBlake2128: Weight;
132-
readonly apiCostHashBlake2128PerByte: Weight;
141+
readonly instructionWeights: InstructionWeights;
142+
readonly hostFnWeights: HostFnWeights;
133143
readonly enablePrintln: bool;
134144
readonly maxEventTopics: u32;
135145
readonly maxStackHeight: u32;

0 commit comments

Comments
 (0)