-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/eip 1283 #1173
Feature/eip 1283 #1173
Changes from 6 commits
b826ad9
a6a5f61
923d6d0
b035bb0
81ccc2b
8ab754a
53098a6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -230,6 +230,14 @@ public String dumpStateTrie() { | |
throw new RuntimeException("Not supported"); | ||
} | ||
|
||
/** | ||
* As tests only implementation this hack is pretty sufficient | ||
*/ | ||
@Override | ||
public Repository clone() { | ||
return startTracking(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Basically, |
||
} | ||
|
||
class ContractDetailsImpl implements ContractDetails { | ||
private byte[] address; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -88,6 +88,7 @@ public class Program { | |
private Stack stack; | ||
private Memory memory; | ||
private Storage storage; | ||
private Repository originalRepo; | ||
private byte[] returnDataBuffer; | ||
|
||
private ProgramResult result = new ProgramResult(); | ||
|
@@ -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().clone(); | ||
this.storage = setupProgramListener(new Storage(programInvoke)); | ||
this.trace = new ProgramTrace(config, programInvoke); | ||
this.blockchainConfig = config.getBlockchainConfig().getConfigForBlock(programInvoke.getNumber().longValue()); | ||
|
@@ -793,6 +795,22 @@ public DataWord storageLoad(DataWord key) { | |
return getStorage().getStorageValue(getOwnerAddress().getLast20Bytes(), key); | ||
} | ||
|
||
/** | ||
* @return current Storage data for key | ||
*/ | ||
public DataWord getCurrentValue(DataWord key) { | ||
return getStorage().getStorageValue(getOwnerAddress().getLast20Bytes(), key); | ||
} | ||
|
||
/* | ||
* Original storage value at the beginning of current frame execution | ||
* For more info check EIP-1283 https://eips.ethereum.org/EIPS/eip-1283 | ||
* @return Storage data at the beginning of Program execution | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's extend description with a reference to the EIP-1283 |
||
*/ | ||
public DataWord getOriginalValue(DataWord key) { | ||
return originalRepo.getStorageValue(getOwnerAddress().getLast20Bytes(), key); | ||
} | ||
|
||
public DataWord getPrevHash() { | ||
return invoke.getPrevHash(); | ||
} | ||
|
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.