@@ -161,8 +161,8 @@ func TestInterpretArrayMetering(t *testing.T) {
161161 // 1 Int8 for type
162162 // 2 String: 1 for type, 1 for value
163163 // 3 Bool: 1 for type, 2 for value
164- assert .Equal (t , uint64 (6 ), meter .getMemory (common .MemoryKindPrimitiveStaticType ))
165- assert .Equal (t , uint64 (10 ), meter .getMemory (common .MemoryKindVariableSizedStaticType ))
164+ assert .Equal (t , uint64 (18 ), meter .getMemory (common .MemoryKindPrimitiveStaticType ))
165+ assert .Equal (t , uint64 (30 ), meter .getMemory (common .MemoryKindVariableSizedStaticType ))
166166 }
167167 })
168168
@@ -195,8 +195,8 @@ func TestInterpretArrayMetering(t *testing.T) {
195195 assert .Equal (t , uint64 (8 ), meter .getMemory (common .MemoryKindVariable ))
196196
197197 // 4 Int8: 1 for type, 3 for values
198- assert .Equal (t , uint64 (4 ), meter .getMemory (common .MemoryKindPrimitiveStaticType ))
199- assert .Equal (t , uint64 (5 ), meter .getMemory (common .MemoryKindVariableSizedStaticType ))
198+ assert .Equal (t , uint64 (18 ), meter .getMemory (common .MemoryKindPrimitiveStaticType ))
199+ assert .Equal (t , uint64 (21 ), meter .getMemory (common .MemoryKindVariableSizedStaticType ))
200200 }
201201 })
202202
@@ -221,7 +221,7 @@ func TestInterpretArrayMetering(t *testing.T) {
221221 assert .Equal (t , uint64 (2 ), meter .getMemory (common .MemoryKindAtreeArrayDataSlab ))
222222 assert .Equal (t , uint64 (0 ), meter .getMemory (common .MemoryKindAtreeArrayMetaDataSlab ))
223223 assert .Equal (t , uint64 (0 ), meter .getMemory (common .MemoryKindAtreeArrayElementOverhead ))
224- assert .Equal (t , uint64 (2 ), meter .getMemory (common .MemoryKindPrimitiveStaticType ))
224+ assert .Equal (t , uint64 (9 ), meter .getMemory (common .MemoryKindPrimitiveStaticType ))
225225 })
226226
227227 t .Run ("append with packing" , func (t * testing.T ) {
@@ -351,11 +351,11 @@ func TestInterpretArrayMetering(t *testing.T) {
351351 assert .Equal (t , uint64 (0 ), meter .getMemory (common .MemoryKindAtreeArrayMetaDataSlab ))
352352 assert .Equal (t , uint64 (2 ), meter .getMemory (common .MemoryKindAtreeArrayElementOverhead ))
353353
354- assert .Equal (t , ifCompile [uint64 ](10 , 7 ), meter .getMemory (common .MemoryKindPrimitiveStaticType ))
354+ assert .Equal (t , ifCompile [uint64 ](10 , 23 ), meter .getMemory (common .MemoryKindPrimitiveStaticType ))
355355
356356 // TODO: assert equivalent for compiler/VM
357357 if ! * compile {
358- assert .Equal (t , uint64 (1 ), meter .getMemory (common .MemoryKindVariableSizedStaticType ))
358+ assert .Equal (t , uint64 (5 ), meter .getMemory (common .MemoryKindVariableSizedStaticType ))
359359 }
360360 })
361361
@@ -436,7 +436,7 @@ func TestInterpretArrayMetering(t *testing.T) {
436436
437437 // TODO: assert equivalent for compiler/VM
438438 if ! * compile {
439- assert .Equal (t , uint64 (12 ), meter .getMemory (common .MemoryKindConstantSizedStaticType ))
439+ assert .Equal (t , uint64 (36 ), meter .getMemory (common .MemoryKindConstantSizedStaticType ))
440440 }
441441 })
442442
@@ -470,11 +470,11 @@ func TestInterpretArrayMetering(t *testing.T) {
470470 // 1 Int8 for `w` element
471471 // 2 Int8 for `r` elements
472472 // 2 Int8 for `q` elements
473- assert .Equal (t , ifCompile [uint64 ](30 , 19 ), meter .getMemory (common .MemoryKindPrimitiveStaticType ))
473+ assert .Equal (t , ifCompile [uint64 ](30 , 63 ), meter .getMemory (common .MemoryKindPrimitiveStaticType ))
474474
475475 // TODO: assert equivalent for compiler/VM
476476 if ! * compile {
477- assert .Equal (t , uint64 (1 ), meter .getMemory (common .MemoryKindVariableSizedStaticType ))
477+ assert .Equal (t , uint64 (9 ), meter .getMemory (common .MemoryKindVariableSizedStaticType ))
478478 }
479479 })
480480}
@@ -504,12 +504,12 @@ func TestInterpretDictionaryMetering(t *testing.T) {
504504 assert .Equal (t , uint64 (8 ), meter .getMemory (common .MemoryKindAtreeMapDataSlab ))
505505 assert .Equal (t , uint64 (0 ), meter .getMemory (common .MemoryKindAtreeMapMetaDataSlab ))
506506 assert .Equal (t , uint64 (159 ), meter .getMemory (common .MemoryKindAtreeMapPreAllocatedElement ))
507- assert .Equal (t , ifCompile [uint64 ](3 , 9 ), meter .getMemory (common .MemoryKindPrimitiveStaticType ))
507+ assert .Equal (t , ifCompile [uint64 ](3 , 25 ), meter .getMemory (common .MemoryKindPrimitiveStaticType ))
508508
509509 // TODO: assert equivalent for compiler/VM
510510 if ! * compile {
511511 assert .Equal (t , uint64 (3 ), meter .getMemory (common .MemoryKindVariable ))
512- assert .Equal (t , uint64 (4 ), meter .getMemory (common .MemoryKindDictionaryStaticType ))
512+ assert .Equal (t , uint64 (12 ), meter .getMemory (common .MemoryKindDictionaryStaticType ))
513513 }
514514 })
515515
@@ -541,8 +541,8 @@ func TestInterpretDictionaryMetering(t *testing.T) {
541541
542542 // 4 Int8: 1 for type, 3 for values
543543 // 4 String: 1 for type, 3 for values
544- assert .Equal (t , uint64 (8 ), meter .getMemory (common .MemoryKindPrimitiveStaticType ))
545- assert .Equal (t , uint64 (4 ), meter .getMemory (common .MemoryKindDictionaryStaticType ))
544+ assert .Equal (t , uint64 (36 ), meter .getMemory (common .MemoryKindPrimitiveStaticType ))
545+ assert .Equal (t , uint64 (18 ), meter .getMemory (common .MemoryKindDictionaryStaticType ))
546546 }
547547
548548 })
@@ -564,7 +564,7 @@ func TestInterpretDictionaryMetering(t *testing.T) {
564564 _ , err = inter .Invoke ("main" )
565565 require .NoError (t , err )
566566
567- assert .Equal (t , ifCompile [uint64 ](2 , 3 ), meter .getMemory (common .MemoryKindPrimitiveStaticType ))
567+ assert .Equal (t , ifCompile [uint64 ](2 , 13 ), meter .getMemory (common .MemoryKindPrimitiveStaticType ))
568568 })
569569
570570 t .Run ("insert" , func (t * testing.T ) {
@@ -591,11 +591,11 @@ func TestInterpretDictionaryMetering(t *testing.T) {
591591 assert .Equal (t , uint64 (0 ), meter .getMemory (common .MemoryKindAtreeMapMetaDataSlab ))
592592 assert .Equal (t , uint64 (32 ), meter .getMemory (common .MemoryKindAtreeMapPreAllocatedElement ))
593593
594- assert .Equal (t , ifCompile [uint64 ](12 , 10 ), meter .getMemory (common .MemoryKindPrimitiveStaticType ))
594+ assert .Equal (t , ifCompile [uint64 ](12 , 30 ), meter .getMemory (common .MemoryKindPrimitiveStaticType ))
595595
596596 // TODO: assert equivalent for compiler/VM
597597 if ! * compile {
598- assert .Equal (t , uint64 (1 ), meter .getMemory (common .MemoryKindDictionaryStaticType ))
598+ assert .Equal (t , uint64 (5 ), meter .getMemory (common .MemoryKindDictionaryStaticType ))
599599 }
600600 })
601601
@@ -754,7 +754,7 @@ func TestInterpretCompositeMetering(t *testing.T) {
754754 assert .Equal (t , uint64 (0 ), meter .getMemory (common .MemoryKindAtreeMapMetaDataSlab ))
755755 assert .Equal (t , uint64 (1 ), meter .getMemory (common .MemoryKindAtreeMapElementOverhead ))
756756 assert .Equal (t , uint64 (32 ), meter .getMemory (common .MemoryKindAtreeMapPreAllocatedElement ))
757- assert .Equal (t , uint64 (2 ), meter .getMemory (common .MemoryKindCompositeStaticType ))
757+ assert .Equal (t , uint64 (12 ), meter .getMemory (common .MemoryKindCompositeStaticType ))
758758 assert .Equal (t , uint64 (4 ), meter .getMemory (common .MemoryKindCompositeTypeInfo ))
759759
760760 // TODO: assert equivalent for compiler/VM
@@ -791,7 +791,7 @@ func TestInterpretCompositeMetering(t *testing.T) {
791791 assert .Equal (t , uint64 (0 ), meter .getMemory (common .MemoryKindAtreeMapElementOverhead ))
792792 assert .Equal (t , uint64 (480 ), meter .getMemory (common .MemoryKindAtreeMapPreAllocatedElement ))
793793
794- assert .Equal (t , ifCompile [uint64 ](6 , 7 ), meter .getMemory (common .MemoryKindCompositeStaticType ))
794+ assert .Equal (t , ifCompile [uint64 ](6 , 27 ), meter .getMemory (common .MemoryKindCompositeStaticType ))
795795 assert .Equal (t , uint64 (18 ), meter .getMemory (common .MemoryKindCompositeTypeInfo ))
796796 assert .Equal (t , uint64 (0 ), meter .getMemory (common .MemoryKindCompositeField ))
797797
@@ -1470,11 +1470,11 @@ func TestInterpretOptionalValueMetering(t *testing.T) {
14701470 // 2 for `z`
14711471 assert .Equal (t , uint64 (2 ), meter .getMemory (common .MemoryKindOptionalValue ))
14721472
1473- assert .Equal (t , ifCompile [uint64 ](20 , 14 ), meter .getMemory (common .MemoryKindPrimitiveStaticType ))
1473+ assert .Equal (t , ifCompile [uint64 ](20 , 34 ), meter .getMemory (common .MemoryKindPrimitiveStaticType ))
14741474
14751475 // TODO: assert equivalent for compiler/VM
14761476 if ! * compile {
1477- assert .Equal (t , uint64 (1 ), meter .getMemory (common .MemoryKindDictionaryStaticType ))
1477+ assert .Equal (t , uint64 (3 ), meter .getMemory (common .MemoryKindDictionaryStaticType ))
14781478 }
14791479 })
14801480
@@ -8995,7 +8995,7 @@ func TestInterpretIdentifierMetering(t *testing.T) {
89958995 _ , err = inter .Invoke ("main" )
89968996 require .NoError (t , err )
89978997 assert .Equal (t , uint64 (14 ), meter .getMemory (common .MemoryKindIdentifier ))
8998- assert .Equal (t , ifCompile [uint64 ](4 , 3 ), meter .getMemory (common .MemoryKindPrimitiveStaticType ))
8998+ assert .Equal (t , ifCompile [uint64 ](4 , 17 ), meter .getMemory (common .MemoryKindPrimitiveStaticType ))
89998999 })
90009000}
90019001
@@ -9074,7 +9074,7 @@ func TestInterpretFunctionStaticType(t *testing.T) {
90749074
90759075 // TODO: assert equivalent for compiler/VM
90769076 if ! * compile {
9077- assert .Equal (t , uint64 (2 ), meter .getMemory (common .MemoryKindFunctionStaticType ))
9077+ assert .Equal (t , uint64 (6 ), meter .getMemory (common .MemoryKindFunctionStaticType ))
90789078 }
90799079 })
90809080
@@ -9099,7 +9099,7 @@ func TestInterpretFunctionStaticType(t *testing.T) {
90999099 _ , err = inter .Invoke ("main" )
91009100 require .NoError (t , err )
91019101
9102- assert .Equal (t , ifCompile [uint64 ](2 , 1 ), meter .getMemory (common .MemoryKindFunctionStaticType ))
9102+ assert .Equal (t , ifCompile [uint64 ](2 , 3 ), meter .getMemory (common .MemoryKindFunctionStaticType ))
91039103 })
91049104
91059105 t .Run ("isInstance" , func (t * testing.T ) {
@@ -9125,7 +9125,7 @@ func TestInterpretFunctionStaticType(t *testing.T) {
91259125
91269126 assert .Equal (
91279127 t ,
9128- ifCompile [uint64 ](2 , 3 ),
9128+ ifCompile [uint64 ](2 , 4 ),
91299129 meter .getMemory (common .MemoryKindFunctionStaticType ),
91309130 )
91319131 })
0 commit comments