Skip to content
This repository has been archived by the owner on Apr 12, 2021. It is now read-only.

[wip] OVM self-upgradability #357

Draft
wants to merge 38 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
b6289b2
new create codepath working
ben-chain Mar 8, 2021
8b7aa9d
get calls ported over to new function
ben-chain Mar 8, 2021
c8b9a5c
remove from interface
ben-chain Mar 8, 2021
810b67a
Merge branch 'master' into feat/simplify-creation
ben-chain Mar 8, 2021
8ccd116
clean up, add comments
ben-chain Mar 8, 2021
6e71f6a
remove unused commented code
ben-chain Mar 8, 2021
222e345
fix nuisance gas
ben-chain Mar 9, 2021
42035c6
add return type to ovmCREATE
ben-chain Mar 9, 2021
a648449
focus on final failing test
ben-chain Mar 9, 2021
563853f
finish up tests with new contract account revert type
ben-chain Mar 9, 2021
bd7cc45
remove test focus
ben-chain Mar 9, 2021
477819b
linting
ben-chain Mar 9, 2021
9ed5fee
cleanup
ben-chain Mar 9, 2021
18734c7
add explicit unsafe bytecode test
ben-chain Mar 9, 2021
eb8e24d
linting
ben-chain Mar 9, 2021
06f3399
Merge branch 'master' into feat/simplify-creation
ben-chain Mar 9, 2021
d546cf0
remove pointless ternary
ben-chain Mar 9, 2021
99d96d6
fix docstring
ben-chain Mar 9, 2021
bbb4bc5
stub putcode
ben-chain Mar 9, 2021
7f17283
unauthenticated upgrader for easy testing
ben-chain Mar 10, 2021
ec4d11d
Merge branch 'master' into feat/763/ovm-self-upgrade
ben-chain Mar 10, 2021
31f87eb
Merge branch 'master' into feat/simplify-creation
ben-chain Mar 11, 2021
c64991d
fix eth_call for creates and fix contract account reversions
ben-chain Mar 11, 2021
4278b54
use if statement instead
ben-chain Mar 11, 2021
b8e3810
nits
ben-chain Mar 11, 2021
b8027b2
Update contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManag…
ben-chain Mar 11, 2021
250442d
Update contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManag…
ben-chain Mar 11, 2021
5856cf8
Update contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManag…
ben-chain Mar 11, 2021
821d27a
Update contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManag…
ben-chain Mar 11, 2021
014ed31
Update contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManag…
ben-chain Mar 11, 2021
4a0bdd4
Merge branch 'feat/simplify-creation' into feat/763/ovm-self-upgrade
ben-chain Mar 11, 2021
aff7395
auth skeleton
ben-chain Mar 29, 2021
d111f06
Merge branch 'master' into feat/763/ovm-self-upgrade
ben-chain Mar 29, 2021
bc52f97
add tests setstorage
ben-chain Mar 30, 2021
6bfa26a
update smock, get smoddit assertions passing
ben-chain Mar 30, 2021
c7240c4
finish unit tests
ben-chain Apr 2, 2021
843d684
clean up EM
ben-chain Apr 2, 2021
29c3d2a
address PR feedback
ben-chain Apr 5, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add explicit unsafe bytecode test
  • Loading branch information
ben-chain committed Mar 9, 2021
commit 18734c79e0d2f7740a6ca2ae350232a2d68d75a3
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ import {
NON_NULL_BYTES32,
REVERT_FLAGS,
DUMMY_BYTECODE,
UNSAFE_BYTECODE,
ZERO_ADDRESS,
VERIFIED_EMPTY_CONTRACT_HASH,
DUMMY_BYTECODE_BYTELEN,
DUMMY_BYTECODE_HASH,
getStorageXOR,
encodeSolidityError,
} from '../../../../helpers'

const CREATED_CONTRACT_1 = '0x2bda4a99d5be88609d23b1e4ab5d1d34fb1c2feb'
Expand Down Expand Up @@ -725,6 +727,22 @@ const test_ovmCREATE: TestDefinition = {
},
],
},
{
name: 'ovmCREATE(UNSAFE_CODE)',
steps: [
{
functionName: 'ovmCREATE',
functionParams: {
bytecode: UNSAFE_BYTECODE,
},
expectedReturnStatus: true,
expectedReturnValue: {
address: ZERO_ADDRESS,
revertData: encodeSolidityError('Constrcutor attempted to deploy unsafe opcodes.')
},
},
],
},
],
subTests: [
{
Expand Down
1 change: 1 addition & 0 deletions test/helpers/dummy/bytecode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ import { keccak256 } from 'ethers/lib/utils'

export const DUMMY_BYTECODE = '0x123412341234'
export const DUMMY_BYTECODE_BYTELEN = 6
export const UNSAFE_BYTECODE = '0x6069606955'
export const DUMMY_BYTECODE_HASH = keccak256(DUMMY_BYTECODE)
7 changes: 6 additions & 1 deletion test/helpers/test-runner/test-runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import {
NULL_BYTES32,
} from '../constants'
import { getStorageXOR } from '../'
import { UNSAFE_BYTECODE } from '../dummy'

export class ExecutionManagerTestRunner {
private snapshot: string
Expand Down Expand Up @@ -194,7 +195,11 @@ export class ExecutionManagerTestRunner {
).deploy()

const MockSafetyChecker = await smockit(SafetyChecker)
MockSafetyChecker.smocked.isBytecodeSafe.will.return.with(true)
MockSafetyChecker.smocked.isBytecodeSafe.will.return.with(
(bytecode: string) => {
return bytecode !== UNSAFE_BYTECODE
}
)

this.contracts.OVM_SafetyChecker = MockSafetyChecker

Expand Down
4 changes: 4 additions & 0 deletions test/helpers/utils/sol-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,7 @@ const errorABI = new ethers.utils.Interface([
export const decodeSolidityError = (err: string): string => {
return errorABI.decodeFunctionData('Error', err)[0]
}

export const encodeSolidityError = (message: string): string => {
return errorABI.encodeFunctionData('Error', [message])
}