Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

Commit

Permalink
Fixes some bugs and tidies things up
Browse files Browse the repository at this point in the history
  • Loading branch information
josh-richardson committed Sep 11, 2019
1 parent 48f0720 commit 4fce9fb
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,18 +151,14 @@ protected void codeSuccess(final MessageFrame frame) {
// Finalize contract creation, setting the contract code.
final MutableAccount contract =
frame.getWorldState().getOrCreate(frame.getContractAddress());
if (!(contract instanceof ReadOnlyMutableAccount)) {
contract.setCode(contractCode);
contract.setVersion(accountVersion);
LOG.trace(
"Successful creation of contract {} with code of size {} (Gas remaining: {})",
frame.getContractAddress(),
contractCode.size(),
frame.getRemainingGas());
frame.setState(MessageFrame.State.COMPLETED_SUCCESS);
} else {
frame.setState(MessageFrame.State.EXCEPTIONAL_HALT);
}
contract.setCode(contractCode);
contract.setVersion(accountVersion);
LOG.trace(
"Successful creation of contract {} with code of size {} (Gas remaining: {})",
frame.getContractAddress(),
contractCode.size(),
frame.getRemainingGas());
frame.setState(MessageFrame.State.COMPLETED_SUCCESS);
} else {
frame.setState(MessageFrame.State.EXCEPTIONAL_HALT);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ public BytesValue compute(final BytesValue input, final MessageFrame messageFram
privateWorldStateArchive.getMutable(lastRootHash).get();

final WorldUpdater privateWorldStateUpdater = disposablePrivateState.updater();

final PrivateTransactionProcessor.Result result =
privateTransactionProcessor.processTransaction(
messageFrame.getBlockchain(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ public Result processTransaction(
final MessageFrame initialFrame;
final Deque<MessageFrame> messageFrameStack = new ArrayDeque<>();

final WorldUpdater mungedUpUpdater =
final WorldUpdater mutablePrivateWorldStateUpdater =
new DefaultMutablePrivateWorldStateUpdater(publicWorldState, privateWorldState.updater());

if (transaction.isContractCreation()) {
Expand All @@ -231,7 +231,7 @@ public Result processTransaction(
.type(MessageFrame.Type.CONTRACT_CREATION)
.messageFrameStack(messageFrameStack)
.blockchain(blockchain)
.worldState(mungedUpUpdater)
.worldState(mutablePrivateWorldStateUpdater)
.address(privateContractAddress)
.originator(senderAddress)
.contract(privateContractAddress)
Expand Down Expand Up @@ -260,7 +260,7 @@ public Result processTransaction(
.type(MessageFrame.Type.MESSAGE_CALL)
.messageFrameStack(messageFrameStack)
.blockchain(blockchain)
.worldState(mungedUpUpdater)
.worldState(mutablePrivateWorldStateUpdater)
.address(to)
.originator(senderAddress)
.contract(to)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ public MutableAccount getMutable(final Address address) {
}
final MutableAccount publicAccount = publicWorldUpdater.getMutable(address);
if (publicAccount != null && !publicAccount.isEmpty()) {
revert();
return new ReadOnlyMutableAccount(publicAccount);
}
return null;
Expand Down

0 comments on commit 4fce9fb

Please sign in to comment.