├── .changeset ├── README.md └── config.json ├── .circleci └── config.yml ├── .coderabbit.yml ├── .dockerignore ├── .editorconfig ├── .envrc.example ├── .eslintrc.js ├── .gitattributes ├── .github ├── CODEOWNERS ├── actions │ └── setup │ │ └── action.yml ├── dependabot.yml ├── mergify.yml └── workflows │ ├── close-stale.yml │ ├── release-docker-canary.yml │ ├── release-snapshot.yml │ ├── release.yml │ ├── slither.yml │ └── tag-service.yml ├── .gitignore ├── .gitmodules ├── .npmrc ├── .nvmrc ├── .pnpmfile.cjs ├── .prettierrc.js ├── .semgrepignore ├── .shellcheckrc ├── .snyk ├── .vscode ├── extensions.json └── settings.json ├── CITATION.cff ├── CONTRIBUTING.md ├── LICENSE ├── Makefile ├── README.md ├── SECURITY.md ├── bedrock-devnet ├── README.md ├── devnet │ ├── __init__.py │ └── log_setup.py └── main.py ├── cannon ├── .gitignore ├── LICENSE ├── Makefile ├── README.md ├── cmd │ ├── load_elf.go │ ├── log.go │ ├── matcher.go │ ├── run.go │ └── witness.go ├── docs │ └── README.md ├── example │ ├── Makefile │ ├── alloc │ │ ├── go.mod │ │ ├── go.sum │ │ └── main.go │ ├── claim │ │ ├── go.mod │ │ ├── go.sum │ │ └── main.go │ └── hello │ │ ├── go.mod │ │ └── main.go ├── main.go └── mipsevm │ ├── .gitignore │ ├── README.md │ ├── evm.go │ ├── evm_test.go │ ├── fuzz_evm_test.go │ ├── iface.go │ ├── instrumented.go │ ├── logw.go │ ├── memory.go │ ├── memory_test.go │ ├── metadata.go │ ├── mips.go │ ├── mips_instructions.go │ ├── mips_syscalls.go │ ├── open_mips_tests │ ├── LICENSE │ ├── README.md │ ├── maketests.py │ └── test │ │ ├── add.asm │ │ ├── addi.asm │ │ ├── addiu.asm │ │ ├── addu.asm │ │ ├── and.asm │ │ ├── andi.asm │ │ ├── beq.asm │ │ ├── bgez.asm │ │ ├── bgtz.asm │ │ ├── bin │ │ ├── add.bin │ │ ├── addi.bin │ │ ├── addiu.bin │ │ ├── addu.bin │ │ ├── and.bin │ │ ├── andi.bin │ │ ├── beq.bin │ │ ├── bgez.bin │ │ ├── bgtz.bin │ │ ├── blez.bin │ │ ├── bltz.bin │ │ ├── bne.bin │ │ ├── brk.bin │ │ ├── clo.bin │ │ ├── clone.bin │ │ ├── clz.bin │ │ ├── div.bin │ │ ├── divu.bin │ │ ├── exit_group.bin │ │ ├── fcntl.bin │ │ ├── j.bin │ │ ├── jal.bin │ │ ├── jalr.bin │ │ ├── jr.bin │ │ ├── lb.bin │ │ ├── lbu.bin │ │ ├── lh.bin │ │ ├── lhu.bin │ │ ├── lui.bin │ │ ├── lw.bin │ │ ├── lwl.bin │ │ ├── lwr.bin │ │ ├── mfthi.bin │ │ ├── mftlo.bin │ │ ├── mmap.bin │ │ ├── movn.bin │ │ ├── movz.bin │ │ ├── mul.bin │ │ ├── mult.bin │ │ ├── multu.bin │ │ ├── nor.bin │ │ ├── oracle.bin │ │ ├── oracle_kzg.bin │ │ ├── oracle_unaligned_read.bin │ │ ├── oracle_unaligned_write.bin │ │ ├── ori.bin │ │ ├── sb.bin │ │ ├── sh.bin │ │ ├── sll.bin │ │ ├── sllv.bin │ │ ├── slt.bin │ │ ├── slti.bin │ │ ├── sltiu.bin │ │ ├── sltu.bin │ │ ├── sra.bin │ │ ├── srav.bin │ │ ├── srl.bin │ │ ├── srlv.bin │ │ ├── sub.bin │ │ ├── subu.bin │ │ ├── swl.bin │ │ ├── swr.bin │ │ ├── xor.bin │ │ └── xori.bin │ │ ├── blez.asm │ │ ├── bltz.asm │ │ ├── bne.asm │ │ ├── brk.asm │ │ ├── clo.asm │ │ ├── clone.asm │ │ ├── clz.asm │ │ ├── div.asm │ │ ├── divu.asm │ │ ├── exit_group.asm │ │ ├── fcntl.asm │ │ ├── j.asm │ │ ├── jal.asm │ │ ├── jalr.asm │ │ ├── jr.asm │ │ ├── lb.asm │ │ ├── lbu.asm │ │ ├── lh.asm │ │ ├── lhu.asm │ │ ├── lui.asm │ │ ├── lw.asm │ │ ├── lwl.asm │ │ ├── lwr.asm │ │ ├── mfthi.asm │ │ ├── mftlo.asm │ │ ├── mmap.asm │ │ ├── movn.asm │ │ ├── movz.asm │ │ ├── mul.asm │ │ ├── mult.asm │ │ ├── multu.asm │ │ ├── nor.asm │ │ ├── oracle.asm │ │ ├── oracle_kzg.asm │ │ ├── oracle_unaligned_read.asm │ │ ├── oracle_unaligned_write.asm │ │ ├── ori.asm │ │ ├── sb.asm │ │ ├── sh.asm │ │ ├── sll.asm │ │ ├── sllv.asm │ │ ├── slt.asm │ │ ├── slti.asm │ │ ├── sltiu.asm │ │ ├── sltu.asm │ │ ├── sra.asm │ │ ├── srav.asm │ │ ├── srl.asm │ │ ├── srlv.asm │ │ ├── sub.asm │ │ ├── subu.asm │ │ ├── swl.asm │ │ ├── swr.asm │ │ ├── xor.asm │ │ └── xori.asm │ ├── page.go │ ├── page_test.go │ ├── patch.go │ ├── state.go │ ├── state_mt.go │ ├── state_mt_test.go │ ├── state_test.go │ └── witness.go ├── cloudbuild.yaml ├── codecov.yml ├── docker-bake.hcl ├── docs ├── README.md ├── fault-proof-alpha │ ├── README.md │ ├── cannon.md │ ├── deployments.md │ ├── immunefi.md │ ├── invalid-proposals.md │ ├── manual.md │ └── run-challenger.md ├── handbook │ └── pr-guidelines.md ├── postmortems │ ├── 2022-02-02-inflation-vuln.md │ ├── 2022-05-31-drop-1.md │ ├── 2023-04-26-transaction-delays.md │ └── 2023-04-26-transaction-delays │ │ └── outage.png └── security-reviews │ ├── 2020_10-Rollup-TrailOfBits.pdf │ ├── 2020_11-Dapphub-ECDSA_Wallet.pdf │ ├── 2021_03-OVM_and_Rollup-OpenZeppelin.pdf │ ├── 2021_03-SafetyChecker-ConsenSysDiligence.pdf │ ├── 2022_05-Bedrock_Contracts-Zeppelin.pdf │ ├── 2022_05-OpNode-TrailOfBits.pdf │ ├── 2022_08-Bedrock_GoLang-SigmaPrime.pdf │ ├── 2022_09-Bedrock_and_Periphery-Zeppelin.pdf │ ├── 2022_10-Drippie-Spearbit.pdf │ ├── 2022_11-Invariant_Testing-TrailOfBits.pdf │ ├── 2023_01-Bedrock_Updates-TrailOfBits.pdf │ ├── 2023_12_Trust_SuperchainConfigUpgrade.pdf │ ├── 2024_02-MCP_L1-Cantina.pdf │ ├── 2024_05-FaultProofs-Sherlock.pdf │ ├── 2024_05_SafeLivenessExtensions-Cantina.pdf │ └── README.md ├── go.mod ├── go.sum ├── nx.json ├── op-batcher ├── .gitignore ├── Makefile ├── batcher │ ├── batch_submitter.go │ ├── channel.go │ ├── channel_builder.go │ ├── channel_builder_test.go │ ├── channel_config.go │ ├── channel_config_test.go │ ├── channel_manager.go │ ├── channel_manager_test.go │ ├── channel_test.go │ ├── config.go │ ├── config_test.go │ ├── driver.go │ ├── driver_test.go │ ├── service.go │ ├── tx_data.go │ └── tx_data_test.go ├── cmd │ └── main.go ├── compressor │ ├── compressors.go │ ├── compressors_test.go │ ├── config.go │ ├── non_compressor.go │ ├── non_compressor_test.go │ ├── ratio_compressor.go │ ├── ratio_compressor_test.go │ ├── shadow_compressor.go │ └── shadow_compressor_test.go ├── flags │ ├── flags.go │ ├── flags_test.go │ └── types.go ├── metrics │ ├── metrics.go │ └── noop.go └── rpc │ └── api.go ├── op-bootnode ├── .gitignore ├── Makefile ├── bootnode │ └── entrypoint.go ├── cmd │ └── main.go └── flags │ └── flags.go ├── op-chain-ops ├── .gitignore ├── Makefile ├── clients │ └── clients.go ├── cmd │ ├── check-canyon │ │ └── main.go │ ├── check-delta │ │ └── aggregate-channels.sh │ ├── check-deploy-config │ │ └── main.go │ ├── check-derivation │ │ └── main.go │ ├── check-ecotone │ │ ├── bindings │ │ │ └── gaspriceoracle.go │ │ └── main.go │ ├── check-fjord │ │ ├── checks │ │ │ └── checks.go │ │ └── main.go │ ├── ecotone-scalar │ │ ├── README.md │ │ └── main.go │ ├── op-simulate │ │ └── main.go │ ├── protocol-version │ │ └── main.go │ ├── receipt-reference-builder │ │ ├── README.md │ │ ├── convert.go │ │ ├── main.go │ │ ├── merge.go │ │ ├── print.go │ │ ├── pull.go │ │ └── readwrite.go │ └── unclaimed-credits │ │ └── main.go ├── contracts │ ├── common.go │ └── contracts.go ├── crossdomain │ ├── alias.go │ ├── alias_test.go │ ├── bindings │ │ ├── l1crossdomainmessenger.go │ │ ├── l1standardbridge.go │ │ └── l2crossdomainmessenger.go │ ├── doc.go │ ├── encoding.go │ ├── encoding_test.go │ ├── hashing.go │ ├── legacy.go │ ├── legacy_withdrawal.go │ ├── legacy_withdrawal_test.go │ ├── message.go │ ├── message_test.go │ ├── migrate.go │ ├── migrate_test.go │ ├── testdata │ │ ├── README.md │ │ ├── call-traces │ │ │ ├── 0x26b854fe0b8f0c5ad15d5c3c1291107cc870f5d7351cfc399e23e68f22231fbe.json │ │ │ ├── 0x32d3b5a0178a33cfbf904cfd36f66a13ff8576f409f15aae86dc3ff0e101c93a.json │ │ │ ├── 0x38236157c6941ef64f4dd0dfa7efed4a82ef9fccdcdda75a8ee89cbe831b182b.json │ │ │ └── 0xed57a510022157b14542491a501daed1d58003e4b274b331d2fc40dcc43f0941.json │ │ ├── receipts │ │ │ ├── 0x26b854fe0b8f0c5ad15d5c3c1291107cc870f5d7351cfc399e23e68f22231fbe.json │ │ │ ├── 0x32d3b5a0178a33cfbf904cfd36f66a13ff8576f409f15aae86dc3ff0e101c93a.json │ │ │ ├── 0x38236157c6941ef64f4dd0dfa7efed4a82ef9fccdcdda75a8ee89cbe831b182b.json │ │ │ └── 0xed57a510022157b14542491a501daed1d58003e4b274b331d2fc40dcc43f0941.json │ │ ├── state-diffs │ │ │ ├── 0x26b854fe0b8f0c5ad15d5c3c1291107cc870f5d7351cfc399e23e68f22231fbe.json │ │ │ ├── 0x32d3b5a0178a33cfbf904cfd36f66a13ff8576f409f15aae86dc3ff0e101c93a.json │ │ │ ├── 0x38236157c6941ef64f4dd0dfa7efed4a82ef9fccdcdda75a8ee89cbe831b182b.json │ │ │ └── 0xed57a510022157b14542491a501daed1d58003e4b274b331d2fc40dcc43f0941.json │ │ ├── trace.sh │ │ └── witness.txt │ ├── types.go │ ├── withdrawal.go │ └── withdrawal_test.go ├── etherscan │ └── client.go ├── foundry │ ├── artifact.go │ ├── artifact_test.go │ └── testdata │ │ └── OptimismPortal.json ├── genesis │ ├── config.go │ ├── config_test.go │ ├── genesis.go │ ├── helpers.go │ ├── layer_one.go │ ├── layer_one_test.go │ ├── layer_two.go │ ├── testdata │ │ ├── l1-deployments.json │ │ └── test-deploy-config-full.json │ ├── withdrawal_network.go │ └── withdrawal_network_test.go ├── solc │ └── types.go └── srcmap │ ├── solutil.go │ └── solutil_test.go ├── op-challenger ├── .gitignore ├── Makefile ├── README.md ├── challenger.go ├── challenger_test.go ├── cmd │ ├── create_game.go │ ├── credits.go │ ├── list_claims.go │ ├── list_games.go │ ├── main.go │ ├── main_test.go │ ├── move.go │ ├── resolve.go │ ├── resolve_claim.go │ └── utils.go ├── config │ ├── config.go │ └── config_test.go ├── flags │ ├── flags.go │ └── flags_test.go ├── game │ ├── disk.go │ ├── disk_test.go │ ├── fault │ │ ├── agent.go │ │ ├── agent_test.go │ │ ├── claims │ │ │ ├── claimer.go │ │ │ ├── claimer_test.go │ │ │ ├── scheduler.go │ │ │ └── scheduler_test.go │ │ ├── contracts │ │ │ ├── abis │ │ │ │ ├── FaultDisputeGame-0.18.1.json │ │ │ │ ├── FaultDisputeGame-0.8.0.json │ │ │ │ └── FaultDisputeGame-1.1.1.json │ │ │ ├── delayed_weth.go │ │ │ ├── delayed_weth_test.go │ │ │ ├── faultdisputegame.go │ │ │ ├── faultdisputegame0180.go │ │ │ ├── faultdisputegame080.go │ │ │ ├── faultdisputegame111.go │ │ │ ├── faultdisputegame_test.go │ │ │ ├── gamefactory.go │ │ │ ├── gamefactory_test.go │ │ │ ├── metrics │ │ │ │ ├── metrics.go │ │ │ │ └── noop.go │ │ │ ├── oracle.go │ │ │ ├── oracle_test.go │ │ │ ├── vm.go │ │ │ └── vm_test.go │ │ ├── player.go │ │ ├── player_test.go │ │ ├── preimages │ │ │ ├── direct.go │ │ │ ├── direct_test.go │ │ │ ├── large.go │ │ │ ├── large_test.go │ │ │ ├── split.go │ │ │ ├── split_test.go │ │ │ └── types.go │ │ ├── register.go │ │ ├── responder │ │ │ ├── responder.go │ │ │ └── responder_test.go │ │ ├── solver │ │ │ ├── actors.go │ │ │ ├── game_rules_test.go │ │ │ ├── game_solver.go │ │ │ ├── game_solver_test.go │ │ │ ├── honest_claims.go │ │ │ ├── honest_claims_test.go │ │ │ ├── rules.go │ │ │ ├── solver.go │ │ │ └── solver_test.go │ │ ├── sync.go │ │ ├── sync_test.go │ │ ├── test │ │ │ ├── alphabet.go │ │ │ ├── claim_builder.go │ │ │ ├── game_builder.go │ │ │ └── seq_builder.go │ │ ├── trace │ │ │ ├── access.go │ │ │ ├── access_test.go │ │ │ ├── alphabet │ │ │ │ ├── prestate.go │ │ │ │ ├── prestate_test.go │ │ │ │ ├── provider.go │ │ │ │ └── provider_test.go │ │ │ ├── asterisc │ │ │ │ ├── prestate.go │ │ │ │ ├── prestate_test.go │ │ │ │ ├── provider.go │ │ │ │ ├── provider_test.go │ │ │ │ ├── state.go │ │ │ │ ├── state_test.go │ │ │ │ └── test_data │ │ │ │ │ ├── invalid.json │ │ │ │ │ ├── proofs │ │ │ │ │ ├── 0.json │ │ │ │ │ ├── 1.json │ │ │ │ │ └── 2.json │ │ │ │ │ └── state.json │ │ │ ├── cannon │ │ │ │ ├── prestate.go │ │ │ │ ├── prestate_test.go │ │ │ │ ├── provider.go │ │ │ │ ├── provider_test.go │ │ │ │ ├── state.go │ │ │ │ ├── state_test.go │ │ │ │ └── test_data │ │ │ │ │ ├── invalid.json │ │ │ │ │ ├── proofs │ │ │ │ │ ├── 0.json │ │ │ │ │ ├── 1.json │ │ │ │ │ ├── 2.json │ │ │ │ │ ├── 420.json │ │ │ │ │ └── 421.json │ │ │ │ │ └── state.json │ │ │ ├── outputs │ │ │ │ ├── output_alphabet.go │ │ │ │ ├── output_asterisc.go │ │ │ │ ├── output_cannon.go │ │ │ │ ├── prestate.go │ │ │ │ ├── prestate_test.go │ │ │ │ ├── provider.go │ │ │ │ ├── provider_cache.go │ │ │ │ ├── provider_cache_test.go │ │ │ │ ├── provider_test.go │ │ │ │ ├── split_adapter.go │ │ │ │ └── split_adapter_test.go │ │ │ ├── prestates │ │ │ │ ├── cache.go │ │ │ │ ├── cache_test.go │ │ │ │ ├── multi.go │ │ │ │ ├── multi_test.go │ │ │ │ └── single.go │ │ │ ├── split │ │ │ │ ├── split.go │ │ │ │ └── split_test.go │ │ │ ├── translate.go │ │ │ ├── translate_test.go │ │ │ ├── utils │ │ │ │ ├── local.go │ │ │ │ ├── local_test.go │ │ │ │ ├── preimage.go │ │ │ │ ├── preimage_test.go │ │ │ │ └── provider.go │ │ │ └── vm │ │ │ │ ├── executor.go │ │ │ │ ├── executor_test.go │ │ │ │ └── prestates.go │ │ ├── types │ │ │ ├── actions.go │ │ │ ├── game.go │ │ │ ├── game_test.go │ │ │ ├── position.go │ │ │ ├── position_test.go │ │ │ ├── types.go │ │ │ └── types_test.go │ │ ├── validator.go │ │ └── validator_test.go │ ├── keccak │ │ ├── challenger.go │ │ ├── challenger_test.go │ │ ├── fetcher │ │ │ ├── fetcher.go │ │ │ └── fetcher_test.go │ │ ├── matrix │ │ │ ├── immediateeof_test.go │ │ │ ├── keccak.go │ │ │ ├── matrix.go │ │ │ ├── matrix_test.go │ │ │ └── testdata │ │ │ │ └── commitments.json │ │ ├── merkle │ │ │ ├── testdata │ │ │ │ └── proofs.json │ │ │ ├── tree.go │ │ │ └── tree_test.go │ │ ├── scheduler.go │ │ ├── scheduler_test.go │ │ ├── types │ │ │ ├── types.go │ │ │ └── types_test.go │ │ ├── verifier.go │ │ └── verifier_test.go │ ├── monitor.go │ ├── monitor_test.go │ ├── registry │ │ ├── oracles.go │ │ ├── oracles_test.go │ │ ├── registry.go │ │ └── registry_test.go │ ├── scheduler │ │ ├── coordinator.go │ │ ├── coordinator_test.go │ │ ├── scheduler.go │ │ ├── scheduler_test.go │ │ ├── test │ │ │ └── stub_player.go │ │ ├── types.go │ │ ├── worker.go │ │ └── worker_test.go │ ├── service.go │ └── types │ │ ├── types.go │ │ └── types_test.go ├── metrics │ ├── metrics.go │ └── noop.go ├── sender │ ├── sender.go │ └── sender_test.go ├── tools │ └── create_game.go └── version │ └── version.go ├── op-conductor ├── .gitignore ├── Makefile ├── README.md ├── assets │ ├── op-conductor-state-transition.svg │ └── op-conductor.svg ├── client │ ├── mocks │ │ └── SequencerControl.go │ └── sequencer.go ├── cmd │ └── main.go ├── conductor │ ├── config.go │ ├── service.go │ └── service_test.go ├── consensus │ ├── iface.go │ ├── mocks │ │ └── Consensus.go │ ├── raft.go │ ├── raft_fsm.go │ ├── raft_fsm_test.go │ └── raft_test.go ├── flags │ ├── flags.go │ └── flags_test.go ├── health │ ├── mocks │ │ └── HealthMonitor.go │ ├── monitor.go │ └── monitor_test.go ├── metrics │ ├── metrics.go │ └── noop.go ├── rpc │ ├── api.go │ ├── backend.go │ ├── client.go │ ├── execution_proxy.go │ ├── node_admin_proxy.go │ └── node_proxy.go └── run_test_100times.sh ├── op-dispute-mon ├── .gitignore ├── Dockerfile ├── Dockerfile.dockerignore ├── Makefile ├── README.md ├── cmd │ ├── main.go │ └── main_test.go ├── config │ ├── config.go │ └── config_test.go ├── flags │ ├── flags.go │ └── flags_test.go ├── metrics │ ├── metrics.go │ └── noop.go ├── mon │ ├── bonds │ │ ├── collateral.go │ │ ├── collateral_test.go │ │ ├── monitor.go │ │ └── monitor_test.go │ ├── claims.go │ ├── claims_test.go │ ├── extract │ │ ├── agreement_enricher.go │ │ ├── agreement_enricher_test.go │ │ ├── balance_enricher.go │ │ ├── balance_enricher_test.go │ │ ├── bond_enricher.go │ │ ├── bond_enricher_test.go │ │ ├── caller.go │ │ ├── caller_test.go │ │ ├── claim_enricher.go │ │ ├── claim_enricher_test.go │ │ ├── extractor.go │ │ ├── extractor_test.go │ │ ├── head_enricher.go │ │ ├── head_enricher_test.go │ │ ├── recipient_enricher.go │ │ ├── recipient_enricher_test.go │ │ ├── withdrawals_enricher.go │ │ └── withdrawals_enricher_test.go │ ├── forecast.go │ ├── forecast_test.go │ ├── l2_challenges.go │ ├── l2_challenges_test.go │ ├── monitor.go │ ├── monitor_test.go │ ├── resolutions.go │ ├── resolutions_test.go │ ├── resolve.go │ ├── resolve_test.go │ ├── service.go │ ├── transform │ │ ├── tree.go │ │ └── tree_test.go │ ├── types │ │ ├── honest_actors.go │ │ └── types.go │ ├── withdrawals.go │ └── withdrawals_test.go ├── monitor.go ├── monitor_test.go └── version │ └── version.go ├── op-e2e ├── .gitignore ├── Makefile ├── README.md ├── actions │ ├── action.go │ ├── blocktime_test.go │ ├── dencun_fork_test.go │ ├── ecotone_fork_test.go │ ├── eip4844_test.go │ ├── fjord_fork_test.go │ ├── garbage_channel_out.go │ ├── l1_miner.go │ ├── l1_miner_test.go │ ├── l1_replica.go │ ├── l1_replica_test.go │ ├── l2_batcher.go │ ├── l2_batcher_test.go │ ├── l2_engine.go │ ├── l2_engine_test.go │ ├── l2_proposer.go │ ├── l2_proposer_test.go │ ├── l2_sequencer.go │ ├── l2_sequencer_test.go │ ├── l2_verifier.go │ ├── l2_verifier_test.go │ ├── plasma_test.go │ ├── reorg_test.go │ ├── safedb_test.go │ ├── span_batch_test.go │ ├── sync_test.go │ ├── system_config_test.go │ ├── tx_helper.go │ ├── user.go │ └── user_test.go ├── bindings │ ├── addressmanager.go │ ├── alphabetvm.go │ ├── alphabetvm2.go │ ├── basefeevault.go │ ├── create2deployer.go │ ├── crossdomainmessenger.go │ ├── delayedvetoable.go │ ├── delayedweth.go │ ├── deployerwhitelist.go │ ├── deterministicdeploymentproxy.go │ ├── disputegamefactory.go │ ├── eas.go │ ├── entrypoint.go │ ├── erc20.go │ ├── faultdisputegame.go │ ├── gaspriceoracle.go │ ├── governancetoken.go │ ├── isemver.go │ ├── l1block.go │ ├── l1blocknumber.go │ ├── l1crossdomainmessenger.go │ ├── l1erc721bridge.go │ ├── l1feevault.go │ ├── l1standardbridge.go │ ├── l2crossdomainmessenger.go │ ├── l2erc721bridge.go │ ├── l2outputoracle.go │ ├── l2standardbridge.go │ ├── l2tol1messagepasser.go │ ├── legacymessagepasser.go │ ├── mips.go │ ├── multicall3.go │ ├── multisend_v130.go │ ├── multisendcallonly_v130.go │ ├── optimismmintableerc20.go │ ├── optimismmintableerc20factory.go │ ├── optimismmintableerc721factory.go │ ├── optimismportal.go │ ├── permit2.go │ ├── preimageoracle.go │ ├── protocolversions.go │ ├── proxy.go │ ├── proxyadmin.go │ ├── safe.go │ ├── safe_v130.go │ ├── safel2_v130.go │ ├── safeproxyfactory.go │ ├── safesingletonfactory.go │ ├── schemaregistry.go │ ├── sendercreator.go │ ├── sequencerfeevault.go │ ├── standardbridge.go │ ├── storagesetter.go │ ├── superchainconfig.go │ ├── systemconfig.go │ ├── weth.go │ └── weth9.go ├── bindingspreview │ └── optimismportal2.go ├── bridge_test.go ├── brotli_batcher_test.go ├── build_helper.go ├── check_scripts_test.go ├── config │ └── init.go ├── custom_gas_token_test.go ├── deposit_test.go ├── e2eutils │ ├── addresses.go │ ├── addresses_test.go │ ├── batcher │ │ └── batcher.go │ ├── blobs.go │ ├── challenger │ │ ├── helper.go │ │ └── metrics.go │ ├── disputegame │ │ ├── claim_helper.go │ │ ├── dishonest_helper.go │ │ ├── helper.go │ │ ├── output_alphabet_helper.go │ │ ├── output_cannon_helper.go │ │ ├── output_game_helper.go │ │ ├── output_honest_helper.go │ │ └── preimage │ │ │ └── preimage_helper.go │ ├── fakebeacon │ │ └── blobs.go │ ├── geth │ │ ├── fakepos.go │ │ ├── find.go │ │ ├── geth.go │ │ ├── peers.go │ │ └── wait.go │ ├── receipts │ │ └── logs.go │ ├── secrets.go │ ├── setup.go │ ├── setup_test.go │ ├── testing.go │ ├── transactions │ │ ├── blobs.go │ │ ├── gas.go │ │ └── send.go │ └── wait │ │ ├── blocks.go │ │ ├── waits.go │ │ └── withdrawals.go ├── eip4844_test.go ├── external.go ├── external │ └── config.go ├── external_geth │ ├── .gitignore │ ├── Makefile │ ├── README.md │ ├── main.go │ ├── main_test.go │ ├── test_parms.json │ └── tools.go ├── fastlz │ ├── fastlz.c │ ├── fastlz.go │ └── fastlz.h ├── fastlz_test.go ├── faultproofs │ ├── bigCodeCreateInput.data │ ├── cannon_benchmark_test.go │ ├── challenge_preimage_test.go │ ├── multi_test.go │ ├── output_alphabet_test.go │ ├── output_cannon_test.go │ ├── precompile_test.go │ ├── preimages_test.go │ └── util.go ├── helper.go ├── l1_beacon_client_test.go ├── l2_gossip_test.go ├── op_geth.go ├── op_geth_test.go ├── sequencer_failover_setup.go ├── sequencer_failover_test.go ├── setup.go ├── system_adminrpc_test.go ├── system_fpp_test.go ├── system_test.go ├── system_tob_test.go ├── tracer.go ├── tx_helper.go └── withdrawal_helper.go ├── op-heartbeat ├── .gitignore ├── Makefile ├── cmd │ └── main.go ├── config.go ├── flags │ └── flags.go ├── metrics.go ├── service.go ├── service_test.go └── whitelists.go ├── op-node ├── .gitignore ├── LICENSE ├── Makefile ├── README.md ├── benchmarks │ └── batchbuilding_test.go ├── bindings │ ├── disputegamefactory.go │ ├── l1block.go │ ├── l2outputoracle.go │ ├── l2tol1messagepasser.go │ ├── optimismportal.go │ └── preview │ │ └── optimismportal2.go ├── chaincfg │ ├── chains.go │ └── chains_test.go ├── cmd │ ├── batch_decoder │ │ ├── README.md │ │ ├── fetch │ │ │ └── fetch.go │ │ ├── main.go │ │ ├── reassemble │ │ │ └── reassemble.go │ │ └── script.sh │ ├── genesis │ │ └── cmd.go │ ├── main.go │ ├── networks │ │ └── cmd.go │ └── p2p │ │ ├── cmd.go │ │ └── cmd_test.go ├── flags │ ├── flags.go │ ├── flags_test.go │ └── p2p_flags.go ├── heartbeat │ ├── service.go │ └── service_test.go ├── metrics │ └── metrics.go ├── node │ ├── api.go │ ├── client.go │ ├── client_test.go │ ├── comms.go │ ├── conductor.go │ ├── config.go │ ├── config_persistence.go │ ├── config_persistence_test.go │ ├── node.go │ ├── node_test.go │ ├── runtime_config.go │ ├── safedb │ │ ├── disabled.go │ │ ├── safedb.go │ │ └── safedb_test.go │ ├── server.go │ ├── server_test.go │ ├── superchain.go │ └── superchain_test.go ├── p2p │ ├── app_params.go │ ├── app_scores.go │ ├── app_scores_test.go │ ├── cli │ │ ├── load_config.go │ │ └── load_signer.go │ ├── config.go │ ├── discovery.go │ ├── gating │ │ ├── blocking.go │ │ ├── expiry.go │ │ ├── expiry_test.go │ │ ├── metrics.go │ │ ├── mocks │ │ │ ├── BlockingConnectionGater.go │ │ │ ├── ExpiryStore.go │ │ │ └── Scores.go │ │ └── scoring.go │ ├── gossip.go │ ├── gossip_test.go │ ├── host.go │ ├── host_test.go │ ├── mocks │ │ ├── API.go │ │ ├── GossipMetricer.go │ │ ├── PeerGater.go │ │ ├── Peerstore.go │ │ └── ScoreMetrics.go │ ├── monitor │ │ ├── mocks │ │ │ └── PeerManager.go │ │ ├── peer_monitor.go │ │ └── peer_monitor_test.go │ ├── node.go │ ├── notifications.go │ ├── peer_params.go │ ├── peer_params_test.go │ ├── peer_scorer.go │ ├── peer_scorer_test.go │ ├── peer_scores.go │ ├── peer_scores_test.go │ ├── pings.go │ ├── pings_test.go │ ├── prepared.go │ ├── rpc_api.go │ ├── rpc_client.go │ ├── rpc_server.go │ ├── signer.go │ ├── signer_test.go │ ├── store │ │ ├── extended.go │ │ ├── gc.go │ │ ├── gc_test.go │ │ ├── iface.go │ │ ├── ip_ban_book.go │ │ ├── ip_ban_book_test.go │ │ ├── mdbook.go │ │ ├── peer_ban_book.go │ │ ├── peer_ban_book_test.go │ │ ├── records_book.go │ │ ├── scorebook.go │ │ ├── scorebook_test.go │ │ ├── serialize.go │ │ └── serialize_test.go │ ├── sync.go │ └── sync_test.go ├── rollup │ ├── async │ │ ├── asyncgossiper.go │ │ └── asyncgossiper_test.go │ ├── attributes │ │ ├── attributes.go │ │ ├── attributes_test.go │ │ ├── engine_consolidate.go │ │ └── engine_consolidate_test.go │ ├── chain_spec.go │ ├── chain_spec_test.go │ ├── clsync │ │ ├── clsync.go │ │ ├── clsync_test.go │ │ ├── payloads_queue.go │ │ └── payloads_queue_test.go │ ├── conductor │ │ └── conductor.go │ ├── confdepth │ │ ├── conf_depth.go │ │ └── conf_depth_test.go │ ├── derive │ │ ├── attributes.go │ │ ├── attributes_queue.go │ │ ├── attributes_queue_test.go │ │ ├── attributes_test.go │ │ ├── batch.go │ │ ├── batch_queue.go │ │ ├── batch_queue_test.go │ │ ├── batch_test.go │ │ ├── batch_test_utils.go │ │ ├── batch_tob_test.go │ │ ├── batches.go │ │ ├── batches_test.go │ │ ├── blob_data_source.go │ │ ├── blob_data_source_test.go │ │ ├── calldata_source.go │ │ ├── calldata_source_test.go │ │ ├── channel.go │ │ ├── channel_bank.go │ │ ├── channel_bank_test.go │ │ ├── channel_compressor.go │ │ ├── channel_compressor_test.go │ │ ├── channel_in_reader.go │ │ ├── channel_out.go │ │ ├── channel_out_test.go │ │ ├── channel_test.go │ │ ├── check_l1.go │ │ ├── check_l1_test.go │ │ ├── data_source.go │ │ ├── deposit_log.go │ │ ├── deposit_log_test.go │ │ ├── deposit_log_tob_test.go │ │ ├── deposit_source.go │ │ ├── deposit_source_test.go │ │ ├── deposits.go │ │ ├── deriver.go │ │ ├── doc.go │ │ ├── ecotone_upgrade_transactions.go │ │ ├── ecotone_upgrade_transactions_test.go │ │ ├── error.go │ │ ├── fjord_upgrade_transactions.go │ │ ├── fjord_upgrade_transactions_test.go │ │ ├── frame.go │ │ ├── frame_queue.go │ │ ├── frame_test.go │ │ ├── fuzz_parsers_test.go │ │ ├── l1_block_info.go │ │ ├── l1_block_info_test.go │ │ ├── l1_block_info_tob_test.go │ │ ├── l1_retrieval.go │ │ ├── l1_retrieval_test.go │ │ ├── l1_traversal.go │ │ ├── l1_traversal_test.go │ │ ├── l2block_util.go │ │ ├── params.go │ │ ├── payload_util.go │ │ ├── pipeline.go │ │ ├── pipeline_test.go │ │ ├── plasma_data_source.go │ │ ├── plasma_data_source_test.go │ │ ├── singular_batch.go │ │ ├── singular_batch_test.go │ │ ├── span_batch.go │ │ ├── span_batch_test.go │ │ ├── span_batch_tx.go │ │ ├── span_batch_tx_test.go │ │ ├── span_batch_txs.go │ │ ├── span_batch_txs_test.go │ │ ├── span_batch_util.go │ │ ├── span_channel_out.go │ │ ├── system_config.go │ │ ├── system_config_test.go │ │ ├── test │ │ │ └── random.go │ │ ├── types.go │ │ └── types_test.go │ ├── driver │ │ ├── config.go │ │ ├── driver.go │ │ ├── metered_l1fetcher.go │ │ ├── metered_l1fetcher_test.go │ │ ├── state.go │ │ ├── steps.go │ │ └── steps_test.go │ ├── engine │ │ ├── build_cancel.go │ │ ├── build_invalid.go │ │ ├── build_seal.go │ │ ├── build_sealed.go │ │ ├── build_start.go │ │ ├── build_started.go │ │ ├── engine_controller.go │ │ ├── engine_kind.go │ │ ├── engine_reset.go │ │ ├── engine_update.go │ │ ├── events.go │ │ ├── iface.go │ │ ├── params.go │ │ ├── payload_invalid.go │ │ ├── payload_process.go │ │ └── payload_success.go │ ├── event.go │ ├── event │ │ ├── events.go │ │ ├── events_test.go │ │ ├── executor.go │ │ ├── executor_global.go │ │ ├── executor_global_test.go │ │ ├── limiter.go │ │ ├── limiter_test.go │ │ ├── metrics.go │ │ ├── options.go │ │ ├── system.go │ │ ├── system_test.go │ │ ├── tracer.go │ │ ├── tracer_log.go │ │ ├── tracer_metrics.go │ │ ├── tracer_sequence.go │ │ ├── tracer_struct.go │ │ ├── tracer_timing.go │ │ ├── util.go │ │ └── util_test.go │ ├── finality │ │ ├── finalizer.go │ │ ├── finalizer_test.go │ │ ├── plasma.go │ │ └── plasma_test.go │ ├── iface.go │ ├── output_root.go │ ├── sequencing │ │ ├── disabled.go │ │ ├── iface.go │ │ ├── origin_selector.go │ │ ├── origin_selector_test.go │ │ ├── sequencer.go │ │ ├── sequencer_chaos_test.go │ │ └── sequencer_test.go │ ├── status │ │ └── status.go │ ├── superchain.go │ ├── sync │ │ ├── config.go │ │ ├── start.go │ │ └── start_test.go │ ├── types.go │ └── types_test.go ├── service.go ├── version │ └── version.go └── withdrawals │ ├── proof.go │ ├── testdata │ └── bridge-withdrawal.json │ ├── utils.go │ └── utils_test.go ├── op-plasma ├── .gitignore ├── Dockerfile ├── Dockerfile.dockerignore ├── Makefile ├── bindings │ └── dataavailabilitychallenge.go ├── cli.go ├── cmd │ └── daserver │ │ ├── README.md │ │ ├── entrypoint.go │ │ ├── file.go │ │ ├── flags.go │ │ ├── main.go │ │ └── s3.go ├── commitment.go ├── commitment_test.go ├── daclient.go ├── daclient_test.go ├── damgr.go ├── damgr_test.go ├── damock.go ├── daserver.go ├── dastate.go ├── metrics.go └── params.go ├── op-preimage ├── README.md ├── filechan.go ├── filepoller.go ├── filepoller_test.go ├── hash.go ├── hints.go ├── hints_test.go ├── iface.go ├── iface_test.go ├── oracle.go ├── oracle_test.go ├── verifier.go └── verifier_test.go ├── op-program ├── .gitignore ├── Dockerfile.repro ├── LICENSE ├── Makefile ├── README.md ├── chainconfig │ └── chaincfg.go ├── client │ ├── boot.go │ ├── boot_test.go │ ├── claim │ │ ├── validate.go │ │ └── validate_test.go │ ├── cmd │ │ └── main.go │ ├── driver │ │ ├── driver.go │ │ ├── driver_test.go │ │ ├── program.go │ │ └── program_test.go │ ├── env.go │ ├── l1 │ │ ├── blob_fetcher.go │ │ ├── cache.go │ │ ├── cache_test.go │ │ ├── client.go │ │ ├── client_test.go │ │ ├── hints.go │ │ ├── oracle.go │ │ ├── oracle_test.go │ │ └── test │ │ │ └── stub_oracle.go │ ├── l2 │ │ ├── cache.go │ │ ├── cache_test.go │ │ ├── db.go │ │ ├── db_test.go │ │ ├── engine.go │ │ ├── engine_backend.go │ │ ├── engine_backend_test.go │ │ ├── engine_test.go │ │ ├── engineapi │ │ │ ├── block_processor.go │ │ │ ├── l2_engine_api.go │ │ │ ├── precompiles.go │ │ │ └── test │ │ │ │ └── l2_engine_api_tests.go │ │ ├── hints.go │ │ ├── oracle.go │ │ ├── oracle_test.go │ │ └── test │ │ │ └── stub_oracle.go │ ├── mpt │ │ ├── db.go │ │ ├── trie.go │ │ └── trie_test.go │ └── program.go ├── host │ ├── cmd │ │ ├── main.go │ │ └── main_test.go │ ├── config │ │ ├── config.go │ │ └── config_test.go │ ├── flags │ │ ├── flags.go │ │ └── flags_test.go │ ├── host.go │ ├── host_test.go │ ├── kvstore │ │ ├── disk.go │ │ ├── disk_test.go │ │ ├── kv.go │ │ ├── kv_test.go │ │ ├── local.go │ │ ├── local_test.go │ │ ├── mem.go │ │ ├── mem_test.go │ │ ├── splitter.go │ │ └── splitter_test.go │ ├── l2_client.go │ ├── prefetcher │ │ ├── prefetcher.go │ │ ├── prefetcher_test.go │ │ ├── retry.go │ │ └── retry_test.go │ └── version │ │ └── version.go ├── io │ └── filechan.go ├── scripts │ └── run-compat.sh └── verify │ ├── mainnet │ └── cmd │ │ └── mainnet.go │ ├── sepolia │ └── cmd │ │ └── sepolia.go │ └── verify.go ├── op-proposer ├── .gitignore ├── Makefile ├── bindings │ ├── disputegamefactory.go │ └── l2outputoracle.go ├── cmd │ └── main.go ├── flags │ ├── flags.go │ └── flags_test.go ├── metrics │ ├── metrics.go │ └── noop.go └── proposer │ ├── abi_test.go │ ├── config.go │ ├── driver.go │ ├── l2_output_submitter.go │ ├── rpc │ └── api.go │ └── service.go ├── op-service ├── Makefile ├── cliapp │ ├── flag.go │ ├── flag_test.go │ ├── lifecycle.go │ └── lifecycle_test.go ├── client │ ├── client.go │ ├── dial_test.go │ ├── http.go │ ├── http_test.go │ ├── mocks │ │ └── HTTP.go │ ├── polling.go │ ├── polling_test.go │ ├── rate_limited.go │ └── rpc.go ├── clock │ ├── advancing.go │ ├── advancing_test.go │ ├── clock.go │ ├── clock_test.go │ ├── common.go │ ├── deterministic.go │ ├── deterministic_test.go │ ├── loop.go │ ├── loop_test.go │ ├── simple.go │ ├── simple_test.go │ ├── util.go │ └── util_test.go ├── crypto │ └── signature.go ├── dial │ ├── active_l2_provider.go │ ├── active_l2_provider_test.go │ ├── active_rollup_provider.go │ ├── dial.go │ ├── ethclient_interface.go │ ├── rollup_sync.go │ ├── rollup_sync_test.go │ ├── rollupclient_interface.go │ ├── static_l2_provider.go │ └── static_rollup_provider.go ├── enum │ ├── enum.go │ └── enum_test.go ├── errutil │ ├── errors.go │ └── errors_test.go ├── eth │ ├── account_proof.go │ ├── account_proof_test.go │ ├── address.go │ ├── address_test.go │ ├── balance.go │ ├── balance_test.go │ ├── blob.go │ ├── blob_test.go │ ├── blobs_api.go │ ├── blobs_api_test.go │ ├── block_info.go │ ├── ether.go │ ├── ether_test.go │ ├── heads.go │ ├── id.go │ ├── label.go │ ├── output.go │ ├── output_test.go │ ├── receipts.go │ ├── ssz.go │ ├── ssz_test.go │ ├── status.go │ ├── sync_status.go │ ├── testdata │ │ ├── eth_v1_beacon_blob_sidecars_7422094_goerli.json │ │ ├── eth_v1_beacon_genesis_goerli.json │ │ └── eth_v1_config_spec_goerli.json │ ├── transactions.go │ ├── transactions_test.go │ ├── types.go │ └── types_test.go ├── flags │ ├── custom.go │ └── flags.go ├── httputil │ ├── http.go │ ├── server.go │ ├── server_test.go │ ├── timeout.go │ └── wrapped_response_writer.go ├── ioutil │ ├── atomic.go │ ├── atomic_test.go │ ├── gzip.go │ └── gzip_test.go ├── jsonutil │ ├── json.go │ ├── json_test.go │ ├── sortedmap.go │ └── sortedmap_test.go ├── log │ ├── cli.go │ ├── defaults.go │ ├── dynamic.go │ ├── dynamic_test.go │ ├── http.go │ ├── writer.go │ └── writer_test.go ├── metrics │ ├── balance.go │ ├── caching.go │ ├── cli.go │ ├── doc │ │ └── cmd.go │ ├── event.go │ ├── factory.go │ ├── http.go │ ├── node_info.go │ ├── ref_metrics.go │ ├── registry.go │ ├── rpc_metrics.go │ └── server.go ├── opio │ └── interrupts.go ├── oppprof │ ├── cli.go │ └── service.go ├── predeploys │ ├── addresses.go │ ├── addresses_test.go │ ├── eip4788.go │ ├── legacy_addresses.go │ └── predeploy.go ├── rethdb-reader │ ├── .gitignore │ ├── Cargo.lock │ ├── Cargo.toml │ ├── Makefile │ ├── README.md │ ├── headgen.sh │ ├── rustfmt.toml │ ├── src │ │ ├── db.rs │ │ ├── lib.rs │ │ └── receipts.rs │ └── testdata │ │ ├── block.rlp │ │ └── receipts.json ├── retry │ ├── operation.go │ ├── operation_test.go │ ├── strategies.go │ └── strategies_test.go ├── rpc │ ├── api.go │ ├── cli.go │ ├── server.go │ └── server_test.go ├── safego │ └── nocopy.go ├── signer │ ├── cli.go │ ├── cli_test.go │ ├── client.go │ └── transaction_args.go ├── solabi │ ├── util.go │ └── utils_test.go ├── sources │ ├── batching │ │ ├── arrays.go │ │ ├── balance_call.go │ │ ├── balance_call_test.go │ │ ├── batching.go │ │ ├── batching_test.go │ │ ├── bound.go │ │ ├── bound_test.go │ │ ├── call.go │ │ ├── call_test.go │ │ ├── contract_call.go │ │ ├── contract_call_test.go │ │ ├── multicall.go │ │ ├── rpcblock │ │ │ └── blocks.go │ │ ├── test │ │ │ ├── abi_stub.go │ │ │ ├── erc20.go │ │ │ └── generic_stub.go │ │ └── types.go │ ├── caching │ │ └── cache.go │ ├── debug_client.go │ ├── engine_client.go │ ├── eth_client.go │ ├── eth_client_test.go │ ├── l1_beacon_client.go │ ├── l1_beacon_client_test.go │ ├── l1_client.go │ ├── l2_client.go │ ├── limit.go │ ├── limit_test.go │ ├── mocks │ │ ├── BeaconClient.go │ │ └── BlobSideCarsFetcher.go │ ├── receipts.go │ ├── receipts_basic.go │ ├── receipts_basic_test.go │ ├── receipts_caching.go │ ├── receipts_caching_test.go │ ├── receipts_rpc.go │ ├── receipts_test.go │ ├── reth_db.go │ ├── reth_db_stub.go │ ├── reth_db_test.go │ ├── rollupclient.go │ ├── testdata │ │ ├── data │ │ │ ├── blocks │ │ │ │ ├── post-shanghai-bad-receipts-hash_data.json │ │ │ │ ├── post-shanghai-bad-receipts-hash_metadata.json │ │ │ │ ├── post-shanghai-bad-transactions-hash_data.json │ │ │ │ ├── post-shanghai-bad-transactions-hash_metadata.json │ │ │ │ ├── post-shanghai-bad-transactions-nil_data.json │ │ │ │ ├── post-shanghai-bad-transactions-nil_metadata.json │ │ │ │ ├── post-shanghai-bad-transactions_data.json │ │ │ │ ├── post-shanghai-bad-transactions_metadata.json │ │ │ │ ├── post-shanghai-bad-withdrawals-hash_data.json │ │ │ │ ├── post-shanghai-bad-withdrawals-hash_metadata.json │ │ │ │ ├── post-shanghai-bad-withdrawals-nil_data.json │ │ │ │ ├── post-shanghai-bad-withdrawals-nil_metadata.json │ │ │ │ ├── post-shanghai-bad-withdrawals_data.json │ │ │ │ ├── post-shanghai-bad-withdrawals_metadata.json │ │ │ │ ├── post-shanghai-success_data.json │ │ │ │ ├── post-shanghai-success_metadata.json │ │ │ │ ├── pre-shanghai-bad-receipts-hash_data.json │ │ │ │ ├── pre-shanghai-bad-receipts-hash_metadata.json │ │ │ │ ├── pre-shanghai-bad-transactions-hash_data.json │ │ │ │ ├── pre-shanghai-bad-transactions-hash_metadata.json │ │ │ │ ├── pre-shanghai-bad-transactions_data.json │ │ │ │ ├── pre-shanghai-bad-transactions_metadata.json │ │ │ │ ├── pre-shanghai-success_data.json │ │ │ │ └── pre-shanghai-success_metadata.json │ │ │ └── headers │ │ │ │ ├── post-shanghai-bad-receipts_data.json │ │ │ │ ├── post-shanghai-bad-receipts_metadata.json │ │ │ │ ├── post-shanghai-bad-transactions_data.json │ │ │ │ ├── post-shanghai-bad-transactions_metadata.json │ │ │ │ ├── post-shanghai-bad-withdrawals_data.json │ │ │ │ ├── post-shanghai-bad-withdrawals_metadata.json │ │ │ │ ├── post-shanghai-success_data.json │ │ │ │ ├── post-shanghai-success_metadata.json │ │ │ │ ├── pre-shanghai-bad-receipts_data.json │ │ │ │ ├── pre-shanghai-bad-receipts_metadata.json │ │ │ │ ├── pre-shanghai-bad-transactions_data.json │ │ │ │ ├── pre-shanghai-bad-transactions_metadata.json │ │ │ │ ├── pre-shanghai-success_data.json │ │ │ │ └── pre-shanghai-success_metadata.json │ │ └── gen.sh │ ├── types.go │ └── types_test.go ├── tasks │ └── tasks.go ├── testlog │ ├── LICENSE │ ├── README.md │ ├── capturing.go │ ├── capturing_test.go │ └── testlog.go ├── testutils │ ├── assertions.go │ ├── block_id.go │ ├── deposits.go │ ├── fake_chain.go │ ├── fuzzerutils │ │ └── fuzzer_functions.go │ ├── l1info.go │ ├── metrics.go │ ├── mock_blobs_fetcher.go │ ├── mock_client.go │ ├── mock_debug_client.go │ ├── mock_emitter.go │ ├── mock_engine.go │ ├── mock_eth_client.go │ ├── mock_l1.go │ ├── mock_l2.go │ ├── mock_rollup_client.go │ ├── mock_rpc.go │ ├── random.go │ ├── random_keys.go │ ├── rpc_err_faker.go │ └── runtime_config.go ├── tls │ ├── certman │ │ ├── certman.go │ │ ├── certman_test.go │ │ └── testdata │ │ │ ├── README │ │ │ ├── server.crt │ │ │ ├── server.key │ │ │ ├── server1.crt │ │ │ ├── server1.key │ │ │ ├── server2.crt │ │ │ └── server2.key │ ├── cli.go │ ├── cli_test.go │ └── tlsinfo.go ├── txmgr │ ├── cli.go │ ├── cli_test.go │ ├── metrics │ │ ├── noop.go │ │ └── tx_metrics.go │ ├── mocks │ │ └── TxManager.go │ ├── price_bump_test.go │ ├── queue.go │ ├── queue_test.go │ ├── send_state.go │ ├── send_state_test.go │ ├── txmgr.go │ └── txmgr_test.go ├── util.go ├── util_test.go ├── version.go └── version_test.go ├── op-supervisor ├── .gitignore ├── Makefile ├── cmd │ ├── main.go │ └── main_test.go ├── config │ ├── config.go │ └── config_test.go ├── flags │ ├── flags.go │ └── flags_test.go ├── metrics │ ├── metrics.go │ └── noop.go └── supervisor │ ├── backend │ ├── backend.go │ ├── chain_metrics.go │ ├── config.go │ ├── db │ │ ├── db.go │ │ ├── db_test.go │ │ ├── entrydb │ │ │ ├── entry_db.go │ │ │ └── entry_db_test.go │ │ ├── heads │ │ │ ├── heads.go │ │ │ ├── heads_test.go │ │ │ ├── types.go │ │ │ └── types_test.go │ │ ├── init.go │ │ ├── init_test.go │ │ └── logs │ │ │ ├── db.go │ │ │ ├── db_invariants_test.go │ │ │ ├── db_test.go │ │ │ ├── entries.go │ │ │ └── iterator.go │ ├── file_layout.go │ ├── file_layout_test.go │ ├── mock.go │ ├── source │ │ ├── chain.go │ │ ├── chain_processor.go │ │ ├── chain_processor_test.go │ │ ├── fetch_logs.go │ │ ├── fetch_logs_test.go │ │ ├── head_monitor.go │ │ ├── head_monitor_test.go │ │ ├── head_processor.go │ │ ├── head_processor_test.go │ │ ├── log_processor.go │ │ └── log_processor_test.go │ └── types │ │ └── types.go │ ├── entrypoint.go │ ├── frontend │ └── frontend.go │ ├── service.go │ ├── service_test.go │ └── types │ ├── types.go │ └── types_test.go ├── op-ufm └── README.md ├── op-wheel ├── .gitignore ├── Makefile ├── cheat │ └── cheat.go ├── cmd │ └── main.go ├── commands.go └── engine │ ├── engine.go │ ├── metrics.go │ └── version_provider.go ├── ops-bedrock ├── Dockerfile.l1 ├── Dockerfile.l2 ├── docker-compose.yml ├── entrypoint-l1.sh ├── entrypoint-l2.sh ├── op-batcher-entrypoint.sh ├── op-batcher-key.txt ├── p2p-node-key.txt └── test-jwt-secret.txt ├── ops ├── README.md ├── check-changed │ ├── .gitignore │ ├── main.py │ └── requirements.txt ├── docker │ ├── Dockerfile.packages │ ├── ci-builder │ │ ├── Dockerfile │ │ └── Dockerfile.dockerignore │ ├── op-stack-go │ │ ├── Dockerfile │ │ └── Dockerfile.dockerignore │ └── oplabs.crt ├── scripts │ ├── ci-docker-tag-op-stack-release.sh │ ├── ci-match-values-between-files.sh │ ├── ci-versions.js │ ├── find_release_tag.sh │ ├── geth-version-checker.sh │ ├── install-foundry.sh │ ├── newer-file.sh │ ├── parse_json_test_output.sh │ ├── todo-checker.sh │ └── update-op-geth.py └── tag-service │ ├── .gitignore │ ├── README.md │ ├── requirements.txt │ ├── tag-service.py │ └── tag-tool.py ├── package.json ├── packages ├── chain-mon │ ├── .depcheckrc │ ├── .env.example │ ├── .eslintrc.js │ ├── .lintstagedrc.yml │ ├── .prettierrc.js │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── contrib │ │ ├── initialized-upgraded-mon │ │ │ └── service.ts │ │ ├── replica-mon │ │ │ ├── README.md │ │ │ ├── index.ts │ │ │ └── service.ts │ │ └── wallet-mon │ │ │ └── service.ts │ ├── hardhat.config.ts │ ├── internal │ │ ├── balance-mon │ │ │ └── service.ts │ │ └── multisig-mon │ │ │ └── service.ts │ ├── package.json │ ├── src │ │ ├── abi │ │ │ ├── IGnosisSafe.0.8.19.json │ │ │ └── OptimismPortal.json │ │ ├── fault-mon │ │ │ ├── README.md │ │ │ ├── helpers.ts │ │ │ ├── index.ts │ │ │ └── service.ts │ │ ├── faultproof-wd-mon │ │ │ ├── constants.ts │ │ │ └── service.ts │ │ ├── index.ts │ │ └── wd-mon │ │ │ ├── constants.ts │ │ │ └── service.ts │ ├── test │ │ └── fault-mon │ │ │ ├── helpers.spec.ts │ │ │ └── setup.ts │ └── tsconfig.json ├── contracts-bedrock │ ├── .eslintignore │ ├── .eslintrc.js │ ├── .gas-snapshot │ ├── .gitignore │ ├── .npmignore │ ├── CHANGELOG.md │ ├── CONTRIBUTING.md │ ├── LICENSE │ ├── README.md │ ├── STYLE_GUIDE.md │ ├── VERSIONING.md │ ├── deploy-config-periphery │ │ ├── deploy │ │ │ ├── 4202.json │ │ │ ├── 4460.json │ │ │ ├── 58008.json │ │ │ ├── 84532.json │ │ │ ├── 901.json │ │ │ ├── 919.json │ │ │ ├── 999999999.json │ │ │ ├── optimism-goerli.json │ │ │ ├── optimism-sepolia.json │ │ │ └── sepolia.json │ │ └── drippie │ │ │ ├── sepolia-faucet-bridges.json │ │ │ ├── sepolia-faucet-core.json │ │ │ └── sepolia-ops.json │ ├── deploy-config │ │ ├── devnetL1-template.json │ │ ├── hardhat.json │ │ ├── internal-devnet.json │ │ ├── mainnet.json │ │ ├── sepolia-devnet-0.json │ │ └── sepolia.json │ ├── deployments │ │ ├── 4202 │ │ │ └── .chainId │ │ └── .gitinclude │ ├── foundry.toml │ ├── invariant-docs │ │ ├── AddressAliasHelper.md │ │ ├── Burn.Eth.md │ │ ├── Burn.Gas.md │ │ ├── CrossDomainMessenger.md │ │ ├── Encoding.md │ │ ├── FaultDisputeGame.md │ │ ├── Hashing.md │ │ ├── InvariantTest.sol.md │ │ ├── L2OutputOracle.md │ │ ├── OptimismPortal.md │ │ ├── OptimismPortal2.md │ │ ├── README.md │ │ ├── ResourceMetering.md │ │ ├── SafeCall.md │ │ └── SystemConfig.md │ ├── package.json │ ├── scripts │ │ ├── Artifacts.s.sol │ │ ├── ChainAssertions.sol │ │ ├── Chains.sol │ │ ├── Config.sol │ │ ├── Executables.sol │ │ ├── FaultDisputeGameViz.s.sol │ │ ├── FeeVaultWithdrawal.s.sol │ │ ├── ForgeArtifacts.sol │ │ ├── L2Genesis.s.sol │ │ ├── SemverLock.s.sol │ │ ├── Types.sol │ │ ├── autogen │ │ │ ├── generate-invariant-docs.ts │ │ │ └── generate-snapshots.ts │ │ ├── checks │ │ │ ├── check-deploy-configs.sh │ │ │ ├── check-foundry-install.sh │ │ │ ├── check-snapshots.sh │ │ │ ├── check-spacers.ts │ │ │ └── check-test-names.ts │ │ ├── dag-viz.py │ │ ├── deploy │ │ │ ├── Deploy.s.sol │ │ │ ├── DeployConfig.s.sol │ │ │ ├── DeployOwnership.s.sol │ │ │ ├── Deployer.sol │ │ │ └── deploy.sh │ │ ├── fpac │ │ │ ├── .gitignore │ │ │ ├── FPACOPS.s.sol │ │ │ ├── Makefile │ │ │ ├── README.md │ │ │ ├── SubmitLPP.sol │ │ │ └── lpp-estimation.sh │ │ ├── getting-started │ │ │ ├── config.sh │ │ │ ├── versions.sh │ │ │ └── wallets.sh │ │ ├── go-ffi │ │ │ ├── README.md │ │ │ ├── bin.go │ │ │ ├── differential-testing.go │ │ │ ├── merkle.go │ │ │ ├── trie.go │ │ │ └── utils.go │ │ ├── interfaces │ │ │ ├── IAddressManager.sol │ │ │ ├── IGnosisSafe.sol │ │ │ └── ISystemConfigV0.sol │ │ ├── libraries │ │ │ ├── LibStateDiff.sol │ │ │ └── Process.sol │ │ ├── periphery │ │ │ ├── deploy │ │ │ │ ├── DeployPeriphery.s.sol │ │ │ │ └── PeripheryDeployConfig.s.sol │ │ │ └── drippie │ │ │ │ ├── DrippieConfig.s.sol │ │ │ │ └── ManageDrippie.s.sol │ │ ├── print-addresses.sh │ │ ├── restructure_tests.py │ │ ├── statediff.sh │ │ └── visualize.sh │ ├── semver-lock.json │ ├── slither.config.json │ ├── slither.db.json │ ├── snapshots │ │ ├── abi │ │ │ ├── AddressManager.json │ │ │ ├── AdminFaucetAuthModule.json │ │ │ ├── AnchorStateRegistry.json │ │ │ ├── AssetReceiver.json │ │ │ ├── AttestationStation.json │ │ │ ├── BaseFeeVault.json │ │ │ ├── Burner.json │ │ │ ├── CheckBalanceLow.json │ │ │ ├── CheckGelatoLow.json │ │ │ ├── CheckSecrets.json │ │ │ ├── CheckTrue.json │ │ │ ├── CrossDomainMessengerLegacySpacer0.json │ │ │ ├── CrossDomainMessengerLegacySpacer1.json │ │ │ ├── CrossL2Inbox.json │ │ │ ├── DataAvailabilityChallenge.json │ │ │ ├── DelayedVetoable.json │ │ │ ├── DelayedWETH.json │ │ │ ├── DeployerWhitelist.json │ │ │ ├── DeputyGuardianModule.json │ │ │ ├── DisputeGameFactory.json │ │ │ ├── Drippie.json │ │ │ ├── EAS.json │ │ │ ├── Faucet.json │ │ │ ├── FaultDisputeGame.json │ │ │ ├── GasPriceOracle.json │ │ │ ├── GovernanceToken.json │ │ │ ├── L1Block.json │ │ │ ├── L1BlockInterop.json │ │ │ ├── L1BlockNumber.json │ │ │ ├── L1ChugSplashProxy.json │ │ │ ├── L1CrossDomainMessenger.json │ │ │ ├── L1ERC721Bridge.json │ │ │ ├── L1FeeVault.json │ │ │ ├── L1StandardBridge.json │ │ │ ├── L2CrossDomainMessenger.json │ │ │ ├── L2ERC721Bridge.json │ │ │ ├── L2OutputOracle.json │ │ │ ├── L2StandardBridge.json │ │ │ ├── L2ToL1MessagePasser.json │ │ │ ├── L2ToL2CrossDomainMessenger.json │ │ │ ├── LegacyMessagePasser.json │ │ │ ├── LegacyMintableERC20.json │ │ │ ├── LivenessGuard.json │ │ │ ├── LivenessModule.json │ │ │ ├── MIPS.json │ │ │ ├── MintManager.json │ │ │ ├── OptimismMintableERC20.json │ │ │ ├── OptimismMintableERC20Factory.json │ │ │ ├── OptimismMintableERC721.json │ │ │ ├── OptimismMintableERC721Factory.json │ │ │ ├── OptimismPortal.json │ │ │ ├── OptimismPortal2.json │ │ │ ├── OptimismPortalInterop.json │ │ │ ├── Optimist.json │ │ │ ├── OptimistAllowlist.json │ │ │ ├── OptimistInviter.json │ │ │ ├── PermissionedDisputeGame.json │ │ │ ├── PreimageOracle.json │ │ │ ├── ProtocolVersions.json │ │ │ ├── Proxy.json │ │ │ ├── ProxyAdmin.json │ │ │ ├── ResolvedDelegateProxy.json │ │ │ ├── SafeSend.json │ │ │ ├── SchemaRegistry.json │ │ │ ├── SequencerFeeVault.json │ │ │ ├── StorageSetter.json │ │ │ ├── SuperchainConfig.json │ │ │ ├── SystemConfig.json │ │ │ ├── SystemConfigInterop.json │ │ │ ├── Transactor.json │ │ │ ├── TransferOnion.json │ │ │ ├── TransientReentrancyAware.json │ │ │ ├── WETH.json │ │ │ └── WETH98.json │ │ ├── abi_loader.go │ │ ├── abi_loader_test.go │ │ ├── state-diff │ │ │ └── Kontrol-Deploy.json │ │ └── storageLayout │ │ │ ├── AddressManager.json │ │ │ ├── AdminFaucetAuthModule.json │ │ │ ├── AnchorStateRegistry.json │ │ │ ├── AssetReceiver.json │ │ │ ├── AttestationStation.json │ │ │ ├── BaseFeeVault.json │ │ │ ├── Burner.json │ │ │ ├── CheckBalanceLow.json │ │ │ ├── CheckGelatoLow.json │ │ │ ├── CheckSecrets.json │ │ │ ├── CheckTrue.json │ │ │ ├── CrossDomainMessengerLegacySpacer0.json │ │ │ ├── CrossDomainMessengerLegacySpacer1.json │ │ │ ├── CrossL2Inbox.json │ │ │ ├── DataAvailabilityChallenge.json │ │ │ ├── DelayedVetoable.json │ │ │ ├── DelayedWETH.json │ │ │ ├── DeployerWhitelist.json │ │ │ ├── DeputyGuardianModule.json │ │ │ ├── DisputeGameFactory.json │ │ │ ├── Drippie.json │ │ │ ├── EAS.json │ │ │ ├── Faucet.json │ │ │ ├── FaultDisputeGame.json │ │ │ ├── GasPriceOracle.json │ │ │ ├── GovernanceToken.json │ │ │ ├── L1Block.json │ │ │ ├── L1BlockInterop.json │ │ │ ├── L1BlockNumber.json │ │ │ ├── L1ChugSplashProxy.json │ │ │ ├── L1CrossDomainMessenger.json │ │ │ ├── L1ERC721Bridge.json │ │ │ ├── L1FeeVault.json │ │ │ ├── L1StandardBridge.json │ │ │ ├── L2CrossDomainMessenger.json │ │ │ ├── L2ERC721Bridge.json │ │ │ ├── L2OutputOracle.json │ │ │ ├── L2StandardBridge.json │ │ │ ├── L2ToL1MessagePasser.json │ │ │ ├── L2ToL2CrossDomainMessenger.json │ │ │ ├── LegacyMessagePasser.json │ │ │ ├── LegacyMintableERC20.json │ │ │ ├── LivenessGuard.json │ │ │ ├── LivenessModule.json │ │ │ ├── MIPS.json │ │ │ ├── MintManager.json │ │ │ ├── OptimismMintableERC20.json │ │ │ ├── OptimismMintableERC20Factory.json │ │ │ ├── OptimismMintableERC721.json │ │ │ ├── OptimismMintableERC721Factory.json │ │ │ ├── OptimismPortal.json │ │ │ ├── OptimismPortal2.json │ │ │ ├── OptimismPortalInterop.json │ │ │ ├── Optimist.json │ │ │ ├── OptimistAllowlist.json │ │ │ ├── OptimistInviter.json │ │ │ ├── PermissionedDisputeGame.json │ │ │ ├── PreimageOracle.json │ │ │ ├── ProtocolVersions.json │ │ │ ├── Proxy.json │ │ │ ├── ProxyAdmin.json │ │ │ ├── ResolvedDelegateProxy.json │ │ │ ├── SafeSend.json │ │ │ ├── SchemaRegistry.json │ │ │ ├── SequencerFeeVault.json │ │ │ ├── StorageSetter.json │ │ │ ├── SuperchainConfig.json │ │ │ ├── SystemConfig.json │ │ │ ├── SystemConfigInterop.json │ │ │ ├── Transactor.json │ │ │ ├── TransferOnion.json │ │ │ ├── TransientReentrancyAware.json │ │ │ ├── WETH.json │ │ │ └── WETH98.json │ ├── src │ │ ├── EAS │ │ │ ├── Common.sol │ │ │ ├── EAS.sol │ │ │ ├── IEAS.sol │ │ │ ├── ISchemaRegistry.sol │ │ │ ├── SchemaRegistry.sol │ │ │ ├── eip1271 │ │ │ │ └── EIP1271Verifier.sol │ │ │ └── resolver │ │ │ │ ├── ISchemaResolver.sol │ │ │ │ └── SchemaResolver.sol │ │ ├── L1 │ │ │ ├── DataAvailabilityChallenge.sol │ │ │ ├── DelayedVetoable.sol │ │ │ ├── L1CrossDomainMessenger.sol │ │ │ ├── L1ERC721Bridge.sol │ │ │ ├── L1StandardBridge.sol │ │ │ ├── L2OutputOracle.sol │ │ │ ├── OptimismPortal.sol │ │ │ ├── OptimismPortal2.sol │ │ │ ├── OptimismPortalInterop.sol │ │ │ ├── ProtocolVersions.sol │ │ │ ├── ResourceMetering.sol │ │ │ ├── SuperchainConfig.sol │ │ │ ├── SystemConfig.sol │ │ │ └── SystemConfigInterop.sol │ │ ├── L2 │ │ │ ├── BaseFeeVault.sol │ │ │ ├── CrossDomainOwnable.sol │ │ │ ├── CrossDomainOwnable2.sol │ │ │ ├── CrossDomainOwnable3.sol │ │ │ ├── CrossL2Inbox.sol │ │ │ ├── GasPriceOracle.sol │ │ │ ├── ICrossL2Inbox.sol │ │ │ ├── IL2ToL2CrossDomainMessenger.sol │ │ │ ├── L1Block.sol │ │ │ ├── L1BlockInterop.sol │ │ │ ├── L1FeeVault.sol │ │ │ ├── L2CrossDomainMessenger.sol │ │ │ ├── L2ERC721Bridge.sol │ │ │ ├── L2StandardBridge.sol │ │ │ ├── L2ToL1MessagePasser.sol │ │ │ ├── L2ToL2CrossDomainMessenger.sol │ │ │ ├── SequencerFeeVault.sol │ │ │ └── WETH.sol │ │ ├── Safe │ │ │ ├── DeputyGuardianModule.sol │ │ │ ├── LivenessGuard.sol │ │ │ ├── LivenessModule.sol │ │ │ └── SafeSigners.sol │ │ ├── cannon │ │ │ ├── MIPS.sol │ │ │ ├── PreimageKeyLib.sol │ │ │ ├── PreimageOracle.sol │ │ │ ├── interfaces │ │ │ │ └── IPreimageOracle.sol │ │ │ └── libraries │ │ │ │ ├── CannonErrors.sol │ │ │ │ ├── CannonTypes.sol │ │ │ │ ├── MIPSInstructions.sol │ │ │ │ ├── MIPSMemory.sol │ │ │ │ ├── MIPSState.sol │ │ │ │ └── MIPSSyscalls.sol │ │ ├── dispute │ │ │ ├── AnchorStateRegistry.sol │ │ │ ├── DisputeGameFactory.sol │ │ │ ├── FaultDisputeGame.sol │ │ │ ├── PermissionedDisputeGame.sol │ │ │ ├── interfaces │ │ │ │ ├── IAnchorStateRegistry.sol │ │ │ │ ├── IBigStepper.sol │ │ │ │ ├── IDelayedWETH.sol │ │ │ │ ├── IDisputeGame.sol │ │ │ │ ├── IDisputeGameFactory.sol │ │ │ │ ├── IFaultDisputeGame.sol │ │ │ │ ├── IInitializable.sol │ │ │ │ └── IWETH.sol │ │ │ ├── lib │ │ │ │ ├── Errors.sol │ │ │ │ ├── LibPosition.sol │ │ │ │ ├── LibUDT.sol │ │ │ │ └── Types.sol │ │ │ └── weth │ │ │ │ ├── DelayedWETH.sol │ │ │ │ └── WETH98.sol │ │ ├── governance │ │ │ ├── GovernanceToken.sol │ │ │ └── MintManager.sol │ │ ├── legacy │ │ │ ├── AddressManager.sol │ │ │ ├── DeployerWhitelist.sol │ │ │ ├── L1BlockNumber.sol │ │ │ ├── L1ChugSplashProxy.sol │ │ │ ├── LegacyMessagePasser.sol │ │ │ ├── LegacyMintableERC20.sol │ │ │ └── ResolvedDelegateProxy.sol │ │ ├── libraries │ │ │ ├── Arithmetic.sol │ │ │ ├── Burn.sol │ │ │ ├── Bytes.sol │ │ │ ├── Constants.sol │ │ │ ├── Encoding.sol │ │ │ ├── GasPayingToken.sol │ │ │ ├── Hashing.sol │ │ │ ├── L1BlockErrors.sol │ │ │ ├── LegacyCrossDomainUtils.sol │ │ │ ├── PortalErrors.sol │ │ │ ├── Predeploys.sol │ │ │ ├── Preinstalls.sol │ │ │ ├── SafeCall.sol │ │ │ ├── StaticConfig.sol │ │ │ ├── Storage.sol │ │ │ ├── TransientContext.sol │ │ │ ├── Types.sol │ │ │ ├── rlp │ │ │ │ ├── RLPErrors.sol │ │ │ │ ├── RLPReader.sol │ │ │ │ └── RLPWriter.sol │ │ │ └── trie │ │ │ │ ├── MerkleTrie.sol │ │ │ │ └── SecureMerkleTrie.sol │ │ ├── periphery │ │ │ ├── AssetReceiver.sol │ │ │ ├── Transactor.sol │ │ │ ├── TransferOnion.sol │ │ │ ├── drippie │ │ │ │ ├── Drippie.sol │ │ │ │ ├── IDripCheck.sol │ │ │ │ └── dripchecks │ │ │ │ │ ├── CheckBalanceLow.sol │ │ │ │ │ ├── CheckGelatoLow.sol │ │ │ │ │ ├── CheckSecrets.sol │ │ │ │ │ └── CheckTrue.sol │ │ │ ├── faucet │ │ │ │ ├── Faucet.sol │ │ │ │ └── authmodules │ │ │ │ │ ├── AdminFaucetAuthModule.sol │ │ │ │ │ └── IFaucetAuthModule.sol │ │ │ └── op-nft │ │ │ │ ├── AttestationStation.sol │ │ │ │ ├── Optimist.sol │ │ │ │ ├── OptimistAllowlist.sol │ │ │ │ ├── OptimistInviter.sol │ │ │ │ └── libraries │ │ │ │ └── OptimistConstants.sol │ │ ├── universal │ │ │ ├── CrossDomainMessenger.sol │ │ │ ├── ERC721Bridge.sol │ │ │ ├── FeeVault.sol │ │ │ ├── IOptimismMintableERC20.sol │ │ │ ├── IOptimismMintableERC721.sol │ │ │ ├── ISemver.sol │ │ │ ├── OptimismMintableERC20.sol │ │ │ ├── OptimismMintableERC20Factory.sol │ │ │ ├── OptimismMintableERC721.sol │ │ │ ├── OptimismMintableERC721Factory.sol │ │ │ ├── Proxy.sol │ │ │ ├── ProxyAdmin.sol │ │ │ ├── StandardBridge.sol │ │ │ └── StorageSetter.sol │ │ └── vendor │ │ │ └── AddressAliasHelper.sol │ ├── test │ │ ├── BenchmarkTest.t.sol │ │ ├── ExtendedPause.t.sol │ │ ├── L1 │ │ │ ├── DataAvailabilityChallenge.t.sol │ │ │ ├── DelayedVetoable.t.sol │ │ │ ├── L1CrossDomainMessenger.t.sol │ │ │ ├── L1ERC721Bridge.t.sol │ │ │ ├── L1StandardBridge.t.sol │ │ │ ├── L2OutputOracle.t.sol │ │ │ ├── OptimismPortal.t.sol │ │ │ ├── OptimismPortal2.t.sol │ │ │ ├── OptimismPortalInterop.t.sol │ │ │ ├── ProtocolVersions.t.sol │ │ │ ├── ResourceMetering.t.sol │ │ │ ├── SuperchainConfig.t.sol │ │ │ ├── SystemConfig.t.sol │ │ │ └── SystemConfigInterop.t.sol │ │ ├── L2 │ │ │ ├── CrossDomainOwnable.t.sol │ │ │ ├── CrossDomainOwnable2.t.sol │ │ │ ├── CrossDomainOwnable3.t.sol │ │ │ ├── CrossL2Inbox.t.sol │ │ │ ├── GasPriceOracle.t.sol │ │ │ ├── L1Block.t.sol │ │ │ ├── L1BlockInterop.t.sol │ │ │ ├── L2CrossDomainMessenger.t.sol │ │ │ ├── L2ERC721Bridge.t.sol │ │ │ ├── L2StandardBridge.t.sol │ │ │ ├── L2ToL1MessagePasser.t.sol │ │ │ ├── L2ToL2CrossDomainMessenger.t.sol │ │ │ ├── SequencerFeeVault.t.sol │ │ │ └── WETH.t.sol │ │ ├── L2Genesis.t.sol │ │ ├── Predeploys.t.sol │ │ ├── Preinstalls.t.sol │ │ ├── Safe │ │ │ ├── DeployOwnership.t.sol │ │ │ ├── DeputyGuardianModule.t.sol │ │ │ ├── LivenessGuard.t.sol │ │ │ ├── LivenessModule.t.sol │ │ │ └── SafeSigners.t.sol │ │ ├── Specs.t.sol │ │ ├── actors │ │ │ └── FaultDisputeActors.sol │ │ ├── cannon │ │ │ ├── MIPS.t.sol │ │ │ └── PreimageOracle.t.sol │ │ ├── dispute │ │ │ ├── AnchorStateRegistry.t.sol │ │ │ ├── DelayedWETH.t.sol │ │ │ ├── DisputeGameFactory.t.sol │ │ │ ├── FaultDisputeGame.t.sol │ │ │ ├── PermissionedDisputeGame.t.sol │ │ │ ├── WETH98.t.sol │ │ │ └── lib │ │ │ │ ├── LibClock.t.sol │ │ │ │ ├── LibGameId.t.sol │ │ │ │ └── LibPosition.t.sol │ │ ├── governance │ │ │ ├── GovernanceToken.t.sol │ │ │ └── MintManager.t.sol │ │ ├── invariants │ │ │ ├── AddressAliasHelper.t.sol │ │ │ ├── Burn.Eth.t.sol │ │ │ ├── Burn.Gas.t.sol │ │ │ ├── CrossDomainMessenger.t.sol │ │ │ ├── Encoding.t.sol │ │ │ ├── FaultDisputeGame.t.sol │ │ │ ├── Hashing.t.sol │ │ │ ├── InvariantTest.sol │ │ │ ├── L2OutputOracle.t.sol │ │ │ ├── OptimismPortal.t.sol │ │ │ ├── OptimismPortal2.t.sol │ │ │ ├── ResourceMetering.t.sol │ │ │ ├── SafeCall.t.sol │ │ │ └── SystemConfig.t.sol │ │ ├── kontrol │ │ │ ├── README.md │ │ │ ├── deployment │ │ │ │ ├── DeploymentSummary.t.sol │ │ │ │ ├── DeploymentSummaryFaultProofs.t.sol │ │ │ │ └── KontrolDeployment.sol │ │ │ ├── pausability-lemmas.md │ │ │ ├── proofs │ │ │ │ ├── L1CrossDomainMessenger.k.sol │ │ │ │ ├── L1ERC721Bridge.k.sol │ │ │ │ ├── L1StandardBridge.k.sol │ │ │ │ ├── OptimismPortal.k.sol │ │ │ │ ├── OptimismPortal2.k.sol │ │ │ │ ├── interfaces │ │ │ │ │ └── KontrolInterfaces.sol │ │ │ │ └── utils │ │ │ │ │ ├── DeploymentSummary.sol │ │ │ │ │ ├── DeploymentSummaryCode.sol │ │ │ │ │ ├── DeploymentSummaryFaultProofs.sol │ │ │ │ │ ├── DeploymentSummaryFaultProofsCode.sol │ │ │ │ │ └── KontrolUtils.sol │ │ │ └── scripts │ │ │ │ ├── common.sh │ │ │ │ ├── json │ │ │ │ ├── clean_json.py │ │ │ │ └── reverse_key_values.py │ │ │ │ ├── make-summary-deployment.sh │ │ │ │ └── run-kontrol.sh │ │ ├── legacy │ │ │ ├── DeployerWhitelist.t.sol │ │ │ ├── L1BlockNumber.t.sol │ │ │ ├── LegacyMessagePasser.t.sol │ │ │ └── ResolvedDelegateProxy.t.sol │ │ ├── libraries │ │ │ ├── Bytes.t.sol │ │ │ ├── Constants.t.sol │ │ │ ├── Encoding.t.sol │ │ │ ├── GasPayingToken.t.sol │ │ │ ├── Hashing.t.sol │ │ │ ├── SafeCall.t.sol │ │ │ ├── StaticConfig.t.sol │ │ │ ├── Storage.t.sol │ │ │ ├── TransientContext.t.sol │ │ │ ├── rlp │ │ │ │ ├── RLPReader.t.sol │ │ │ │ └── RLPWriter.t.sol │ │ │ └── trie │ │ │ │ └── MerkleTrie.t.sol │ │ ├── mocks │ │ │ ├── AlphabetVM.sol │ │ │ ├── Callers.sol │ │ │ ├── EIP1967Helper.sol │ │ │ ├── FaucetHelper.sol │ │ │ ├── NextImpl.sol │ │ │ ├── OptimistInviterHelper.sol │ │ │ ├── SimpleStorage.sol │ │ │ ├── TestERC1271Wallet.sol │ │ │ ├── TestERC20.sol │ │ │ ├── TestERC721.sol │ │ │ └── block.json │ │ ├── periphery │ │ │ ├── AssetReceiver.t.sol │ │ │ ├── Transactor.t.sol │ │ │ ├── TransferOnion.t.sol │ │ │ ├── drippie │ │ │ │ ├── Drippie.t.sol │ │ │ │ └── dripchecks │ │ │ │ │ ├── CheckBalanceLow.t.sol │ │ │ │ │ ├── CheckGelatoLow.t.sol │ │ │ │ │ ├── CheckSecrets.t.sol │ │ │ │ │ └── CheckTrue.t.sol │ │ │ ├── faucet │ │ │ │ ├── Faucet.t.sol │ │ │ │ └── authmodules │ │ │ │ │ └── AdminFaucetAuthModule.t.sol │ │ │ └── op-nft │ │ │ │ ├── AttestationStation.t.sol │ │ │ │ ├── Optimist.t.sol │ │ │ │ ├── OptimistAllowlist.t.sol │ │ │ │ └── OptimistInviter.t.sol │ │ ├── safe-tools │ │ │ ├── CompatibilityFallbackHandler_1_3_0.sol │ │ │ └── SafeTestTools.sol │ │ ├── setup │ │ │ ├── Bridge_Initializer.sol │ │ │ ├── CommonTest.sol │ │ │ ├── Events.sol │ │ │ ├── FFIInterface.sol │ │ │ └── Setup.sol │ │ ├── universal │ │ │ ├── CrossDomainMessenger.t.sol │ │ │ ├── FeeVault.t.sol │ │ │ ├── OptimismMintableERC20.t.sol │ │ │ ├── OptimismMintableERC20Factory.t.sol │ │ │ ├── OptimismMintableERC721.t.sol │ │ │ ├── OptimismMintableERC721Factory.t.sol │ │ │ ├── Proxy.t.sol │ │ │ ├── ProxyAdmin.t.sol │ │ │ └── StandardBridge.t.sol │ │ └── vendor │ │ │ ├── AddressAliasHelper.t.sol │ │ │ └── Initializable.t.sol │ └── tsconfig.json └── devnet-tasks │ ├── .depcheckrc │ ├── .eslintrc.js │ ├── .gitignore │ ├── .lintstagedrc.yml │ ├── .prettierrc.js │ ├── LICENSE │ ├── README.md │ ├── hardhat.config.ts │ ├── package.json │ ├── src │ └── tasks │ │ ├── deposit-erc20.ts │ │ ├── deposit-eth.ts │ │ └── index.ts │ └── tsconfig.json ├── pnpm-lock.yaml ├── pnpm-workspace.yaml ├── proxyd └── README.md ├── specs └── README.md └── versions.json /.changeset/README.md: -------------------------------------------------------------------------------- 1 | # Changesets 2 | 3 | Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works 4 | with multi-package repos, or single-package repos to help you version and publish your code. You can 5 | find the full documentation for it [in our repository](https://github.com/changesets/changesets) 6 | 7 | We have a quick list of common questions to get you started engaging with this project in 8 | [our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md) 9 | -------------------------------------------------------------------------------- /.changeset/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://unpkg.com/@changesets/config@2.3.0/schema.json", 3 | "changelog": ["@changesets/changelog-github", { "repo": "ethereum-optimism/optimism" }], 4 | "commit": false, 5 | "fixed": [], 6 | "linked": [], 7 | "access": "public", 8 | "baseBranch": "develop", 9 | "updateInternalDependencies": "patch", 10 | "privatePackages": { "version": true, "tag": true }, 11 | "ignore": [] 12 | } 13 | -------------------------------------------------------------------------------- /.coderabbit.yml: -------------------------------------------------------------------------------- 1 | language: "en" 2 | early_access: false 3 | reviews: 4 | high_level_summary: false 5 | poem: false 6 | review_status: false 7 | collapse_walkthrough: true 8 | path_filters: 9 | - "!**/*.json" 10 | path_instructions: 11 | - path: "**.sol" 12 | instructions: "Focus on the following areas: 13 | - Security 14 | - Identifying test cases which are lacking 15 | - Removing unnecessary code 16 | " 17 | auto_review: 18 | enabled: false 19 | drafts: false 20 | base_branches: 21 | - "develop" 22 | - "feat/*" 23 | chat: 24 | auto_reply: true 25 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | .github 2 | .vscode 3 | 4 | node_modules 5 | **/node_modules 6 | .env 7 | **/.env 8 | 9 | test 10 | **/*_test.go 11 | build/_workspace 12 | build/bin 13 | build/_bin 14 | tests/testdata 15 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | # defaults 4 | [*] 5 | charset = utf-8 6 | end_of_line = lf 7 | indent_size = 2 8 | indent_style = space 9 | insert_final_newline = true 10 | trim_trailing_whitespace = true 11 | 12 | [*.sol] 13 | indent_size = 4 14 | 15 | [*.go] 16 | indent_size = 4 17 | indent_style = tab 18 | 19 | [Makefile] 20 | indent_size = 2 21 | indent_style = tab 22 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.sh text eol=lf 2 | -------------------------------------------------------------------------------- /.github/workflows/close-stale.yml: -------------------------------------------------------------------------------- 1 | name: 'Close stale issues and PRs' 2 | on: 3 | schedule: 4 | - cron: '30 1 * * *' 5 | 6 | jobs: 7 | stale: 8 | runs-on: ubuntu-latest 9 | steps: 10 | - uses: actions/stale@v9 11 | with: 12 | stale-pr-message: 'This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 5 days.' 13 | stale-issue-label: 'S-stale' 14 | exempt-pr-labels: 'S-exempt-stale' 15 | days-before-issue-stale: 999 16 | days-before-pr-stale: 14 17 | days-before-close: 5 18 | repo-token: ${{ secrets.GITHUB_TOKEN }} 19 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | results 4 | temp 5 | .nyc_output 6 | coverage.json 7 | *.tsbuildinfo 8 | **/lcov.info 9 | 10 | yarn-error.log 11 | .yarn/* 12 | !.yarn/releases 13 | !.yarn/plugins 14 | .pnp.* 15 | 16 | dist 17 | artifacts 18 | cache 19 | 20 | packages/contracts-bedrock/deployments/devnetL1 21 | packages/contracts-bedrock/deployments/anvil 22 | 23 | # vim 24 | *.sw* 25 | 26 | # jetbrains 27 | .idea/ 28 | 29 | .secrets 30 | .env 31 | .env* 32 | !.env.example 33 | !.envrc.example 34 | *.log 35 | 36 | .devnet 37 | 38 | # Ignore local fuzzing results 39 | **/testdata/fuzz/ 40 | 41 | coverage.out 42 | 43 | 44 | __pycache__ 45 | 46 | # Ignore echidna artifacts 47 | crytic-export 48 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | # run prefoo scripts 2 | # npm and yarn support this as a default pnpm defaults to false 3 | enable-pre-post-scripts=true 4 | lockfile=true 5 | prefer-workspace-packages=true 6 | -------------------------------------------------------------------------------- /.nvmrc: -------------------------------------------------------------------------------- 1 | v20.9.0 2 | -------------------------------------------------------------------------------- /.pnpmfile.cjs: -------------------------------------------------------------------------------- 1 | // This function does not modify the lockfile. It asserts that packages do not use SSH 2 | // when specifying git repository 3 | function afterAllResolved(lockfile, context) { 4 | const pkgs = lockfile['packages']; 5 | for (const [pkg, entry] of Object.entries(pkgs)) { 6 | const repo = entry.resolution['repo']; 7 | if (repo !== undefined) { 8 | if (repo.startsWith('git@github.com')) { 9 | throw new Error(`Invalid git ssh specification found for package ${pkg}. Ensure sure that the dependencies do not reference SSH-based git repos before running installing them`); 10 | } 11 | } 12 | } 13 | return lockfile 14 | } 15 | 16 | module.exports = { 17 | hooks: { 18 | afterAllResolved 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /.prettierrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | $schema: 'http://json.schemastore.org/prettierrc', 3 | plugins: [], 4 | trailingComma: 'es5', 5 | tabWidth: 2, 6 | semi: false, 7 | singleQuote: true, 8 | arrowParens: 'always', 9 | overrides: [], 10 | } 11 | -------------------------------------------------------------------------------- /.semgrepignore: -------------------------------------------------------------------------------- 1 | # Common large paths 2 | node_modules/ 3 | build/ 4 | dist/ 5 | vendor/ 6 | .env/ 7 | .venv/ 8 | .tox/ 9 | *.min.js 10 | 11 | # Common test paths 12 | test/ 13 | tests/ 14 | 15 | # Semgrep rules folder 16 | .semgrep 17 | 18 | # Semgrep-action log folder 19 | .semgrep_logs/ 20 | 21 | 22 | packages/*/node_modules 23 | packages/*/test 24 | -------------------------------------------------------------------------------- /.shellcheckrc: -------------------------------------------------------------------------------- 1 | disable=SC2002 2 | -------------------------------------------------------------------------------- /.snyk: -------------------------------------------------------------------------------- 1 | exclude: 2 | global: 3 | - infra/op-replica/** # snyk does not respect kustomizations, so not useful here 4 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | // See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations. 3 | // Extension identifier format: ${publisher}.${name}. Example: vscode.csharp 4 | 5 | // List of extensions which should be recommended for users of this workspace. 6 | "recommendations": [ 7 | "dbaeumer.vscode-eslint", 8 | "editorconfig.editorconfig", 9 | "juanblanco.solidity", 10 | "golang.go", 11 | ], 12 | } -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "[typescript]": { 3 | "editor.defaultFormatter": "dbaeumer.vscode-eslint", 4 | "editor.formatOnSave": true 5 | }, 6 | "eslint.workingDirectories": [ 7 | { 8 | "directory": "packages/chain-mon", 9 | "changeProcessCWD": true 10 | } 11 | ], 12 | "eslint.nodePath": "./node_modules/eslint/bin/", 13 | "eslint.format.enable": true, 14 | "editorconfig.generateAuto": false, 15 | "files.trimTrailingWhitespace": true 16 | } 17 | -------------------------------------------------------------------------------- /CITATION.cff: -------------------------------------------------------------------------------- 1 | cff-version: 1.2.0 2 | message: If you use this software in your work, please cite it using the following metadata 3 | title: The Optimism Monorepo 4 | authors: 5 | - name: The Optimism Collective 6 | version: 1.0.0 7 | year: 2020 8 | url: https://github.com/ethereum-optimism/optimism 9 | repository: https://github.com/ethereum-optimism/optimism 10 | license: MIT 11 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | Please see our security policy document [here](https://github.com/ethereum-optimism/.github/blob/master/SECURITY.md). 2 | -------------------------------------------------------------------------------- /bedrock-devnet/README.md: -------------------------------------------------------------------------------- 1 | # bedrock-devnet 2 | 3 | This is a utility for running a local Bedrock devnet. It is designed to replace the legacy Bash-based devnet runner as part of a progressive migration away from Bash automation. 4 | 5 | The easiest way to invoke this script is to run `make devnet-up` from the root of this repository. Otherwise, to use this script run `python3 main.py --monorepo-dir=`. You may need to set `PYTHONPATH` to this directory if you are invoking the script from somewhere other than `bedrock-devnet`. 6 | -------------------------------------------------------------------------------- /bedrock-devnet/devnet/log_setup.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | from logging.config import dictConfig 4 | 5 | log_level = os.getenv('LOG_LEVEL') 6 | 7 | log_config = { 8 | 'version': 1, 9 | 'loggers': { 10 | '': { 11 | 'handlers': ['console'], 12 | 'level': log_level if log_level is not None else 'INFO' 13 | }, 14 | }, 15 | 'handlers': { 16 | 'console': { 17 | 'formatter': 'stderr', 18 | 'class': 'logging.StreamHandler', 19 | 'stream': 'ext://sys.stdout' 20 | } 21 | }, 22 | 'formatters': { 23 | 'stderr': { 24 | 'format': '[%(levelname)s|%(asctime)s] %(message)s', 25 | 'datefmt': '%m-%d-%Y %I:%M:%S' 26 | } 27 | }, 28 | } 29 | 30 | dictConfig(log_config) 31 | -------------------------------------------------------------------------------- /bedrock-devnet/main.py: -------------------------------------------------------------------------------- 1 | import devnet 2 | 3 | 4 | def main(): 5 | devnet.main() 6 | 7 | 8 | if __name__ == '__main__': 9 | main() 10 | -------------------------------------------------------------------------------- /cannon/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | artifacts 3 | cache 4 | .*.swp 5 | venv 6 | .idea 7 | *.log 8 | example/bin 9 | contracts/out 10 | state.json 11 | *.json 12 | *.json.gz 13 | *.pprof 14 | *.out 15 | bin 16 | -------------------------------------------------------------------------------- /cannon/example/Makefile: -------------------------------------------------------------------------------- 1 | all: elf dump 2 | 3 | .PHONY: elf 4 | elf: $(patsubst %/go.mod,bin/%.elf,$(wildcard */go.mod)) 5 | 6 | .PHONY: dump 7 | dump: $(patsubst %/go.mod,bin/%.dump,$(wildcard */go.mod)) 8 | 9 | bin: 10 | mkdir bin 11 | 12 | # take any directory with a go mod, and build an ELF 13 | # verify output with: readelf -h bin/.elf 14 | # result is mips32, big endian, R3000 15 | bin/%.elf: bin 16 | cd $(@:bin/%.elf=%) && GOOS=linux GOARCH=mips GOMIPS=softfloat go build -o ../$@ . 17 | 18 | # take any ELF and dump it 19 | # TODO: currently have the little-endian toolchain, but should use the big-endian one. The -EB compat flag works though. 20 | bin/%.dump: bin/%.elf 21 | mipsel-linux-gnu-objdump -D --disassembler-options=no-aliases --wide --source -m mips:3000 -EB $(@:%.dump=%.elf) > $@ 22 | -------------------------------------------------------------------------------- /cannon/example/alloc/go.mod: -------------------------------------------------------------------------------- 1 | module alloc 2 | 3 | go 1.21 4 | 5 | toolchain go1.21.1 6 | 7 | require github.com/ethereum-optimism/optimism v0.0.0 8 | 9 | require ( 10 | golang.org/x/crypto v0.25.0 // indirect 11 | golang.org/x/sys v0.22.0 // indirect 12 | ) 13 | 14 | replace github.com/ethereum-optimism/optimism v0.0.0 => ../../.. 15 | -------------------------------------------------------------------------------- /cannon/example/claim/go.mod: -------------------------------------------------------------------------------- 1 | module claim 2 | 3 | go 1.21 4 | 5 | toolchain go1.21.1 6 | 7 | require github.com/ethereum-optimism/optimism v0.0.0 8 | 9 | require ( 10 | golang.org/x/crypto v0.25.0 // indirect 11 | golang.org/x/sys v0.22.0 // indirect 12 | ) 13 | 14 | replace github.com/ethereum-optimism/optimism v0.0.0 => ../../.. 15 | -------------------------------------------------------------------------------- /cannon/example/hello/go.mod: -------------------------------------------------------------------------------- 1 | module hello 2 | 3 | go 1.20 4 | -------------------------------------------------------------------------------- /cannon/example/hello/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "os" 4 | 5 | func main() { 6 | _, _ = os.Stdout.Write([]byte("hello world!\n")) 7 | } 8 | -------------------------------------------------------------------------------- /cannon/mipsevm/.gitignore: -------------------------------------------------------------------------------- 1 | mipsevm 2 | mipsevm.test 3 | *.prof 4 | -------------------------------------------------------------------------------- /cannon/mipsevm/logw.go: -------------------------------------------------------------------------------- 1 | package mipsevm 2 | 3 | import ( 4 | "github.com/ethereum/go-ethereum/common/hexutil" 5 | "github.com/ethereum/go-ethereum/log" 6 | ) 7 | 8 | // LoggingWriter is a simple util to wrap a logger, 9 | // and expose an io Writer interface, 10 | // for the program running within the VM to write to. 11 | type LoggingWriter struct { 12 | Log log.Logger 13 | } 14 | 15 | func logAsText(b string) bool { 16 | for _, c := range b { 17 | if (c < 0x20 || c >= 0x7F) && (c != '\n' && c != '\t') { 18 | return false 19 | } 20 | } 21 | return true 22 | } 23 | 24 | func (lw *LoggingWriter) Write(b []byte) (int, error) { 25 | t := string(b) 26 | if logAsText(t) { 27 | lw.Log.Info("", "text", t) 28 | } else { 29 | lw.Log.Info("", "data", hexutil.Bytes(b)) 30 | } 31 | return len(b), nil 32 | } 33 | -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/README.md: -------------------------------------------------------------------------------- 1 | # OpenMIPS test vectors 2 | 3 | Tests from https://github.com/grantae/OpenMIPS/tree/d606b35e9d5260aef20de2a58660c8303a681e9c/software/test/macro/tests 4 | 5 | OpenMIPS is licensed LGPLv3 (as seen in the root of the repository), see [`LICENSE`](./LICENSE) file. 6 | Note that some build-system files from 2014/2015 in that repository by the same author are marked as BSD licensed, 7 | but the build-system is not used here. 8 | 9 | Requires https://github.com/sergev/LiteBSD/releases/download/tools/gcc-4.8.1-mips-macosx.tgz to build 10 | 11 | -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/bin/add.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/cannon/mipsevm/open_mips_tests/test/bin/add.bin -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/bin/addi.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/cannon/mipsevm/open_mips_tests/test/bin/addi.bin -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/bin/addiu.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/cannon/mipsevm/open_mips_tests/test/bin/addiu.bin -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/bin/addu.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/cannon/mipsevm/open_mips_tests/test/bin/addu.bin -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/bin/and.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/cannon/mipsevm/open_mips_tests/test/bin/and.bin -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/bin/andi.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/cannon/mipsevm/open_mips_tests/test/bin/andi.bin -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/bin/beq.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/cannon/mipsevm/open_mips_tests/test/bin/beq.bin -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/bin/bgez.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/cannon/mipsevm/open_mips_tests/test/bin/bgez.bin -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/bin/bgtz.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/cannon/mipsevm/open_mips_tests/test/bin/bgtz.bin -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/bin/blez.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/cannon/mipsevm/open_mips_tests/test/bin/blez.bin -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/bin/bltz.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/cannon/mipsevm/open_mips_tests/test/bin/bltz.bin -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/bin/bne.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/cannon/mipsevm/open_mips_tests/test/bin/bne.bin -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/bin/brk.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/cannon/mipsevm/open_mips_tests/test/bin/brk.bin -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/bin/clo.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/cannon/mipsevm/open_mips_tests/test/bin/clo.bin -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/bin/clone.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/cannon/mipsevm/open_mips_tests/test/bin/clone.bin -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/bin/clz.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/cannon/mipsevm/open_mips_tests/test/bin/clz.bin -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/bin/div.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/cannon/mipsevm/open_mips_tests/test/bin/div.bin -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/bin/divu.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/cannon/mipsevm/open_mips_tests/test/bin/divu.bin -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/bin/exit_group.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/cannon/mipsevm/open_mips_tests/test/bin/exit_group.bin -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/bin/fcntl.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/cannon/mipsevm/open_mips_tests/test/bin/fcntl.bin -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/bin/j.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/cannon/mipsevm/open_mips_tests/test/bin/j.bin -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/bin/jal.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/cannon/mipsevm/open_mips_tests/test/bin/jal.bin -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/bin/jalr.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/cannon/mipsevm/open_mips_tests/test/bin/jalr.bin -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/bin/jr.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/cannon/mipsevm/open_mips_tests/test/bin/jr.bin -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/bin/lb.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/cannon/mipsevm/open_mips_tests/test/bin/lb.bin -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/bin/lbu.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/cannon/mipsevm/open_mips_tests/test/bin/lbu.bin -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/bin/lh.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/cannon/mipsevm/open_mips_tests/test/bin/lh.bin -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/bin/lhu.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/cannon/mipsevm/open_mips_tests/test/bin/lhu.bin -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/bin/lui.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/cannon/mipsevm/open_mips_tests/test/bin/lui.bin -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/bin/lw.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/cannon/mipsevm/open_mips_tests/test/bin/lw.bin -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/bin/lwl.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/cannon/mipsevm/open_mips_tests/test/bin/lwl.bin -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/bin/lwr.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/cannon/mipsevm/open_mips_tests/test/bin/lwr.bin -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/bin/mfthi.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/cannon/mipsevm/open_mips_tests/test/bin/mfthi.bin -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/bin/mftlo.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/cannon/mipsevm/open_mips_tests/test/bin/mftlo.bin -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/bin/mmap.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/cannon/mipsevm/open_mips_tests/test/bin/mmap.bin -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/bin/movn.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/cannon/mipsevm/open_mips_tests/test/bin/movn.bin -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/bin/movz.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/cannon/mipsevm/open_mips_tests/test/bin/movz.bin -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/bin/mul.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/cannon/mipsevm/open_mips_tests/test/bin/mul.bin -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/bin/mult.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/cannon/mipsevm/open_mips_tests/test/bin/mult.bin -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/bin/multu.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/cannon/mipsevm/open_mips_tests/test/bin/multu.bin -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/bin/nor.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/cannon/mipsevm/open_mips_tests/test/bin/nor.bin -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/bin/oracle.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/cannon/mipsevm/open_mips_tests/test/bin/oracle.bin -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/bin/oracle_kzg.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/cannon/mipsevm/open_mips_tests/test/bin/oracle_kzg.bin -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/bin/oracle_unaligned_read.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/cannon/mipsevm/open_mips_tests/test/bin/oracle_unaligned_read.bin -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/bin/oracle_unaligned_write.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/cannon/mipsevm/open_mips_tests/test/bin/oracle_unaligned_write.bin -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/bin/ori.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/cannon/mipsevm/open_mips_tests/test/bin/ori.bin -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/bin/sb.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/cannon/mipsevm/open_mips_tests/test/bin/sb.bin -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/bin/sh.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/cannon/mipsevm/open_mips_tests/test/bin/sh.bin -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/bin/sll.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/cannon/mipsevm/open_mips_tests/test/bin/sll.bin -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/bin/sllv.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/cannon/mipsevm/open_mips_tests/test/bin/sllv.bin -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/bin/slt.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/cannon/mipsevm/open_mips_tests/test/bin/slt.bin -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/bin/slti.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/cannon/mipsevm/open_mips_tests/test/bin/slti.bin -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/bin/sltiu.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/cannon/mipsevm/open_mips_tests/test/bin/sltiu.bin -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/bin/sltu.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/cannon/mipsevm/open_mips_tests/test/bin/sltu.bin -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/bin/sra.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/cannon/mipsevm/open_mips_tests/test/bin/sra.bin -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/bin/srav.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/cannon/mipsevm/open_mips_tests/test/bin/srav.bin -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/bin/srl.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/cannon/mipsevm/open_mips_tests/test/bin/srl.bin -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/bin/srlv.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/cannon/mipsevm/open_mips_tests/test/bin/srlv.bin -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/bin/sub.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/cannon/mipsevm/open_mips_tests/test/bin/sub.bin -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/bin/subu.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/cannon/mipsevm/open_mips_tests/test/bin/subu.bin -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/bin/swl.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/cannon/mipsevm/open_mips_tests/test/bin/swl.bin -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/bin/swr.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/cannon/mipsevm/open_mips_tests/test/bin/swr.bin -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/bin/xor.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/cannon/mipsevm/open_mips_tests/test/bin/xor.bin -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/bin/xori.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/cannon/mipsevm/open_mips_tests/test/bin/xori.bin -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/brk.asm: -------------------------------------------------------------------------------- 1 | .section .test, "x" 2 | .balign 4 3 | .set noreorder 4 | .global test 5 | .ent test 6 | 7 | test: 8 | li $v0, 4045 9 | syscall 10 | lui $t0, 0x4000 11 | subu $v0, $v0, $t0 12 | sltiu $v0, $v0, 1 13 | 14 | # save results 15 | lui $s0, 0xbfff # Load the base address 0xbffffff0 16 | ori $s0, 0xfff0 17 | ori $s1, $0, 1 # Prepare the 'done' status 18 | 19 | sw $v0, 8($s0) # Set the test result 20 | sw $s1, 4($s0) # Set 'done' 21 | 22 | $done: 23 | jr $ra 24 | nop 25 | 26 | .end test 27 | -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/clone.asm: -------------------------------------------------------------------------------- 1 | .section .test, "x" 2 | .balign 4 3 | .set noreorder 4 | .global test 5 | .ent test 6 | 7 | test: 8 | li $v0, 4120 9 | syscall 10 | li $t0, 0x1 11 | subu $v0, $v0, $t0 12 | sltiu $v0, $v0, 1 13 | 14 | # save results 15 | lui $s0, 0xbfff # Load the base address 0xbffffff0 16 | ori $s0, 0xfff0 17 | ori $s1, $0, 1 # Prepare the 'done' status 18 | 19 | sw $v0, 8($s0) # Set the test result 20 | sw $s1, 4($s0) # Set 'done' 21 | 22 | $done: 23 | jr $ra 24 | nop 25 | 26 | .end test 27 | -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/exit_group.asm: -------------------------------------------------------------------------------- 1 | .section .test, "x" 2 | .balign 4 3 | .set noreorder 4 | .global test 5 | .ent test 6 | 7 | test: 8 | li $a0, 1 9 | li $v0, 4246 10 | syscall 11 | 12 | # Unreachable .... 13 | # set test result to fail. 14 | # Test runner should short-circuit before reaching this point. 15 | li $v0, 0 16 | 17 | # save results 18 | lui $s0, 0xbfff # Load the base address 0xbffffff0 19 | ori $s0, 0xfff0 20 | ori $s1, $0, 1 # Prepare the 'done' status 21 | 22 | sw $v0, 8($s0) # Set the test result 23 | sw $s1, 4($s0) # Set 'done' 24 | 25 | $done: 26 | jr $ra 27 | nop 28 | 29 | .end test 30 | -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/fcntl.asm: -------------------------------------------------------------------------------- 1 | .section .test, "x" 2 | .balign 4 3 | .set noreorder 4 | .global test 5 | .ent test 6 | 7 | test: 8 | # fcntl(0, 3) 9 | li $v0, 4055 10 | li $a0, 0x0 11 | li $a1, 0x3 12 | syscall 13 | sltiu $v0, $v0, 1 14 | 15 | # save results 16 | lui $s0, 0xbfff # Load the base address 0xbffffff0 17 | ori $s0, 0xfff0 18 | ori $s1, $0, 1 # Prepare the 'done' status 19 | 20 | sw $v0, 8($s0) # Set the test result 21 | sw $s1, 4($s0) # Set 'done' 22 | 23 | $done: 24 | jr $ra 25 | nop 26 | 27 | .end test 28 | -------------------------------------------------------------------------------- /cannon/mipsevm/open_mips_tests/test/mmap.asm: -------------------------------------------------------------------------------- 1 | .section .test, "x" 2 | .balign 4 3 | .set noreorder 4 | .global test 5 | .ent test 6 | 7 | test: 8 | li $v0, 4090 9 | lui $a0, 0x3000 10 | li $a1, 4096 11 | syscall 12 | lui $t0, 0x3000 13 | subu $v0, $v0, $t0 14 | sltiu $v0, $v0, 1 15 | 16 | # save results 17 | lui $s0, 0xbfff # Load the base address 0xbffffff0 18 | ori $s0, 0xfff0 19 | ori $s1, $0, 1 # Prepare the 'done' status 20 | 21 | sw $v0, 8($s0) # Set the test result 22 | sw $s1, 4($s0) # Set 'done' 23 | 24 | $done: 25 | jr $ra 26 | nop 27 | 28 | .end test 29 | -------------------------------------------------------------------------------- /cannon/mipsevm/witness.go: -------------------------------------------------------------------------------- 1 | package mipsevm 2 | 3 | import "github.com/ethereum/go-ethereum/common" 4 | 5 | type LocalContext common.Hash 6 | 7 | type StepWitness struct { 8 | // encoded state witness 9 | State []byte 10 | StateHash common.Hash 11 | 12 | ProofData []byte 13 | 14 | PreimageKey [32]byte // zeroed when no pre-image is accessed 15 | PreimageValue []byte // including the 8-byte length prefix 16 | PreimageOffset uint32 17 | } 18 | 19 | func (wit *StepWitness) HasPreimage() bool { 20 | return wit.PreimageKey != ([32]byte{}) 21 | } 22 | 23 | func AppendBoolToWitness(witnessData []byte, boolVal bool) []byte { 24 | if boolVal { 25 | return append(witnessData, 1) 26 | } else { 27 | return append(witnessData, 0) 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /cloudbuild.yaml: -------------------------------------------------------------------------------- 1 | steps: 2 | - name: 'gcr.io/kaniko-project/executor:latest' 3 | args: 4 | - --destination=us-central1-docker.pkg.dev/$PROJECT_ID/images/deployer-bedrock:$_TAG 5 | - --destination=us-central1-docker.pkg.dev/$PROJECT_ID/images/deployer-bedrock:$COMMIT_SHA 6 | - --dockerfile=./ops/docker/Dockerfile.packages 7 | - --target=deployer-bedrock 8 | - --cache=true 9 | - --cache-ttl=48h 10 | waitFor: ['-'] 11 | options: 12 | machineType: N1_HIGHCPU_32 13 | -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | ## Optimism Monorepo Documentation 2 | 3 | The `docs/` directory contains Optimism documentation closely tied to the implementation details of the monorepo (https://github.com/ethereum-optimism/optimism). 4 | 5 | The directory layout is divided into the following sub-directories. 6 | 7 | - [`postmortems/`](./postmortems/): Timestamped post-mortem documents. 8 | - [`security-reviews`](./security-reviews/): Audit summaries and other security review documents. 9 | - [`fault-proof-alpha`](./fault-proof-alpha): Information on the alpha version of the fault proof system. 10 | -------------------------------------------------------------------------------- /docs/postmortems/2023-04-26-transaction-delays/outage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/docs/postmortems/2023-04-26-transaction-delays/outage.png -------------------------------------------------------------------------------- /docs/security-reviews/2020_10-Rollup-TrailOfBits.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/docs/security-reviews/2020_10-Rollup-TrailOfBits.pdf -------------------------------------------------------------------------------- /docs/security-reviews/2020_11-Dapphub-ECDSA_Wallet.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/docs/security-reviews/2020_11-Dapphub-ECDSA_Wallet.pdf -------------------------------------------------------------------------------- /docs/security-reviews/2021_03-OVM_and_Rollup-OpenZeppelin.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/docs/security-reviews/2021_03-OVM_and_Rollup-OpenZeppelin.pdf -------------------------------------------------------------------------------- /docs/security-reviews/2021_03-SafetyChecker-ConsenSysDiligence.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/docs/security-reviews/2021_03-SafetyChecker-ConsenSysDiligence.pdf -------------------------------------------------------------------------------- /docs/security-reviews/2022_05-Bedrock_Contracts-Zeppelin.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/docs/security-reviews/2022_05-Bedrock_Contracts-Zeppelin.pdf -------------------------------------------------------------------------------- /docs/security-reviews/2022_05-OpNode-TrailOfBits.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/docs/security-reviews/2022_05-OpNode-TrailOfBits.pdf -------------------------------------------------------------------------------- /docs/security-reviews/2022_08-Bedrock_GoLang-SigmaPrime.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/docs/security-reviews/2022_08-Bedrock_GoLang-SigmaPrime.pdf -------------------------------------------------------------------------------- /docs/security-reviews/2022_09-Bedrock_and_Periphery-Zeppelin.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/docs/security-reviews/2022_09-Bedrock_and_Periphery-Zeppelin.pdf -------------------------------------------------------------------------------- /docs/security-reviews/2022_10-Drippie-Spearbit.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/docs/security-reviews/2022_10-Drippie-Spearbit.pdf -------------------------------------------------------------------------------- /docs/security-reviews/2022_11-Invariant_Testing-TrailOfBits.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/docs/security-reviews/2022_11-Invariant_Testing-TrailOfBits.pdf -------------------------------------------------------------------------------- /docs/security-reviews/2023_01-Bedrock_Updates-TrailOfBits.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/docs/security-reviews/2023_01-Bedrock_Updates-TrailOfBits.pdf -------------------------------------------------------------------------------- /docs/security-reviews/2023_12_Trust_SuperchainConfigUpgrade.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/docs/security-reviews/2023_12_Trust_SuperchainConfigUpgrade.pdf -------------------------------------------------------------------------------- /docs/security-reviews/2024_02-MCP_L1-Cantina.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/docs/security-reviews/2024_02-MCP_L1-Cantina.pdf -------------------------------------------------------------------------------- /docs/security-reviews/2024_05-FaultProofs-Sherlock.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/docs/security-reviews/2024_05-FaultProofs-Sherlock.pdf -------------------------------------------------------------------------------- /docs/security-reviews/2024_05_SafeLivenessExtensions-Cantina.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/docs/security-reviews/2024_05_SafeLivenessExtensions-Cantina.pdf -------------------------------------------------------------------------------- /op-batcher/.gitignore: -------------------------------------------------------------------------------- 1 | bin 2 | -------------------------------------------------------------------------------- /op-batcher/compressor/compressors.go: -------------------------------------------------------------------------------- 1 | package compressor 2 | 3 | import ( 4 | "github.com/ethereum-optimism/optimism/op-node/rollup/derive" 5 | ) 6 | 7 | type FactoryFunc func(Config) (derive.Compressor, error) 8 | 9 | const ( 10 | RatioKind = "ratio" 11 | ShadowKind = "shadow" 12 | NoneKind = "none" 13 | 14 | // CloseOverheadZlib is the number of final bytes a [zlib.Writer] call writes 15 | // to the output buffer. 16 | CloseOverheadZlib = 9 17 | ) 18 | 19 | var Kinds = map[string]FactoryFunc{ 20 | RatioKind: NewRatioCompressor, 21 | ShadowKind: NewShadowCompressor, 22 | NoneKind: NewNonCompressor, 23 | } 24 | 25 | var KindKeys []string 26 | 27 | func init() { 28 | for k := range Kinds { 29 | KindKeys = append(KindKeys, k) 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /op-batcher/compressor/compressors_test.go: -------------------------------------------------------------------------------- 1 | package compressor 2 | 3 | import ( 4 | "bytes" 5 | "compress/zlib" 6 | "io" 7 | "math/rand" 8 | "testing" 9 | 10 | "github.com/stretchr/testify/require" 11 | ) 12 | 13 | func TestCloseOverheadZlib(t *testing.T) { 14 | var buf bytes.Buffer 15 | z := zlib.NewWriter(&buf) 16 | rng := rand.New(rand.NewSource(420)) 17 | _, err := io.CopyN(z, rng, 0xff) 18 | require.NoError(t, err) 19 | 20 | require.NoError(t, z.Flush()) 21 | fsize := buf.Len() 22 | require.NoError(t, z.Close()) 23 | csize := buf.Len() 24 | require.Equal(t, CloseOverheadZlib, csize-fsize) 25 | } 26 | -------------------------------------------------------------------------------- /op-batcher/compressor/non_compressor_test.go: -------------------------------------------------------------------------------- 1 | package compressor 2 | 3 | import ( 4 | "math/rand" 5 | "testing" 6 | 7 | "github.com/stretchr/testify/require" 8 | ) 9 | 10 | func TestNonCompressor(t *testing.T) { 11 | require := require.New(t) 12 | c, err := NewNonCompressor(Config{ 13 | TargetOutputSize: 100000, 14 | }) 15 | require.NoError(err) 16 | 17 | const dlen = 100 18 | data := make([]byte, dlen) 19 | rng := rand.New(rand.NewSource(42)) 20 | rng.Read(data) 21 | 22 | n, err := c.Write(data) 23 | require.NoError(err) 24 | require.Equal(n, dlen) 25 | l0 := c.Len() 26 | require.Less(l0, dlen) 27 | require.Equal(7, l0) 28 | c.Flush() 29 | l1 := c.Len() 30 | require.Greater(l1, l0) 31 | require.Greater(l1, dlen) 32 | 33 | n, err = c.Write(data) 34 | require.NoError(err) 35 | require.Equal(n, dlen) 36 | l2 := c.Len() 37 | require.Equal(l1+5, l2) 38 | } 39 | -------------------------------------------------------------------------------- /op-bootnode/.gitignore: -------------------------------------------------------------------------------- 1 | bin 2 | -------------------------------------------------------------------------------- /op-bootnode/Makefile: -------------------------------------------------------------------------------- 1 | GITCOMMIT ?= $(shell git rev-parse HEAD) 2 | GITDATE ?= $(shell git show -s --format='%ct') 3 | VERSION ?= v0.0.0 4 | 5 | LDFLAGSSTRING +=-X main.GitCommit=$(GITCOMMIT) 6 | LDFLAGSSTRING +=-X main.GitDate=$(GITDATE) 7 | LDFLAGSSTRING +=-X main.Version=$(VERSION) 8 | LDFLAGS := -ldflags "$(LDFLAGSSTRING)" 9 | 10 | op-bootnode: 11 | env GO111MODULE=on GOOS=$(TARGETOS) GOARCH=$(TARGETARCH) go build -v $(LDFLAGS) -o ./bin/op-bootnode ./cmd 12 | 13 | clean: 14 | rm -f bin/op-bootnode 15 | 16 | test: 17 | go test -v ./... 18 | 19 | .PHONY: \ 20 | op-bootnode \ 21 | clean \ 22 | test 23 | -------------------------------------------------------------------------------- /op-bootnode/cmd/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "os" 5 | 6 | "github.com/ethereum/go-ethereum/log" 7 | "github.com/urfave/cli/v2" 8 | 9 | "github.com/ethereum-optimism/optimism/op-bootnode/bootnode" 10 | "github.com/ethereum-optimism/optimism/op-bootnode/flags" 11 | oplog "github.com/ethereum-optimism/optimism/op-service/log" 12 | ) 13 | 14 | func main() { 15 | oplog.SetupDefaults() 16 | 17 | app := cli.NewApp() 18 | app.Flags = flags.Flags 19 | app.Name = "bootnode" 20 | app.Usage = "Rollup Bootnode" 21 | app.Description = "Broadcasts incoming P2P peers to each other, enabling peer bootstrapping." 22 | app.Action = bootnode.Main 23 | 24 | err := app.Run(os.Args) 25 | if err != nil { 26 | log.Crit("Application failed", "message", err) 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /op-bootnode/flags/flags.go: -------------------------------------------------------------------------------- 1 | package flags 2 | 3 | import ( 4 | "github.com/urfave/cli/v2" 5 | 6 | "github.com/ethereum-optimism/optimism/op-node/flags" 7 | opflags "github.com/ethereum-optimism/optimism/op-service/flags" 8 | oplog "github.com/ethereum-optimism/optimism/op-service/log" 9 | opmetrics "github.com/ethereum-optimism/optimism/op-service/metrics" 10 | oprpc "github.com/ethereum-optimism/optimism/op-service/rpc" 11 | ) 12 | 13 | const envVarPrefix = "OP_BOOTNODE" 14 | 15 | var Flags = []cli.Flag{ 16 | opflags.CLINetworkFlag(envVarPrefix, ""), 17 | opflags.CLIRollupConfigFlag(envVarPrefix, ""), 18 | } 19 | 20 | func init() { 21 | Flags = append(Flags, flags.P2PFlags(envVarPrefix)...) 22 | Flags = append(Flags, opmetrics.CLIFlags(envVarPrefix)...) 23 | Flags = append(Flags, oplog.CLIFlags(envVarPrefix)...) 24 | Flags = append(Flags, oprpc.CLIFlags(envVarPrefix)...) 25 | } 26 | -------------------------------------------------------------------------------- /op-chain-ops/.gitignore: -------------------------------------------------------------------------------- 1 | bin 2 | -------------------------------------------------------------------------------- /op-chain-ops/Makefile: -------------------------------------------------------------------------------- 1 | # Use the old Apple linker to workaround broken xcode - https://github.com/golang/go/issues/65169 2 | ifeq ($(shell uname),Darwin) 3 | FUZZLDFLAGS := -ldflags=-extldflags=-Wl,-ld_classic 4 | endif 5 | 6 | ecotone-scalar: 7 | go build -o ./bin/ecotone-scalar ./cmd/ecotone-scalar/main.go 8 | 9 | receipt-reference-builder: 10 | go build -o ./bin/receipt-reference-builder ./cmd/receipt-reference-builder/*.go 11 | 12 | test: 13 | go test ./... 14 | 15 | fuzz: 16 | go test $(FUZZLDFLAGS) -run NOTAREALTEST -v -fuzztime 10s -fuzz=FuzzEncodeDecodeWithdrawal ./crossdomain 17 | go test $(FUZZLDFLAGS) -run NOTAREALTEST -v -fuzztime 10s -fuzz=FuzzEncodeDecodeLegacyWithdrawal ./crossdomain 18 | go test $(FUZZLDFLAGS) -run NOTAREALTEST -v -fuzztime 10s -fuzz=FuzzAliasing ./crossdomain 19 | go test $(FUZZLDFLAGS) -run NOTAREALTEST -v -fuzztime 10s -fuzz=FuzzVersionedNonce ./crossdomain 20 | 21 | .PHONY: test fuzz 22 | -------------------------------------------------------------------------------- /op-chain-ops/cmd/receipt-reference-builder/print.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "github.com/ethereum/go-ethereum/log" 5 | "github.com/urfave/cli/v2" 6 | ) 7 | 8 | var printCommand = &cli.Command{ 9 | Name: "print", 10 | Usage: "read an aggregate file and print it to stdout", 11 | Flags: []cli.Flag{FilesFlag, InputFormatFlag}, 12 | Action: print, 13 | } 14 | 15 | func print(ctx *cli.Context) error { 16 | log := log.New() 17 | files := ctx.StringSlice("files") 18 | r := formats[ctx.String("input-format")] 19 | for _, f := range files { 20 | a, err := r.readAggregate(f) 21 | if err != nil { 22 | log.Error("failed to read aggregate", "file", f, "err", err) 23 | return err 24 | } 25 | log.Info("aggregate", "aggregate", a) 26 | } 27 | return nil 28 | } 29 | -------------------------------------------------------------------------------- /op-chain-ops/contracts/common.go: -------------------------------------------------------------------------------- 1 | package contracts 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/ethereum/go-ethereum/common" 7 | "github.com/urfave/cli/v2" 8 | ) 9 | 10 | // parseAddress will parse a [common.Address] from a [cli.Context] and return 11 | // an error if the configured address is not correct. 12 | func parseAddress(ctx *cli.Context, name string) (common.Address, error) { 13 | value := ctx.String(name) 14 | if value == "" { 15 | return common.Address{}, nil 16 | } 17 | if !common.IsHexAddress(value) { 18 | return common.Address{}, fmt.Errorf("invalid address: %s", value) 19 | } 20 | return common.HexToAddress(value), nil 21 | } 22 | -------------------------------------------------------------------------------- /op-chain-ops/crossdomain/doc.go: -------------------------------------------------------------------------------- 1 | // Package crossdomain provides libraries useful for 2 | // managing L1 <> L2 cross domain communication. This 3 | // library is very low level and most users will not 4 | // these abstractions directly. They were used for 5 | // the migration to Bedrock from the legacy Optimism 6 | // system. The bindings subpackage will never need 7 | // to be updated as they are only used for the migration 8 | // tooling. 9 | package crossdomain 10 | -------------------------------------------------------------------------------- /op-chain-ops/crossdomain/testdata/README.md: -------------------------------------------------------------------------------- 1 | # crossdomain/testdata 2 | 3 | Real world test data is used to generate test vectors for the withdrawal 4 | hashing. The `trace.sh` script will generate artifacts used as part of the 5 | tests. It accepts a single argument, being the transaction hash to fetch 6 | artifacts for. It will fetch a receipt, a call trace and a state diff. 7 | The tests require that a file named after the transaction hash exists 8 | in each of the directories `call-traces`, `receipts` and `state-diffs`. 9 | The `trace.sh` script will ensure that the files are created correctly. 10 | -------------------------------------------------------------------------------- /op-chain-ops/crossdomain/testdata/trace.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | HASH=$1 4 | 5 | if [[ -z $HASH ]]; then 6 | exit 1 7 | fi 8 | 9 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" > /dev/null && pwd )" 10 | 11 | TRACES=$DIR/call-traces 12 | RECEIPTS=$DIR/receipts 13 | DIFFS=$DIR/state-diffs 14 | 15 | mkdir -p "$TRACES" 16 | mkdir -p "$RECEIPTS" 17 | mkdir -p "$DIFFS" 18 | 19 | cast rpc \ 20 | debug_traceTransaction \ 21 | "$HASH" \ 22 | '{"tracer": "callTracer"}' | jq > "$TRACES"/"$HASH".json 23 | 24 | cast receipt "$HASH" --json | jq > "$RECEIPTS"/"$HASH".json 25 | 26 | cast rpc \ 27 | debug_traceTransaction \ 28 | "$HASH" \ 29 | '{"tracer": "prestateTracer"}' | jq > "$DIFFS"/"$HASH".json 30 | 31 | -------------------------------------------------------------------------------- /op-chain-ops/crossdomain/types.go: -------------------------------------------------------------------------------- 1 | package crossdomain 2 | 3 | import ( 4 | "github.com/ethereum/go-ethereum/accounts/abi" 5 | "github.com/ethereum/go-ethereum/common" 6 | ) 7 | 8 | var ( 9 | // Standard ABI types 10 | Uint256Type, _ = abi.NewType("uint256", "", nil) 11 | BytesType, _ = abi.NewType("bytes", "", nil) 12 | AddressType, _ = abi.NewType("address", "", nil) 13 | Bytes32Type, _ = abi.NewType("bytes32", "", nil) 14 | ) 15 | 16 | // WithdrawalMessage represents a Withdrawal. The Withdrawal 17 | // and LegacyWithdrawal types must implement this interface. 18 | type WithdrawalMessage interface { 19 | Encode() ([]byte, error) 20 | Decode([]byte) error 21 | Hash() (common.Hash, error) 22 | StorageSlot() (common.Hash, error) 23 | } 24 | -------------------------------------------------------------------------------- /op-challenger/.gitignore: -------------------------------------------------------------------------------- 1 | bin 2 | .fault-game-address 3 | -------------------------------------------------------------------------------- /op-challenger/challenger.go: -------------------------------------------------------------------------------- 1 | package op_challenger 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/ethereum-optimism/optimism/op-challenger/metrics" 7 | "github.com/ethereum/go-ethereum/log" 8 | 9 | "github.com/ethereum-optimism/optimism/op-challenger/config" 10 | "github.com/ethereum-optimism/optimism/op-challenger/game" 11 | "github.com/ethereum-optimism/optimism/op-service/cliapp" 12 | ) 13 | 14 | // Main is the programmatic entry-point for running op-challenger with a given configuration. 15 | func Main(ctx context.Context, logger log.Logger, cfg *config.Config, m metrics.Metricer) (cliapp.Lifecycle, error) { 16 | if err := cfg.Check(); err != nil { 17 | return nil, err 18 | } 19 | return game.NewService(ctx, logger, cfg, m) 20 | } 21 | -------------------------------------------------------------------------------- /op-challenger/challenger_test.go: -------------------------------------------------------------------------------- 1 | package op_challenger 2 | 3 | import ( 4 | "context" 5 | "testing" 6 | 7 | "github.com/ethereum-optimism/optimism/op-challenger/config" 8 | "github.com/ethereum-optimism/optimism/op-challenger/metrics" 9 | "github.com/ethereum-optimism/optimism/op-service/testlog" 10 | "github.com/ethereum/go-ethereum/log" 11 | "github.com/stretchr/testify/require" 12 | ) 13 | 14 | func TestMainShouldReturnErrorWhenConfigInvalid(t *testing.T) { 15 | cfg := &config.Config{} 16 | app, err := Main(context.Background(), testlog.Logger(t, log.LevelInfo), cfg, metrics.NoopMetrics) 17 | require.ErrorIs(t, err, cfg.Check()) 18 | require.Nil(t, app) 19 | } 20 | -------------------------------------------------------------------------------- /op-challenger/game/fault/contracts/metrics/noop.go: -------------------------------------------------------------------------------- 1 | package metrics 2 | 3 | type NoopMetrics struct { 4 | } 5 | 6 | func (n *NoopMetrics) StartContractRequest(_ string) EndTimer { 7 | return func() {} 8 | } 9 | 10 | var _ ContractMetricer = (*NoopMetrics)(nil) 11 | 12 | var NoopContractMetrics = &NoopMetrics{} 13 | -------------------------------------------------------------------------------- /op-challenger/game/fault/trace/alphabet/prestate_test.go: -------------------------------------------------------------------------------- 1 | package alphabet 2 | 3 | import ( 4 | "context" 5 | "testing" 6 | 7 | "github.com/ethereum/go-ethereum/common" 8 | "github.com/stretchr/testify/require" 9 | ) 10 | 11 | func TestAlphabetPrestateProvider_AbsolutePreStateCommitment_Succeeds(t *testing.T) { 12 | provider := alphabetPrestateProvider{} 13 | hash, err := provider.AbsolutePreStateCommitment(context.Background()) 14 | require.NoError(t, err) 15 | expected := common.HexToHash("0x03c7ae758795765c6664a5d39bf63841c71ff191e9189522bad8ebff5d4eca98") 16 | require.Equal(t, expected, hash) 17 | } 18 | -------------------------------------------------------------------------------- /op-challenger/game/fault/trace/asterisc/test_data/invalid.json: -------------------------------------------------------------------------------- 1 | { 2 | "preimageKey": 1 3 | } 4 | -------------------------------------------------------------------------------- /op-challenger/game/fault/trace/asterisc/test_data/proofs/1.json: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | -------------------------------------------------------------------------------- /op-challenger/game/fault/trace/asterisc/test_data/proofs/2.json: -------------------------------------------------------------------------------- 1 | { 2 | "foo": 0, 3 | "bar": "0x71f9eb93ff904e5c03c3425228ef75766db0c906ad239df9a7a7f0d9c6a89705", 4 | "step": 0, 5 | "pre": "0x03abd5c535c08bae7c4ad48fcae39b65f9c25239f65b4376c58638d262c97381", 6 | "post": "0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", 7 | "state-data": "0xcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", 8 | "proof-data": "0xdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd" 9 | } 10 | -------------------------------------------------------------------------------- /op-challenger/game/fault/trace/asterisc/test_data/state.json: -------------------------------------------------------------------------------- 1 | { 2 | "pc": 0, 3 | "exited": false, 4 | "step": 0, 5 | "witness": "wOSi8Cm62dDmKt1OGwxlLrSznk6zE4ghp7evP1rfrXYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIGCAAAAAAAAAAAAAAAAB/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=", 6 | "stateHash": "0x03216fdc4a7bfd4c7160fa946d1bfe451d13ff32da496609fe18355282b910c6" 7 | } 8 | -------------------------------------------------------------------------------- /op-challenger/game/fault/trace/cannon/state.go: -------------------------------------------------------------------------------- 1 | package cannon 2 | 3 | import ( 4 | "encoding/json" 5 | "fmt" 6 | "io" 7 | 8 | "github.com/ethereum-optimism/optimism/cannon/mipsevm" 9 | "github.com/ethereum-optimism/optimism/op-service/ioutil" 10 | ) 11 | 12 | func parseState(path string) (*mipsevm.State, error) { 13 | file, err := ioutil.OpenDecompressed(path) 14 | if err != nil { 15 | return nil, fmt.Errorf("cannot open state file (%v): %w", path, err) 16 | } 17 | return parseStateFromReader(file) 18 | } 19 | 20 | func parseStateFromReader(in io.ReadCloser) (*mipsevm.State, error) { 21 | defer in.Close() 22 | var state mipsevm.State 23 | if err := json.NewDecoder(in).Decode(&state); err != nil { 24 | return nil, fmt.Errorf("invalid mipsevm state: %w", err) 25 | } 26 | return &state, nil 27 | } 28 | -------------------------------------------------------------------------------- /op-challenger/game/fault/trace/cannon/test_data/invalid.json: -------------------------------------------------------------------------------- 1 | { 2 | "preimageKey": 1 3 | } 4 | -------------------------------------------------------------------------------- /op-challenger/game/fault/trace/cannon/test_data/proofs/1.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /op-challenger/game/fault/trace/cannon/test_data/state.json: -------------------------------------------------------------------------------- 1 | { 2 | "memory": [], 3 | "preimageKey": "0xcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", 4 | "preimageOffset": 0, 5 | "pc": 0, 6 | "nextPC": 1, 7 | "lo": 0, 8 | "hi": 0, 9 | "heap": 0, 10 | "exit": 0, 11 | "exited": false, 12 | "step": 0, 13 | "registers": [] 14 | } 15 | -------------------------------------------------------------------------------- /op-challenger/game/fault/trace/prestates/single.go: -------------------------------------------------------------------------------- 1 | package prestates 2 | 3 | import "github.com/ethereum/go-ethereum/common" 4 | 5 | type SinglePrestateSource struct { 6 | path string 7 | } 8 | 9 | func NewSinglePrestateSource(path string) *SinglePrestateSource { 10 | return &SinglePrestateSource{path: path} 11 | } 12 | 13 | func (s *SinglePrestateSource) PrestatePath(_ common.Hash) (string, error) { 14 | return s.path, nil 15 | } 16 | -------------------------------------------------------------------------------- /op-challenger/game/fault/types/actions.go: -------------------------------------------------------------------------------- 1 | package types 2 | 3 | import "github.com/ethereum/go-ethereum/common" 4 | 5 | type ActionType string 6 | 7 | func (a ActionType) String() string { 8 | return string(a) 9 | } 10 | 11 | const ( 12 | ActionTypeMove ActionType = "move" 13 | ActionTypeStep ActionType = "step" 14 | ActionTypeChallengeL2BlockNumber ActionType = "challenge-l2-block-number" 15 | ) 16 | 17 | type Action struct { 18 | Type ActionType 19 | 20 | // Moves and Steps 21 | ParentClaim Claim 22 | IsAttack bool 23 | 24 | // Moves 25 | Value common.Hash 26 | 27 | // Steps 28 | PreState []byte 29 | ProofData []byte 30 | OracleData *PreimageOracleData 31 | 32 | // Challenge L2 Block Number 33 | InvalidL2BlockNumberChallenge *InvalidL2BlockNumberChallenge 34 | } 35 | -------------------------------------------------------------------------------- /op-challenger/game/registry/oracles.go: -------------------------------------------------------------------------------- 1 | package registry 2 | 3 | import ( 4 | "sync" 5 | 6 | keccakTypes "github.com/ethereum-optimism/optimism/op-challenger/game/keccak/types" 7 | "github.com/ethereum/go-ethereum/common" 8 | "golang.org/x/exp/maps" 9 | ) 10 | 11 | type OracleRegistry struct { 12 | l sync.Mutex 13 | oracles map[common.Address]keccakTypes.LargePreimageOracle 14 | } 15 | 16 | func NewOracleRegistry() *OracleRegistry { 17 | return &OracleRegistry{ 18 | oracles: make(map[common.Address]keccakTypes.LargePreimageOracle), 19 | } 20 | } 21 | 22 | func (r *OracleRegistry) RegisterOracle(oracle keccakTypes.LargePreimageOracle) { 23 | r.l.Lock() 24 | defer r.l.Unlock() 25 | r.oracles[oracle.Addr()] = oracle 26 | } 27 | 28 | func (r *OracleRegistry) Oracles() []keccakTypes.LargePreimageOracle { 29 | r.l.Lock() 30 | defer r.l.Unlock() 31 | return maps.Values(r.oracles) 32 | } 33 | -------------------------------------------------------------------------------- /op-challenger/game/scheduler/test/stub_player.go: -------------------------------------------------------------------------------- 1 | package test 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/ethereum-optimism/optimism/op-challenger/game/types" 7 | "github.com/ethereum/go-ethereum/common" 8 | ) 9 | 10 | type StubGamePlayer struct { 11 | Addr common.Address 12 | ProgressCount int 13 | StatusValue types.GameStatus 14 | Dir string 15 | PrestateErr error 16 | } 17 | 18 | func (g *StubGamePlayer) ValidatePrestate(_ context.Context) error { 19 | return g.PrestateErr 20 | } 21 | 22 | func (g *StubGamePlayer) ProgressGame(_ context.Context) types.GameStatus { 23 | g.ProgressCount++ 24 | return g.StatusValue 25 | } 26 | 27 | func (g *StubGamePlayer) Status() types.GameStatus { 28 | return g.StatusValue 29 | } 30 | -------------------------------------------------------------------------------- /op-challenger/game/scheduler/types.go: -------------------------------------------------------------------------------- 1 | package scheduler 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/ethereum/go-ethereum/common" 7 | 8 | "github.com/ethereum-optimism/optimism/op-challenger/game/types" 9 | ) 10 | 11 | type GamePlayer interface { 12 | ValidatePrestate(ctx context.Context) error 13 | ProgressGame(ctx context.Context) types.GameStatus 14 | Status() types.GameStatus 15 | } 16 | 17 | type DiskManager interface { 18 | DirForGame(addr common.Address) string 19 | RemoveAllExcept(addrs []common.Address) error 20 | } 21 | 22 | type job struct { 23 | block uint64 24 | addr common.Address 25 | player GamePlayer 26 | status types.GameStatus 27 | } 28 | 29 | func newJob(block uint64, addr common.Address, player GamePlayer, status types.GameStatus) *job { 30 | return &job{ 31 | block: block, 32 | addr: addr, 33 | player: player, 34 | status: status, 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /op-challenger/game/scheduler/worker.go: -------------------------------------------------------------------------------- 1 | package scheduler 2 | 3 | import ( 4 | "context" 5 | "sync" 6 | ) 7 | 8 | // progressGames accepts jobs from in channel, calls ProgressGame on the job.player and returns the job 9 | // with updated job.resolved via the out channel. 10 | // The loop exits when the ctx is done. wg.Done() is called when the function returns. 11 | func progressGames(ctx context.Context, in <-chan job, out chan<- job, wg *sync.WaitGroup, threadActive, threadIdle func()) { 12 | defer wg.Done() 13 | for { 14 | select { 15 | case <-ctx.Done(): 16 | return 17 | case j := <-in: 18 | threadActive() 19 | j.status = j.player.ProgressGame(ctx) 20 | out <- j 21 | threadIdle() 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /op-challenger/game/types/types_test.go: -------------------------------------------------------------------------------- 1 | package types 2 | 3 | import ( 4 | "fmt" 5 | "testing" 6 | 7 | "github.com/stretchr/testify/require" 8 | ) 9 | 10 | var validGameStatuses = []GameStatus{ 11 | GameStatusInProgress, 12 | GameStatusChallengerWon, 13 | GameStatusDefenderWon, 14 | } 15 | 16 | func TestGameStatusFromUint8(t *testing.T) { 17 | for _, status := range validGameStatuses { 18 | t.Run(fmt.Sprintf("Valid Game Status %v", status), func(t *testing.T) { 19 | parsed, err := GameStatusFromUint8(uint8(status)) 20 | require.NoError(t, err) 21 | require.Equal(t, status, parsed) 22 | }) 23 | } 24 | 25 | t.Run("Invalid", func(t *testing.T) { 26 | status, err := GameStatusFromUint8(3) 27 | require.Error(t, err) 28 | require.Equal(t, GameStatus(3), status) 29 | }) 30 | } 31 | -------------------------------------------------------------------------------- /op-challenger/version/version.go: -------------------------------------------------------------------------------- 1 | package version 2 | 3 | var ( 4 | Version = "v0.1.0" 5 | Meta = "dev" 6 | ) 7 | 8 | var SimpleWithMeta = func() string { 9 | v := Version 10 | if Meta != "" { 11 | v += "-" + Meta 12 | } 13 | return v 14 | }() 15 | -------------------------------------------------------------------------------- /op-conductor/.gitignore: -------------------------------------------------------------------------------- 1 | bin 2 | -------------------------------------------------------------------------------- /op-conductor/Makefile: -------------------------------------------------------------------------------- 1 | GITCOMMIT ?= $(shell git rev-parse HEAD) 2 | GITDATE ?= $(shell git show -s --format='%ct') 3 | VERSION ?= v0.0.0 4 | 5 | LDFLAGSSTRING +=-X main.GitCommit=$(GITCOMMIT) 6 | LDFLAGSSTRING +=-X main.GitDate=$(GITDATE) 7 | LDFLAGSSTRING +=-X main.Version=$(VERSION) 8 | LDFLAGS := -ldflags "$(LDFLAGSSTRING)" 9 | 10 | op-conductor: 11 | env GO111MODULE=on GOOS=$(TARGETOS) GOARCH=$(TARGETARCH) go build -v $(LDFLAGS) -o ./bin/op-conductor ./cmd 12 | 13 | clean: 14 | rm bin/op-conductor 15 | 16 | test: 17 | go test -v ./... 18 | 19 | generate-mocks: 20 | go generate ./... 21 | 22 | .PHONY: \ 23 | op-conductor \ 24 | clean \ 25 | test \ 26 | generate-mocks 27 | -------------------------------------------------------------------------------- /op-conductor/metrics/noop.go: -------------------------------------------------------------------------------- 1 | package metrics 2 | 3 | type NoopMetricsImpl struct{} 4 | 5 | var NoopMetrics Metricer = new(NoopMetricsImpl) 6 | 7 | func (*NoopMetricsImpl) RecordInfo(version string) {} 8 | func (*NoopMetricsImpl) RecordUp() {} 9 | func (*NoopMetricsImpl) RecordStateChange(leader bool, healthy bool, active bool) {} 10 | func (*NoopMetricsImpl) RecordLeaderTransfer(success bool) {} 11 | func (*NoopMetricsImpl) RecordStartSequencer(success bool) {} 12 | func (*NoopMetricsImpl) RecordStopSequencer(success bool) {} 13 | func (*NoopMetricsImpl) RecordHealthCheck(success bool, err error) {} 14 | func (*NoopMetricsImpl) RecordLoopExecutionTime(duration float64) {} 15 | -------------------------------------------------------------------------------- /op-conductor/run_test_100times.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | for i in {1..100}; do 6 | echo "=======================" 7 | echo "Running iteration $i" 8 | if ! gotestsum -- -run 'TestControlLoop' ./... --count=1 --timeout=5s -race; then 9 | echo "Test failed" 10 | exit 1 11 | fi 12 | done 13 | -------------------------------------------------------------------------------- /op-dispute-mon/.gitignore: -------------------------------------------------------------------------------- 1 | bin 2 | -------------------------------------------------------------------------------- /op-dispute-mon/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG OP_STACK_GO_BUILDER=us-docker.pkg.dev/oplabs-tools-artifacts/images/op-stack-go:latest 2 | FROM $OP_STACK_GO_BUILDER as builder 3 | # See "make golang-docker" and /ops/docker/op-stack-go 4 | 5 | FROM alpine:3.18 6 | 7 | COPY --from=builder /usr/local/bin/op-dispute-mon /usr/local/bin/op-dispute-mon 8 | 9 | CMD ["op-dispute-mon"] 10 | -------------------------------------------------------------------------------- /op-dispute-mon/Dockerfile.dockerignore: -------------------------------------------------------------------------------- 1 | # ignore everything but the dockerfile, the op-stack-go base image performs the build 2 | * 3 | -------------------------------------------------------------------------------- /op-dispute-mon/Makefile: -------------------------------------------------------------------------------- 1 | GITCOMMIT ?= $(shell git rev-parse HEAD) 2 | GITDATE ?= $(shell git show -s --format='%ct') 3 | VERSION ?= v0.0.0 4 | 5 | LDFLAGSSTRING +=-X main.GitCommit=$(GITCOMMIT) 6 | LDFLAGSSTRING +=-X main.GitDate=$(GITDATE) 7 | LDFLAGSSTRING +=-X github.com/ethereum-optimism/optimism/op-dispute-mon/version.Version=$(VERSION) 8 | LDFLAGSSTRING +=-X github.com/ethereum-optimism/optimism/op-dispute-mon/version.Meta=$(VERSION_META) 9 | LDFLAGS := -ldflags "$(LDFLAGSSTRING)" 10 | 11 | op-dispute-mon: 12 | env GO111MODULE=on GOOS=$(TARGETOS) GOARCH=$(TARGETARCH) go build -v $(LDFLAGS) -o ./bin/op-dispute-mon ./cmd 13 | .PHONY: op-dispute-mon 14 | 15 | clean: 16 | rm bin/op-dispute-mon 17 | .PHONY: clean 18 | 19 | test: 20 | go test -v ./... 21 | .PHONY: test 22 | -------------------------------------------------------------------------------- /op-dispute-mon/README.md: -------------------------------------------------------------------------------- 1 | # op-dispute-mon 2 | 3 | The `op-dispute-mon` is an off-chain service to monitor dispute games. 4 | 5 | ## Quickstart 6 | 7 | Clone this repo. Then run: 8 | 9 | ```shell 10 | make op-dispute-mon 11 | ``` 12 | 13 | This will build the `op-dispute-mon` binary which can be run with 14 | `./op-dispute-mon/bin/op-dispute-mon`. 15 | 16 | ## Usage 17 | 18 | `op-dispute-mon` is configurable via command line flags and environment variables. The help menu 19 | shows the available config options and can be accessed by running `./op-dispute-mon --help`. 20 | 21 | -------------------------------------------------------------------------------- /op-dispute-mon/mon/extract/recipient_enricher_test.go: -------------------------------------------------------------------------------- 1 | package extract 2 | 3 | import ( 4 | "context" 5 | "testing" 6 | 7 | "github.com/ethereum-optimism/optimism/op-service/sources/batching/rpcblock" 8 | "github.com/ethereum/go-ethereum/common" 9 | "github.com/stretchr/testify/require" 10 | ) 11 | 12 | func TestRecipientEnricher(t *testing.T) { 13 | game, recipients := makeTestGame() 14 | game.Recipients = make(map[common.Address]bool) 15 | game.BlockNumberChallenger = common.Address{0xff, 0xee, 0xdd} 16 | enricher := NewRecipientEnricher() 17 | caller := &mockGameCaller{} 18 | ctx := context.Background() 19 | err := enricher.Enrich(ctx, rpcblock.Latest, caller, game) 20 | require.NoError(t, err) 21 | for _, recipient := range recipients { 22 | require.Contains(t, game.Recipients, recipient) 23 | } 24 | require.Contains(t, game.Recipients, game.BlockNumberChallenger) 25 | } 26 | -------------------------------------------------------------------------------- /op-dispute-mon/mon/types/honest_actors.go: -------------------------------------------------------------------------------- 1 | package types 2 | 3 | import "github.com/ethereum/go-ethereum/common" 4 | 5 | type HonestActors map[common.Address]bool // Map for efficient lookup 6 | 7 | func NewHonestActors(honestActors []common.Address) HonestActors { 8 | actors := make(map[common.Address]bool) 9 | for _, actor := range honestActors { 10 | actors[actor] = true 11 | } 12 | return actors 13 | } 14 | 15 | func (h HonestActors) Contains(addr common.Address) bool { 16 | return h[addr] 17 | } 18 | -------------------------------------------------------------------------------- /op-dispute-mon/monitor.go: -------------------------------------------------------------------------------- 1 | package monitor 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/ethereum/go-ethereum/log" 7 | 8 | "github.com/ethereum-optimism/optimism/op-dispute-mon/config" 9 | "github.com/ethereum-optimism/optimism/op-dispute-mon/mon" 10 | "github.com/ethereum-optimism/optimism/op-service/cliapp" 11 | ) 12 | 13 | func Main(ctx context.Context, logger log.Logger, cfg *config.Config) (cliapp.Lifecycle, error) { 14 | if err := cfg.Check(); err != nil { 15 | return nil, err 16 | } 17 | return mon.NewService(ctx, logger, cfg) 18 | } 19 | -------------------------------------------------------------------------------- /op-dispute-mon/monitor_test.go: -------------------------------------------------------------------------------- 1 | package monitor 2 | 3 | import ( 4 | "context" 5 | "testing" 6 | 7 | "github.com/ethereum-optimism/optimism/op-dispute-mon/config" 8 | "github.com/ethereum-optimism/optimism/op-service/testlog" 9 | "github.com/ethereum/go-ethereum/log" 10 | "github.com/stretchr/testify/require" 11 | ) 12 | 13 | func TestMainShouldReturnErrorWhenConfigInvalid(t *testing.T) { 14 | cfg := &config.Config{} 15 | app, err := Main(context.Background(), testlog.Logger(t, log.LvlInfo), cfg) 16 | require.ErrorIs(t, err, cfg.Check()) 17 | require.Nil(t, app) 18 | } 19 | -------------------------------------------------------------------------------- /op-dispute-mon/version/version.go: -------------------------------------------------------------------------------- 1 | package version 2 | 3 | var ( 4 | Version = "v0.1.0" 5 | Meta = "dev" 6 | ) 7 | 8 | var SimpleWithMeta = func() string { 9 | v := Version 10 | if Meta != "" { 11 | v += "-" + Meta 12 | } 13 | return v 14 | }() 15 | -------------------------------------------------------------------------------- /op-e2e/.gitignore: -------------------------------------------------------------------------------- 1 | external_*/shim 2 | -------------------------------------------------------------------------------- /op-e2e/build_helper.go: -------------------------------------------------------------------------------- 1 | package op_e2e 2 | 3 | import ( 4 | "context" 5 | "os/exec" 6 | "strings" 7 | "testing" 8 | "time" 9 | 10 | "github.com/stretchr/testify/require" 11 | ) 12 | 13 | // BuildOpProgramClient builds the `op-program` client executable and returns the path to the resulting executable 14 | func BuildOpProgramClient(t *testing.T) string { 15 | t.Log("Building op-program-client") 16 | ctx, cancel := context.WithTimeout(context.Background(), 2*time.Minute) 17 | defer cancel() 18 | cmd := exec.CommandContext(ctx, "make", "op-program-client") 19 | cmd.Dir = "../op-program" 20 | var out strings.Builder 21 | cmd.Stdout = &out 22 | cmd.Stderr = &out 23 | require.NoErrorf(t, cmd.Run(), "Failed to build op-program-client: %v", &out) 24 | t.Log("Built op-program-client successfully") 25 | return "../op-program/bin/op-program-client" 26 | } 27 | -------------------------------------------------------------------------------- /op-e2e/e2eutils/addresses_test.go: -------------------------------------------------------------------------------- 1 | package e2eutils 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/stretchr/testify/require" 7 | ) 8 | 9 | func TestCollectAddresses(t *testing.T) { 10 | tp := &TestParams{ 11 | MaxSequencerDrift: 40, 12 | SequencerWindowSize: 120, 13 | ChannelTimeout: 120, 14 | L1BlockTime: 15, 15 | } 16 | dp := MakeDeployParams(t, tp) 17 | alloc := &AllocParams{PrefundTestUsers: true} 18 | sd := Setup(t, dp, alloc) 19 | addrs := CollectAddresses(sd, dp) 20 | require.NotEmpty(t, addrs) 21 | require.Contains(t, addrs, dp.Addresses.Batcher) 22 | } 23 | -------------------------------------------------------------------------------- /op-e2e/e2eutils/challenger/metrics.go: -------------------------------------------------------------------------------- 1 | package challenger 2 | 3 | import ( 4 | "sync/atomic" 5 | 6 | "github.com/ethereum-optimism/optimism/op-challenger/metrics" 7 | ) 8 | 9 | type CapturingMetrics struct { 10 | metrics.NoopMetricsImpl 11 | 12 | HighestActedL1Block atomic.Uint64 13 | } 14 | 15 | func NewCapturingMetrics() *CapturingMetrics { 16 | return &CapturingMetrics{} 17 | } 18 | 19 | var _ metrics.Metricer = (*CapturingMetrics)(nil) 20 | 21 | func (c *CapturingMetrics) RecordActedL1Block(block uint64) { 22 | c.HighestActedL1Block.Store(block) 23 | } 24 | -------------------------------------------------------------------------------- /op-e2e/external_geth/.gitignore: -------------------------------------------------------------------------------- 1 | op-geth 2 | -------------------------------------------------------------------------------- /op-e2e/external_geth/Makefile: -------------------------------------------------------------------------------- 1 | default: shim op-geth 2 | 3 | op-geth: 4 | go build -o op-geth "github.com/ethereum/go-ethereum/cmd/geth" 5 | .PHONY: op-geth 6 | 7 | shim: main.go 8 | go build -o shim . 9 | -------------------------------------------------------------------------------- /op-e2e/external_geth/test_parms.json: -------------------------------------------------------------------------------- 1 | { 2 | "skip_tests":{ 3 | "TestPendingGasLimit":"This test requires directly modifying go structures and cannot be implemented with flags" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /op-e2e/external_geth/tools.go: -------------------------------------------------------------------------------- 1 | //go:build tools 2 | 3 | package main 4 | 5 | import _ "github.com/ethereum/go-ethereum/cmd/geth" 6 | -------------------------------------------------------------------------------- /op-heartbeat/.gitignore: -------------------------------------------------------------------------------- 1 | bin 2 | -------------------------------------------------------------------------------- /op-heartbeat/Makefile: -------------------------------------------------------------------------------- 1 | GITCOMMIT ?= $(shell git rev-parse HEAD) 2 | GITDATE ?= $(shell git show -s --format='%ct') 3 | VERSION ?= v0.0.0 4 | 5 | LDFLAGSSTRING +=-X main.GitCommit=$(GITCOMMIT) 6 | LDFLAGSSTRING +=-X main.GitDate=$(GITDATE) 7 | LDFLAGSSTRING +=-X main.Version=$(VERSION) 8 | LDFLAGS := -ldflags "$(LDFLAGSSTRING)" 9 | 10 | op-heartbeat: 11 | env GO111MODULE=on go build -v $(LDFLAGS) -o ./bin/op-heartbeat ./cmd 12 | 13 | clean: 14 | rm bin/op-heartbeat 15 | 16 | test: 17 | go test -v ./... 18 | 19 | .PHONY: \ 20 | clean \ 21 | op-heartbeat \ 22 | test 23 | -------------------------------------------------------------------------------- /op-heartbeat/whitelists.go: -------------------------------------------------------------------------------- 1 | package op_heartbeat 2 | 3 | var AllowedChainIDs = map[uint64]bool{ 4 | 420: true, 5 | 902: true, 6 | 10: true, 7 | } 8 | 9 | var AllowedVersions = map[string]bool{ 10 | "": true, 11 | "v0.1.0-beta.1": true, 12 | "v0.1.0-goerli-rehearsal.1": true, 13 | "v0.10.9": true, 14 | "v0.10.10": true, 15 | "v0.10.11": true, 16 | "v0.10.12": true, 17 | "v0.10.13": true, 18 | "v0.10.14": true, 19 | "v0.11.0": true, 20 | } 21 | -------------------------------------------------------------------------------- /op-node/.gitignore: -------------------------------------------------------------------------------- 1 | bin 2 | 3 | # config files 4 | genesis.json 5 | jwt.txt 6 | rollup.json 7 | -------------------------------------------------------------------------------- /op-node/cmd/batch_decoder/script.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | echo "$1" 3 | jq '.frames[] | {timestamp, inclusion_block}' "$1" 4 | jq '.batches[]|.Timestamp' "$1" 5 | -------------------------------------------------------------------------------- /op-node/node/comms.go: -------------------------------------------------------------------------------- 1 | package node 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/libp2p/go-libp2p/core/peer" 7 | 8 | "github.com/ethereum-optimism/optimism/op-service/eth" 9 | ) 10 | 11 | // Tracer configures the OpNode to share events 12 | type Tracer interface { 13 | OnNewL1Head(ctx context.Context, sig eth.L1BlockRef) 14 | OnUnsafeL2Payload(ctx context.Context, from peer.ID, payload *eth.ExecutionPayloadEnvelope) 15 | OnPublishL2Payload(ctx context.Context, payload *eth.ExecutionPayloadEnvelope) 16 | } 17 | 18 | type noOpTracer struct{} 19 | 20 | func (n noOpTracer) OnNewL1Head(ctx context.Context, sig eth.L1BlockRef) {} 21 | 22 | func (n noOpTracer) OnUnsafeL2Payload(ctx context.Context, from peer.ID, payload *eth.ExecutionPayloadEnvelope) { 23 | } 24 | 25 | func (n noOpTracer) OnPublishL2Payload(ctx context.Context, payload *eth.ExecutionPayloadEnvelope) {} 26 | 27 | var _ Tracer = (*noOpTracer)(nil) 28 | -------------------------------------------------------------------------------- /op-node/node/node_test.go: -------------------------------------------------------------------------------- 1 | package node 2 | 3 | import ( 4 | "testing" 5 | "time" 6 | 7 | "github.com/stretchr/testify/require" 8 | ) 9 | 10 | func TestUnixTimeStale(t *testing.T) { 11 | require.True(t, unixTimeStale(1_600_000_000, 1*time.Hour)) 12 | require.False(t, unixTimeStale(uint64(time.Now().Unix()), 1*time.Hour)) 13 | } 14 | -------------------------------------------------------------------------------- /op-node/node/safedb/disabled.go: -------------------------------------------------------------------------------- 1 | package safedb 2 | 3 | import ( 4 | "context" 5 | "errors" 6 | 7 | "github.com/ethereum-optimism/optimism/op-service/eth" 8 | ) 9 | 10 | type DisabledDB struct{} 11 | 12 | var ( 13 | Disabled = &DisabledDB{} 14 | ErrNotEnabled = errors.New("safe head database not enabled") 15 | ) 16 | 17 | func (d *DisabledDB) Enabled() bool { 18 | return false 19 | } 20 | 21 | func (d *DisabledDB) SafeHeadUpdated(_ eth.L2BlockRef, _ eth.BlockID) error { 22 | return nil 23 | } 24 | 25 | func (d *DisabledDB) SafeHeadAtL1(_ context.Context, _ uint64) (l1 eth.BlockID, safeHead eth.BlockID, err error) { 26 | err = ErrNotEnabled 27 | return 28 | } 29 | 30 | func (d *DisabledDB) SafeHeadReset(_ eth.L2BlockRef) error { 31 | return nil 32 | } 33 | 34 | func (d *DisabledDB) Close() error { 35 | return nil 36 | } 37 | -------------------------------------------------------------------------------- /op-node/p2p/store/gc.go: -------------------------------------------------------------------------------- 1 | package store 2 | 3 | import ( 4 | "context" 5 | "sync" 6 | "time" 7 | 8 | "github.com/ethereum-optimism/optimism/op-service/clock" 9 | "github.com/ethereum/go-ethereum/log" 10 | ) 11 | 12 | const ( 13 | gcPeriod = 2 * time.Hour 14 | ) 15 | 16 | type gcAction func() error 17 | 18 | func startGc(ctx context.Context, logger log.Logger, clock clock.Clock, bgTasks *sync.WaitGroup, action gcAction) { 19 | bgTasks.Add(1) 20 | go func() { 21 | defer bgTasks.Done() 22 | 23 | gcTimer := clock.NewTicker(gcPeriod) 24 | defer gcTimer.Stop() 25 | 26 | for { 27 | select { 28 | case <-gcTimer.Ch(): 29 | if err := action(); err != nil { 30 | logger.Warn("GC failed", "err", err) 31 | } 32 | 33 | case <-ctx.Done(): 34 | return 35 | } 36 | } 37 | }() 38 | } 39 | -------------------------------------------------------------------------------- /op-node/p2p/store/serialize.go: -------------------------------------------------------------------------------- 1 | package store 2 | 3 | import "encoding/json" 4 | 5 | func serializeScoresV0(scores scoreRecord) ([]byte, error) { 6 | // v0 just serializes to JSON. New/unrecognized values default to 0. 7 | return json.Marshal(&scores) 8 | } 9 | 10 | func deserializeScoresV0(data []byte) (scoreRecord, error) { 11 | var out scoreRecord 12 | err := json.Unmarshal(data, &out) 13 | return out, err 14 | } 15 | -------------------------------------------------------------------------------- /op-node/rollup/derive/doc.go: -------------------------------------------------------------------------------- 1 | // Package derive provides the data transformation functions that take L1 data 2 | // and turn it into L2 blocks and results. Certain L2 data is also able to 3 | // turned back into L1 data. 4 | // 5 | // The flow is data is as follows 6 | // receipts, batches -> eth.PayloadAttributes, by parsing the L1 data and deriving L2 inputs 7 | // l2.PayloadAttributes -> l2.ExecutionPayload, by running the EVM (using an Execution Engine) 8 | // L2 block -> Corresponding L1 block info, by parsing the first deposited transaction 9 | // 10 | // The Payload Attributes derivation stage is a pure function. 11 | // The Execution Payload derivation stage relies on the L2 execution engine to perform the state update. 12 | // The inversion step is a pure function. 13 | // 14 | // The steps should be kept separate to enable easier testing. 15 | package derive 16 | -------------------------------------------------------------------------------- /op-node/rollup/derive/pipeline_test.go: -------------------------------------------------------------------------------- 1 | package derive 2 | 3 | import "github.com/ethereum-optimism/optimism/op-service/testutils" 4 | 5 | var _ L1Fetcher = (*testutils.MockL1Source)(nil) 6 | 7 | var _ Metrics = (*testutils.TestDerivationMetrics)(nil) 8 | -------------------------------------------------------------------------------- /op-node/rollup/derive/singular_batch_test.go: -------------------------------------------------------------------------------- 1 | package derive 2 | 3 | import ( 4 | "math/big" 5 | "math/rand" 6 | "testing" 7 | 8 | "github.com/stretchr/testify/require" 9 | ) 10 | 11 | func TestSingularBatchForBatchInterface(t *testing.T) { 12 | rng := rand.New(rand.NewSource(0x543331)) 13 | chainID := big.NewInt(rng.Int63n(1000)) 14 | txCount := 1 + rng.Intn(8) 15 | 16 | singularBatch := RandomSingularBatch(rng, txCount, chainID) 17 | 18 | require.Equal(t, SingularBatchType, singularBatch.GetBatchType()) 19 | require.Equal(t, singularBatch.Timestamp, singularBatch.GetTimestamp()) 20 | require.Equal(t, singularBatch.EpochNum, singularBatch.GetEpochNum()) 21 | } 22 | -------------------------------------------------------------------------------- /op-node/rollup/engine/iface.go: -------------------------------------------------------------------------------- 1 | package engine 2 | 3 | import ( 4 | "github.com/ethereum-optimism/optimism/op-node/rollup/derive" 5 | "github.com/ethereum-optimism/optimism/op-service/eth" 6 | ) 7 | 8 | // EngineState provides a read-only interface of the forkchoice state properties of the L2 Engine. 9 | type EngineState interface { 10 | Finalized() eth.L2BlockRef 11 | UnsafeL2Head() eth.L2BlockRef 12 | SafeL2Head() eth.L2BlockRef 13 | } 14 | 15 | type Engine interface { 16 | ExecEngine 17 | derive.L2Source 18 | } 19 | 20 | type LocalEngineState interface { 21 | EngineState 22 | 23 | PendingSafeL2Head() eth.L2BlockRef 24 | BackupUnsafeL2Head() eth.L2BlockRef 25 | } 26 | 27 | type LocalEngineControl interface { 28 | LocalEngineState 29 | ResetEngineControl 30 | } 31 | 32 | var _ LocalEngineControl = (*EngineController)(nil) 33 | -------------------------------------------------------------------------------- /op-node/rollup/engine/params.go: -------------------------------------------------------------------------------- 1 | package engine 2 | 3 | import "time" 4 | 5 | const ( 6 | buildSealTimeout = time.Second * 10 7 | buildStartTimeout = time.Second * 10 8 | buildCancelTimeout = time.Second * 10 9 | payloadProcessTimeout = time.Second * 10 10 | ) 11 | -------------------------------------------------------------------------------- /op-node/rollup/engine/payload_invalid.go: -------------------------------------------------------------------------------- 1 | package engine 2 | 3 | import "github.com/ethereum-optimism/optimism/op-service/eth" 4 | 5 | type PayloadInvalidEvent struct { 6 | Envelope *eth.ExecutionPayloadEnvelope 7 | Err error 8 | } 9 | 10 | func (ev PayloadInvalidEvent) String() string { 11 | return "payload-invalid" 12 | } 13 | 14 | func (eq *EngDeriver) onPayloadInvalid(ev PayloadInvalidEvent) { 15 | eq.log.Warn("Payload was invalid", "block", ev.Envelope.ExecutionPayload.ID(), 16 | "err", ev.Err, "timestamp", uint64(ev.Envelope.ExecutionPayload.Timestamp)) 17 | } 18 | -------------------------------------------------------------------------------- /op-node/rollup/event/executor.go: -------------------------------------------------------------------------------- 1 | package event 2 | 3 | type Executable interface { 4 | RunEvent(ev AnnotatedEvent) 5 | } 6 | 7 | // ExecutableFunc implements the Executable interface as a function, 8 | // similar to how the std-lib http HandlerFunc implements a Handler. 9 | // This can be used for small in-place executables, test helpers, etc. 10 | type ExecutableFunc func(ev AnnotatedEvent) 11 | 12 | func (fn ExecutableFunc) RunEvent(ev AnnotatedEvent) { 13 | fn(ev) 14 | } 15 | 16 | type Executor interface { 17 | Add(d Executable, opts *ExecutorOpts) (leaveExecutor func()) 18 | Enqueue(ev AnnotatedEvent) error 19 | } 20 | -------------------------------------------------------------------------------- /op-node/rollup/event/limiter_test.go: -------------------------------------------------------------------------------- 1 | package event 2 | 3 | import ( 4 | "context" 5 | "testing" 6 | 7 | "github.com/stretchr/testify/require" 8 | "golang.org/x/time/rate" 9 | ) 10 | 11 | func TestLimiter(t *testing.T) { 12 | count := uint64(0) 13 | em := EmitterFunc(func(ev Event) { 14 | count += 1 15 | }) 16 | hitRateLimitAt := uint64(0) 17 | // Test that we are able to hit the specified rate limit, and no earlier 18 | lim := NewLimiter(context.Background(), em, rate.Limit(10), 10, func() { 19 | if hitRateLimitAt != 0 { 20 | return 21 | } 22 | hitRateLimitAt = count 23 | }) 24 | for i := 0; i < 30; i++ { 25 | lim.Emit(TestEvent{}) 26 | } 27 | require.LessOrEqual(t, uint64(10), hitRateLimitAt) 28 | } 29 | -------------------------------------------------------------------------------- /op-node/rollup/event/metrics.go: -------------------------------------------------------------------------------- 1 | package event 2 | 3 | import "time" 4 | 5 | type Metrics interface { 6 | RecordEmittedEvent(eventName string, emitter string) 7 | RecordProcessedEvent(eventName string, deriver string, duration time.Duration) 8 | RecordEventsRateLimited() 9 | } 10 | 11 | type NoopMetrics struct { 12 | } 13 | 14 | func (n NoopMetrics) RecordEmittedEvent(eventName string, emitter string) {} 15 | 16 | func (n NoopMetrics) RecordProcessedEvent(eventName string, deriver string, duration time.Duration) {} 17 | 18 | func (n NoopMetrics) RecordEventsRateLimited() {} 19 | 20 | var _ Metrics = NoopMetrics{} 21 | -------------------------------------------------------------------------------- /op-node/rollup/event/tracer.go: -------------------------------------------------------------------------------- 1 | package event 2 | 3 | import ( 4 | "time" 5 | ) 6 | 7 | type Tracer interface { 8 | OnDeriveStart(name string, ev AnnotatedEvent, derivContext uint64, startTime time.Time) 9 | OnDeriveEnd(name string, ev AnnotatedEvent, derivContext uint64, startTime time.Time, duration time.Duration, effect bool) 10 | OnRateLimited(name string, derivContext uint64) 11 | OnEmit(name string, ev AnnotatedEvent, derivContext uint64, emitTime time.Time) 12 | } 13 | -------------------------------------------------------------------------------- /op-node/rollup/event/util.go: -------------------------------------------------------------------------------- 1 | package event 2 | 3 | // Is as helper function is syntax-sugar to do an Event type check as a boolean function 4 | func Is[T Event](ev Event) bool { 5 | _, ok := ev.(T) 6 | return ok 7 | } 8 | 9 | // Any as helper function combines different event conditions into a single function 10 | func Any(fns ...func(ev Event) bool) func(ev Event) bool { 11 | return func(ev Event) bool { 12 | for _, fn := range fns { 13 | if fn(ev) { 14 | return true 15 | } 16 | } 17 | return false 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /op-node/rollup/sequencing/iface.go: -------------------------------------------------------------------------------- 1 | package sequencing 2 | 3 | import ( 4 | "context" 5 | "time" 6 | 7 | "github.com/ethereum/go-ethereum/common" 8 | 9 | "github.com/ethereum-optimism/optimism/op-node/rollup/event" 10 | ) 11 | 12 | type SequencerIface interface { 13 | event.Deriver 14 | // NextAction returns when the sequencer needs to do the next change, and iff it should do so. 15 | NextAction() (t time.Time, ok bool) 16 | Active() bool 17 | Init(ctx context.Context, active bool) error 18 | Start(ctx context.Context, head common.Hash) error 19 | Stop(ctx context.Context) (hash common.Hash, err error) 20 | SetMaxSafeLag(ctx context.Context, v uint64) error 21 | OverrideLeader(ctx context.Context) error 22 | Close() 23 | } 24 | -------------------------------------------------------------------------------- /op-node/version/version.go: -------------------------------------------------------------------------------- 1 | package version 2 | 3 | var ( 4 | Version = "v0.10.14" 5 | Meta = "dev" 6 | ) 7 | -------------------------------------------------------------------------------- /op-plasma/.gitignore: -------------------------------------------------------------------------------- 1 | bin 2 | -------------------------------------------------------------------------------- /op-plasma/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG OP_STACK_GO_BUILDER=us-docker.pkg.dev/oplabs-tools-artifacts/images/op-stack-go:latest 2 | FROM $OP_STACK_GO_BUILDER as builder 3 | # See "make golang-docker" and /ops/docker/op-stack-go 4 | 5 | FROM alpine:3.18 6 | 7 | COPY --from=builder /usr/local/bin/da-server /usr/local/bin/da-server 8 | 9 | CMD ["da-server"] 10 | -------------------------------------------------------------------------------- /op-plasma/Dockerfile.dockerignore: -------------------------------------------------------------------------------- 1 | * 2 | 3 | !/op-service 4 | !/op-plasma 5 | !/go.mod 6 | !/go.sum 7 | -------------------------------------------------------------------------------- /op-plasma/Makefile: -------------------------------------------------------------------------------- 1 | GITCOMMIT ?= $(shell git rev-parse HEAD) 2 | GITDATE ?= $(shell git show -s --format='%ct') 3 | VERSION ?= v0.0.0 4 | 5 | LDFLAGSSTRING +=-X main.GitCommit=$(GITCOMMIT) 6 | LDFLAGSSTRING +=-X main.GitDate=$(GITDATE) 7 | LDFLAGSSTRING +=-X main.Version=$(VERSION) 8 | LDFLAGS := -ldflags "$(LDFLAGSSTRING)" 9 | 10 | da-server: 11 | env GO111MODULE=on GOOS=$(TARGETOS) GOARCH=$(TARGETARCH) go build -v $(LDFLAGS) -o ./bin/da-server ./cmd/daserver 12 | 13 | clean: 14 | rm bin/da-server 15 | 16 | test: 17 | go test -v ./... 18 | 19 | .PHONY: \ 20 | op-batcher \ 21 | clean \ 22 | test 23 | -------------------------------------------------------------------------------- /op-plasma/cmd/daserver/file.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "context" 5 | "encoding/hex" 6 | "os" 7 | "path" 8 | 9 | plasma "github.com/ethereum-optimism/optimism/op-plasma" 10 | ) 11 | 12 | type FileStore struct { 13 | directory string 14 | } 15 | 16 | func NewFileStore(directory string) *FileStore { 17 | return &FileStore{ 18 | directory: directory, 19 | } 20 | } 21 | 22 | func (s *FileStore) Get(ctx context.Context, key []byte) ([]byte, error) { 23 | data, err := os.ReadFile(s.fileName(key)) 24 | if err != nil { 25 | if os.IsNotExist(err) { 26 | return nil, plasma.ErrNotFound 27 | } 28 | return nil, err 29 | } 30 | return data, nil 31 | } 32 | 33 | func (s *FileStore) Put(ctx context.Context, key []byte, value []byte) error { 34 | return os.WriteFile(s.fileName(key), value, 0600) 35 | } 36 | 37 | func (s *FileStore) fileName(key []byte) string { 38 | return path.Join(s.directory, hex.EncodeToString(key)) 39 | } 40 | -------------------------------------------------------------------------------- /op-plasma/params.go: -------------------------------------------------------------------------------- 1 | package plasma 2 | 3 | // MaxInputSize ensures the canonical chain cannot include input batches too large to 4 | // challenge in the Data Availability Challenge contract. Value in number of bytes. 5 | // This value can only be changed in a hard fork. 6 | const MaxInputSize = 130672 7 | 8 | // TxDataVersion1 is the version number for batcher transactions containing 9 | // plasma commitments. It should not collide with DerivationVersion which is still 10 | // used downstream when parsing the frames. 11 | const TxDataVersion1 = 1 12 | -------------------------------------------------------------------------------- /op-preimage/README.md: -------------------------------------------------------------------------------- 1 | # op-preimage 2 | 3 | `op-preimage` offers simple Go bindings to interact as client or server over the Pre-image Oracle ABI. 4 | 5 | Read more about the Preimage Oracle in the [specs](../specs/fault-proof.md). 6 | 7 | See [op-program](../op-program) and [Cannon client examples](../cannon/example) for client-side usage. 8 | See [Cannon `mipsevm`](../cannon/mipsevm) for server-side usage. 9 | -------------------------------------------------------------------------------- /op-preimage/hash.go: -------------------------------------------------------------------------------- 1 | package preimage 2 | 3 | import "golang.org/x/crypto/sha3" 4 | 5 | func Keccak256(v []byte) (out [32]byte) { 6 | s := sha3.NewLegacyKeccak256() 7 | s.Write(v) 8 | s.Sum(out[:0]) 9 | return 10 | } 11 | -------------------------------------------------------------------------------- /op-program/.gitignore: -------------------------------------------------------------------------------- 1 | bin 2 | -------------------------------------------------------------------------------- /op-program/client/cmd/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "os" 5 | 6 | "github.com/ethereum/go-ethereum/log" 7 | 8 | "github.com/ethereum-optimism/optimism/op-program/client" 9 | oplog "github.com/ethereum-optimism/optimism/op-service/log" 10 | ) 11 | 12 | func main() { 13 | // Default to a machine parsable but relatively human friendly log format. 14 | // Don't do anything fancy to detect if color output is supported. 15 | logger := oplog.NewLogger(os.Stdout, oplog.CLIConfig{ 16 | Level: log.LevelInfo, 17 | Format: oplog.FormatLogFmt, 18 | Color: false, 19 | }) 20 | oplog.SetGlobalLogHandler(logger.Handler()) 21 | client.Main(logger) 22 | } 23 | -------------------------------------------------------------------------------- /op-program/client/env.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | // 0,1,2 used for stdin,stdout,stderr 5 | HClientRFd = iota + 3 6 | HClientWFd 7 | PClientRFd 8 | PClientWFd 9 | MaxFd 10 | ) 11 | -------------------------------------------------------------------------------- /op-program/host/kvstore/disk_test.go: -------------------------------------------------------------------------------- 1 | package kvstore 2 | 3 | import ( 4 | "path/filepath" 5 | "testing" 6 | 7 | "github.com/ethereum/go-ethereum/crypto" 8 | "github.com/stretchr/testify/require" 9 | ) 10 | 11 | func TestDiskKV(t *testing.T) { 12 | tmp := t.TempDir() // automatically removed by testing cleanup 13 | kv := NewDiskKV(tmp) 14 | kvTest(t, kv) 15 | } 16 | 17 | func TestCreateMissingDirectory(t *testing.T) { 18 | tmp := t.TempDir() 19 | dir := filepath.Join(tmp, "data") 20 | kv := NewDiskKV(dir) 21 | val := []byte{1, 2, 3, 4} 22 | key := crypto.Keccak256Hash(val) 23 | require.NoError(t, kv.Put(key, val)) 24 | } 25 | -------------------------------------------------------------------------------- /op-program/host/kvstore/kv.go: -------------------------------------------------------------------------------- 1 | package kvstore 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/ethereum/go-ethereum/common" 7 | ) 8 | 9 | // ErrNotFound is returned when a pre-image cannot be found in the KV store. 10 | var ErrNotFound = errors.New("not found") 11 | 12 | // KV is a Key-Value store interface for pre-image data. 13 | type KV interface { 14 | // Put puts the pre-image value v in the key-value store with key k. 15 | // KV store implementations may return additional errors specific to the KV storage. 16 | Put(k common.Hash, v []byte) error 17 | 18 | // Get retrieves the pre-image with key k from the key-value store. 19 | // It returns ErrNotFound when the pre-image cannot be found. 20 | // KV store implementations may return additional errors specific to the KV storage. 21 | Get(k common.Hash) ([]byte, error) 22 | } 23 | -------------------------------------------------------------------------------- /op-program/host/kvstore/mem_test.go: -------------------------------------------------------------------------------- 1 | package kvstore 2 | 3 | import "testing" 4 | 5 | func TestMemKV(t *testing.T) { 6 | kv := NewMemKV() 7 | kvTest(t, kv) 8 | } 9 | -------------------------------------------------------------------------------- /op-program/host/kvstore/splitter.go: -------------------------------------------------------------------------------- 1 | package kvstore 2 | 3 | import ( 4 | preimage "github.com/ethereum-optimism/optimism/op-preimage" 5 | "github.com/ethereum/go-ethereum/common" 6 | ) 7 | 8 | type PreimageSource func(key common.Hash) ([]byte, error) 9 | 10 | type PreimageSourceSplitter struct { 11 | local PreimageSource 12 | global PreimageSource 13 | } 14 | 15 | func NewPreimageSourceSplitter(local PreimageSource, global PreimageSource) *PreimageSourceSplitter { 16 | return &PreimageSourceSplitter{ 17 | local: local, 18 | global: global, 19 | } 20 | } 21 | 22 | func (s *PreimageSourceSplitter) Get(key [32]byte) ([]byte, error) { 23 | if key[0] == byte(preimage.LocalKeyType) { 24 | return s.local(key) 25 | } 26 | return s.global(key) 27 | } 28 | -------------------------------------------------------------------------------- /op-program/host/version/version.go: -------------------------------------------------------------------------------- 1 | package version 2 | 3 | var ( 4 | Version = "v0.10.14" 5 | Meta = "dev" 6 | ) 7 | -------------------------------------------------------------------------------- /op-program/scripts/run-compat.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -euo pipefail 3 | 4 | SCRIPTS_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) 5 | COMPAT_DIR="${SCRIPTS_DIR}/../temp/compat" 6 | 7 | TESTNAME="${1?Must specify compat file to run}" 8 | BASEURL="${2:-https://github.com/ethereum-optimism/chain-test-data/releases/download/2024-03-14.3}" 9 | 10 | URL="${BASEURL}/${TESTNAME}.tar.bz" 11 | 12 | mkdir -p "${COMPAT_DIR}" 13 | curl --etag-save "${COMPAT_DIR}/${TESTNAME}-etag.txt" --etag-compare "${COMPAT_DIR}/${TESTNAME}-etag.txt" -L --fail -o "${COMPAT_DIR}/${TESTNAME}.tar.bz" "${URL}" 14 | tar jxf "${COMPAT_DIR}/${TESTNAME}.tar.bz" -C "${COMPAT_DIR}" 15 | # shellcheck disable=SC2046 16 | "${SCRIPTS_DIR}/../bin/op-program" $(cat "${COMPAT_DIR}/${TESTNAME}/args.txt") 17 | -------------------------------------------------------------------------------- /op-proposer/.gitignore: -------------------------------------------------------------------------------- 1 | bin 2 | -------------------------------------------------------------------------------- /op-proposer/metrics/noop.go: -------------------------------------------------------------------------------- 1 | package metrics 2 | 3 | import ( 4 | "io" 5 | 6 | "github.com/ethereum/go-ethereum/common" 7 | "github.com/ethereum/go-ethereum/ethclient" 8 | "github.com/ethereum/go-ethereum/log" 9 | 10 | "github.com/ethereum-optimism/optimism/op-service/eth" 11 | opmetrics "github.com/ethereum-optimism/optimism/op-service/metrics" 12 | txmetrics "github.com/ethereum-optimism/optimism/op-service/txmgr/metrics" 13 | ) 14 | 15 | type noopMetrics struct { 16 | opmetrics.NoopRefMetrics 17 | txmetrics.NoopTxMetrics 18 | opmetrics.NoopRPCMetrics 19 | } 20 | 21 | var NoopMetrics Metricer = new(noopMetrics) 22 | 23 | func (*noopMetrics) RecordInfo(version string) {} 24 | func (*noopMetrics) RecordUp() {} 25 | 26 | func (*noopMetrics) RecordL2BlocksProposed(l2ref eth.L2BlockRef) {} 27 | 28 | func (*noopMetrics) StartBalanceMetrics(log.Logger, *ethclient.Client, common.Address) io.Closer { 29 | return nil 30 | } 31 | -------------------------------------------------------------------------------- /op-service/clock/common.go: -------------------------------------------------------------------------------- 1 | package clock 2 | 3 | import ( 4 | "context" 5 | "time" 6 | ) 7 | 8 | func sleepCtx(ctx context.Context, d time.Duration, c Clock) error { 9 | timer := c.NewTimer(d) 10 | defer timer.Stop() 11 | select { 12 | case <-ctx.Done(): 13 | return ctx.Err() 14 | case <-timer.Ch(): 15 | return nil 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /op-service/clock/loop_test.go: -------------------------------------------------------------------------------- 1 | package clock 2 | 3 | import ( 4 | "context" 5 | "errors" 6 | "testing" 7 | "time" 8 | 9 | "github.com/stretchr/testify/require" 10 | ) 11 | 12 | func TestLoopFn(t *testing.T) { 13 | cl := NewDeterministicClock(time.Now()) 14 | calls := make(chan struct{}, 10) 15 | testErr := errors.New("test close error") 16 | loopFn := NewLoopFn(cl, func(ctx context.Context) { 17 | calls <- struct{}{} 18 | }, func() error { 19 | close(calls) 20 | return testErr 21 | }, time.Second*10) 22 | cl.AdvanceTime(time.Second * 15) 23 | <-calls 24 | cl.AdvanceTime(time.Second * 10) 25 | <-calls 26 | select { 27 | case <-calls: 28 | t.Fatal("more calls than expected") 29 | default: 30 | } 31 | require.ErrorIs(t, loopFn.Close(), testErr) 32 | } 33 | -------------------------------------------------------------------------------- /op-service/clock/simple.go: -------------------------------------------------------------------------------- 1 | package clock 2 | 3 | import ( 4 | "sync/atomic" 5 | "time" 6 | ) 7 | 8 | type SimpleClock struct { 9 | v atomic.Pointer[time.Time] 10 | } 11 | 12 | func NewSimpleClock() *SimpleClock { 13 | return &SimpleClock{} 14 | } 15 | 16 | func (c *SimpleClock) SetTime(u uint64) { 17 | t := time.Unix(int64(u), 0) 18 | c.v.Store(&t) 19 | } 20 | 21 | func (c *SimpleClock) Set(v time.Time) { 22 | c.v.Store(&v) 23 | } 24 | 25 | func (c *SimpleClock) Now() time.Time { 26 | v := c.v.Load() 27 | if v == nil { 28 | return time.Unix(0, 0) 29 | } 30 | return *v 31 | } 32 | -------------------------------------------------------------------------------- /op-service/clock/util.go: -------------------------------------------------------------------------------- 1 | package clock 2 | 3 | import ( 4 | "time" 5 | ) 6 | 7 | type RWClock interface { 8 | Now() time.Time 9 | } 10 | 11 | // MinCheckedTimestamp returns the minimum checked unix timestamp. 12 | // If the duration is 0, the returned minimum timestamp is 0. 13 | // Otherwise, the minimum timestamp is the current unix time minus the duration. 14 | // The subtraction operation is checked and returns 0 on underflow. 15 | func MinCheckedTimestamp(clock RWClock, duration time.Duration) uint64 { 16 | if duration.Seconds() == 0 { 17 | return 0 18 | } 19 | // To compute t-d for a duration d, use t.Add(-d). 20 | // See https://pkg.go.dev/time#Time.Sub 21 | if clock.Now().Unix() > int64(duration.Seconds()) { 22 | return uint64(clock.Now().Add(-duration).Unix()) 23 | } 24 | return 0 25 | } 26 | -------------------------------------------------------------------------------- /op-service/dial/ethclient_interface.go: -------------------------------------------------------------------------------- 1 | package dial 2 | 3 | import ( 4 | "context" 5 | "math/big" 6 | 7 | "github.com/ethereum/go-ethereum/core/types" 8 | ) 9 | 10 | // EthClientInterface is an interface for providing an ethclient.Client 11 | // It does not describe all of the functions an ethclient.Client has, only the ones used by callers of the L2 Providers 12 | type EthClientInterface interface { 13 | BlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error) 14 | 15 | Close() 16 | } 17 | -------------------------------------------------------------------------------- /op-service/enum/enum.go: -------------------------------------------------------------------------------- 1 | package enum 2 | 3 | import ( 4 | "strings" 5 | ) 6 | 7 | // EnumString returns a comma-separated string of the enum values. 8 | // This is primarily used to generate a cli flag. 9 | func EnumString[T ~string](values []T) string { 10 | var out strings.Builder 11 | for i, v := range values { 12 | out.WriteString(string(v)) 13 | if i+1 < len(values) { 14 | out.WriteString(", ") 15 | } 16 | } 17 | return out.String() 18 | } 19 | -------------------------------------------------------------------------------- /op-service/enum/enum_test.go: -------------------------------------------------------------------------------- 1 | package enum 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/stretchr/testify/require" 7 | ) 8 | 9 | // TestEnumString_MultipleInputs tests the EnumString function with multiple inputs. 10 | func TestEnumString_MultipleInputs(t *testing.T) { 11 | require.Equal(t, "a, b, c", EnumString([]string{"a", "b", "c"})) 12 | } 13 | 14 | // TestEnumString_SingleString tests the EnumString function with a single input. 15 | func TestEnumString_SingleString(t *testing.T) { 16 | require.Equal(t, "a", EnumString([]string{"a"})) 17 | } 18 | 19 | // TestEnumString_EmptyString tests the EnumString function with no inputs. 20 | func TestEnumString_EmptyString(t *testing.T) { 21 | require.Equal(t, "", EnumString([]string{})) 22 | } 23 | -------------------------------------------------------------------------------- /op-service/errutil/errors.go: -------------------------------------------------------------------------------- 1 | package errutil 2 | 3 | import ( 4 | "errors" 5 | "fmt" 6 | ) 7 | 8 | type errWithData interface { 9 | ErrorData() interface{} 10 | } 11 | 12 | // TryAddRevertReason attempts to extract the revert reason from geth RPC client errors and adds it to the error message. 13 | // This is most useful when attempting to execute gas, as if the transaction reverts this will then show the reason. 14 | func TryAddRevertReason(err error) error { 15 | var errData errWithData 16 | ok := errors.As(err, &errData) 17 | if ok { 18 | return fmt.Errorf("%w, reason: %v", err, errData.ErrorData()) 19 | } else { 20 | return err 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /op-service/errutil/errors_test.go: -------------------------------------------------------------------------------- 1 | package errutil 2 | 3 | import ( 4 | "errors" 5 | "testing" 6 | 7 | "github.com/stretchr/testify/require" 8 | ) 9 | 10 | func TestTryAddRevertReason(t *testing.T) { 11 | t.Run("AddsReason", func(t *testing.T) { 12 | err := stubError{} 13 | result := TryAddRevertReason(err) 14 | require.Contains(t, result.Error(), "kaboom") 15 | }) 16 | 17 | t.Run("ReturnOriginalWhenNoErrorDataMethod", func(t *testing.T) { 18 | err := errors.New("boom") 19 | result := TryAddRevertReason(err) 20 | require.Same(t, err, result) 21 | }) 22 | } 23 | 24 | type stubError struct{} 25 | 26 | func (s stubError) Error() string { 27 | return "where's the" 28 | } 29 | 30 | func (s stubError) ErrorData() interface{} { 31 | return "kaboom" 32 | } 33 | -------------------------------------------------------------------------------- /op-service/eth/address.go: -------------------------------------------------------------------------------- 1 | package eth 2 | 3 | import "github.com/ethereum/go-ethereum/common" 4 | 5 | // AddressAsLeftPaddedHash converts an address to a hash by left-padding it with zeros. 6 | // No hashing is performed. 7 | // This was previously known as Address.Hash(), 8 | // but removed from go-ethereum in PR 28228, because the naming was not clear. 9 | func AddressAsLeftPaddedHash(addr common.Address) (out common.Hash) { 10 | copy(out[32-20:], addr[:]) 11 | return 12 | } 13 | -------------------------------------------------------------------------------- /op-service/eth/balance.go: -------------------------------------------------------------------------------- 1 | package eth 2 | 3 | import ( 4 | "math/big" 5 | 6 | "github.com/ethereum/go-ethereum/params" 7 | ) 8 | 9 | // WeiToEther divides the wei value by 10^18 to get a number in ether as a float64 10 | func WeiToEther(wei *big.Int) float64 { 11 | num := new(big.Rat).SetInt(wei) 12 | denom := big.NewRat(params.Ether, 1) 13 | num = num.Quo(num, denom) 14 | f, _ := num.Float64() 15 | return f 16 | } 17 | -------------------------------------------------------------------------------- /op-service/eth/balance_test.go: -------------------------------------------------------------------------------- 1 | package eth 2 | 3 | import ( 4 | "math/big" 5 | "testing" 6 | ) 7 | 8 | type weiToEthTestCase struct { 9 | input *big.Int 10 | output float64 11 | } 12 | 13 | func TestWeiToEther(t *testing.T) { 14 | tests := []weiToEthTestCase{ 15 | { 16 | input: big.NewInt(1_000_000_000_000_000_000), 17 | output: 1.0, 18 | }, 19 | { 20 | input: big.NewInt(3_000_000_000_000_000_000), 21 | output: 3.0, 22 | }, 23 | { 24 | input: big.NewInt(3_456_789_000_000_000_000), 25 | output: 3.456789, 26 | }, 27 | { 28 | input: new(big.Int).Mul(big.NewInt(1_000_000), big.NewInt(1_000_000_000_000_000_000)), 29 | output: 1_000_000, 30 | }, 31 | } 32 | 33 | for i, tc := range tests { 34 | out := WeiToEther(tc.input) 35 | if out != tc.output { 36 | t.Fatalf("test %v: expected %v but got %v", i, tc.output, out) 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /op-service/eth/ether.go: -------------------------------------------------------------------------------- 1 | package eth 2 | 3 | import ( 4 | "errors" 5 | "fmt" 6 | "math" 7 | "math/big" 8 | 9 | "github.com/ethereum/go-ethereum/accounts/abi" 10 | "github.com/ethereum/go-ethereum/params" 11 | ) 12 | 13 | func GweiToWei(gwei float64) (*big.Int, error) { 14 | if math.IsNaN(gwei) || math.IsInf(gwei, 0) { 15 | return nil, fmt.Errorf("invalid gwei value: %v", gwei) 16 | } 17 | 18 | // convert float GWei value into integer Wei value 19 | wei, _ := new(big.Float).Mul( 20 | big.NewFloat(gwei), 21 | big.NewFloat(params.GWei)). 22 | Int(nil) 23 | 24 | if wei.Cmp(abi.MaxUint256) == 1 { 25 | return nil, errors.New("gwei value larger than max uint256") 26 | } 27 | 28 | return wei, nil 29 | } 30 | -------------------------------------------------------------------------------- /op-service/eth/label.go: -------------------------------------------------------------------------------- 1 | package eth 2 | 3 | type BlockLabel string 4 | 5 | const ( 6 | // Unsafe is: 7 | // - L1: absolute head of the chain 8 | // - L2: absolute head of the chain, not confirmed on L1 9 | Unsafe = "latest" 10 | // Safe is: 11 | // - L1: Justified checkpoint, beacon chain: 1 epoch of 2/3 of the validators attesting the epoch. 12 | // - L2: Derived chain tip from L1 data 13 | Safe = "safe" 14 | // Finalized is: 15 | // - L1: Finalized checkpoint, beacon chain: 2+ justified epochs with "supermajority link" (see FFG docs). 16 | // More about FFG: https://ethereum.org/en/developers/docs/consensus-mechanisms/pos/gasper/ 17 | // - L2: Derived chain tip from finalized L1 data 18 | Finalized = "finalized" 19 | ) 20 | 21 | func (label BlockLabel) Arg() any { return string(label) } 22 | 23 | func (BlockLabel) CheckID(id BlockID) error { 24 | return nil 25 | } 26 | -------------------------------------------------------------------------------- /op-service/eth/output_test.go: -------------------------------------------------------------------------------- 1 | package eth 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/ethereum/go-ethereum/common" 7 | "github.com/stretchr/testify/require" 8 | ) 9 | 10 | func TestOutputV0Codec(t *testing.T) { 11 | output := OutputV0{ 12 | StateRoot: Bytes32{1, 2, 3}, 13 | MessagePasserStorageRoot: Bytes32{4, 5, 6}, 14 | BlockHash: common.Hash{7, 8, 9}, 15 | } 16 | marshaled := output.Marshal() 17 | unmarshaled, err := UnmarshalOutput(marshaled) 18 | require.NoError(t, err) 19 | unmarshaledV0 := unmarshaled.(*OutputV0) 20 | require.Equal(t, output, *unmarshaledV0) 21 | 22 | _, err = UnmarshalOutput([]byte{0: 0xA, 32: 0xA}) 23 | require.ErrorIs(t, err, ErrInvalidOutputVersion) 24 | _, err = UnmarshalOutput([]byte{64: 0xA}) 25 | require.ErrorIs(t, err, ErrInvalidOutput) 26 | } 27 | -------------------------------------------------------------------------------- /op-service/eth/testdata/eth_v1_beacon_genesis_goerli.json: -------------------------------------------------------------------------------- 1 | {"data":{"genesis_time":"1606824023","genesis_validators_root":"0x4b363db94e286120d76eb905340fdd4e54bfe9f06bf33ff6cf5ad27f511bfe95","genesis_fork_version":"0x00000000"}} -------------------------------------------------------------------------------- /op-service/httputil/http.go: -------------------------------------------------------------------------------- 1 | package httputil 2 | 3 | import ( 4 | "net/http" 5 | 6 | "github.com/ethereum/go-ethereum/rpc" 7 | ) 8 | 9 | // Use default timeouts from Geth as battle tested default values 10 | var timeouts = rpc.DefaultHTTPTimeouts 11 | 12 | func NewHttpServer(handler http.Handler) *http.Server { 13 | return &http.Server{ 14 | Handler: handler, 15 | ReadTimeout: timeouts.ReadTimeout, 16 | ReadHeaderTimeout: timeouts.ReadHeaderTimeout, 17 | WriteTimeout: timeouts.WriteTimeout, 18 | IdleTimeout: timeouts.IdleTimeout, 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /op-service/httputil/wrapped_response_writer.go: -------------------------------------------------------------------------------- 1 | package httputil 2 | 3 | import "net/http" 4 | 5 | type WrappedResponseWriter struct { 6 | StatusCode int 7 | ResponseLen int 8 | 9 | w http.ResponseWriter 10 | wroteHeader bool 11 | } 12 | 13 | func NewWrappedResponseWriter(w http.ResponseWriter) *WrappedResponseWriter { 14 | return &WrappedResponseWriter{ 15 | StatusCode: 200, 16 | w: w, 17 | } 18 | } 19 | 20 | func (w *WrappedResponseWriter) Header() http.Header { 21 | return w.w.Header() 22 | } 23 | 24 | func (w *WrappedResponseWriter) Write(bytes []byte) (int, error) { 25 | n, err := w.w.Write(bytes) 26 | w.ResponseLen += n 27 | return n, err 28 | } 29 | 30 | func (w *WrappedResponseWriter) WriteHeader(statusCode int) { 31 | if w.wroteHeader { 32 | return 33 | } 34 | 35 | w.wroteHeader = true 36 | w.StatusCode = statusCode 37 | w.w.WriteHeader(statusCode) 38 | } 39 | -------------------------------------------------------------------------------- /op-service/log/defaults.go: -------------------------------------------------------------------------------- 1 | package log 2 | 3 | import ( 4 | "os" 5 | 6 | "github.com/ethereum/go-ethereum/log" 7 | ) 8 | 9 | func SetupDefaults() { 10 | SetGlobalLogHandler(log.LogfmtHandlerWithLevel(os.Stdout, log.LevelInfo)) 11 | } 12 | -------------------------------------------------------------------------------- /op-service/log/http.go: -------------------------------------------------------------------------------- 1 | package log 2 | 3 | import ( 4 | "net/http" 5 | "time" 6 | 7 | "github.com/ethereum-optimism/optimism/op-service/httputil" 8 | "github.com/ethereum/go-ethereum/log" 9 | ) 10 | 11 | func NewLoggingMiddleware(lgr log.Logger, next http.Handler) http.Handler { 12 | return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { 13 | ww := httputil.NewWrappedResponseWriter(w) 14 | start := time.Now() 15 | next.ServeHTTP(ww, r) 16 | lgr.Debug( 17 | "served HTTP request", 18 | "status", ww.StatusCode, 19 | "response_len", ww.ResponseLen, 20 | "path", r.URL.EscapedPath(), 21 | "duration", time.Since(start), 22 | "remote_addr", r.RemoteAddr, 23 | ) 24 | }) 25 | } 26 | -------------------------------------------------------------------------------- /op-service/metrics/registry.go: -------------------------------------------------------------------------------- 1 | package metrics 2 | 3 | import ( 4 | "github.com/prometheus/client_golang/prometheus" 5 | "github.com/prometheus/client_golang/prometheus/collectors" 6 | ) 7 | 8 | func NewRegistry() *prometheus.Registry { 9 | registry := prometheus.NewRegistry() 10 | registry.MustRegister(collectors.NewProcessCollector(collectors.ProcessCollectorOpts{})) 11 | registry.MustRegister(collectors.NewGoCollector()) 12 | return registry 13 | } 14 | 15 | type RegistryMetricer interface { 16 | Registry() *prometheus.Registry 17 | } 18 | -------------------------------------------------------------------------------- /op-service/metrics/server.go: -------------------------------------------------------------------------------- 1 | package metrics 2 | 3 | import ( 4 | "net" 5 | "strconv" 6 | 7 | "github.com/ethereum-optimism/optimism/op-service/httputil" 8 | "github.com/prometheus/client_golang/prometheus" 9 | "github.com/prometheus/client_golang/prometheus/promhttp" 10 | ) 11 | 12 | func StartServer(r *prometheus.Registry, hostname string, port int) (*httputil.HTTPServer, error) { 13 | addr := net.JoinHostPort(hostname, strconv.Itoa(port)) 14 | h := promhttp.InstrumentMetricHandler( 15 | r, promhttp.HandlerFor(r, promhttp.HandlerOpts{}), 16 | ) 17 | return httputil.StartHTTPServer(addr, h) 18 | } 19 | -------------------------------------------------------------------------------- /op-service/predeploys/addresses_test.go: -------------------------------------------------------------------------------- 1 | package predeploys 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/ethereum/go-ethereum/core/types" 7 | "github.com/stretchr/testify/require" 8 | ) 9 | 10 | func TestGethAddresses(t *testing.T) { 11 | // We test if the addresses in geth match those in op monorepo, to avoid an import-cycle: 12 | // we import geth in the monorepo, and do not want to import op monorepo into geth. 13 | require.Equal(t, L1BlockAddr, types.L1BlockAddr) 14 | } 15 | -------------------------------------------------------------------------------- /op-service/predeploys/legacy_addresses.go: -------------------------------------------------------------------------------- 1 | package predeploys 2 | 3 | import "github.com/ethereum/go-ethereum/common" 4 | 5 | const ( 6 | LegacyERC20ETH = "0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000" 7 | ) 8 | 9 | var ( 10 | LegacyERC20ETHAddr = common.HexToAddress(LegacyERC20ETH) 11 | ) 12 | -------------------------------------------------------------------------------- /op-service/predeploys/predeploy.go: -------------------------------------------------------------------------------- 1 | package predeploys 2 | 3 | import ( 4 | "github.com/ethereum/go-ethereum/common" 5 | ) 6 | 7 | type DeployConfig interface { 8 | GovernanceEnabled() bool 9 | CanyonTime(genesisTime uint64) *uint64 10 | } 11 | 12 | type Predeploy struct { 13 | Address common.Address 14 | ProxyDisabled bool 15 | Enabled func(config DeployConfig) bool 16 | } 17 | -------------------------------------------------------------------------------- /op-service/rethdb-reader/.gitignore: -------------------------------------------------------------------------------- 1 | # Target 2 | target/ 3 | 4 | # Bindings 5 | rdb.h 6 | 7 | # Testdata DB 8 | testdata/db 9 | -------------------------------------------------------------------------------- /op-service/rethdb-reader/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: testdata 2 | testdata: 3 | mkdir -p testdata 4 | @echo "Fetching block RLP and receipts for block #18,663,292 from ethereum mainnet" 5 | cast rpc debug_getRawBlock 0x11CC77C | jq -r | xxd -r -p > testdata/block.rlp 6 | cast rpc debug_getRawReceipts 0x11CC77C | jq -r > testdata/receipts.json 7 | @echo "Done. Generating testdata DB & testing integrity..." 8 | cargo test 9 | -------------------------------------------------------------------------------- /op-service/rethdb-reader/headgen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | # Generate rdb.h 6 | cbindgen --crate rethdb-reader --output rdb.h -l C 7 | 8 | # Process README.md to replace the content within the specified code block 9 | awk ' 10 | BEGIN { in_code_block=0; } 11 | /^```c/ { in_code_block=1; print; next; } 12 | /^```/ && in_code_block { in_code_block=0; while ((getline line < "rdb.h") > 0) print line; } 13 | !in_code_block { print; } 14 | ' README.md > README.tmp && mv README.tmp README.md 15 | 16 | echo "Generated C header successfully" 17 | -------------------------------------------------------------------------------- /op-service/rethdb-reader/rustfmt.toml: -------------------------------------------------------------------------------- 1 | reorder_imports = true 2 | imports_granularity = "Crate" 3 | use_small_heuristics = "Max" 4 | comment_width = 100 5 | wrap_comments = true 6 | binop_separator = "Back" 7 | trailing_comma = "Vertical" 8 | trailing_semicolon = false 9 | use_field_init_shorthand = true 10 | format_code_in_doc_comments = true 11 | doc_comment_code_block_width = 100 12 | -------------------------------------------------------------------------------- /op-service/rethdb-reader/testdata/block.rlp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/op-service/rethdb-reader/testdata/block.rlp -------------------------------------------------------------------------------- /op-service/retry/operation_test.go: -------------------------------------------------------------------------------- 1 | package retry 2 | 3 | import ( 4 | "context" 5 | "errors" 6 | "testing" 7 | "time" 8 | 9 | "github.com/stretchr/testify/require" 10 | ) 11 | 12 | func TestDo(t *testing.T) { 13 | strategy := Fixed(10 * time.Millisecond) 14 | dummyErr := errors.New("explode") 15 | 16 | start := time.Now() 17 | var i int 18 | _, err := Do(context.Background(), 2, strategy, func() (int, error) { 19 | if i == 1 { 20 | return 0, nil 21 | } 22 | i++ 23 | return 0, dummyErr 24 | }) 25 | require.NoError(t, err) 26 | require.True(t, time.Since(start) > 10*time.Millisecond) 27 | start = time.Now() 28 | // add one because the first attempt counts 29 | _, err = Do(context.Background(), 3, strategy, func() (int, error) { 30 | return 0, dummyErr 31 | }) 32 | require.Equal(t, dummyErr, err.(*ErrFailedPermanently).LastErr) 33 | require.True(t, time.Since(start) > 20*time.Millisecond) 34 | } 35 | -------------------------------------------------------------------------------- /op-service/retry/strategies_test.go: -------------------------------------------------------------------------------- 1 | package retry 2 | 3 | import ( 4 | "math" 5 | "testing" 6 | "time" 7 | 8 | "github.com/stretchr/testify/require" 9 | ) 10 | 11 | func TestExponential(t *testing.T) { 12 | strategy := &ExponentialStrategy{ 13 | Min: 3 * time.Second, 14 | Max: 10 * time.Second, 15 | MaxJitter: 0, 16 | } 17 | 18 | require.Equal(t, 3*time.Second, strategy.Duration(-1)) 19 | durations := []time.Duration{4, 5, 7, 10, 10} 20 | for i, dur := range durations { 21 | require.Equal(t, dur*time.Second, strategy.Duration(i), "attempt %d", i) 22 | } 23 | require.Equal(t, 10*time.Second, strategy.Duration(100)) 24 | require.Equal(t, 10*time.Second, strategy.Duration(16000)) 25 | require.Equal(t, 10*time.Second, strategy.Duration(math.MaxInt)) 26 | } 27 | -------------------------------------------------------------------------------- /op-service/safego/nocopy.go: -------------------------------------------------------------------------------- 1 | package safego 2 | 3 | // NoCopy is a super simple safety util taken from the Go atomic lib. 4 | // 5 | // NoCopy may be added to structs which must not be copied 6 | // after the first use. 7 | // 8 | // The NoCopy struct is empty, so should be a zero-cost util at runtime. 9 | // 10 | // See https://golang.org/issues/8005#issuecomment-190753527 11 | // for details. 12 | // 13 | // Note that it must not be embedded, due to the Lock and Unlock methods. 14 | // 15 | // Like: 16 | // ``` 17 | // 18 | // type Example { 19 | // V uint64 20 | // _ NoCopy 21 | // } 22 | // 23 | // Then run: `go vet -copylocks .` 24 | // ``` 25 | type NoCopy struct{} 26 | 27 | // Lock is a no-op used by -copylocks checker from `go vet`. 28 | func (*NoCopy) Lock() {} 29 | func (*NoCopy) Unlock() {} 30 | -------------------------------------------------------------------------------- /op-service/solabi/utils_test.go: -------------------------------------------------------------------------------- 1 | package solabi_test 2 | 3 | import ( 4 | "bytes" 5 | "testing" 6 | 7 | "github.com/ethereum-optimism/optimism/op-service/solabi" 8 | "github.com/stretchr/testify/require" 9 | ) 10 | 11 | func TestEmptyReader(t *testing.T) { 12 | t.Run("empty", func(t *testing.T) { 13 | r := new(bytes.Buffer) 14 | require.True(t, solabi.EmptyReader(r)) 15 | }) 16 | t.Run("empty after read", func(t *testing.T) { 17 | r := bytes.NewBufferString("not empty") 18 | tmp := make([]byte, 9) 19 | n, err := r.Read(tmp) 20 | require.Equal(t, 9, n) 21 | require.NoError(t, err) 22 | require.True(t, solabi.EmptyReader(r)) 23 | }) 24 | t.Run("extra bytes", func(t *testing.T) { 25 | r := bytes.NewBufferString("not empty") 26 | require.False(t, solabi.EmptyReader(r)) 27 | }) 28 | } 29 | -------------------------------------------------------------------------------- /op-service/sources/batching/balance_call_test.go: -------------------------------------------------------------------------------- 1 | package batching 2 | 3 | import ( 4 | "context" 5 | "math/big" 6 | "testing" 7 | 8 | "github.com/ethereum-optimism/optimism/op-service/sources/batching/rpcblock" 9 | "github.com/ethereum-optimism/optimism/op-service/sources/batching/test" 10 | "github.com/ethereum/go-ethereum/common" 11 | "github.com/stretchr/testify/require" 12 | ) 13 | 14 | func TestGetBalance(t *testing.T) { 15 | addr := common.Address{0xab, 0xcd} 16 | expectedBalance := big.NewInt(248924) 17 | 18 | stub := test.NewRpcStub(t) 19 | stub.AddExpectedCall(test.NewGetBalanceCall(addr, rpcblock.Latest, expectedBalance)) 20 | 21 | caller := NewMultiCaller(stub, DefaultBatchSize) 22 | result, err := caller.SingleCall(context.Background(), rpcblock.Latest, NewBalanceCall(addr)) 23 | require.NoError(t, err) 24 | require.Equal(t, expectedBalance, result.GetBigInt(0)) 25 | } 26 | -------------------------------------------------------------------------------- /op-service/sources/batching/types.go: -------------------------------------------------------------------------------- 1 | package batching 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/ethereum/go-ethereum/rpc" 7 | ) 8 | 9 | type BatchCallContextFn func(ctx context.Context, b []rpc.BatchElem) error 10 | 11 | type CallContextFn func(ctx context.Context, result any, method string, args ...any) error 12 | -------------------------------------------------------------------------------- /op-service/sources/reth_db_stub.go: -------------------------------------------------------------------------------- 1 | //go:build !rethdb 2 | 3 | package sources 4 | 5 | import ( 6 | "github.com/ethereum-optimism/optimism/op-service/client" 7 | "github.com/ethereum-optimism/optimism/op-service/sources/caching" 8 | "github.com/ethereum/go-ethereum/log" 9 | ) 10 | 11 | const buildRethdb = false 12 | 13 | func newRecProviderFromConfig(client client.RPC, log log.Logger, metrics caching.Metrics, config *EthClientConfig) *CachingReceiptsProvider { 14 | return newRPCRecProviderFromConfig(client, log, metrics, config) 15 | } 16 | -------------------------------------------------------------------------------- /op-service/sources/testdata/data/blocks/post-shanghai-bad-receipts-hash_metadata.json: -------------------------------------------------------------------------------- 1 | {"name":"post-shanghai-bad-receipts-hash","fail":true, "reason":"failed to verify block hash"} 2 | -------------------------------------------------------------------------------- /op-service/sources/testdata/data/blocks/post-shanghai-bad-transactions-hash_metadata.json: -------------------------------------------------------------------------------- 1 | {"name":"post-shanghai-bad-transactions-hash","fail":true, "reason":"failed to verify block hash"} 2 | -------------------------------------------------------------------------------- /op-service/sources/testdata/data/blocks/post-shanghai-bad-transactions-nil_metadata.json: -------------------------------------------------------------------------------- 1 | {"name":"post-shanghai-bad-transactions-nil","fail":true, "reason": "block tx 0 is nil"} 2 | -------------------------------------------------------------------------------- /op-service/sources/testdata/data/blocks/post-shanghai-bad-transactions_metadata.json: -------------------------------------------------------------------------------- 1 | {"name":"post-shanghai-bad-transactions","fail":true, "reason": "failed to verify transactions list"} 2 | -------------------------------------------------------------------------------- /op-service/sources/testdata/data/blocks/post-shanghai-bad-withdrawals-hash_metadata.json: -------------------------------------------------------------------------------- 1 | {"name":"post-shanghai-bad-withdrawals-hash","fail":true, "reason":"failed to verify block hash"} 2 | -------------------------------------------------------------------------------- /op-service/sources/testdata/data/blocks/post-shanghai-bad-withdrawals-nil_metadata.json: -------------------------------------------------------------------------------- 1 | {"name":"post-shanghai-bad-withdrawals-nil","fail":true, "reason": "block withdrawal 0 is null"} 2 | -------------------------------------------------------------------------------- /op-service/sources/testdata/data/blocks/post-shanghai-bad-withdrawals_metadata.json: -------------------------------------------------------------------------------- 1 | {"name":"post-shanghai-bad-withdrawals","fail":true,"reason": "failed to verify withdrawals list"} 2 | -------------------------------------------------------------------------------- /op-service/sources/testdata/data/blocks/post-shanghai-success_metadata.json: -------------------------------------------------------------------------------- 1 | {"name":"post-shanghai-success"} 2 | -------------------------------------------------------------------------------- /op-service/sources/testdata/data/blocks/pre-shanghai-bad-receipts-hash_metadata.json: -------------------------------------------------------------------------------- 1 | {"name":"pre-shanghai-bad-receipts-hash","fail":true, "reason":"failed to verify block hash"} 2 | -------------------------------------------------------------------------------- /op-service/sources/testdata/data/blocks/pre-shanghai-bad-transactions-hash_metadata.json: -------------------------------------------------------------------------------- 1 | {"name":"pre-shanghai-bad-transactions-hash","fail":true, "reason":"failed to verify block hash"} 2 | -------------------------------------------------------------------------------- /op-service/sources/testdata/data/blocks/pre-shanghai-bad-transactions_metadata.json: -------------------------------------------------------------------------------- 1 | {"name":"pre-shanghai-bad-transactions","fail":true,"reason": "failed to verify transactions list"} 2 | -------------------------------------------------------------------------------- /op-service/sources/testdata/data/blocks/pre-shanghai-success_metadata.json: -------------------------------------------------------------------------------- 1 | {"name":"pre-shanghai-success"} 2 | -------------------------------------------------------------------------------- /op-service/sources/testdata/data/headers/post-shanghai-bad-receipts_metadata.json: -------------------------------------------------------------------------------- 1 | {"name":"post-shanghai-bad-receipts","fail":true} 2 | -------------------------------------------------------------------------------- /op-service/sources/testdata/data/headers/post-shanghai-bad-transactions_metadata.json: -------------------------------------------------------------------------------- 1 | {"name":"post-shanghai-bad-transactions","fail":true} 2 | -------------------------------------------------------------------------------- /op-service/sources/testdata/data/headers/post-shanghai-bad-withdrawals_metadata.json: -------------------------------------------------------------------------------- 1 | {"name":"post-shanghai-bad-withdrawals","fail":true} 2 | -------------------------------------------------------------------------------- /op-service/sources/testdata/data/headers/post-shanghai-success_metadata.json: -------------------------------------------------------------------------------- 1 | {"name":"post-shanghai-success"} 2 | -------------------------------------------------------------------------------- /op-service/sources/testdata/data/headers/pre-shanghai-bad-receipts_metadata.json: -------------------------------------------------------------------------------- 1 | {"name":"pre-shanghai-bad-receipts","fail":true} 2 | -------------------------------------------------------------------------------- /op-service/sources/testdata/data/headers/pre-shanghai-bad-transactions_metadata.json: -------------------------------------------------------------------------------- 1 | {"name":"pre-shanghai-bad-transactions","fail":true} 2 | -------------------------------------------------------------------------------- /op-service/sources/testdata/data/headers/pre-shanghai-success_metadata.json: -------------------------------------------------------------------------------- 1 | {"name":"pre-shanghai-success"} 2 | -------------------------------------------------------------------------------- /op-service/tasks/tasks.go: -------------------------------------------------------------------------------- 1 | package tasks 2 | 3 | import ( 4 | "fmt" 5 | "runtime/debug" 6 | 7 | "golang.org/x/sync/errgroup" 8 | ) 9 | 10 | // Group is a tasks group, which can at any point be awaited to complete. 11 | // Tasks in the group are run in separate go routines. 12 | // If a task panics, the panic is recovered with HandleCrit. 13 | type Group struct { 14 | errGroup errgroup.Group 15 | HandleCrit func(err error) 16 | } 17 | 18 | func (t *Group) Go(fn func() error) { 19 | t.errGroup.Go(func() error { 20 | defer func() { 21 | if err := recover(); err != nil { 22 | debug.PrintStack() 23 | t.HandleCrit(fmt.Errorf("panic: %v", err)) 24 | } 25 | }() 26 | return fn() 27 | }) 28 | } 29 | 30 | func (t *Group) Wait() error { 31 | return t.errGroup.Wait() 32 | } 33 | -------------------------------------------------------------------------------- /op-service/testlog/README.md: -------------------------------------------------------------------------------- 1 | # testlog 2 | 3 | `github.com/ethereum/go-ethereum/internal/testlog`: a Go-ethereum util for logging in tests. 4 | 5 | Since we use the same logging, but as an external package, we have to move the test utility to our own internal package. 6 | 7 | This fork also made minor modifications: 8 | 9 | - Enable color by default. 10 | - Add `estimateInfoLen` and use this for message padding in `flush()` to align the contents of the log entries, 11 | compensating for the different lengths of the log decoration that the Go library adds. 12 | -------------------------------------------------------------------------------- /op-service/testutils/assertions.go: -------------------------------------------------------------------------------- 1 | package testutils 2 | 3 | import ( 4 | "math/big" 5 | "testing" 6 | ) 7 | 8 | func BigEqual(a, b *big.Int) bool { 9 | if a == nil || b == nil { 10 | return a == b 11 | } else { 12 | return a.Cmp(b) == 0 13 | } 14 | } 15 | 16 | func RequireBigEqual(t *testing.T, exp, actual *big.Int) { 17 | t.Helper() 18 | if !BigEqual(exp, actual) { 19 | t.Fatalf("expected %s to be equal to %s", exp.String(), actual.String()) 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /op-service/testutils/fuzzerutils/fuzzer_functions.go: -------------------------------------------------------------------------------- 1 | package fuzzerutils 2 | 3 | import ( 4 | "math/big" 5 | 6 | "github.com/ethereum/go-ethereum/common" 7 | fuzz "github.com/google/gofuzz" 8 | ) 9 | 10 | // AddFuzzerFunctions takes a fuzz.Fuzzer and adds a list of functions to handle different 11 | // data types in a fuzzing campaign. It adds support for commonly used types throughout the 12 | // application. 13 | func AddFuzzerFunctions(fuzzer *fuzz.Fuzzer) { 14 | fuzzer.Funcs( 15 | func(e *big.Int, c fuzz.Continue) { 16 | var temp [32]byte 17 | c.Fuzz(&temp) 18 | e.SetBytes(temp[:]) 19 | }, 20 | func(e *common.Hash, c fuzz.Continue) { 21 | var temp [32]byte 22 | c.Fuzz(&temp) 23 | e.SetBytes(temp[:]) 24 | }, 25 | func(e *common.Address, c fuzz.Continue) { 26 | var temp [20]byte 27 | c.Fuzz(&temp) 28 | e.SetBytes(temp[:]) 29 | }, 30 | ) 31 | } 32 | -------------------------------------------------------------------------------- /op-service/testutils/mock_debug_client.go: -------------------------------------------------------------------------------- 1 | package testutils 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/ethereum/go-ethereum/common" 7 | "github.com/stretchr/testify/mock" 8 | ) 9 | 10 | type MockDebugClient struct { 11 | mock.Mock 12 | } 13 | 14 | func (m *MockDebugClient) ExpectNodeByHash(hash common.Hash, res []byte, err error) { 15 | m.Mock.On("NodeByHash", hash).Once().Return(res, err) 16 | } 17 | 18 | func (m *MockDebugClient) NodeByHash(ctx context.Context, hash common.Hash) ([]byte, error) { 19 | out := m.Mock.Called(hash) 20 | return out.Get(0).([]byte), out.Error(1) 21 | } 22 | 23 | func (m *MockDebugClient) ExpectCodeByHash(hash common.Hash, res []byte, err error) { 24 | m.Mock.On("CodeByHash", hash).Once().Return(res, err) 25 | } 26 | 27 | func (m *MockDebugClient) CodeByHash(ctx context.Context, hash common.Hash) ([]byte, error) { 28 | out := m.Mock.Called(hash) 29 | return out.Get(0).([]byte), out.Error(1) 30 | } 31 | -------------------------------------------------------------------------------- /op-service/testutils/runtime_config.go: -------------------------------------------------------------------------------- 1 | package testutils 2 | 3 | import "github.com/ethereum/go-ethereum/common" 4 | 5 | type MockRuntimeConfig struct { 6 | P2PSeqAddress common.Address 7 | } 8 | 9 | func (m *MockRuntimeConfig) P2PSequencerAddress() common.Address { 10 | return m.P2PSeqAddress 11 | } 12 | -------------------------------------------------------------------------------- /op-service/tls/certman/testdata/README: -------------------------------------------------------------------------------- 1 | Test certificates generated with the following command: 2 | 3 | openssl req -new -newkey rsa:2048 -days 365 -nodes -x509 -sha256 -keyout server.key -out server.crt -------------------------------------------------------------------------------- /op-service/txmgr/metrics/noop.go: -------------------------------------------------------------------------------- 1 | package metrics 2 | 3 | import ( 4 | "math/big" 5 | 6 | "github.com/ethereum/go-ethereum/core/types" 7 | ) 8 | 9 | type NoopTxMetrics struct{} 10 | 11 | func (*NoopTxMetrics) RecordNonce(uint64) {} 12 | func (*NoopTxMetrics) RecordPendingTx(int64) {} 13 | func (*NoopTxMetrics) RecordGasBumpCount(int) {} 14 | func (*NoopTxMetrics) RecordTxConfirmationLatency(int64) {} 15 | func (*NoopTxMetrics) TxConfirmed(*types.Receipt) {} 16 | func (*NoopTxMetrics) TxPublished(string) {} 17 | func (*NoopTxMetrics) RecordBaseFee(*big.Int) {} 18 | func (*NoopTxMetrics) RecordBlobBaseFee(*big.Int) {} 19 | func (*NoopTxMetrics) RecordTipCap(*big.Int) {} 20 | func (*NoopTxMetrics) RPCError() {} 21 | -------------------------------------------------------------------------------- /op-service/util_test.go: -------------------------------------------------------------------------------- 1 | package op_service 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/stretchr/testify/require" 7 | "github.com/urfave/cli/v2" 8 | ) 9 | 10 | func TestCLIFlagsToEnvVars(t *testing.T) { 11 | flags := []cli.Flag{ 12 | &cli.StringFlag{ 13 | Name: "test", 14 | EnvVars: []string{"OP_NODE_TEST_VAR"}, 15 | }, 16 | &cli.IntFlag{ 17 | Name: "no env var", 18 | }, 19 | } 20 | res := cliFlagsToEnvVars(flags) 21 | require.Contains(t, res, "OP_NODE_TEST_VAR") 22 | } 23 | 24 | func TestValidateEnvVars(t *testing.T) { 25 | provided := []string{"OP_BATCHER_CONFIG=true", "OP_BATCHER_FAKE=false", "LD_PRELOAD=/lib/fake.so"} 26 | defined := map[string]struct{}{ 27 | "OP_BATCHER_CONFIG": {}, 28 | "OP_BATCHER_OTHER": {}, 29 | } 30 | invalids := validateEnvVars("OP_BATCHER", provided, defined) 31 | require.ElementsMatch(t, invalids, []string{"OP_BATCHER_FAKE=false"}) 32 | } 33 | -------------------------------------------------------------------------------- /op-service/version.go: -------------------------------------------------------------------------------- 1 | package op_service 2 | 3 | func FormatVersion(version string, gitCommit string, gitDate string, meta string) string { 4 | v := version 5 | if gitCommit != "" { 6 | if len(gitCommit) >= 8 { 7 | v += "-" + gitCommit[:8] 8 | } else { 9 | v += "-" + gitCommit 10 | } 11 | } 12 | if gitDate != "" { 13 | v += "-" + gitDate 14 | } 15 | if meta != "" { 16 | v += "-" + meta 17 | } 18 | return v 19 | } 20 | -------------------------------------------------------------------------------- /op-supervisor/.gitignore: -------------------------------------------------------------------------------- 1 | bin 2 | -------------------------------------------------------------------------------- /op-supervisor/Makefile: -------------------------------------------------------------------------------- 1 | GITCOMMIT ?= $(shell git rev-parse HEAD) 2 | GITDATE ?= $(shell git show -s --format='%ct') 3 | VERSION ?= v0.0.0 4 | 5 | LDFLAGSSTRING +=-X main.GitCommit=$(GITCOMMIT) 6 | LDFLAGSSTRING +=-X main.GitDate=$(GITDATE) 7 | LDFLAGSSTRING +=-X main.Version=$(VERSION) 8 | LDFLAGSSTRING +=-X main.Meta=$(VERSION_META) 9 | LDFLAGS := -ldflags "$(LDFLAGSSTRING)" 10 | 11 | 12 | op-supervisor: 13 | env GO111MODULE=on GOOS=$(TARGETOS) GOARCH=$(TARGETARCH) go build -v $(LDFLAGS) -o ./bin/op-supervisor ./cmd 14 | 15 | clean: 16 | rm bin/op-supervisor 17 | 18 | test: 19 | go test -v ./... 20 | 21 | .PHONY: \ 22 | op-supervisor \ 23 | clean \ 24 | test 25 | -------------------------------------------------------------------------------- /op-supervisor/metrics/noop.go: -------------------------------------------------------------------------------- 1 | package metrics 2 | 3 | import ( 4 | opmetrics "github.com/ethereum-optimism/optimism/op-service/metrics" 5 | "github.com/ethereum-optimism/optimism/op-supervisor/supervisor/types" 6 | ) 7 | 8 | type noopMetrics struct { 9 | opmetrics.NoopRPCMetrics 10 | } 11 | 12 | var NoopMetrics Metricer = new(noopMetrics) 13 | 14 | func (*noopMetrics) Document() []opmetrics.DocumentedMetric { return nil } 15 | 16 | func (*noopMetrics) RecordInfo(version string) {} 17 | func (*noopMetrics) RecordUp() {} 18 | 19 | func (m *noopMetrics) CacheAdd(_ types.ChainID, _ string, _ int, _ bool) {} 20 | func (m *noopMetrics) CacheGet(_ types.ChainID, _ string, _ bool) {} 21 | 22 | func (m *noopMetrics) RecordDBEntryCount(_ types.ChainID, _ int64) {} 23 | func (m *noopMetrics) RecordDBSearchEntriesRead(_ types.ChainID, _ int64) {} 24 | -------------------------------------------------------------------------------- /op-supervisor/supervisor/backend/config.go: -------------------------------------------------------------------------------- 1 | package backend 2 | 3 | type Config struct { 4 | // TODO(protocol-quest#288): configure list of chains and their RPC endpoints / potential alternative data sources 5 | } 6 | -------------------------------------------------------------------------------- /op-supervisor/supervisor/backend/types/types.go: -------------------------------------------------------------------------------- 1 | package types 2 | 3 | import ( 4 | "encoding/hex" 5 | 6 | "github.com/ethereum/go-ethereum/common" 7 | ) 8 | 9 | type TruncatedHash [20]byte 10 | 11 | func TruncateHash(hash common.Hash) TruncatedHash { 12 | var truncated TruncatedHash 13 | copy(truncated[:], hash[0:20]) 14 | return truncated 15 | } 16 | 17 | func (h TruncatedHash) String() string { 18 | return hex.EncodeToString(h[:]) 19 | } 20 | 21 | type ExecutingMessage struct { 22 | Chain uint32 23 | BlockNum uint64 24 | LogIdx uint32 25 | Timestamp uint64 26 | Hash TruncatedHash 27 | } 28 | -------------------------------------------------------------------------------- /op-ufm/README.md: -------------------------------------------------------------------------------- 1 | # ⚠️ Important 2 | This project has been moved to [ethereum-optimism/infra](https://github.com/ethereum-optimism/infra) 3 | 4 | # OP User Facing Monitoring 5 | 6 | This project simulates a synthetic user interacting with a OP Stack chain. 7 | 8 | It is intended to be used as a tool for monitoring 9 | the health of the network by measuring end-to-end transaction latency. 10 | 11 | 12 | ## Metrics 13 | 14 | * Round-trip duration time to get transaction receipt (from creation timestamp) 15 | 16 | * First-seen duration time (from creation timestamp) 17 | 18 | 19 | ## Usage 20 | 21 | Run `make ufm` to build the binary. No additional dependencies are necessary. 22 | 23 | Copy `example.config.toml` to `config.toml` and edit the file to configure the service. 24 | 25 | Start the service with `ufm config.toml`. 26 | 27 | -------------------------------------------------------------------------------- /op-wheel/.gitignore: -------------------------------------------------------------------------------- 1 | bin 2 | -------------------------------------------------------------------------------- /op-wheel/Makefile: -------------------------------------------------------------------------------- 1 | GITCOMMIT ?= $(shell git rev-parse HEAD) 2 | GITDATE ?= $(shell git show -s --format='%ct') 3 | VERSION ?= v0.0.0 4 | 5 | LDFLAGSSTRING +=-X main.GitCommit=$(GITCOMMIT) 6 | LDFLAGSSTRING +=-X main.GitDate=$(GITDATE) 7 | LDFLAGSSTRING +=-X main.Version=$(VERSION) 8 | LDFLAGS := -ldflags "$(LDFLAGSSTRING)" 9 | 10 | op-wheel: 11 | env GO111MODULE=on GOOS=$(TARGETOS) GOARCH=$(TARGETARCH) go build -v $(LDFLAGS) -o ./bin/op-wheel ./cmd 12 | 13 | .PHONY: \ 14 | op-wheel 15 | -------------------------------------------------------------------------------- /ops-bedrock/Dockerfile.l1: -------------------------------------------------------------------------------- 1 | FROM ethereum/client-go:v1.13.15 2 | 3 | RUN apk add --no-cache jq bash 4 | 5 | COPY entrypoint-l1.sh /entrypoint.sh 6 | 7 | VOLUME ["/db"] 8 | 9 | ENTRYPOINT ["/bin/bash", "/entrypoint.sh"] 10 | -------------------------------------------------------------------------------- /ops-bedrock/Dockerfile.l2: -------------------------------------------------------------------------------- 1 | FROM us-docker.pkg.dev/oplabs-tools-artifacts/images/op-geth:optimism 2 | 3 | RUN apk add --no-cache jq 4 | 5 | COPY entrypoint-l2.sh /entrypoint.sh 6 | 7 | VOLUME ["/db"] 8 | 9 | ENTRYPOINT ["/bin/sh", "/entrypoint.sh"] 10 | -------------------------------------------------------------------------------- /ops-bedrock/op-batcher-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -exu 3 | 4 | curl \ 5 | --fail \ 6 | --retry 10 \ 7 | --retry-delay 2 \ 8 | --retry-connrefused \ 9 | -X POST \ 10 | -H "Content-Type: application/json" \ 11 | --data '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["0x0", false],"id":1}' \ 12 | http://l1:8545 13 | 14 | exec op-batcher 15 | -------------------------------------------------------------------------------- /ops-bedrock/op-batcher-key.txt: -------------------------------------------------------------------------------- 1 | bf7604d9d3a1c7748642b1b7b05c2bd219c9faa91458b370f85e5a40f3b03af7 -------------------------------------------------------------------------------- /ops-bedrock/p2p-node-key.txt: -------------------------------------------------------------------------------- 1 | dae4671006c60a3619556ace98eca6f6e092948d05b13070a27ac492a4fba419 2 | -------------------------------------------------------------------------------- /ops-bedrock/test-jwt-secret.txt: -------------------------------------------------------------------------------- 1 | 688f5d737bad920bdfb2fc2f488d6b6209eebda1dae949a8de91398d932c517a 2 | -------------------------------------------------------------------------------- /ops/README.md: -------------------------------------------------------------------------------- 1 | # ops 2 | 3 | Various operational packages 4 | -------------------------------------------------------------------------------- /ops/check-changed/.gitignore: -------------------------------------------------------------------------------- 1 | venv -------------------------------------------------------------------------------- /ops/check-changed/requirements.txt: -------------------------------------------------------------------------------- 1 | certifi==2024.7.4 2 | cffi==1.15.1 3 | charset-normalizer==2.1.1 4 | Deprecated==1.2.13 5 | idna==3.7 6 | pycparser==2.21 7 | PyGithub==1.57 8 | PyJWT==2.6.0 9 | PyNaCl==1.5.0 10 | requests==2.32.0 11 | urllib3==1.26.19 12 | wrapt==1.14.1 13 | -------------------------------------------------------------------------------- /ops/docker/ci-builder/Dockerfile.dockerignore: -------------------------------------------------------------------------------- 1 | * 2 | !/.nvmrc 3 | !/versions.json 4 | !/ops/scripts/install-foundry.sh 5 | -------------------------------------------------------------------------------- /ops/docker/op-stack-go/Dockerfile.dockerignore: -------------------------------------------------------------------------------- 1 | # All the files we depend on. We are using a negative pattern to not include anything by accident. 2 | # node_modules, packages (contains git submodules and node modules etc.), devnet dirs etc. all add up a lot. 3 | * 4 | 5 | !/cannon 6 | !/op-batcher 7 | !/op-bootnode 8 | !/op-chain-ops 9 | !/op-challenger 10 | !/packages/contracts-bedrock/snapshots 11 | !/op-dispute-mon 12 | !/op-conductor 13 | !/op-heartbeat 14 | !/op-node 15 | !/op-preimage 16 | !/op-program 17 | !/op-proposer 18 | !/op-service 19 | !/op-supervisor 20 | !/op-wheel 21 | !/op-plasma 22 | !/go.mod 23 | !/go.sum 24 | -------------------------------------------------------------------------------- /ops/docker/oplabs.crt: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIICEDCCAZagAwIBAgIUALLKhe49OFLAGb5Zt+DZlvpKScswCgYIKoZIzj0EAwMw 3 | KTEQMA4GA1UEChMHT1AgTGFiczEVMBMGA1UEAxMMb3BsYWJzLmNsb3VkMB4XDTIy 4 | MTIxOTE3MDQwNFoXDTMyMTIxNjE3MDQwM1owKTEQMA4GA1UEChMHT1AgTGFiczEV 5 | MBMGA1UEAxMMb3BsYWJzLmNsb3VkMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEyCco 6 | PpvE5IRv5S0zqmpE2VsbhVzB+hiQjbQO3J6j5L+pAvWjXGvjZblGvNi5PIVBCxvm 7 | 5UofdFrOCAiOdRfevhadv3zLzGUmoJ52iXCTPL01dlkQt5KUsoT+AU7GPW4Ko38w 8 | fTAOBgNVHQ8BAf8EBAMCAaYwEgYDVR0TAQH/BAgwBgEB/wIBCjAdBgNVHQ4EFgQU 9 | 2AVLbBUBZcBOPkg8QCAOvSMrdj0wHwYDVR0jBBgwFoAU2AVLbBUBZcBOPkg8QCAO 10 | vSMrdj0wFwYDVR0RBBAwDoIMb3BsYWJzLmNsb3VkMAoGCCqGSM49BAMDA2gAMGUC 11 | MBuERHbRkWDwXm97jqKEGANU4VDBqgmRicdF7FspDqA5Zcpj+r+rQVaDlH0qvtxH 12 | SQIxAL3fjNoC1Kon4kKmPQdp5KNhvGzOaoQiqbb5JuL3+j6f3x0ucLVD1yWP/V/+ 13 | zZ/vlQ== 14 | -----END CERTIFICATE----- 15 | -------------------------------------------------------------------------------- /ops/scripts/ci-versions.js: -------------------------------------------------------------------------------- 1 | const os = require('os') 2 | 3 | // this script unbundles the published packages output 4 | // from changesets action to a key-value pair to be used 5 | // with our publishing CI workflow 6 | data = process.argv[2] 7 | data = JSON.parse(data) 8 | 9 | for (const i of data) { 10 | const name = i.name.replace("@eth-optimism/", "") 11 | const version = i.version 12 | process.stdout.write(`::set-output name=${name}::${version}` + os.EOL) 13 | } 14 | -------------------------------------------------------------------------------- /ops/scripts/newer-file.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Returns 0 if the first file is newer than the second file 4 | # Works on files or directories 5 | 6 | if [[ ! -e "$1" ]]; then exit 1; fi 7 | if [[ ! -e "$2" ]]; then exit 1; fi 8 | 9 | if uname | grep -q "Darwin"; then 10 | MOD_TIME_FMT="-f %m" 11 | else 12 | MOD_TIME_FMT="-c %Y" 13 | fi 14 | 15 | FILE_1_AGE=$(stat "$MOD_TIME_FMT" "$1") 16 | FILE_2_AGE=$(stat "$MOD_TIME_FMT" "$2") 17 | 18 | if [ "$FILE_1_AGE" -gt "$FILE_2_AGE" ]; then 19 | exit 0 20 | fi 21 | 22 | exit 1 -------------------------------------------------------------------------------- /ops/scripts/parse_json_test_output.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -euo pipefail 4 | 5 | if [ "$#" -ne 2 ]; then 6 | echo "Usage: $0 " 7 | exit 1 8 | fi 9 | 10 | TEST_NAME="$1" 11 | JSON_FILE="$2" 12 | 13 | jq --raw-output --join-output --arg testName "${TEST_NAME}" 'select(.Test == $testName and .Action == "output").Output' "${JSON_FILE}" 14 | -------------------------------------------------------------------------------- /ops/scripts/update-op-geth.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | 4 | import subprocess 5 | import os 6 | 7 | 8 | GETH_VERSION='v1.12.0' 9 | 10 | 11 | def main(): 12 | for project in ('.',): 13 | print(f'Updating {project}...') 14 | update_mod(project) 15 | 16 | 17 | def update_mod(project): 18 | print('Replacing...') 19 | subprocess.run([ 20 | 'go', 21 | 'mod', 22 | 'edit', 23 | '-replace', 24 | f'github.com/ethereum/go-ethereum@{GETH_VERSION}=github.com/ethereum-optimism/op-geth@optimism' 25 | ], cwd=os.path.join(project), check=True) 26 | print('Tidying...') 27 | subprocess.run([ 28 | 'go', 29 | 'mod', 30 | 'tidy' 31 | ], cwd=os.path.join(project), check=True) 32 | 33 | 34 | if __name__ == '__main__': 35 | main() 36 | -------------------------------------------------------------------------------- /ops/tag-service/.gitignore: -------------------------------------------------------------------------------- 1 | venv -------------------------------------------------------------------------------- /ops/tag-service/requirements.txt: -------------------------------------------------------------------------------- 1 | click==8.1.3 2 | semver==3.0.0-dev4 3 | -------------------------------------------------------------------------------- /packages/chain-mon/.depcheckrc: -------------------------------------------------------------------------------- 1 | ignores: [ 2 | "@babel/eslint-parser", 3 | "@typescript-eslint/parser", 4 | "eslint-plugin-import", 5 | "eslint-plugin-unicorn", 6 | "eslint-plugin-jsdoc", 7 | "eslint-plugin-prefer-arrow", 8 | "eslint-plugin-react", 9 | "@typescript-eslint/eslint-plugin", 10 | "eslint-config-prettier", 11 | "eslint-plugin-prettier", 12 | "chai" 13 | ] 14 | -------------------------------------------------------------------------------- /packages/chain-mon/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: '../../.eslintrc.js', 3 | } 4 | -------------------------------------------------------------------------------- /packages/chain-mon/.lintstagedrc.yml: -------------------------------------------------------------------------------- 1 | "*.{ts,js}": 2 | - eslint 3 | -------------------------------------------------------------------------------- /packages/chain-mon/.prettierrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | ...require('../../.prettierrc.js'), 3 | }; -------------------------------------------------------------------------------- /packages/chain-mon/README.md: -------------------------------------------------------------------------------- 1 | # @eth-optimism/chain-mon 2 | 3 | [![codecov](https://codecov.io/gh/ethereum-optimism/optimism/branch/develop/graph/badge.svg?token=0VTG7PG7YR&flag=chain-mon-tests)](https://codecov.io/gh/ethereum-optimism/optimism) 4 | 5 | `chain-mon` is a collection of chain monitoring services. 6 | 7 | ## Installation 8 | 9 | Clone, install, and build the Optimism monorepo: 10 | 11 | ``` 12 | git clone https://github.com/ethereum-optimism/optimism.git 13 | pnpm install 14 | pnpm build 15 | ``` 16 | 17 | ## Running a service 18 | 19 | Copy `.env.example` into a new file named `.env`, then set the environment variables listed there depending on the service you want to run. 20 | Once your environment variables have been set, run via: 21 | 22 | ``` 23 | pnpm start: 24 | ``` 25 | 26 | For example, to run `balance-mon`, execute: 27 | 28 | ``` 29 | pnpm start:balance-mon 30 | ``` 31 | -------------------------------------------------------------------------------- /packages/chain-mon/contrib/replica-mon/index.ts: -------------------------------------------------------------------------------- 1 | export * from './service' 2 | -------------------------------------------------------------------------------- /packages/chain-mon/hardhat.config.ts: -------------------------------------------------------------------------------- 1 | import { HardhatUserConfig } from 'hardhat/types' 2 | 3 | // Hardhat plugins 4 | import '@nomiclabs/hardhat-ethers' 5 | import '@nomiclabs/hardhat-waffle' 6 | 7 | const config: HardhatUserConfig = { 8 | mocha: { 9 | timeout: 50000, 10 | }, 11 | } 12 | 13 | export default config 14 | -------------------------------------------------------------------------------- /packages/chain-mon/src/fault-mon/index.ts: -------------------------------------------------------------------------------- 1 | export * from './service' 2 | export * from './helpers' 3 | -------------------------------------------------------------------------------- /packages/chain-mon/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from '../internal/balance-mon/service' 2 | export * from './fault-mon/index' 3 | export * from '../internal/multisig-mon/service' 4 | export * from './wd-mon/service' 5 | export * from './faultproof-wd-mon/service' 6 | export * from '../contrib/wallet-mon/service' 7 | export * from '../contrib/initialized-upgraded-mon/service' 8 | -------------------------------------------------------------------------------- /packages/chain-mon/test/fault-mon/setup.ts: -------------------------------------------------------------------------------- 1 | import chai = require('chai') 2 | import chaiAsPromised from 'chai-as-promised' 3 | 4 | // Chai plugins go here. 5 | chai.use(chaiAsPromised) 6 | 7 | const should = chai.should() 8 | const expect = chai.expect 9 | 10 | export { should, expect } 11 | -------------------------------------------------------------------------------- /packages/chain-mon/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "outDir": "./dist", 4 | "skipLibCheck": true, 5 | "module": "commonjs", 6 | "target": "es2017", 7 | "sourceMap": true, 8 | "esModuleInterop": true, 9 | "composite": true, 10 | "resolveJsonModule": true, 11 | "declaration": true, 12 | "noImplicitAny": false, 13 | "removeComments": true, 14 | "noLib": false, 15 | "emitDecoratorMetadata": true, 16 | "experimentalDecorators": true, 17 | "typeRoots": [ 18 | "node_modules/@types" 19 | ] 20 | }, 21 | "exclude": [ 22 | "node_modules", 23 | "dist" 24 | ], 25 | "include": [ 26 | "package.json", 27 | "src/abi/IGnosisSafe.0.8.19.json", 28 | "src/abi/OptimismPortal.json", 29 | "src/**/*", 30 | "contrib/**/*", 31 | "internal/**/*" 32 | ] 33 | } 34 | -------------------------------------------------------------------------------- /packages/contracts-bedrock/.eslintignore: -------------------------------------------------------------------------------- 1 | # Deps and test files 2 | lib 3 | 4 | # build output 5 | artifacts 6 | forge-artifacts 7 | cache 8 | coverage* 9 | deployments 10 | -------------------------------------------------------------------------------- /packages/contracts-bedrock/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: '../../.eslintrc.js', 3 | ignorePatterns: ['src/contract-artifacts.ts'], 4 | } 5 | -------------------------------------------------------------------------------- /packages/contracts-bedrock/.npmignore: -------------------------------------------------------------------------------- 1 | scripts 2 | test 3 | .envrc 4 | -------------------------------------------------------------------------------- /packages/contracts-bedrock/deployments/.gitinclude: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base/optimism/f5221f4d1fae6f3da1bd4d1647e45f40e2b055c4/packages/contracts-bedrock/deployments/.gitinclude -------------------------------------------------------------------------------- /packages/contracts-bedrock/deployments/4202/.chainId: -------------------------------------------------------------------------------- 1 | 4202 -------------------------------------------------------------------------------- /packages/contracts-bedrock/invariant-docs/AddressAliasHelper.md: -------------------------------------------------------------------------------- 1 | # `AddressAliasHelper` Invariants 2 | 3 | ## Address aliases are always able to be undone. 4 | **Test:** [`AddressAliasHelper.t.sol#L48`](../test/invariants/AddressAliasHelper.t.sol#L48) 5 | 6 | Asserts that an address that has been aliased with `applyL1ToL2Alias` can always be unaliased with `undoL1ToL2Alias`. -------------------------------------------------------------------------------- /packages/contracts-bedrock/invariant-docs/Burn.Eth.md: -------------------------------------------------------------------------------- 1 | # `Burn.Eth` Invariants 2 | 3 | ## `eth(uint256)` always burns the exact amount of eth passed. 4 | **Test:** [`Burn.Eth.t.sol#L66`](../test/invariants/Burn.Eth.t.sol#L66) 5 | 6 | Asserts that when `Burn.eth(uint256)` is called, it always burns the exact amount of ETH passed to the function. -------------------------------------------------------------------------------- /packages/contracts-bedrock/invariant-docs/Burn.Gas.md: -------------------------------------------------------------------------------- 1 | # `Burn.Gas` Invariants 2 | 3 | ## `gas(uint256)` always burns at least the amount of gas passed. 4 | **Test:** [`Burn.Gas.t.sol#L66`](../test/invariants/Burn.Gas.t.sol#L66) 5 | 6 | Asserts that when `Burn.gas(uint256)` is called, it always burns at least the amount of gas passed to the function. -------------------------------------------------------------------------------- /packages/contracts-bedrock/invariant-docs/Encoding.md: -------------------------------------------------------------------------------- 1 | # `Encoding` Invariants 2 | 3 | ## `convertRoundTripAToB` never fails. 4 | **Test:** [`Encoding.t.sol#L73`](../test/invariants/Encoding.t.sol#L73) 5 | 6 | Asserts that a raw versioned nonce can be encoded / decoded to reach the same raw value. 7 | 8 | ## `convertRoundTripBToA` never fails. 9 | **Test:** [`Encoding.t.sol#L82`](../test/invariants/Encoding.t.sol#L82) 10 | 11 | Asserts that an encoded versioned nonce can always be decoded / re-encoded to reach the same encoded value. -------------------------------------------------------------------------------- /packages/contracts-bedrock/invariant-docs/FaultDisputeGame.md: -------------------------------------------------------------------------------- 1 | # `FaultDisputeGame` Invariants 2 | 3 | ## FaultDisputeGame always returns all ETH on total resolution 4 | **Test:** [`FaultDisputeGame.t.sol#L33`](../test/invariants/FaultDisputeGame.t.sol#L33) 5 | 6 | The FaultDisputeGame contract should always return all ETH in the contract to the correct recipients upon resolution of all outstanding claims. There may never be any ETH left in the contract after a full resolution. -------------------------------------------------------------------------------- /packages/contracts-bedrock/invariant-docs/Hashing.md: -------------------------------------------------------------------------------- 1 | # `Hashing` Invariants 2 | 3 | ## `hashCrossDomainMessage` reverts if `version` is > `1`. 4 | **Test:** [`Hashing.t.sol#L119`](../test/invariants/Hashing.t.sol#L119) 5 | 6 | The `hashCrossDomainMessage` function should always revert if the `version` passed is > `1`. 7 | 8 | ## `version` = `0`: `hashCrossDomainMessage` and `hashCrossDomainMessageV0` are equivalent. 9 | **Test:** [`Hashing.t.sol#L129`](../test/invariants/Hashing.t.sol#L129) 10 | 11 | If the version passed is 0, `hashCrossDomainMessage` and `hashCrossDomainMessageV0` should be equivalent. 12 | 13 | ## `version` = `1`: `hashCrossDomainMessage` and `hashCrossDomainMessageV1` are equivalent. 14 | **Test:** [`Hashing.t.sol#L140`](../test/invariants/Hashing.t.sol#L140) 15 | 16 | If the version passed is 1, `hashCrossDomainMessage` and `hashCrossDomainMessageV1` should be equivalent. -------------------------------------------------------------------------------- /packages/contracts-bedrock/invariant-docs/InvariantTest.sol.md: -------------------------------------------------------------------------------- 1 | # `InvariantTest.sol` Invariants 2 | 3 | -------------------------------------------------------------------------------- /packages/contracts-bedrock/invariant-docs/L2OutputOracle.md: -------------------------------------------------------------------------------- 1 | # `L2OutputOracle` Invariants 2 | 3 | ## The block number of the output root proposals should monotonically increase. 4 | **Test:** [`L2OutputOracle.t.sol#L58`](../test/invariants/L2OutputOracle.t.sol#L58) 5 | 6 | When a new output is submitted, it should never be allowed to correspond to a block number that is less than the current output. -------------------------------------------------------------------------------- /packages/contracts-bedrock/invariant-docs/SafeCall.md: -------------------------------------------------------------------------------- 1 | # `SafeCall` Invariants 2 | 3 | ## If `callWithMinGas` performs a call, then it must always provide at least the specified minimum gas limit to the subcontext. 4 | **Test:** [`SafeCall.t.sol#L33`](../test/invariants/SafeCall.t.sol#L33) 5 | 6 | If the check for remaining gas in `SafeCall.callWithMinGas` passes, the subcontext of the call below it must be provided at least `minGas` gas. 7 | 8 | ## `callWithMinGas` reverts if there is not enough gas to pass to the subcontext. 9 | **Test:** [`SafeCall.t.sol#L66`](../test/invariants/SafeCall.t.sol#L66) 10 | 11 | If there is not enough gas in the callframe to ensure that `callWithMinGas` can provide the specified minimum gas limit to the subcontext of the call, then `callWithMinGas` must revert. -------------------------------------------------------------------------------- /packages/contracts-bedrock/invariant-docs/SystemConfig.md: -------------------------------------------------------------------------------- 1 | # `SystemConfig` Invariants 2 | 3 | ## Gas limit boundaries 4 | **Test:** [`SystemConfig.t.sol#L70`](../test/invariants/SystemConfig.t.sol#L70) 5 | 6 | The gas limit of the `SystemConfig` contract can never be lower than the hard-coded lower bound or higher than the hard-coded upper bound. The lower bound must never be higher than the upper bound. -------------------------------------------------------------------------------- /packages/contracts-bedrock/scripts/Chains.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.0; 3 | 4 | /// @notice Chain IDs for the various networks. 5 | library Chains { 6 | uint256 internal constant Mainnet = 1; 7 | uint256 internal constant OPMainnet = 10; 8 | uint256 internal constant Goerli = 5; 9 | uint256 internal constant OPGoerli = 420; 10 | uint256 internal constant Sepolia = 11155111; 11 | uint256 internal constant OPSepolia = 11155420; 12 | uint256 internal constant LocalDevnet = 900; 13 | uint256 internal constant OPLocalDevnet = 901; 14 | uint256 internal constant GethDevnet = 1337; 15 | uint256 internal constant Hardhat = 31337; 16 | } 17 | -------------------------------------------------------------------------------- /packages/contracts-bedrock/scripts/Types.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.0; 3 | 4 | library Types { 5 | /// @notice Represents a set of L1 contracts. Used to represent a set of proxies. 6 | struct ContractSet { 7 | address L1CrossDomainMessenger; 8 | address L1StandardBridge; 9 | address L2OutputOracle; 10 | address DisputeGameFactory; 11 | address DelayedWETH; 12 | address AnchorStateRegistry; 13 | address OptimismMintableERC20Factory; 14 | address OptimismPortal; 15 | address OptimismPortal2; 16 | address SystemConfig; 17 | address L1ERC721Bridge; 18 | address ProtocolVersions; 19 | address SuperchainConfig; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /packages/contracts-bedrock/scripts/checks/check-deploy-configs.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # This script is used to check for valid deploy configs. 4 | # It should check all configs and return a non-zero exit code if any of them are invalid. 5 | # getting-started.json isn't valid JSON so its skipped. 6 | 7 | code=0 8 | 9 | SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) 10 | CONTRACTS_BASE=$(dirname "$(dirname "$SCRIPT_DIR")") 11 | MONOREPO_BASE=$(dirname "$(dirname "$CONTRACTS_BASE")") 12 | 13 | for config in "$CONTRACTS_BASE"/deploy-config/*.json; do 14 | # shellcheck disable=SC2086 15 | if ! go run "$MONOREPO_BASE/op-chain-ops/cmd/check-deploy-config/main.go" --path "$config"; then 16 | code=1 17 | fi 18 | done 19 | 20 | exit $code 21 | -------------------------------------------------------------------------------- /packages/contracts-bedrock/scripts/checks/check-snapshots.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -euo pipefail 4 | 5 | # Generate the snapshots 6 | pnpm snapshots 7 | 8 | # Check if the generated `snapshots` or `test/kontrol` files are different from the committed versions 9 | if git diff --exit-code snapshots test/kontrol > /dev/null; then 10 | [ -z "$(git ls-files --others --exclude-standard snapshots test/kontrol)" ] || exit 1 11 | else 12 | exit 1 13 | fi 14 | -------------------------------------------------------------------------------- /packages/contracts-bedrock/scripts/dag-viz.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import dagviz 3 | import networkx as nx 4 | from eth_abi import decode 5 | 6 | # The parent of the root claim is uint32 max. 7 | ROOT_PARENT = 4294967295 8 | 9 | # Get the abi-encoded input 10 | b = sys.argv[1].removeprefix('0x') 11 | 12 | # Decode the input 13 | t = decode(['(uint32,bool,bytes32,uint128,uint128)[]'], bytes.fromhex(b))[0] 14 | 15 | # Create the graph 16 | G = nx.DiGraph() 17 | for c in t: 18 | claim = c[2].hex() 19 | key = f"Position: {bin(c[3])[2:]} | Claim: 0x{claim[:4]}..{claim[60:64]}" 20 | G.add_node(key) 21 | if int(c[0]) != ROOT_PARENT: 22 | pclaim = t[c[0]][2].hex() 23 | G.add_edge(f"Position: {bin(t[c[0]][3])[2:]} | Claim: 0x{pclaim[:4]}..{pclaim[60:64]}", key) 24 | r = dagviz.render_svg(G) 25 | 26 | f = open('dispute_game.svg', 'w') 27 | f.write(r) 28 | f.close() 29 | -------------------------------------------------------------------------------- /packages/contracts-bedrock/scripts/deploy/deploy.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -euo pipefail 3 | 4 | verify_flag="" 5 | if [ -n "${DEPLOY_VERIFY:-}" ]; then 6 | verify_flag="--verify" 7 | fi 8 | 9 | echo "> Deploying contracts" 10 | forge script -vvv scripts/deploy/Deploy.s.sol:Deploy --rpc-url "$DEPLOY_ETH_RPC_URL" --broadcast --private-key "$DEPLOY_PRIVATE_KEY" $verify_flag 11 | 12 | if [ -n "${DEPLOY_GENERATE_HARDHAT_ARTIFACTS:-}" ]; then 13 | echo "> Generating hardhat artifacts" 14 | forge script -vvv scripts/deploy/Deploy.s.sol:Deploy --sig 'sync()' --rpc-url "$DEPLOY_ETH_RPC_URL" --broadcast --private-key "$DEPLOY_PRIVATE_KEY" 15 | fi 16 | -------------------------------------------------------------------------------- /packages/contracts-bedrock/scripts/fpac/.gitignore: -------------------------------------------------------------------------------- 1 | prestate-artifacts/ 2 | prestate-artifacts.tar.gz 3 | -------------------------------------------------------------------------------- /packages/contracts-bedrock/scripts/fpac/README.md: -------------------------------------------------------------------------------- 1 | # `fpac-deploy` 2 | 3 | Chain-ops scripts for the Fault Proof Alpha Chad contracts. 4 | 5 | ## Usage 6 | 7 | ### Generating the Cannon prestate and artifacts 8 | 9 | _Description_: Generates the cannon prestate, tars the relavent artifacts, and sets the absolute prestate field in the network's deploy config. 10 | 11 | ```sh 12 | make cannon-prestate chain= 13 | ``` 14 | 15 | ### Deploying a fresh system 16 | 17 | _Description_: Deploys a fully fresh FPAC system to the passed chain. All args after the `args=` are forwarded to `forge script`. 18 | 19 | ```sh 20 | make deploy-fresh chain= proxy-admin= system-owner-safe= [args=] 21 | ``` 22 | -------------------------------------------------------------------------------- /packages/contracts-bedrock/scripts/go-ffi/bin.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "log" 5 | "os" 6 | ) 7 | 8 | func main() { 9 | switch os.Args[1] { 10 | case "diff": 11 | DiffTestUtils() 12 | case "trie": 13 | FuzzTrie() 14 | case "merkle": 15 | DiffMerkle() 16 | default: 17 | log.Fatal("Must pass a subcommand") 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /packages/contracts-bedrock/scripts/statediff.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -euo pipefail 3 | 4 | echo "> Deploying contracts to generate state diff (non-broadcast)" 5 | forge script -vvv scripts/deploy/Deploy.s.sol:Deploy --sig 'runWithStateDiff()' 6 | -------------------------------------------------------------------------------- /packages/contracts-bedrock/scripts/visualize.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -euo pipefail 3 | 4 | RPC="${1:?Must specify RPC address}" 5 | FAULT_GAME_ADDRESS="${2:?Must specify game address}" 6 | 7 | DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" 8 | DIR="${DIR%/*}" 9 | cd "$DIR" 10 | 11 | forge script scripts/FaultDisputeGameViz.s.sol \ 12 | --sig "remote(address)" "$FAULT_GAME_ADDRESS" \ 13 | --fork-url "$RPC" 14 | -------------------------------------------------------------------------------- /packages/contracts-bedrock/slither.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "detectors_to_exclude": "arbitrary-send-eth,incorrect-equality,naming-convention,solc-version", 3 | "exclude_dependencies": true, 4 | "exclude_informational": true, 5 | "exclude_low": true, 6 | "exclude_optimization": true, 7 | "fail_on": "none", 8 | "filter_paths": "(src/vendor|src/cannon/MIPS.sol|src/EAS/EAS.sol)", 9 | "foundry_out_directory": "artifacts" 10 | } 11 | -------------------------------------------------------------------------------- /packages/contracts-bedrock/snapshots/abi/Burner.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [], 4 | "stateMutability": "payable", 5 | "type": "constructor" 6 | } 7 | ] -------------------------------------------------------------------------------- /packages/contracts-bedrock/snapshots/abi/CheckTrue.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "bytes", 6 | "name": "", 7 | "type": "bytes" 8 | } 9 | ], 10 | "name": "check", 11 | "outputs": [ 12 | { 13 | "internalType": "bool", 14 | "name": "execute_", 15 | "type": "bool" 16 | } 17 | ], 18 | "stateMutability": "pure", 19 | "type": "function" 20 | }, 21 | { 22 | "inputs": [], 23 | "name": "name", 24 | "outputs": [ 25 | { 26 | "internalType": "string", 27 | "name": "", 28 | "type": "string" 29 | } 30 | ], 31 | "stateMutability": "view", 32 | "type": "function" 33 | } 34 | ] -------------------------------------------------------------------------------- /packages/contracts-bedrock/snapshots/abi/CrossDomainMessengerLegacySpacer0.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /packages/contracts-bedrock/snapshots/abi/CrossDomainMessengerLegacySpacer1.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /packages/contracts-bedrock/snapshots/abi/L1BlockNumber.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "stateMutability": "payable", 4 | "type": "fallback" 5 | }, 6 | { 7 | "stateMutability": "payable", 8 | "type": "receive" 9 | }, 10 | { 11 | "inputs": [], 12 | "name": "getL1BlockNumber", 13 | "outputs": [ 14 | { 15 | "internalType": "uint256", 16 | "name": "", 17 | "type": "uint256" 18 | } 19 | ], 20 | "stateMutability": "view", 21 | "type": "function" 22 | }, 23 | { 24 | "inputs": [], 25 | "name": "version", 26 | "outputs": [ 27 | { 28 | "internalType": "string", 29 | "name": "", 30 | "type": "string" 31 | } 32 | ], 33 | "stateMutability": "view", 34 | "type": "function" 35 | } 36 | ] -------------------------------------------------------------------------------- /packages/contracts-bedrock/snapshots/abi/ResolvedDelegateProxy.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "contract AddressManager", 6 | "name": "_addressManager", 7 | "type": "address" 8 | }, 9 | { 10 | "internalType": "string", 11 | "name": "_implementationName", 12 | "type": "string" 13 | } 14 | ], 15 | "stateMutability": "nonpayable", 16 | "type": "constructor" 17 | }, 18 | { 19 | "stateMutability": "payable", 20 | "type": "fallback" 21 | } 22 | ] -------------------------------------------------------------------------------- /packages/contracts-bedrock/snapshots/abi/SafeSend.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "address payable", 6 | "name": "_recipient", 7 | "type": "address" 8 | } 9 | ], 10 | "stateMutability": "payable", 11 | "type": "constructor" 12 | } 13 | ] -------------------------------------------------------------------------------- /packages/contracts-bedrock/snapshots/abi/TransientReentrancyAware.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /packages/contracts-bedrock/snapshots/abi_loader_test.go: -------------------------------------------------------------------------------- 1 | package snapshots 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/ethereum/go-ethereum/accounts/abi" 7 | "github.com/stretchr/testify/require" 8 | ) 9 | 10 | func TestLoadABIs(t *testing.T) { 11 | tests := []struct { 12 | contract string 13 | method func() *abi.ABI 14 | }{ 15 | {"DisputeGameFactory", LoadDisputeGameFactoryABI}, 16 | {"FaultDisputeGame", LoadFaultDisputeGameABI}, 17 | {"PreimageOracle", LoadPreimageOracleABI}, 18 | {"MIPS", LoadMIPSABI}, 19 | {"DelayedWETH", LoadDelayedWETHABI}, 20 | } 21 | for _, test := range tests { 22 | test := test 23 | t.Run(test.contract, func(t *testing.T) { 24 | actual := test.method() 25 | require.NotNil(t, actual) 26 | }) 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /packages/contracts-bedrock/snapshots/storageLayout/AddressManager.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "bytes": "20", 4 | "label": "_owner", 5 | "offset": 0, 6 | "slot": "0", 7 | "type": "address" 8 | }, 9 | { 10 | "bytes": "32", 11 | "label": "addresses", 12 | "offset": 0, 13 | "slot": "1", 14 | "type": "mapping(bytes32 => address)" 15 | } 16 | ] -------------------------------------------------------------------------------- /packages/contracts-bedrock/snapshots/storageLayout/AdminFaucetAuthModule.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /packages/contracts-bedrock/snapshots/storageLayout/AnchorStateRegistry.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "bytes": "1", 4 | "label": "_initialized", 5 | "offset": 0, 6 | "slot": "0", 7 | "type": "uint8" 8 | }, 9 | { 10 | "bytes": "1", 11 | "label": "_initializing", 12 | "offset": 1, 13 | "slot": "0", 14 | "type": "bool" 15 | }, 16 | { 17 | "bytes": "32", 18 | "label": "anchors", 19 | "offset": 0, 20 | "slot": "1", 21 | "type": "mapping(GameType => struct OutputRoot)" 22 | } 23 | ] -------------------------------------------------------------------------------- /packages/contracts-bedrock/snapshots/storageLayout/AssetReceiver.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "bytes": "20", 4 | "label": "owner", 5 | "offset": 0, 6 | "slot": "0", 7 | "type": "address" 8 | } 9 | ] -------------------------------------------------------------------------------- /packages/contracts-bedrock/snapshots/storageLayout/AttestationStation.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "bytes": "32", 4 | "label": "attestations", 5 | "offset": 0, 6 | "slot": "0", 7 | "type": "mapping(address => mapping(address => mapping(bytes32 => bytes)))" 8 | } 9 | ] -------------------------------------------------------------------------------- /packages/contracts-bedrock/snapshots/storageLayout/BaseFeeVault.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "bytes": "32", 4 | "label": "totalProcessed", 5 | "offset": 0, 6 | "slot": "0", 7 | "type": "uint256" 8 | }, 9 | { 10 | "bytes": "1536", 11 | "label": "__gap", 12 | "offset": 0, 13 | "slot": "1", 14 | "type": "uint256[48]" 15 | } 16 | ] -------------------------------------------------------------------------------- /packages/contracts-bedrock/snapshots/storageLayout/Burner.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /packages/contracts-bedrock/snapshots/storageLayout/CheckBalanceLow.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "bytes": "32", 4 | "label": "name", 5 | "offset": 0, 6 | "slot": "0", 7 | "type": "string" 8 | } 9 | ] -------------------------------------------------------------------------------- /packages/contracts-bedrock/snapshots/storageLayout/CheckGelatoLow.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "bytes": "32", 4 | "label": "name", 5 | "offset": 0, 6 | "slot": "0", 7 | "type": "string" 8 | } 9 | ] -------------------------------------------------------------------------------- /packages/contracts-bedrock/snapshots/storageLayout/CheckSecrets.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "bytes": "32", 4 | "label": "name", 5 | "offset": 0, 6 | "slot": "0", 7 | "type": "string" 8 | }, 9 | { 10 | "bytes": "32", 11 | "label": "revealedSecrets", 12 | "offset": 0, 13 | "slot": "1", 14 | "type": "mapping(bytes32 => uint256)" 15 | } 16 | ] -------------------------------------------------------------------------------- /packages/contracts-bedrock/snapshots/storageLayout/CheckTrue.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "bytes": "32", 4 | "label": "name", 5 | "offset": 0, 6 | "slot": "0", 7 | "type": "string" 8 | } 9 | ] -------------------------------------------------------------------------------- /packages/contracts-bedrock/snapshots/storageLayout/CrossDomainMessengerLegacySpacer0.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "bytes": "20", 4 | "label": "spacer_0_0_20", 5 | "offset": 0, 6 | "slot": "0", 7 | "type": "address" 8 | } 9 | ] -------------------------------------------------------------------------------- /packages/contracts-bedrock/snapshots/storageLayout/CrossL2Inbox.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /packages/contracts-bedrock/snapshots/storageLayout/DelayedVetoable.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "bytes": "32", 4 | "label": "_delay", 5 | "offset": 0, 6 | "slot": "0", 7 | "type": "uint256" 8 | }, 9 | { 10 | "bytes": "32", 11 | "label": "_queuedAt", 12 | "offset": 0, 13 | "slot": "1", 14 | "type": "mapping(bytes32 => uint256)" 15 | } 16 | ] -------------------------------------------------------------------------------- /packages/contracts-bedrock/snapshots/storageLayout/DeployerWhitelist.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "bytes": "20", 4 | "label": "owner", 5 | "offset": 0, 6 | "slot": "0", 7 | "type": "address" 8 | }, 9 | { 10 | "bytes": "32", 11 | "label": "whitelist", 12 | "offset": 0, 13 | "slot": "1", 14 | "type": "mapping(address => bool)" 15 | } 16 | ] -------------------------------------------------------------------------------- /packages/contracts-bedrock/snapshots/storageLayout/DeputyGuardianModule.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /packages/contracts-bedrock/snapshots/storageLayout/Drippie.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "bytes": "20", 4 | "label": "owner", 5 | "offset": 0, 6 | "slot": "0", 7 | "type": "address" 8 | }, 9 | { 10 | "bytes": "32", 11 | "label": "drips", 12 | "offset": 0, 13 | "slot": "1", 14 | "type": "mapping(string => struct Drippie.DripState)" 15 | }, 16 | { 17 | "bytes": "32", 18 | "label": "created", 19 | "offset": 0, 20 | "slot": "2", 21 | "type": "string[]" 22 | } 23 | ] -------------------------------------------------------------------------------- /packages/contracts-bedrock/snapshots/storageLayout/Faucet.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "bytes": "32", 4 | "label": "modules", 5 | "offset": 0, 6 | "slot": "0", 7 | "type": "mapping(contract IFaucetAuthModule => struct Faucet.ModuleConfig)" 8 | }, 9 | { 10 | "bytes": "32", 11 | "label": "timeouts", 12 | "offset": 0, 13 | "slot": "1", 14 | "type": "mapping(contract IFaucetAuthModule => mapping(bytes32 => uint256))" 15 | }, 16 | { 17 | "bytes": "32", 18 | "label": "nonces", 19 | "offset": 0, 20 | "slot": "2", 21 | "type": "mapping(bytes32 => mapping(bytes32 => bool))" 22 | } 23 | ] -------------------------------------------------------------------------------- /packages/contracts-bedrock/snapshots/storageLayout/GasPriceOracle.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "bytes": "1", 4 | "label": "isEcotone", 5 | "offset": 0, 6 | "slot": "0", 7 | "type": "bool" 8 | }, 9 | { 10 | "bytes": "1", 11 | "label": "isFjord", 12 | "offset": 1, 13 | "slot": "0", 14 | "type": "bool" 15 | } 16 | ] -------------------------------------------------------------------------------- /packages/contracts-bedrock/snapshots/storageLayout/L1BlockNumber.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /packages/contracts-bedrock/snapshots/storageLayout/L1ChugSplashProxy.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /packages/contracts-bedrock/snapshots/storageLayout/L1FeeVault.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "bytes": "32", 4 | "label": "totalProcessed", 5 | "offset": 0, 6 | "slot": "0", 7 | "type": "uint256" 8 | }, 9 | { 10 | "bytes": "1536", 11 | "label": "__gap", 12 | "offset": 0, 13 | "slot": "1", 14 | "type": "uint256[48]" 15 | } 16 | ] -------------------------------------------------------------------------------- /packages/contracts-bedrock/snapshots/storageLayout/L2ToL1MessagePasser.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "bytes": "32", 4 | "label": "sentMessages", 5 | "offset": 0, 6 | "slot": "0", 7 | "type": "mapping(bytes32 => bool)" 8 | }, 9 | { 10 | "bytes": "30", 11 | "label": "msgNonce", 12 | "offset": 0, 13 | "slot": "1", 14 | "type": "uint240" 15 | } 16 | ] -------------------------------------------------------------------------------- /packages/contracts-bedrock/snapshots/storageLayout/L2ToL2CrossDomainMessenger.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "bytes": "32", 4 | "label": "successfulMessages", 5 | "offset": 0, 6 | "slot": "0", 7 | "type": "mapping(bytes32 => bool)" 8 | }, 9 | { 10 | "bytes": "30", 11 | "label": "msgNonce", 12 | "offset": 0, 13 | "slot": "1", 14 | "type": "uint240" 15 | } 16 | ] -------------------------------------------------------------------------------- /packages/contracts-bedrock/snapshots/storageLayout/LegacyMessagePasser.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "bytes": "32", 4 | "label": "sentMessages", 5 | "offset": 0, 6 | "slot": "0", 7 | "type": "mapping(bytes32 => bool)" 8 | } 9 | ] -------------------------------------------------------------------------------- /packages/contracts-bedrock/snapshots/storageLayout/LivenessGuard.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "bytes": "32", 4 | "label": "lastLive", 5 | "offset": 0, 6 | "slot": "0", 7 | "type": "mapping(address => uint256)" 8 | }, 9 | { 10 | "bytes": "64", 11 | "label": "ownersBefore", 12 | "offset": 0, 13 | "slot": "1", 14 | "type": "struct EnumerableSet.AddressSet" 15 | } 16 | ] -------------------------------------------------------------------------------- /packages/contracts-bedrock/snapshots/storageLayout/LivenessModule.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "bytes": "1", 4 | "label": "ownershipTransferredToFallback", 5 | "offset": 0, 6 | "slot": "0", 7 | "type": "bool" 8 | } 9 | ] -------------------------------------------------------------------------------- /packages/contracts-bedrock/snapshots/storageLayout/MIPS.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /packages/contracts-bedrock/snapshots/storageLayout/MintManager.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "bytes": "20", 4 | "label": "_owner", 5 | "offset": 0, 6 | "slot": "0", 7 | "type": "address" 8 | }, 9 | { 10 | "bytes": "32", 11 | "label": "mintPermittedAfter", 12 | "offset": 0, 13 | "slot": "1", 14 | "type": "uint256" 15 | } 16 | ] -------------------------------------------------------------------------------- /packages/contracts-bedrock/snapshots/storageLayout/OptimismMintableERC20.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "bytes": "32", 4 | "label": "_balances", 5 | "offset": 0, 6 | "slot": "0", 7 | "type": "mapping(address => uint256)" 8 | }, 9 | { 10 | "bytes": "32", 11 | "label": "_allowances", 12 | "offset": 0, 13 | "slot": "1", 14 | "type": "mapping(address => mapping(address => uint256))" 15 | }, 16 | { 17 | "bytes": "32", 18 | "label": "_totalSupply", 19 | "offset": 0, 20 | "slot": "2", 21 | "type": "uint256" 22 | }, 23 | { 24 | "bytes": "32", 25 | "label": "_name", 26 | "offset": 0, 27 | "slot": "3", 28 | "type": "string" 29 | }, 30 | { 31 | "bytes": "32", 32 | "label": "_symbol", 33 | "offset": 0, 34 | "slot": "4", 35 | "type": "string" 36 | } 37 | ] -------------------------------------------------------------------------------- /packages/contracts-bedrock/snapshots/storageLayout/OptimismMintableERC20Factory.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "bytes": "1", 4 | "label": "_initialized", 5 | "offset": 0, 6 | "slot": "0", 7 | "type": "uint8" 8 | }, 9 | { 10 | "bytes": "1", 11 | "label": "_initializing", 12 | "offset": 1, 13 | "slot": "0", 14 | "type": "bool" 15 | }, 16 | { 17 | "bytes": "30", 18 | "label": "spacer_0_2_30", 19 | "offset": 2, 20 | "slot": "0", 21 | "type": "bytes30" 22 | }, 23 | { 24 | "bytes": "20", 25 | "label": "bridge", 26 | "offset": 0, 27 | "slot": "1", 28 | "type": "address" 29 | }, 30 | { 31 | "bytes": "1568", 32 | "label": "__gap", 33 | "offset": 0, 34 | "slot": "2", 35 | "type": "uint256[49]" 36 | } 37 | ] -------------------------------------------------------------------------------- /packages/contracts-bedrock/snapshots/storageLayout/OptimismMintableERC721Factory.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "bytes": "32", 4 | "label": "isOptimismMintableERC721", 5 | "offset": 0, 6 | "slot": "0", 7 | "type": "mapping(address => bool)" 8 | } 9 | ] -------------------------------------------------------------------------------- /packages/contracts-bedrock/snapshots/storageLayout/OptimistAllowlist.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /packages/contracts-bedrock/snapshots/storageLayout/ProtocolVersions.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "bytes": "1", 4 | "label": "_initialized", 5 | "offset": 0, 6 | "slot": "0", 7 | "type": "uint8" 8 | }, 9 | { 10 | "bytes": "1", 11 | "label": "_initializing", 12 | "offset": 1, 13 | "slot": "0", 14 | "type": "bool" 15 | }, 16 | { 17 | "bytes": "1600", 18 | "label": "__gap", 19 | "offset": 0, 20 | "slot": "1", 21 | "type": "uint256[50]" 22 | }, 23 | { 24 | "bytes": "20", 25 | "label": "_owner", 26 | "offset": 0, 27 | "slot": "51", 28 | "type": "address" 29 | }, 30 | { 31 | "bytes": "1568", 32 | "label": "__gap", 33 | "offset": 0, 34 | "slot": "52", 35 | "type": "uint256[49]" 36 | } 37 | ] -------------------------------------------------------------------------------- /packages/contracts-bedrock/snapshots/storageLayout/Proxy.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /packages/contracts-bedrock/snapshots/storageLayout/ProxyAdmin.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "bytes": "20", 4 | "label": "_owner", 5 | "offset": 0, 6 | "slot": "0", 7 | "type": "address" 8 | }, 9 | { 10 | "bytes": "32", 11 | "label": "proxyType", 12 | "offset": 0, 13 | "slot": "1", 14 | "type": "mapping(address => enum ProxyAdmin.ProxyType)" 15 | }, 16 | { 17 | "bytes": "32", 18 | "label": "implementationName", 19 | "offset": 0, 20 | "slot": "2", 21 | "type": "mapping(address => string)" 22 | }, 23 | { 24 | "bytes": "20", 25 | "label": "addressManager", 26 | "offset": 0, 27 | "slot": "3", 28 | "type": "contract AddressManager" 29 | }, 30 | { 31 | "bytes": "1", 32 | "label": "upgrading", 33 | "offset": 20, 34 | "slot": "3", 35 | "type": "bool" 36 | } 37 | ] -------------------------------------------------------------------------------- /packages/contracts-bedrock/snapshots/storageLayout/ResolvedDelegateProxy.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "bytes": "32", 4 | "label": "implementationName", 5 | "offset": 0, 6 | "slot": "0", 7 | "type": "mapping(address => string)" 8 | }, 9 | { 10 | "bytes": "32", 11 | "label": "addressManager", 12 | "offset": 0, 13 | "slot": "1", 14 | "type": "mapping(address => contract AddressManager)" 15 | } 16 | ] -------------------------------------------------------------------------------- /packages/contracts-bedrock/snapshots/storageLayout/SafeSend.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /packages/contracts-bedrock/snapshots/storageLayout/SchemaRegistry.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "bytes": "32", 4 | "label": "_registry", 5 | "offset": 0, 6 | "slot": "0", 7 | "type": "mapping(bytes32 => struct SchemaRecord)" 8 | }, 9 | { 10 | "bytes": "1568", 11 | "label": "__gap", 12 | "offset": 0, 13 | "slot": "1", 14 | "type": "uint256[49]" 15 | } 16 | ] -------------------------------------------------------------------------------- /packages/contracts-bedrock/snapshots/storageLayout/SequencerFeeVault.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "bytes": "32", 4 | "label": "totalProcessed", 5 | "offset": 0, 6 | "slot": "0", 7 | "type": "uint256" 8 | }, 9 | { 10 | "bytes": "1536", 11 | "label": "__gap", 12 | "offset": 0, 13 | "slot": "1", 14 | "type": "uint256[48]" 15 | } 16 | ] -------------------------------------------------------------------------------- /packages/contracts-bedrock/snapshots/storageLayout/StorageSetter.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /packages/contracts-bedrock/snapshots/storageLayout/SuperchainConfig.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "bytes": "1", 4 | "label": "_initialized", 5 | "offset": 0, 6 | "slot": "0", 7 | "type": "uint8" 8 | }, 9 | { 10 | "bytes": "1", 11 | "label": "_initializing", 12 | "offset": 1, 13 | "slot": "0", 14 | "type": "bool" 15 | } 16 | ] -------------------------------------------------------------------------------- /packages/contracts-bedrock/snapshots/storageLayout/Transactor.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "bytes": "20", 4 | "label": "owner", 5 | "offset": 0, 6 | "slot": "0", 7 | "type": "address" 8 | } 9 | ] -------------------------------------------------------------------------------- /packages/contracts-bedrock/snapshots/storageLayout/TransferOnion.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "bytes": "32", 4 | "label": "_status", 5 | "offset": 0, 6 | "slot": "0", 7 | "type": "uint256" 8 | }, 9 | { 10 | "bytes": "32", 11 | "label": "shell", 12 | "offset": 0, 13 | "slot": "1", 14 | "type": "bytes32" 15 | } 16 | ] -------------------------------------------------------------------------------- /packages/contracts-bedrock/snapshots/storageLayout/TransientReentrancyAware.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /packages/contracts-bedrock/snapshots/storageLayout/WETH.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "bytes": "32", 4 | "label": "balanceOf", 5 | "offset": 0, 6 | "slot": "0", 7 | "type": "mapping(address => uint256)" 8 | }, 9 | { 10 | "bytes": "32", 11 | "label": "allowance", 12 | "offset": 0, 13 | "slot": "1", 14 | "type": "mapping(address => mapping(address => uint256))" 15 | } 16 | ] -------------------------------------------------------------------------------- /packages/contracts-bedrock/snapshots/storageLayout/WETH98.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "bytes": "32", 4 | "label": "balanceOf", 5 | "offset": 0, 6 | "slot": "0", 7 | "type": "mapping(address => uint256)" 8 | }, 9 | { 10 | "bytes": "32", 11 | "label": "allowance", 12 | "offset": 0, 13 | "slot": "1", 14 | "type": "mapping(address => mapping(address => uint256))" 15 | } 16 | ] -------------------------------------------------------------------------------- /packages/contracts-bedrock/src/cannon/libraries/MIPSState.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.15; 3 | 4 | library MIPSState { 5 | struct CpuScalars { 6 | uint32 pc; 7 | uint32 nextPC; 8 | uint32 lo; 9 | uint32 hi; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/contracts-bedrock/src/dispute/interfaces/IInitializable.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.0; 3 | 4 | /// @title IInitializable 5 | /// @notice An interface for initializable contracts. 6 | interface IInitializable { 7 | /// @notice Initializes the contract. 8 | /// @dev This function may only be called once. 9 | function initialize() external payable; 10 | } 11 | -------------------------------------------------------------------------------- /packages/contracts-bedrock/src/libraries/L1BlockErrors.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.0; 3 | 4 | /// @notice Error returns when a non-depositor account tries to set L1 block values. 5 | error NotDepositor(); 6 | 7 | /// @notice Error when a chain ID is not in the interop dependency set. 8 | error NotDependency(); 9 | 10 | /// @notice Error when the interop dependency set size is too large. 11 | error DependencySetSizeTooLarge(); 12 | 13 | /// @notice Error when a chain ID already in the interop dependency set is attempted to be added. 14 | error AlreadyDependency(); 15 | 16 | /// @notice Error when the chain's chain ID is attempted to be removed from the interop dependency set. 17 | error CantRemovedDependency(); 18 | -------------------------------------------------------------------------------- /packages/contracts-bedrock/src/libraries/rlp/RLPErrors.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.0; 3 | 4 | /// @notice The length of an RLP item must be greater than zero to be decodable 5 | error EmptyItem(); 6 | 7 | /// @notice The decoded item type for list is not a list item 8 | error UnexpectedString(); 9 | 10 | /// @notice The RLP item has an invalid data remainder 11 | error InvalidDataRemainder(); 12 | 13 | /// @notice Decoded item type for bytes is not a string item 14 | error UnexpectedList(); 15 | 16 | /// @notice The length of the content must be greater than the RLP item length 17 | error ContentLengthMismatch(); 18 | 19 | /// @notice Invalid RLP header for RLP item 20 | error InvalidHeader(); 21 | -------------------------------------------------------------------------------- /packages/contracts-bedrock/src/periphery/drippie/dripchecks/CheckTrue.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.15; 3 | 4 | import { IDripCheck } from "../IDripCheck.sol"; 5 | 6 | /// @title CheckTrue 7 | /// @notice DripCheck that always returns true. 8 | contract CheckTrue is IDripCheck { 9 | /// @inheritdoc IDripCheck 10 | string public name = "CheckTrue"; 11 | 12 | /// @inheritdoc IDripCheck 13 | function check(bytes memory) external pure returns (bool execute_) { 14 | execute_ = true; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/contracts-bedrock/src/periphery/faucet/authmodules/IFaucetAuthModule.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.15; 3 | 4 | import { Faucet } from "../Faucet.sol"; 5 | 6 | /// @title IFaucetAuthModule 7 | /// @notice Interface for faucet authentication modules. 8 | interface IFaucetAuthModule { 9 | /// @notice Verifies that the given drip parameters are valid. 10 | /// @param _params Drip parameters to verify. 11 | /// @param _id Authentication ID to verify. 12 | /// @param _proof Authentication proof to verify. 13 | /// @return valid_ True if the drip parameters are valid. 14 | function verify( 15 | Faucet.DripParameters memory _params, 16 | bytes32 _id, 17 | bytes memory _proof 18 | ) 19 | external 20 | view 21 | returns (bool); 22 | } 23 | -------------------------------------------------------------------------------- /packages/contracts-bedrock/src/periphery/op-nft/libraries/OptimistConstants.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.15; 3 | 4 | /// @title OptimistConstants 5 | /// @notice Library for storing Optimist related constants that are shared in multiple contracts. 6 | library OptimistConstants { 7 | /// @notice Attestation key issued by OptimistInviter allowing the attested account to mint. 8 | bytes32 internal constant OPTIMIST_CAN_MINT_FROM_INVITE_ATTESTATION_KEY = bytes32("optimist.can-mint-from-invite"); 9 | } 10 | -------------------------------------------------------------------------------- /packages/contracts-bedrock/src/universal/ISemver.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.0; 3 | 4 | /// @title ISemver 5 | /// @notice ISemver is a simple contract for ensuring that contracts are 6 | /// versioned using semantic versioning. 7 | interface ISemver { 8 | /// @notice Getter for the semantic version of the contract. This is not 9 | /// meant to be used onchain but instead meant to be used by offchain 10 | /// tooling. 11 | /// @return Semver contract version as a string. 12 | function version() external view returns (string memory); 13 | } 14 | -------------------------------------------------------------------------------- /packages/contracts-bedrock/test/invariants/InvariantTest.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.15; 3 | 4 | import { FFIInterface } from "test/setup/FFIInterface.sol"; 5 | import { Deploy } from "scripts/deploy/Deploy.s.sol"; 6 | import { Test } from "forge-std/Test.sol"; 7 | 8 | /// @title InvariantTest 9 | /// @dev An extension to `Test` that sets up excluded contracts for invariant testing. 10 | contract InvariantTest is Test { 11 | FFIInterface constant ffi = FFIInterface(address(uint160(uint256(keccak256(abi.encode("optimism.ffi")))))); 12 | Deploy internal constant deploy = Deploy(address(uint160(uint256(keccak256(abi.encode("optimism.deploy")))))); 13 | 14 | function setUp() public virtual { 15 | excludeContract(address(ffi)); 16 | excludeContract(address(deploy)); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/contracts-bedrock/test/legacy/LegacyMessagePasser.t.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.15; 3 | 4 | // Testing utilities 5 | import { CommonTest } from "test/setup/CommonTest.sol"; 6 | 7 | contract LegacyMessagePasser_Test is CommonTest { 8 | /// @dev Tests that `passMessageToL1` succeeds. 9 | function test_passMessageToL1_succeeds() external { 10 | vm.prank(alice); 11 | legacyMessagePasser.passMessageToL1(hex"ff"); 12 | assert(legacyMessagePasser.sentMessages(keccak256(abi.encodePacked(hex"ff", alice)))); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/contracts-bedrock/test/libraries/Constants.t.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.15; 3 | 4 | import { Test } from "forge-std/Test.sol"; 5 | import { Constants } from "src/libraries/Constants.sol"; 6 | 7 | contract Constants_Test is Test { 8 | /// @notice Check EIP1967 related constants. 9 | function test_eip1967Constants_succeeds() external pure { 10 | assertEq( 11 | bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1), Constants.PROXY_IMPLEMENTATION_ADDRESS 12 | ); 13 | assertEq(bytes32(uint256(keccak256("eip1967.proxy.admin")) - 1), Constants.PROXY_OWNER_ADDRESS); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/contracts-bedrock/test/mocks/NextImpl.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.15; 3 | 4 | import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; 5 | 6 | /// @title NextImpl 7 | /// @dev Used for testing a future upgrade beyond the current implementations. 8 | // We include some variables so that we can sanity check accessing storage values after an upgrade. 9 | contract NextImpl is Initializable { 10 | // Initializable occupies the zero-th slot. 11 | bytes32 slot1; 12 | bytes32[19] __gap; 13 | bytes32 slot21; 14 | bytes32 public constant slot21Init = bytes32(hex"1337"); 15 | 16 | function initialize(uint8 _init) public reinitializer(_init) { 17 | // Slot21 is unused by an of our upgradeable contracts. 18 | // This is used to verify that we can access this value after an upgrade. 19 | slot21 = slot21Init; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /packages/contracts-bedrock/test/mocks/SimpleStorage.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.0; 3 | 4 | contract SimpleStorage { 5 | mapping(bytes32 => bytes32) public db; 6 | 7 | function set(bytes32 _key, bytes32 _value) public payable { 8 | db[_key] = _value; 9 | } 10 | 11 | function get(bytes32 _key) public view returns (bytes32) { 12 | return db[_key]; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/contracts-bedrock/test/mocks/TestERC20.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.0; 3 | 4 | import { ERC20 } from "@rari-capital/solmate/src/tokens/ERC20.sol"; 5 | 6 | contract TestERC20 is ERC20 { 7 | constructor() ERC20("TEST", "TST", 18) { } 8 | 9 | function mint(address to, uint256 value) public { 10 | _mint(to, value); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/contracts-bedrock/test/mocks/TestERC721.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.0; 3 | 4 | import { ERC721 } from "@rari-capital/solmate/src/tokens/ERC721.sol"; 5 | 6 | contract TestERC721 is ERC721 { 7 | constructor() ERC721("TEST", "TST") { } 8 | 9 | function mint(address to, uint256 tokenId) public { 10 | _mint(to, tokenId); 11 | } 12 | 13 | function tokenURI(uint256) public pure virtual override returns (string memory) { } 14 | } 15 | -------------------------------------------------------------------------------- /packages/contracts-bedrock/test/vendor/AddressAliasHelper.t.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.15; 3 | 4 | import { Test } from "forge-std/Test.sol"; 5 | import { AddressAliasHelper } from "src/vendor/AddressAliasHelper.sol"; 6 | 7 | contract AddressAliasHelper_applyAndUndo_Test is Test { 8 | /// @notice Tests that applying and then undoing an alias results in the original address. 9 | function testFuzz_applyAndUndo_succeeds(address _address) external pure { 10 | address aliased = AddressAliasHelper.applyL1ToL2Alias(_address); 11 | address unaliased = AddressAliasHelper.undoL1ToL2Alias(aliased); 12 | assertEq(_address, unaliased); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/contracts-bedrock/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "outDir": "./dist", 4 | "skipLibCheck": true, 5 | "module": "commonjs", 6 | "target": "es2017", 7 | "sourceMap": true, 8 | "esModuleInterop": true, 9 | "composite": true, 10 | "resolveJsonModule": true, 11 | "declaration": true, 12 | "noImplicitAny": false, 13 | "removeComments": true, 14 | "noLib": false, 15 | "emitDecoratorMetadata": true, 16 | "experimentalDecorators": true, 17 | "typeRoots": [ 18 | "node_modules/@types" 19 | ] 20 | }, 21 | "exclude": [ 22 | "node_modules", 23 | "dist" 24 | ], 25 | "include": [ 26 | "deploy-config/**/*", 27 | "deploy-config/**/*.json", 28 | "scripts/**/*" 29 | ] 30 | } 31 | -------------------------------------------------------------------------------- /packages/devnet-tasks/.depcheckrc: -------------------------------------------------------------------------------- 1 | ignores: [ 2 | "@babel/eslint-parser", 3 | "@typescript-eslint/parser", 4 | "eslint-plugin-import", 5 | "eslint-plugin-unicorn", 6 | "eslint-plugin-jsdoc", 7 | "eslint-plugin-prefer-arrow", 8 | "eslint-plugin-react", 9 | "@typescript-eslint/eslint-plugin", 10 | "eslint-config-prettier", 11 | "eslint-plugin-prettier", 12 | "chai", 13 | "ts-node", 14 | "typedoc", 15 | "typescript", 16 | "ethereum-waffle", 17 | "nyc" 18 | ] 19 | -------------------------------------------------------------------------------- /packages/devnet-tasks/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: '../../.eslintrc.js', 3 | overrides: [], 4 | } 5 | -------------------------------------------------------------------------------- /packages/devnet-tasks/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | build/ 3 | docs/ 4 | -------------------------------------------------------------------------------- /packages/devnet-tasks/.lintstagedrc.yml: -------------------------------------------------------------------------------- 1 | "*.{ts,js}": 2 | - eslint 3 | -------------------------------------------------------------------------------- /packages/devnet-tasks/.prettierrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | ...require('../../.prettierrc.js'), 3 | }; -------------------------------------------------------------------------------- /packages/devnet-tasks/README.md: -------------------------------------------------------------------------------- 1 | # @eth-optimism/devnet-tasks 2 | 3 | `@eth-optimism/devnet-tasks` is a temporary package that hosts two [Hardhat](https://hardhat.org/) tasks used within the [`bedrock-devnet`](/bedrock-devnet/README.md) and is not meant to be published to NPM. 4 | You can generally disregard this package unless you are working on the `bedrock-devnet`. 5 | -------------------------------------------------------------------------------- /packages/devnet-tasks/src/tasks/index.ts: -------------------------------------------------------------------------------- 1 | import './deposit-eth' 2 | import './deposit-erc20' 3 | -------------------------------------------------------------------------------- /packages/devnet-tasks/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "lib": ["ES2021"], 4 | "rootDir": "./src", 5 | "outDir": "./dist", 6 | "skipLibCheck": true, 7 | "module": "commonjs", 8 | "target": "es2017", 9 | "sourceMap": true, 10 | "esModuleInterop": true, 11 | "composite": true, 12 | "resolveJsonModule": true, 13 | "declaration": true, 14 | "noImplicitAny": false, 15 | "removeComments": true, 16 | "noLib": false, 17 | "emitDecoratorMetadata": true, 18 | "experimentalDecorators": true, 19 | "typeRoots": [ 20 | "node_modules/@types" 21 | ] 22 | }, 23 | "exclude": [ 24 | "node_modules", 25 | "dist" 26 | ], 27 | "include": [ 28 | "src/**/*", 29 | "src/forge-artifacts/*.json" 30 | ] 31 | } 32 | -------------------------------------------------------------------------------- /pnpm-workspace.yaml: -------------------------------------------------------------------------------- 1 | packages: 2 | - 'packages/*' 3 | -------------------------------------------------------------------------------- /proxyd/README.md: -------------------------------------------------------------------------------- 1 | # ⚠️ Important 2 | This project has been moved to [ethereum-optimism/infra](https://github.com/ethereum-optimism/infra) 3 | -------------------------------------------------------------------------------- /specs/README.md: -------------------------------------------------------------------------------- 1 | # Specs Have Moved 2 | 3 | Specs have moved to a [dedicated repository](https://github.com/ethereum-optimism/specs). -------------------------------------------------------------------------------- /versions.json: -------------------------------------------------------------------------------- 1 | { 2 | "abigen": "v1.10.25", 3 | "foundry": "63fff3510408b552f11efb8196f48cfe6c1da664", 4 | "geth": "v1.13.14", 5 | "nvm": "v20.9.0", 6 | "slither": "0.10.2", 7 | "kontrol": "0.1.247" 8 | } 9 | --------------------------------------------------------------------------------