This repository has been archived by the owner on Dec 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Feature/eip 1283 #1173
Merged
Merged
Feature/eip 1283 #1173
Changes from 3 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
b826ad9
Merge branch 'develop' into feature/eip-1283
zilm13 a6a5f61
EIP-1283 SSTORE Net gas metering without dirty maps
zilm13 923d6d0
Protect RefundCounter which could go negative since EIP-1283
zilm13 b035bb0
Keep storageLoad for SLOAD as clear helper
zilm13 81ccc2b
Add clone repo method for usage in EIP-1283
zilm13 8ab754a
Update originalValue javadoc for eip-1283 reference
zilm13 53098a6
Fine polishing according to eip-1283 pr review
zilm13 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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().getSnapshotTo(programInvoke.getRepository().getRoot()); | ||
this.storage = setupProgramListener(new Storage(programInvoke)); | ||
this.trace = new ProgramTrace(config, programInvoke); | ||
this.blockchainConfig = config.getBlockchainConfig().getConfigForBlock(programInvoke.getNumber().longValue()); | ||
|
@@ -789,10 +791,29 @@ public byte[] getReturnDataBufferData(DataWord off, DataWord size) { | |
Arrays.copyOfRange(returnDataBuffer, off.intValueSafe(), off.intValueSafe() + size.intValueSafe()); | ||
} | ||
|
||
@Deprecated | ||
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. I'd not deprecate |
||
/* | ||
* @deprecated | ||
* Use {@link #getCurrentValue(DataWord)} instead | ||
*/ | ||
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); | ||
} | ||
|
||
/* | ||
* @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(); | ||
} | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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?