@@ -12,6 +12,7 @@ const wasmTypes = {
12
12
length : 'i32' ,
13
13
ipointer : 'i32' ,
14
14
opointer : 'i32' ,
15
+ gasLimit : 'i64' ,
15
16
// FIXME: these are handled wrongly currently
16
17
address : 'i32' ,
17
18
i128 : 'i32' ,
@@ -139,19 +140,19 @@ const interfaceManifest = {
139
140
CALL : {
140
141
name : 'call' ,
141
142
async : true ,
142
- input : [ 'i64 ' , 'address' , 'i128' , 'readOffset' , 'length' ] ,
143
+ input : [ 'gasLimit ' , 'address' , 'i128' , 'readOffset' , 'length' ] ,
143
144
output : [ 'i32' ]
144
145
} ,
145
146
CALLCODE : {
146
147
name : 'callCode' ,
147
148
async : true ,
148
- input : [ 'i64 ' , 'address' , 'i128' , 'readOffset' , 'length' ] ,
149
+ input : [ 'gasLimit ' , 'address' , 'i128' , 'readOffset' , 'length' ] ,
149
150
output : [ 'i32' ]
150
151
} ,
151
152
DELEGATECALL : {
152
153
name : 'callDelegate' ,
153
154
async : true ,
154
- input : [ 'i32 ' , 'address' , 'i128' , 'readOffset' , 'length' , 'writeOffset' , 'length' ] ,
155
+ input : [ 'gasLimit ' , 'address' , 'i128' , 'readOffset' , 'length' , 'writeOffset' , 'length' ] ,
155
156
output : [ 'i32' ]
156
157
} ,
157
158
SSTORE : {
@@ -263,7 +264,7 @@ function generateManifest (interfaceManifest, opts) {
263
264
// the wasm memory offset is a new item on the EVM stack
264
265
spOffset ++
265
266
call += `(i32.add (get_global $sp) (i32.const ${ spOffset * 32 } ))`
266
- } else if ( input === 'i64' && opcode === 'CALL ') {
267
+ } else if ( input === 'gasLimit ' ) {
267
268
// i64 param for CALL is the gas
268
269
// add 2300 gas subsidy
269
270
// for now this only works if the gas is a 64-bit value
@@ -281,7 +282,7 @@ function generateManifest (interfaceManifest, opts) {
281
282
call += checkOverflowStackItem64 ( spOffset )
282
283
} else if ( input === 'i32' ) {
283
284
call += checkOverflowStackItem256 ( spOffset )
284
- } else if ( input === 'i64' && opcode !== 'CALL' ) {
285
+ } else if ( input === 'i64' ) {
285
286
call += checkOverflowStackItem64 ( spOffset )
286
287
} else if ( input === 'writeOffset' || input === 'readOffset' ) {
287
288
lastOffset = input
0 commit comments