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

Commit

Permalink
Merge pull request #565 from OffchainLabs/create-to-funded-account
Browse files Browse the repository at this point in the history
Preserve account balance across create/create2
  • Loading branch information
edfelten committed Jul 26, 2021
2 parents 435e1f5 + a1d61bb commit 968fcf1
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 9 deletions.
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.

0 comments on commit 968fcf1

Please sign in to comment.