@@ -19,7 +19,12 @@ object ProgramState {
19
19
world = context.world,
20
20
staticCtx = context.staticCtx,
21
21
addressesToDelete = context.initialAddressesToDelete,
22
- originalWorld = context.originalWorld
22
+ originalWorld = context.originalWorld,
23
+ accessedAddresses = PrecompiledContracts .getContracts(context).keySet ++ Set (
24
+ context.originAddr,
25
+ context.recipientAddr.getOrElse(context.callerAddr)
26
+ ),
27
+ accessedStorageKeys = Set .empty
23
28
)
24
29
}
25
30
@@ -58,7 +63,9 @@ case class ProgramState[W <: WorldStateProxy[W, S], S <: Storage[S]](
58
63
halted : Boolean = false ,
59
64
staticCtx : Boolean = false ,
60
65
error : Option [ProgramError ] = None ,
61
- originalWorld : W
66
+ originalWorld : W ,
67
+ accessedAddresses : Set [Address ],
68
+ accessedStorageKeys : Set [(Address , BigInt )]
62
69
) {
63
70
64
71
def config : EvmConfig = env.evmConfig
@@ -126,6 +133,12 @@ case class ProgramState[W <: WorldStateProxy[W, S], S <: Storage[S]](
126
133
def revert (data : ByteString ): ProgramState [W , S ] =
127
134
copy(error = Some (RevertOccurs ), returnData = data, halted = true )
128
135
136
+ def addAccessedAddress (addr : Address ): ProgramState [W , S ] =
137
+ copy(accessedAddresses = accessedAddresses.+ (addr))
138
+
139
+ def addAccessedStorageKey (addr : Address , storageKey : BigInt ): ProgramState [W , S ] =
140
+ copy(accessedStorageKeys = accessedStorageKeys.+ ((addr, storageKey)))
141
+
129
142
def toResult : ProgramResult [W , S ] =
130
143
ProgramResult [W , S ](
131
144
returnData,
0 commit comments