Skip to content

Commit

Permalink
Change contract creation halt reason when account already exists (hyp…
Browse files Browse the repository at this point in the history
…erledger#6518)

* Change halt reason when contract creation fails due to collision or account already exists

Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>

* Fix ATs

Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>

* Add ILLEGAL_STATE_CHANGE to the list of hal reasons that must not be ignored when producing the vm trace

Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>

* add changelog

Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>

---------

Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
  • Loading branch information
gfukushima authored Feb 6, 2024
1 parent a64ad2b commit dee608f
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
- Added configuration options for `pragueTime` to genesis file for Prague fork development [#6473](https://github.com/hyperledger/besu/pull/6473)
- Moving trielog storage to RocksDB's blobdb to improve write amplications [#6289](https://github.com/hyperledger/besu/pull/6289)
- Support for `shanghaiTime` fork and Shanghai EVM smart contracts in QBFT/IBFT chains [#6353](https://github.com/hyperledger/besu/pull/6353)
- Change ExecutionHaltReason for contract creation collision case to return ILLEGAL_STATE_CHANGE [#6518](https://github.com/hyperledger/besu/pull/6518)

### Bug fixes
- Fix the way an advertised host configured with `--p2p-host` is treated when communicating with the originator of a PING packet [#6225](https://github.com/hyperledger/besu/pull/6225)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ private boolean mustIgnore(final TraceFrame frame) {
} else if (frame.getExceptionalHaltReason().isPresent()) {
final Optional<ExceptionalHaltReason> haltReason = frame.getExceptionalHaltReason();
return haltReason.get() != ExceptionalHaltReason.INVALID_JUMP_DESTINATION
&& haltReason.get() != ExceptionalHaltReason.INSUFFICIENT_GAS;
&& haltReason.get() != ExceptionalHaltReason.INSUFFICIENT_GAS
&& haltReason.get() != ExceptionalHaltReason.ILLEGAL_STATE_CHANGE;
} else {
return frame.isVirtualOperation();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"init" : "0x600160015560015460025560ff60005360016000f3",
"value" : "0x0"
},
"error" : "Out of gas",
"error" : "Illegal state change",
"subtraces" : 0,
"traceAddress" : [ 0 ],
"type" : "create"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
"init" : "0x600160015560015460025560ff60005360016000f3",
"value" : "0x0"
},
"error" : "Out of gas",
"error" : "Illegal state change",
"subtraces" : 0,
"traceAddress" : [ 0 ],
"type" : "create"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"init" : "0x600160015560015460025560ff60005360016000f3",
"value" : "0x0"
},
"error" : "Out of gas",
"error" : "Illegal state change",
"subtraces" : 0,
"traceAddress" : [ 0 ],
"type" : "create"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,10 @@ public void start(final MessageFrame frame, final OperationTracer operationTrace
LOG.trace(
"Contract creation error: account has already been created for address {}",
contractAddress);
frame.setExceptionalHaltReason(Optional.of(ExceptionalHaltReason.INSUFFICIENT_GAS));
frame.setExceptionalHaltReason(Optional.of(ExceptionalHaltReason.ILLEGAL_STATE_CHANGE));
frame.setState(MessageFrame.State.EXCEPTIONAL_HALT);
operationTracer.traceAccountCreationResult(
frame, Optional.of(ExceptionalHaltReason.INSUFFICIENT_GAS));
frame, Optional.of(ExceptionalHaltReason.ILLEGAL_STATE_CHANGE));
} else {
frame.addCreate(contractAddress);
contract.incrementBalance(frame.getValue());
Expand Down

0 comments on commit dee608f

Please sign in to comment.