-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Conversation
@@ -136,6 +137,7 @@ public Program(byte[] codeHash, byte[] ops, ProgramInvoke programInvoke, Transac | |||
traceListener = new ProgramTraceListener(config.vmTrace()); | |||
this.memory = setupProgramListener(new Memory()); | |||
this.stack = setupProgramListener(new Stack()); | |||
this.originalRepo = programInvoke.getRepository().getSnapshotTo(programInvoke.getRepository().getRoot()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ooops, we could have not only RepositoryImpl
here at least in tests.
Any ideas how can we get copy of Repo here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you, please, be more specific with the problem?
@@ -789,10 +791,29 @@ private int getReturnDataBufferSizeI() { | |||
Arrays.copyOfRange(returnDataBuffer, off.intValueSafe(), off.intValueSafe() + size.intValueSafe()); | |||
} | |||
|
|||
@Deprecated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd not deprecate storageLoad
cause SLOAD
op should keep using it. getCurrentValue
and storageLoad
are different operations in terms of semantics, I'd decouple them from each other.
} | ||
|
||
/* | ||
* @return Storage data at the beginning of Program execution |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's extend description with a reference to the EIP-1283
*/ | ||
@Override | ||
public Repository clone() { | ||
return startTracking(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basically, RepositoryImpl
itself is used for tracks, thus, it makes sense to return parent.startTracking()
here which will create a clone.
@@ -235,4 +235,6 @@ void loadAccount(byte[] addr, HashMap<ByteArrayWrapper, AccountState> cacheAccou | |||
HashMap<ByteArrayWrapper, ContractDetails> cacheDetails); | |||
|
|||
Repository getSnapshotTo(byte[] root); | |||
|
|||
Repository clone(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add a javadoc to highlight semantics of this call.
Have not found any github tests for this, only unit provided