-
Notifications
You must be signed in to change notification settings - Fork 114
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
Step 11: kernel integration (put / delete split in contract details) #809
Changes from all commits
43083c6
fcc9b1c
5f0e7a5
73d0513
a464bbe
6056d32
1864961
e29722f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
+24 −11 | modFastVM/src/org/aion/fastvm/Callback.java | |
+6 −0 | modFastVM/test/org/aion/vm/DummyRepository.java |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -139,24 +139,33 @@ public BigInteger getBalance(Address addr) { | |
public ByteArrayWrapper getStorageValue(Address addr, ByteArrayWrapper key) { | ||
IContractDetails details = getContractDetails(addr); | ||
ByteArrayWrapper value = (details == null) ? null : details.get(key); | ||
if (value == null) { | ||
return null; | ||
} | ||
return (value.isZero()) ? null : value; | ||
} | ||
|
||
public void addStorageRow(Address addr, ByteArrayWrapper key, ByteArrayWrapper value) { | ||
IContractDetails details = getContractDetails(addr); | ||
|
||
if (details == null) { | ||
createAccount(addr); | ||
details = getContractDetails(addr); | ||
if (value != null && value.isZero()) { | ||
// TODO: remove when integrating the AVM | ||
// used to ensure FVM correctness | ||
throw new IllegalStateException( | ||
"The contract address " | ||
+ addr.toString() | ||
+ " returned a zero value for the key " | ||
+ key.toString() | ||
+ " which is not a valid stored value for the FVM. "); | ||
} | ||
|
||
details.put(key, value); | ||
detailsDB.put(ByteArrayWrapper.wrap(addr.toBytes()), details); | ||
return value; | ||
} | ||
|
||
// never used | ||
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. delete? 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. We may want to remove the full class, cause there are multiple classes used for repository test functionality. But this feels like a separate task. 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. If this is the test class that ends up remaining after refactoring, the functionality may be reenabled. |
||
// public void addStorageRow(Address addr, ByteArrayWrapper key, ByteArrayWrapper value) { | ||
// IContractDetails details = getContractDetails(addr); | ||
// | ||
// if (details == null) { | ||
// createAccount(addr); | ||
// details = getContractDetails(addr); | ||
// } | ||
// details.put(key, value); | ||
// detailsDB.put(ByteArrayWrapper.wrap(addr.toBytes()), details); | ||
// } | ||
|
||
public byte[] getCode(Address addr) { | ||
IContractDetails details = getContractDetails(addr); | ||
|
||
|
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.
@VisibleForTesting?
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 marked the fact that it was only used for testing so that maybe it gets removed from the interface during the refactoring. Then the tag can be added to the implementations.