Skip to content
This repository has been archived by the owner on Nov 6, 2022. It is now read-only.

Preserve account balance across create/create2 #565

Merged
merged 1 commit into from
Jul 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion arb_os/arbos-upgrade.mexe

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion arb_os/arbos.mexe

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions arb_os/evmOps.mini
Original file line number Diff line number Diff line change
Expand Up @@ -1043,24 +1043,25 @@ public impure func evmOp_create2(value: uint, offset: uint, length: uint, salt:

#[noinline, ] public impure func doCreationOpcode(value: uint, constructorCode: ByteArray, newAddress: address) -> address {
// make sure there isn't already an account at the given address
if let Some(acct) = evmCallStack_getAccount(newAddress) {
let originalAcct = xif let Some(acct) = evmCallStack_getAccount(newAddress) {
if (account_hasContract(acct)) {
// there is already a contract at that address; return failure
return address(0);
}
acct
} else {
// somehow there isn't an EVM callframe
evm_runtimePanic(32);
panic;
}
panic
};

let (startPoint, evmJumpTable, _) = translateEvmCodeSegment(bytestream_new(constructorCode), false);

// Create a new account to run the constructor code.
if (evmCallStack_setAccount(
newAddress,
account_setContractInfo(
pristineAccount(newAddress),
originalAcct,
constructorCode,
evmJumpTable,
getDummyAcceptContractCode(),
Expand Down
2 changes: 1 addition & 1 deletion arb_os/upgrade.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion replayTests/evm_test_arbsys_direct.aoslog

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion replayTests/evm_test_create.aoslog

Large diffs are not rendered by default.