@@ -912,7 +912,10 @@ function getContractStorage(runState: RunState, address: Buffer, key: Buffer) {
912
912
}
913
913
runState . stateManager . getContractStorage ( address , key , ( err : Error , current : Buffer ) => {
914
914
if ( err ) return cb ( err , null )
915
- if ( runState . _common . hardfork ( ) === 'constantinople' || runState . _common . gteHardfork ( 'istanbul' ) ) {
915
+ if (
916
+ runState . _common . hardfork ( ) === 'constantinople' ||
917
+ runState . _common . gteHardfork ( 'istanbul' )
918
+ ) {
916
919
runState . stateManager . getOriginalContractStorage (
917
920
address ,
918
921
key ,
@@ -980,42 +983,60 @@ function updateSstoreGas(runState: RunState, found: any, value: Buffer) {
980
983
const original = found . original
981
984
const current = found . current
982
985
// Fail if not enough gas is left
983
- if ( runState . eei . getGasLeft ( ) . lten ( runState . _common . param ( 'gasPrices' , 'sstoreSentryGasEIP2200' ) ) ) {
986
+ if (
987
+ runState . eei . getGasLeft ( ) . lten ( runState . _common . param ( 'gasPrices' , 'sstoreSentryGasEIP2200' ) )
988
+ ) {
984
989
trap ( ERROR . OUT_OF_GAS )
985
990
}
986
991
987
992
// Noop
988
993
if ( current . equals ( value ) ) {
989
- return runState . eei . useGas ( new BN ( runState . _common . param ( 'gasPrices' , 'sstoreNoopGasEIP2200' ) ) )
994
+ return runState . eei . useGas (
995
+ new BN ( runState . _common . param ( 'gasPrices' , 'sstoreNoopGasEIP2200' ) ) ,
996
+ )
990
997
}
991
998
if ( original . equals ( current ) ) {
992
999
// Create slot
993
1000
if ( original . length === 0 ) {
994
- return runState . eei . useGas ( new BN ( runState . _common . param ( 'gasPrices' , 'sstoreInitGasEIP2200' ) ) )
1001
+ return runState . eei . useGas (
1002
+ new BN ( runState . _common . param ( 'gasPrices' , 'sstoreInitGasEIP2200' ) ) ,
1003
+ )
995
1004
}
996
1005
// Delete slot
997
1006
if ( value . length === 0 ) {
998
- runState . eei . refundGas ( new BN ( runState . _common . param ( 'gasPrices' , 'sstoreClearRefundEIP2200' ) ) )
1007
+ runState . eei . refundGas (
1008
+ new BN ( runState . _common . param ( 'gasPrices' , 'sstoreClearRefundEIP2200' ) ) ,
1009
+ )
999
1010
}
1000
1011
// Write existing slot
1001
- return runState . eei . useGas ( new BN ( runState . _common . param ( 'gasPrices' , 'sstoreCleanGasEIP2200' ) ) )
1012
+ return runState . eei . useGas (
1013
+ new BN ( runState . _common . param ( 'gasPrices' , 'sstoreCleanGasEIP2200' ) ) ,
1014
+ )
1002
1015
}
1003
1016
if ( original . length > 0 ) {
1004
- // Recreate slot
1005
1017
if ( current . length === 0 ) {
1006
- runState . eei . subRefund ( new BN ( runState . _common . param ( 'gasPrices' , 'sstoreClearRefundEIP2200' ) ) )
1007
- // Delete slot
1018
+ // Recreate slot
1019
+ runState . eei . subRefund (
1020
+ new BN ( runState . _common . param ( 'gasPrices' , 'sstoreClearRefundEIP2200' ) ) ,
1021
+ )
1008
1022
} else if ( value . length === 0 ) {
1009
- runState . eei . refundGas ( new BN ( runState . _common . param ( 'gasPrices' , 'sstoreClearRefundEIP2200' ) ) )
1023
+ // Delete slot
1024
+ runState . eei . refundGas (
1025
+ new BN ( runState . _common . param ( 'gasPrices' , 'sstoreClearRefundEIP2200' ) ) ,
1026
+ )
1010
1027
}
1011
1028
}
1012
1029
if ( original . equals ( value ) ) {
1013
- // Reset to original non-existent slot
1014
1030
if ( original . length === 0 ) {
1015
- runState . eei . refundGas ( new BN ( runState . _common . param ( 'gasPrices' , 'sstoreInitRefundEIP2200' ) ) )
1016
- // Reset to original existing slot
1031
+ // Reset to original non-existent slot
1032
+ runState . eei . refundGas (
1033
+ new BN ( runState . _common . param ( 'gasPrices' , 'sstoreInitRefundEIP2200' ) ) ,
1034
+ )
1017
1035
} else {
1018
- runState . eei . refundGas ( new BN ( runState . _common . param ( 'gasPrices' , 'sstoreCleanRefundEIP2200' ) ) )
1036
+ // Reset to original existing slot
1037
+ runState . eei . refundGas (
1038
+ new BN ( runState . _common . param ( 'gasPrices' , 'sstoreCleanRefundEIP2200' ) ) ,
1039
+ )
1019
1040
}
1020
1041
}
1021
1042
// Dirty update
0 commit comments