Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: merge develop to superchain modifier #117

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
f6ca236
feat(ct/kontrol): mock DeploymentSummary (#12388)
jsvisa Oct 22, 2024
5808985
op-node/rollup/derive: Implement Holocene Batch Stage (#12417)
sebastianst Oct 22, 2024
3b83710
op-deployer: Run validations over L2 genesis (#12560)
mslipper Oct 22, 2024
c9e3ad6
op-deployer: Add deploy config inspect command (#12570)
mslipper Oct 22, 2024
90fb25f
e2e test for Holocene's configurable eip-1559 params (#12499)
roberto-bayardo Oct 22, 2024
9483e3b
op-deployer: Fix standard artifacts urls (#12575)
mslipper Oct 22, 2024
b93daad
feat:add cannon mips mul/div tests (#12459)
GrapeBaBa Oct 22, 2024
2d08d19
rollup-client: Increase call timeouts in CI (#12561)
ajsutton Oct 22, 2024
cd640b0
feat: support permit2 on OptimismSuperchainERC20 + upgrade solady's e…
0xDiscotech Oct 22, 2024
8524872
proofs-tools: Update kona (#12581)
ajsutton Oct 22, 2024
bb5ab2e
op-deployer: Add support for inspecting l2 semvers (#12577)
mslipper Oct 22, 2024
1ad93ba
proofs-tools: Update kona to alpha 5 (#12583)
ajsutton Oct 22, 2024
e372a2d
op-service: Add omitempty to EIP1559Params (#12582)
mslipper Oct 22, 2024
bb6de07
op-program: Automatically verify the prestate hash for all op-program…
ajsutton Oct 22, 2024
371a66b
op-challenger: Use info log level for kona not default (#12585)
ajsutton Oct 22, 2024
984bd41
op-challenger: Use binary snapshots for asterisc (#12586)
ajsutton Oct 22, 2024
de79564
op-challenger: Log warning and continue if game impl not available (#…
ajsutton Oct 22, 2024
3fbf88b
proofs-tools: Use asterisc version from kona release. (#12587)
ajsutton Oct 23, 2024
32b7ca1
op-chain-ops: Marshal withdrawalnetwork as int (#12584)
mslipper Oct 23, 2024
da7350c
op-deployer: Remove zeroed out allocs and deployer addr (#12589)
mslipper Oct 23, 2024
2769b25
feat(ci): add tests for semgrep rules (#12563)
smartcontracts Oct 23, 2024
0ea0441
GasPriceOracle.sol: small fix (#11840)
cutecups Oct 23, 2024
93f5d41
fix: support storage key RPC response with <32 bytes (#12576)
meyer9 Oct 23, 2024
22d8365
op-challenger: Avoid cancelling context until response data has been …
ajsutton Oct 23, 2024
5ecd2db
proofs-tools: Update challenger (#12591)
ajsutton Oct 23, 2024
7c1ec6b
chore: small fix in op-alt-da (#12038)
Gmanboy Oct 23, 2024
a82a328
readme: fix network deployments link (#12000)
KailMillor Oct 23, 2024
8311719
doc: enhance derive package code comments (#12437)
threewebcode Oct 23, 2024
2bbffdc
fix: superchainWETH failing tests (#114) (#12571)
agusduha Oct 23, 2024
90bb8dc
Merge branch 'develop' into fix/merge-develop-to-superchain-modifier
agusduha Oct 23, 2024
d875270
fix: pre pr
agusduha Oct 23, 2024
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
57 changes: 7 additions & 50 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,8 @@ jobs:
- run:
name: print forge version
command: forge --version
- run-contracts-check:
command: semgrep-test-validity-check
- run-contracts-check:
command: semgrep
- run-contracts-check:
Expand Down Expand Up @@ -996,45 +998,11 @@ jobs:
preimage-reproducibility:
docker:
- image: <<pipeline.parameters.ci_builder_image>>
parameters:
version:
type: string
steps:
- checkout
- setup_remote_docker
- run:
name: Set expected prestate hash
command: |
find_prestate_hash() {
jq -r --arg version "<<parameters.version>>" '.[] | select(.version == $version) | .hash' "$1"
}

prestate_hash=$(find_prestate_hash "op-program/prestates/releases.json")
if [ -z "$prestate_hash" ]; then
echo "Unknown prestate version <<parameters.version>>"
exit 1
fi
echo "export EXPECTED_PRESTATE_HASH=$prestate_hash" >> $BASH_ENV
- run:
name: Switch to tag
command: |
git fetch
git checkout "op-program/v<<parameters.version>>"
git submodule update --init --recursive
- run:
name: Build prestate
command: make reproducible-prestate
- run:
name: Verify prestate
command: |
ACTUAL=$(jq -r .pre ./op-program/bin/prestate-proof.json)
echo "Expected: ${EXPECTED_PRESTATE_HASH}"
echo "Actual: ${ACTUAL}"
if [[ "${EXPECTED_PRESTATE_HASH}" != "${ACTUAL}" ]]
then
echo "Prestate did not match expected"
exit 1
fi
make -C op-program verify-reproducibility
- notify-failures-on-develop:
mentions: "@proofs-team"

Expand Down Expand Up @@ -1332,7 +1300,10 @@ workflows:
- semgrep-scan
- semgrep-scan:
name: semgrep-scan-local
scan_command: semgrep scan --timeout=100 --config=./.semgrep --error .
scan_command: semgrep scan --timeout=100 --config=./semgrep --error .
- semgrep-scan:
name: semgrep-test
scan_command: semgrep scan --test semgrep/
- go-lint
- fuzz-golang:
name: fuzz-golang-<<matrix.package_name>>
Expand Down Expand Up @@ -1699,19 +1670,5 @@ workflows:
- equal: [ true, << pipeline.parameters.reproducibility_dispatch >> ]
jobs:
- preimage-reproducibility:
matrix:
parameters:
version:
- "0.1.0"
- "0.2.0"
- "0.3.0"
- "1.0.0"
- "1.1.0"
- "1.2.0"
- "1.3.0-rc.1"
- "1.3.0-rc.2"
- "1.3.0-rc.3"
- "1.3.1-rc.1"
- "1.3.1-rc.2"
context:
slack
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,6 @@
[submodule "packages/contracts-bedrock/lib/openzeppelin-contracts-v5"]
path = packages/contracts-bedrock/lib/openzeppelin-contracts-v5
url = https://github.com/OpenZeppelin/openzeppelin-contracts
[submodule "packages/contracts-bedrock/lib/solady-v0.0.245"]
path = packages/contracts-bedrock/lib/solady-v0.0.245
url = https://github.com/vectorized/solady
2 changes: 1 addition & 1 deletion .semgrepignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ vendor/
*.min.js

# Semgrep rules folder
.semgrep
semgrep/

# Semgrep-action log folder
.semgrep_logs/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ All other components and packages should be considered development components on
### Development branch

The primary development branch is [`develop`](https://github.com/ethereum-optimism/optimism/tree/develop/).
`develop` contains the most up-to-date software that remains backwards compatible with the latest experimental [network deployments](https://community.optimism.io/docs/useful-tools/networks/).
`develop` contains the most up-to-date software that remains backwards compatible with the latest experimental [network deployments](https://docs.optimism.io/chain/networks).
If you're making a backwards compatible change, please direct your pull request towards `develop`.

**Changes to contracts within `packages/contracts-bedrock/src` are usually NOT considered backwards compatible.**
Expand Down
73 changes: 73 additions & 0 deletions cannon/mipsevm/tests/evm_common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,79 @@ func TestEVMSingleStep_MfhiMflo(t *testing.T) {
}
}

func TestEVMSingleStep_MulDiv(t *testing.T) {
var tracer *tracing.Hooks

versions := GetMipsVersionTestCases(t)
cases := []struct {
name string
rs Word
rt Word
funct uint32
opcode uint32
expectHi Word
expectLo Word
expectRes Word
rdReg uint32
expectRevert bool
errMsg string
}{
{name: "mul", funct: uint32(0x2), rs: Word(5), rt: Word(2), opcode: uint32(28), rdReg: uint32(0x8), expectRes: Word(10), expectRevert: false}, // mul t0, t1, t2
{name: "mult", funct: uint32(0x18), rs: Word(0x0F_FF_00_00), rt: Word(100), rdReg: uint32(0x0), opcode: uint32(0), expectHi: Word(0x6), expectLo: Word(0x3F_9C_00_00), expectRevert: false}, // mult t1, t2
{name: "multu", funct: uint32(0x19), rs: Word(0x0F_FF_00_00), rt: Word(100), rdReg: uint32(0x0), opcode: uint32(0), expectHi: Word(0x6), expectLo: Word(0x3F_9C_00_00), expectRevert: false}, // multu t1, t2
{name: "div", funct: uint32(0x1a), rs: Word(5), rt: Word(2), rdReg: uint32(0x0), opcode: uint32(0), expectHi: Word(1), expectLo: Word(2), expectRevert: false}, // div t1, t2
{name: "div by zero", funct: uint32(0x1a), rs: Word(5), rt: Word(0), rdReg: uint32(0x0), opcode: uint32(0), expectRevert: true, errMsg: "MIPS: division by zero"}, // div t1, t2
{name: "divu", funct: uint32(0x1b), rs: Word(5), rt: Word(2), rdReg: uint32(0x0), opcode: uint32(0), expectHi: Word(1), expectLo: Word(2), expectRevert: false}, // divu t1, t2
{name: "divu by zero", funct: uint32(0x1b), rs: Word(5), rt: Word(0), rdReg: uint32(0x0), opcode: uint32(0), expectRevert: true, errMsg: "MIPS: division by zero"}, // divu t1, t2
}

for _, v := range versions {
for i, tt := range cases {
testName := fmt.Sprintf("%v (%v)", tt.name, v.Name)
t.Run(testName, func(t *testing.T) {
goVm := v.VMFactory(nil, os.Stdout, os.Stderr, testutil.CreateLogger(), testutil.WithRandomization(int64(i)), testutil.WithPC(0), testutil.WithNextPC(4))
state := goVm.GetState()
var insn uint32
baseReg := uint32(0x9)
rtReg := uint32(0xa)

insn = tt.opcode<<26 | baseReg<<21 | rtReg<<16 | tt.rdReg<<11 | tt.funct
state.GetRegistersRef()[rtReg] = tt.rt
state.GetRegistersRef()[baseReg] = tt.rs
state.GetMemory().SetUint32(0, insn)

if tt.expectRevert {
proofData := v.ProofGenerator(t, goVm.GetState())
require.Panics(t, func() {
_, _ = goVm.Step(
false)
})
testutil.AssertEVMReverts(t, state, v.Contracts, tracer, proofData, tt.errMsg)
return
}

step := state.GetStep()
// Setup expectations
expected := testutil.NewExpectedState(state)
expected.ExpectStep()
if tt.expectRes != 0 {
expected.Registers[tt.rdReg] = tt.expectRes
} else {
expected.HI = tt.expectHi
expected.LO = tt.expectLo
}

stepWitness, err := goVm.Step(true)
require.NoError(t, err)

// Check expectations
expected.Validate(t, state)
testutil.ValidateEVM(t, stepWitness, step, goVm, v.StateHashFn, v.Contracts, tracer)
})
}
}
}

func TestEVMSingleStep_MthiMtlo(t *testing.T) {
var tracer *tracing.Hooks
versions := GetMipsVersionTestCases(t)
Expand Down
5 changes: 2 additions & 3 deletions docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,8 @@ target "proofs-tools" {
dockerfile = "./ops/docker/proofs-tools/Dockerfile"
context = "."
args = {
CHALLENGER_VERSION="e7085e537b4a0c95d41b048cfcfdd7ad24808337"
KONA_VERSION="kona-client-v0.1.0-alpha.3"
ASTERISC_VERSION="v1.0.3-alpha1"
CHALLENGER_VERSION="22d8365199b3141fcfbccc7cb9e107a71e151b0a"
KONA_VERSION="kona-client-v0.1.0-alpha.5"
}
target="proofs-tools"
platforms = split(",", PLATFORMS)
Expand Down
6 changes: 5 additions & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ issues:

# Runs semgrep on the entire monorepo.
semgrep:
semgrep scan --config=.semgrep --error .
semgrep scan --config=semgrep --error .

# Runs semgrep tests.
semgrep-test:
semgrep scan --test semgrep/

lint-shellcheck:
find . -type f -name '*.sh' -not -path '*/node_modules/*' -not -path './packages/contracts-bedrock/lib/*' -not -path './packages/contracts-bedrock/kout*/*' -exec sh -c 'echo \"Checking $1\"; shellcheck \"$1\"' _ {} \\;
Expand Down
2 changes: 1 addition & 1 deletion op-batcher/batcher/channel_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func TestChannelConfig_Check(t *testing.T) {
}
for i := 0; i < derive.FrameV0OverHeadSize; i++ {
expectedErr := fmt.Sprintf("max frame size %d is less than the minimum 23", i)
i := i // need to udpate Go version...
i := i // need to update Go version...
tests = append(tests, test{
input: func() ChannelConfig {
cfg := defaultTestChannelConfig()
Expand Down
2 changes: 1 addition & 1 deletion op-chain-ops/cmd/check-canyon/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ func main() {
// Parse the command-line arguments
flag.Parse()

l2RPC, err := client.NewRPC(context.Background(), logger, rpcURL, client.WithDialBackoff(10))
l2RPC, err := client.NewRPC(context.Background(), logger, rpcURL, client.WithDialAttempts(10))
if err != nil {
log.Crit("Error creating RPC", "err", err)
}
Expand Down
6 changes: 3 additions & 3 deletions op-chain-ops/genesis/testdata/test-deploy-config-full.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@
"baseFeeVaultMinimumWithdrawalAmount": "0x8ac7230489e80000",
"l1FeeVaultMinimumWithdrawalAmount": "0x8ac7230489e80000",
"sequencerFeeVaultMinimumWithdrawalAmount": "0x8ac7230489e80000",
"baseFeeVaultWithdrawalNetwork": "remote",
"l1FeeVaultWithdrawalNetwork": "local",
"sequencerFeeVaultWithdrawalNetwork": "local",
"baseFeeVaultWithdrawalNetwork": 0,
"l1FeeVaultWithdrawalNetwork": 1,
"sequencerFeeVaultWithdrawalNetwork": 1,
"l1StandardBridgeProxy": "0x42000000000000000000000000000000000000f8",
"l1CrossDomainMessengerProxy": "0x42000000000000000000000000000000000000f9",
"l1ERC721BridgeProxy": "0x4200000000000000000000000000000000000060",
Expand Down
4 changes: 4 additions & 0 deletions op-chain-ops/genesis/withdrawal_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,7 @@ func (w *WithdrawalNetwork) UnmarshalJSON(b []byte) error {
*w = s
return nil
}

func (w WithdrawalNetwork) MarshalJSON() ([]byte, error) {
return json.Marshal(int(w.ToUint8()))
}
36 changes: 29 additions & 7 deletions op-chain-ops/genesis/withdrawal_network_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ func TestWithdrawalNetworkInlineJSON(t *testing.T) {
"sequencerFeeVaultWithdrawalNetwork": "local"
}`

intJsonString := `{
"baseFeeVaultWithdrawalNetwork": 0,
"l1FeeVaultWithdrawalNetwork": 1,
"sequencerFeeVaultWithdrawalNetwork": 1
}`

t.Run("StringMarshaling", func(t *testing.T) {
decoded := new(tempNetworks)
require.NoError(t, json.Unmarshal([]byte(jsonString), decoded))
Expand All @@ -101,15 +107,10 @@ func TestWithdrawalNetworkInlineJSON(t *testing.T) {

encoded, err := json.Marshal(decoded)
require.NoError(t, err)
require.JSONEq(t, jsonString, string(encoded))
require.JSONEq(t, intJsonString, string(encoded))
})

t.Run("IntMarshaling", func(t *testing.T) {
intJsonString := `{
"baseFeeVaultWithdrawalNetwork": 0,
"l1FeeVaultWithdrawalNetwork": 1,
"sequencerFeeVaultWithdrawalNetwork": 1
}`

decoded := new(tempNetworks)
require.NoError(t, json.Unmarshal([]byte(intJsonString), decoded))
Expand All @@ -120,6 +121,27 @@ func TestWithdrawalNetworkInlineJSON(t *testing.T) {

encoded, err := json.Marshal(decoded)
require.NoError(t, err)
require.JSONEq(t, jsonString, string(encoded))
require.JSONEq(t, intJsonString, string(encoded))
})
}

func TestWithdrawalNetworkMarshalJSON(t *testing.T) {
type test struct {
Network WithdrawalNetwork
}

tests := []struct {
network WithdrawalNetwork
exp string
}{
{WithdrawalNetwork("local"), `{"Network":1}`},
{WithdrawalNetwork("remote"), `{"Network":0}`},
}
for _, tt := range tests {
t.Run(string(tt.network), func(t *testing.T) {
data, err := json.Marshal(test{tt.network})
require.NoError(t, err)
require.JSONEq(t, tt.exp, string(data))
})
}
}
2 changes: 2 additions & 0 deletions op-chain-ops/script/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ var (
ConsoleAddr = common.HexToAddress("0x000000000000000000636F6e736F6c652e6c6f67")
// ScriptDeployer is used for temporary scripts address(uint160(uint256(keccak256("op-stack script deployer"))))
ScriptDeployer = common.HexToAddress("0x76Ce131128F3616871f8CDA86d18fAB44E4d0D8B")
// ForgeDeployer is used by some scripts as a default deployer address, e.g. makeAddr("deployer")
ForgeDeployer = common.HexToAddress("0xaE0bDc4eEAC5E950B67C6819B118761CaAF61946")
)

const (
Expand Down
22 changes: 22 additions & 0 deletions op-chain-ops/script/script.go
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,11 @@ func (h *Host) HasPrecompileOverride(addr common.Address) bool {
return ok
}

// GetCode returns the code of an account from the state.
func (h *Host) GetCode(addr common.Address) []byte {
return h.state.GetCode(addr)
}

// onEnter is a trace-hook, which we use to apply changes to the state-DB, to simulate isolated broadcast calls,
// for better gas estimation of the exact broadcast call execution.
func (h *Host) onEnter(depth int, typ byte, from common.Address, to common.Address, input []byte, gas uint64, value *big.Int) {
Expand Down Expand Up @@ -672,8 +677,25 @@ func (h *Host) StateDump() (*foundry.ForgeAllocs, error) {
delete(allocs.Accounts, scriptAddr)
}

// Clean out empty storage slots in the dump - this is necessary for compatibility
// with the superchain registry.
for _, account := range allocs.Accounts {
toDelete := make([]common.Hash, 0)

for slot, value := range account.Storage {
if value == (common.Hash{}) {
toDelete = append(toDelete, slot)
}
}

for _, slot := range toDelete {
delete(account.Storage, slot)
}
}

// Remove the script deployer from the output
delete(allocs.Accounts, ScriptDeployer)
delete(allocs.Accounts, ForgeDeployer)

// The cheatcodes VM has a placeholder bytecode,
// because solidity checks if the code exists prior to regular EVM-calls to it.
Expand Down
26 changes: 14 additions & 12 deletions op-challenger/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,20 +158,22 @@ func NewConfig(
BinarySnapshots: true,
},
Asterisc: vm.Config{
VmType: types.TraceTypeAsterisc,
L1: l1EthRpc,
L1Beacon: l1BeaconApi,
L2: l2EthRpc,
SnapshotFreq: DefaultAsteriscSnapshotFreq,
InfoFreq: DefaultAsteriscInfoFreq,
VmType: types.TraceTypeAsterisc,
L1: l1EthRpc,
L1Beacon: l1BeaconApi,
L2: l2EthRpc,
SnapshotFreq: DefaultAsteriscSnapshotFreq,
InfoFreq: DefaultAsteriscInfoFreq,
BinarySnapshots: true,
},
AsteriscKona: vm.Config{
VmType: types.TraceTypeAsteriscKona,
L1: l1EthRpc,
L1Beacon: l1BeaconApi,
L2: l2EthRpc,
SnapshotFreq: DefaultAsteriscSnapshotFreq,
InfoFreq: DefaultAsteriscInfoFreq,
VmType: types.TraceTypeAsteriscKona,
L1: l1EthRpc,
L1Beacon: l1BeaconApi,
L2: l2EthRpc,
SnapshotFreq: DefaultAsteriscSnapshotFreq,
InfoFreq: DefaultAsteriscInfoFreq,
BinarySnapshots: true,
},
GameWindow: DefaultGameWindow,
}
Expand Down
Loading