diff --git a/.gitignore b/.gitignore index 88f8a41783bb9..2608c9bf209ad 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,8 @@ +# Added these ingnores for avail-optimism +cmd-addrs-keys.txt + + + .DS_Store node_modules results diff --git a/README.md b/README.md index 5f5cebf16587f..9688ded0d9e02 100644 --- a/README.md +++ b/README.md @@ -2,62 +2,129 @@


- Optimism + Avail X Optimism
-

Optimism is Ethereum, scaled.

+

Avail: Data availability focused blockchain X Low-cost and lightning-fast Ethereum L2 blockchain: Optimism


+# Avail-OP-Stack-Adapter + +### Avail-OP-Stack Adapter integrates the Avail Data Availability layer in Optimism’s OP Stack to create a more optimised and efficient Optimistic Rollup architecture. It is designed to minimise the cost of posting L2 transactions over the DA layer with a better data availability guarantee + +## Contribution Guidelines + +### Rules + +Avail welcomes contributors from every background and skill level. Our mission is to build a community that's not only welcoming and friendly but also aligned with the best development practices. Interested in contributing to this project? Whether you've spotted an issue, have improvement ideas, or want to add new features, we'd love to have your input. Simply open a GitHub issue or submit a pull request to get started. + +1. Before asking any questions regarding how the project works, please read through all the documentation and install the project on your own local machine to try it and understand how it works. Please ask your questions in open channels (Github and [Telegram](https://t.me/avail_uncharted/)). + +2. To work on an issue, first, get approval from a maintainer or team member. You can request to be assigned by commenting on the issue in GitHub. This respects the efforts of others who may already be working on the same issue. Unapproved PRs may be declined. + +3. When assigned to an issue, it's expected that you're ready to actively work on it. After assignment, please provide a draft PR or update within one week. If you encounter delays, communicate with us to maintain your assignment. + +4. Got an idea or found a bug? Open an issue with the tags [New Feature] or [Bug]. Provide detailed information like reproduction steps (for bugs) or a basic feature proposal. The team will review and potentially assign you to it. + +5. Start a draft PR early in your development process, even with incomplete changes. This allows us to track progress, provide timely reviews, and assist you. Expect feedback on your drafts periodically. + +## What is Avail? + +[Avail](https://www.availproject.org/) is a data availability focused blockchain. Its blocks are designed to provide secure, decentralized and low-cost blockspace for the data availability needs of other blockchains. It is built to meet the needs of next-generation, trust-minimized applications and sovereign rollups. Avail's strengths lie in its innovative security approach, which allows light clients to easily verify data availability through sampling over a peer-to-peer network. Avail’s modular approach simplifies blockchain integration for developers, as they no longer need to worry about validator sets or tokenomics. With Avail's unparalleled data availability interface and powerful security capabilities, developers can create zero-knowledge or fraud-proof-based blockchain applications with greater efficiency and ease. + +At its core, Avail prioritizes ordering and publishing transactions while enabling users to verify the availability of block data without needing to download entire blocks. Avail's data-agnostic nature is one of its defining features. It supports various execution environments, including EVM, WASM, and custom new runtimes, offering a versatile foundation for diverse blockchain applications. + ## What is Optimism? [Optimism](https://www.optimism.io/) is a project dedicated to scaling Ethereum's technology and expanding its ability to coordinate people from across the world to build effective decentralized economies and governance systems. The [Optimism Collective](https://app.optimism.io/announcement) builds open-source software for running L2 blockchains and aims to address key governance and economic challenges in the wider cryptocurrency ecosystem. Optimism operates on the principle of **impact=profit**, the idea that individuals who positively impact the Collective should be proportionally rewarded with profit. **Change the incentives and you change the world.** In this repository, you'll find numerous core components of the OP Stack, the decentralized software stack maintained by the Optimism Collective that powers Optimism and forms the backbone of blockchains like [OP Mainnet](https://explorer.optimism.io/) and [Base](https://base.org). Designed to be "aggressively open source," the OP Stack encourages you to explore, modify, extend, and test the code as needed. Although not all elements of the OP Stack are contained here, many of its essential components can be found within this repository. By collaborating on free, open software and shared standards, the Optimism Collective aims to prevent siloed software development and rapidly accelerate the development of the Ethereum ecosystem. Come contribute, build the future, and redefine power, together. +## Integration of Avail DA layer in OP-Stack + +OP Stack chain is derived from the Data Availability Layer, the Data Availability module(s) used have a significant impact on the security model of a system. For example, if a certain piece of data can no longer be retrieved from the Data Availability Layer, it may not be possible to sync the chain. + +In ORUs, **Sequencer** has the responsibility to submit L2 transactions to a **data availability provider**. Ethereum DA is currently the used Data Availability module for the OP Stack. + +In `Avail-OP-Stack-Adapter`, the Data Availability layer is switched from Ethereum to Avail in OP Stack modular blockchain architecture to create the optimistic rollup. + +1. **Sequencer** posts L2 transaction data on Avail DA and submits the data commitment to Ethereum as `callData`. +2. **Verifier and Rollup nodes** can derive the chain using the data commitment from `callData` to read the L2 transaction data from Avail. + +## Working of Avail-OP-Stack-Adapter + +There are few changes being made in the workflow compared to **`op-stack`** with Ethereum as Data Availability Layer + +1. **`op-avail`** is the module added to integrate the Avail DA with **`op-stack`**. +2. Here, **`op-batcher`** submits the batch of transactions on Avail DA using the **`op-avail`** and gets the data commitment in the return, which is again submitted over Ethereum as `callData` on BatchInbox address. +3. To derive the chain **`op-node`**, first query the data commitment from Ethereum `callData` and then fetch the L2 transaction data through **`op-avail`**. + +Here **`op-node`**, **`op-geth`**, **`op-batcher`** and **`op-proposer`** are the software components of op-stack to learn more about it, follow [**op-stack**](https://github.com/ethereum-optimism/optimism/tree/develop) + +
+
+
+ Avail X Optimism +
+
+ +## Benefits + +ORUs faced with growth challenges due to constrained blockspace and prohibitive costs, have now come to recognize that a scalable [data availability](https://availproject.github.io/?ref=blog.availproject.org) layer is crucial for effectively scaling blockchains. They have come to realize the need for a cost-effective base layer with expandable block space + +Avail is a highly tuned data availability base layer which can provide raw blockspace for next-generation, trust minimized applications and blockchains. it ensures the modular blockchain ecosystem can access secure, affordable and highly available block space for transaction data unlocking significant scaling potential for the industry. + +### Cost + +When inspecting L1 transactions for Ethereum Rollups, we can see the major bottleneck which represents up to 90% of their costs is transaction data. In fact, this is the largest cost item for Ethereum Rollups as [most of their revenues](https://twitter.com/0xKofi/status/1666844191194853383?ref=blog.availproject.org) go towards paying an L1 to publish transaction data. + +Ethereum is the most expensive solution in relation to congestion and demand. Even with EIP-4844 Ethereum will still be costly as it provides only a one-time increase in blockspace. DACs are the cheapest, but this comes at the cost of adopting a more centralized approach. + +Avail is a Data Availablity Sampling based DA provider with no congestion, Using Avail as DA layer will reduce the cost of posting L2 transactional data over L1 layer. + +### High Data Availability + +pre EIP 4844 ethereum has no support of DAS and fraud proof and with low calldata space, where as in Avail + +Avail’s light client network ensures high availability of data through Data Availability Sampling. with validity proof mechanism and high space compared to ethereum’s calldata + ## Documentation -- If you want to build on top of OP Mainnet, refer to the [Optimism Community Hub](https://community.optimism.io) -- If you want to build your own OP Stack based blockchain, refer to the [OP Stack docs](https://stack.optimism.io) -- If you want to contribute to the OP Stack, check out the [Protocol Specs](./specs) +- If you want to build on top of Avail, refer to the [Avail developers](https://www.availproject.org/developer) +- If you want to build your own avail-optimism blockchain, refer to the [Avail Optimism(Optimium)](https://docs.availproject.org/category/optimium/) +- If you want to learn more about OP-Stack and Optimsim, check out the [OP Stack](https://stack.optimism.io/) and [Optimism](https://www.optimism.io/) ## Community +### Optimism + General discussion happens most frequently on the [Optimism discord](https://discord.gg/optimism). Governance discussion can also be found on the [Optimism Governance Forum](https://gov.optimism.io/). -## Contributing - -Read through [CONTRIBUTING.md](./CONTRIBUTING.md) for a general overview of the contributing process for this repository. -Use the [Developer Quick Start](./CONTRIBUTING.md#development-quick-start) to get your development environment set up to start working on the Optimism Monorepo. -Then check out the list of [Good First Issues](https://github.com/ethereum-optimism/optimism/contribute) to find something fun to work on! - -## Security Policy and Vulnerability Reporting +### Avail -Please refer to the canonical [Security Policy](https://github.com/ethereum-optimism/.github/blob/master/SECURITY.md) document for detailed information about how to report vulnerabilities in this codebase. -Bounty hunters are encouraged to check out [the Optimism Immunefi bug bounty program](https://immunefi.com/bounty/optimism/). -The Optimism Immunefi program offers up to $2,000,042 for in-scope critical vulnerabilities. +General discussion happens most frequently on the [Avail discord](https://discord.gg/y6fHnxZQX8). +Other discussion can also be found on the [Avail Forum](https://forum.availproject.org/). -## The Bedrock Upgrade - -OP Mainnet is currently preparing for [its next major upgrade, Bedrock](https://dev.optimism.io/introducing-optimism-bedrock/). -You can find detailed specifications for the Bedrock upgrade within the [specs folder](./specs) in this repository. +## Contributing -Please note that a significant number of packages and folders within this repository are part of the Bedrock upgrade and are NOT currently running in production. -Refer to the Directory Structure section below to understand which packages are currently running in production and which are intended for use as part of the Bedrock upgrade. +Read through [CONTRIBUTING.md](./CONTRIBUTING.md) for a general overview of the contributing process for this repository. +Use the [Developer Quick Start](./CONTRIBUTING.md#development-quick-start) to get your development environment set up to start working on the avail-op-stack-adapter Monorepo. +Then check out the list of [Good First Issues](https://github.com/availproject/avail-op-stack-adapter/contribute) to find something fun to work on! ## Directory Structure
-~~ Production ~~
 ├── packages
 │   ├── common-ts: Common tools for building apps in TypeScript
 │   ├── contracts-bedrock: Bedrock smart contracts.
-│   ├── contracts-periphery: Peripheral contracts for Optimism
-│   ├── core-utils: Low-level utilities that make building Optimism easier
+│   ├── contracts-periphery: Peripheral contracts for avail-op-stack-adapter
+│   ├── core-utils: Low-level utilities that make building avail-op-stack-adapter easier
 │   ├── chain-mon: Chain monitoring services
 │   ├── fault-detector: Service for detecting Sequencer faults
 │   ├── replica-healthcheck: Service for monitoring the health of a replica node
-│   └── sdk: provides a set of tools for interacting with Optimism
+│   └── sdk: provides a set of tools for interacting with avail-op-stack-adapter
+├── op-avail: Avail module to interact with Avail DA
 ├── op-bindings: Go bindings for Bedrock smart contracts.
 ├── op-batcher: L2-Batch Submitter, submits bundles of batches to L1
 ├── op-bootnode: Standalone op-node discovery bootnode
@@ -75,20 +142,6 @@ Refer to the Directory Structure section below to understand which packages are
 ├── ops-bedrock: Bedrock devnet work
 ├── proxyd: Configurable RPC request router and proxy
 └── specs: Specs of the rollup starting at the Bedrock upgrade
-
-~~ Pre-BEDROCK ~~
-├── packages
-│   ├── common-ts: Common tools for building apps in TypeScript
-│   ├── contracts-periphery: Peripheral contracts for Optimism
-│   ├── core-utils: Low-level utilities that make building Optimism easier
-│   ├── chain-mon: Chain monitoring services
-│   ├── fault-detector: Service for detecting Sequencer faults
-│   ├── replica-healthcheck: Service for monitoring the health of a replica node
-│   └── sdk: provides a set of tools for interacting with Optimism
-├── indexer: indexes and syncs transactions
-├── op-exporter: A prometheus exporter to collect/serve metrics from an Optimism node
-├── proxyd: Configurable RPC request router and proxy
-└── technical-documents: audits and post-mortem documents
 
## Branching Model @@ -97,9 +150,8 @@ Refer to the Directory Structure section below to understand which packages are | Branch | Status | | --------------- | -------------------------------------------------------------------------------- | -| [master](https://github.com/ethereum-optimism/optimism/tree/master/) | Accepts PRs from `develop` when intending to deploy to production. | -| [develop](https://github.com/ethereum-optimism/optimism/tree/develop/) | Accepts PRs that are compatible with `master` OR from `release/X.X.X` branches. | -| release/X.X.X | Accepts PRs for all changes, particularly those not backwards compatible with `develop` and `master`. | +| [avail-master](hhttps://github.com/availproject/avail-op-stack-adapter/tree/avail-master/) | Accepts PRs from `avail-develop` when intending to deploy to production. | +| [avail-develop](https://github.com/availproject/avail-op-stack-adapter/tree/avail-develop/) | Accepts PRs that are successfully running without fails. | ### Overview @@ -108,55 +160,16 @@ Please read the linked post if you're planning to make frequent PRs into this re ### Production branch -The production branch is `master`. -The `master` branch contains the code for latest "stable" releases. -Updates from `master` **always** come from the `develop` branch. +The production branch is `avail-master`. +The `avail-master` branch contains the code for latest "stable" releases. +Updates from `avail-master` **always** come from the `avail-develop` branch. ### Development branch -The primary development branch is [`develop`](https://github.com/ethereum-optimism/optimism/tree/develop/). -`develop` contains the most up-to-date software that remains backwards compatible with the latest experimental [network deployments](https://community.optimism.io/docs/useful-tools/networks/). -If you're making a backwards compatible change, please direct your pull request towards `develop`. - -**Changes to contracts within `packages/contracts-bedrock/contracts` are usually NOT considered backwards compatible and SHOULD be made against a release candidate branch**. -Some exceptions to this rule exist for cases in which we absolutely must deploy some new contract after a release candidate branch has already been fully deployed. -If you're changing or adding a contract and you're unsure about which branch to make a PR into, default to using the latest release candidate branch. -See below for info about release candidate branches. - -### Release candidate branches - -Branches marked `release/X.X.X` are **release candidate branches**. -Changes that are not backwards compatible and all changes to contracts within `packages/contracts-bedrock/contracts` MUST be directed towards a release candidate branch. -Release candidates are merged into `develop` and then into `master` once they've been fully deployed. -We may sometimes have more than one active `release/X.X.X` branch if we're in the middle of a deployment. -See table in the **Active Branches** section above to find the right branch to target. - -## Releases - -### Changesets - -We use [changesets](https://github.com/changesets/changesets) to mark packages for new releases. -When merging commits to the `develop` branch you MUST include a changeset file if your change would require that a new version of a package be released. - -To add a changeset, run the command `pnpm changeset` in the root of this monorepo. -You will be presented with a small prompt to select the packages to be released, the scope of the release (major, minor, or patch), and the reason for the release. -Comments within changeset files will be automatically included in the changelog of the package. - -### Triggering Releases - -Releases can be triggered using the following process: - -1. Create a PR that merges the `develop` branch into the `master` branch. -2. Wait for the auto-generated `Version Packages` PR to be opened (may take several minutes). -3. Change the base branch of the auto-generated `Version Packages` PR from `master` to `develop` and merge into `develop`. -4. Create a second PR to merge the `develop` branch into the `master` branch. - -After merging the second PR into the `master` branch, packages will be automatically released to their respective locations according to the set of changeset files in the `develop` branch at the start of the process. -Please carry this process out exactly as listed to avoid `develop` and `master` falling out of sync. - -**NOTE**: PRs containing changeset files merged into `develop` during the release process can cause issues with changesets that can require manual intervention to fix. -It's strongly recommended to avoid merging PRs into develop during an active release. +The primary development branch is [`avail-develop`](https://github.com/availproject/avail-op-stack-adapter/tree/avail-develop/). +`avail-develop` contains the most up-to-date software that remains backwards compatible with the latest experimental. +If you're making a backwards compatible change, please direct your pull request towards `avail-develop`. ## License -All other files within this repository are licensed under the [MIT License](https://github.com/ethereum-optimism/optimism/blob/master/LICENSE) unless stated otherwise. +All other files within this repository are licensed under the [MIT License](https://github.com/availproject/avail-op-stack-adapter/blob/avail-master/LICENSE) unless stated otherwise. diff --git a/go.mod b/go.mod index 00ea82efb8a21..44a82bf90bd09 100644 --- a/go.mod +++ b/go.mod @@ -39,6 +39,7 @@ require ( ) require ( + github.com/ChainSafe/go-schnorrkel v1.0.0 // indirect github.com/DataDog/zstd v1.5.2 // indirect github.com/VictoriaMetrics/fastcache v1.10.0 // indirect github.com/allegro/bigcache v1.2.1 // indirect @@ -47,6 +48,7 @@ require ( github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect github.com/btcsuite/btcd/btcutil v1.1.0 // indirect github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f // indirect + github.com/centrifuge/go-substrate-rpc-client/v4 v4.1.0 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/cockroachdb/errors v1.9.1 // indirect github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect @@ -54,10 +56,13 @@ require ( github.com/cockroachdb/redact v1.1.3 // indirect github.com/containerd/cgroups v1.1.0 // indirect github.com/coreos/go-systemd/v22 v22.5.0 // indirect + github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c // indirect + github.com/deckarep/golang-set v1.8.0 // indirect github.com/deckarep/golang-set/v2 v2.1.0 // indirect + github.com/decred/base58 v1.0.3 // indirect github.com/decred/dcrd/crypto/blake256 v1.0.0 // indirect github.com/deepmap/oapi-codegen v1.8.2 // indirect github.com/docker/docker v20.10.24+incompatible // indirect @@ -84,6 +89,8 @@ require ( github.com/google/uuid v1.3.0 // indirect github.com/gorilla/websocket v1.5.0 // indirect github.com/graph-gophers/graphql-go v1.3.0 // indirect + github.com/gtank/merlin v0.1.1 // indirect + github.com/gtank/ristretto255 v0.1.2 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-bexpr v0.1.11 // indirect github.com/holiman/bloomfilter/v2 v2.0.3 // indirect @@ -118,6 +125,7 @@ require ( github.com/miekg/dns v1.1.50 // indirect github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b // indirect github.com/mikioh/tcpopt v0.0.0-20190314235656-172688c1accc // indirect + github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0 // indirect github.com/minio/sha256-simd v1.0.0 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mitchellh/pointerstructure v1.2.1 // indirect @@ -134,6 +142,7 @@ require ( github.com/opentracing/opentracing-go v1.2.0 // indirect github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7 // indirect + github.com/pierrec/xxHash v0.1.5 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/client_model v0.3.0 // indirect github.com/prometheus/common v0.39.0 // indirect @@ -157,6 +166,7 @@ require ( github.com/tklauser/go-sysconf v0.3.10 // indirect github.com/tklauser/numcpus v0.5.0 // indirect github.com/tyler-smith/go-bip39 v1.1.0 // indirect + github.com/vedhavyas/go-subkey v1.0.3 // indirect github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect github.com/yusufpapurcu/wmi v1.2.2 // indirect go.uber.org/atomic v1.10.0 // indirect @@ -180,4 +190,7 @@ require ( replace github.com/ethereum/go-ethereum v1.11.6 => github.com/ethereum-optimism/op-geth v1.101106.0-rc.2 +//To interact with Avail DA +replace github.com/centrifuge/go-substrate-rpc-client/v4 => github.com/availproject/go-substrate-rpc-client/v4 v4.0.12-avail-1.4.0-rc1-5e286e3 + //replace github.com/ethereum/go-ethereum v1.11.6 => ../go-ethereum diff --git a/go.sum b/go.sum index bbf384ec46390..a0f3f74d9b716 100644 --- a/go.sum +++ b/go.sum @@ -9,23 +9,42 @@ dmitri.shuralyov.com/state v0.0.0-20180228185332-28bcc343414c/go.mod h1:0PRwlb0D git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg= github.com/AndreasBriese/bbloom v0.0.0-20190306092124-e2d15f34fcf9/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= github.com/AndreasBriese/bbloom v0.0.0-20190825152654-46b345b51c96 h1:cTp8I5+VIoKjsnZuH8vjyaysT/ses3EvZeaV/1UkF2M= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.1/go.mod h1:fBF9PQNqB8scdgpZ3ufzaLntG0AG7C1WjPMsiFOmfHM= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v0.3.0/go.mod h1:tPaiy8S5bQ+S5sOiDlINkp7+Ef339+Nz5L5XO+cnOHo= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8= +github.com/ChainSafe/go-schnorrkel v1.0.0 h1:3aDA67lAykLaG1y3AOjs88dMxC88PgUuHRrLeDnvGIM= +github.com/ChainSafe/go-schnorrkel v1.0.0/go.mod h1:dpzHYVxLZcp8pjlV+O+UR8K0Hp/z7vcchBSbMBEhCw4= github.com/CloudyKit/fastprinter v0.0.0-20200109182630-33d98a066a53/go.mod h1:+3IMCy2vIlbG1XG/0ggNQv0SvxCAIpPM5b1nCz56Xno= github.com/CloudyKit/jet/v3 v3.0.0/go.mod h1:HKQPgSJmdK8hdoAbKUUWajkHyHo4RaU5rMdUywE7VMo= github.com/DataDog/zstd v1.5.2 h1:vUG4lAyuPCXO0TLbXvPv7EB7cNK1QV/luu55UHLrrn8= github.com/DataDog/zstd v1.5.2/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= github.com/Joker/hpp v1.0.0/go.mod h1:8x5n+M1Hp5hC0g8okX3sR3vFQwynaX/UgSOM9MeBKzY= github.com/Shopify/goreferrer v0.0.0-20181106222321-ec9c9a553398/go.mod h1:a1uqRtAwp2Xwc6WNPJEufxJ7fx3npB4UV/JOLmbu5I0= +github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/VictoriaMetrics/fastcache v1.10.0 h1:5hDJnLsKLpnUEToub7ETuRu8RCkb40woBZAUiKonXzY= github.com/VictoriaMetrics/fastcache v1.10.0/go.mod h1:tjiYeEfYXCqacuvYw/7UoDIeJaNxq6132xHICNP77w8= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY= +github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= github.com/allegro/bigcache v1.2.1 h1:hg1sY1raCwic3Vnsvje6TT7/pnZba83LeFck5NrFKSc= github.com/allegro/bigcache v1.2.1/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= +github.com/availproject/go-substrate-rpc-client/v4 v4.0.12-avail-1.4.0-rc1-5e286e3 h1:9bPK0/Vd+uOQul3vEBSemRXO+rwqi+UXDAvFzNUlG8A= +github.com/availproject/go-substrate-rpc-client/v4 v4.0.12-avail-1.4.0-rc1-5e286e3/go.mod h1:5g1oM4Zu3BOaLpsKQ+O8PAv2kNuq+kPcA1VzFbsSqxE= +github.com/aws/aws-sdk-go-v2 v1.2.0/go.mod h1:zEQs02YRBw1DjK0PoJv3ygDYOFTre1ejlJWl8FwAuQo= +github.com/aws/aws-sdk-go-v2/config v1.1.1/go.mod h1:0XsVy9lBI/BCXm+2Tuvt39YmdHwS5unDQmxZOYe8F5Y= +github.com/aws/aws-sdk-go-v2/credentials v1.1.1/go.mod h1:mM2iIjwl7LULWtS6JCACyInboHirisUUdkBPoTHMOUo= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.0.2/go.mod h1:3hGg3PpiEjHnrkrlasTfxFqUsZ2GCk/fMUn4CbKgSkM= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.0.2/go.mod h1:45MfaXZ0cNbeuT0KQ1XJylq8A6+OpVV2E5kvY/Kq+u8= +github.com/aws/aws-sdk-go-v2/service/route53 v1.1.1/go.mod h1:rLiOUrPLW/Er5kRcQ7NkwbjlijluLsrIbu/iyl35RO4= +github.com/aws/aws-sdk-go-v2/service/sso v1.1.1/go.mod h1:SuZJxklHxLAXgLTc1iFXbEWkXs7QRTQpCLGaKIprQW0= +github.com/aws/aws-sdk-go-v2/service/sts v1.1.1/go.mod h1:Wi0EBZwiz/K44YliU0EKxqTCJGUfYTWXrrBwkq736bM= +github.com/aws/smithy-go v1.1.0/go.mod h1:EzMw8dbp/YJL4A5/sbhGddag+NPT7q084agLbB9LgIw= github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= @@ -49,6 +68,7 @@ github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtyd github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f h1:bAs4lUbRJpnnkd9VhRV3jjAVU7DJVjMaK+IsvSeZvFo= github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= +github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce/go.mod h1:0DVlHczLPewLcPGEIeUEzfOJhqGPQ0mJJRDBtD307+o= github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= github.com/btcsuite/goleveldb v1.0.0/go.mod h1:QiK9vBlgftBg6rWQIj6wFzbPfRjiykIEhBH4obrXJ/I= @@ -59,7 +79,9 @@ github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46f github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/cp v0.1.0 h1:SE+dxFebS7Iik5LK0tsi1k9ZCxEaFX4AjQmoyA+1dJk= +github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s= github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= @@ -68,6 +90,7 @@ github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5P github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/cilium/ebpf v0.2.0/go.mod h1:To2CFviqOWL/M0gIMsvSMlqe7em/l1ALkX1PyjrX2Qs= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cloudflare/cloudflare-go v0.14.0/go.mod h1:EnwdgGMaFOruiPZRFSgn+TsQ3hQ7C/YWzIGLeu5c304= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cockroachdb/datadriven v1.0.2 h1:H9MtNqVoVhvd9nCBwOyDjUEdZCREqbIdCJD93PBm/jA= github.com/cockroachdb/datadriven v1.0.2/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU= @@ -80,6 +103,7 @@ github.com/cockroachdb/pebble v0.0.0-20230209160836-829675f94811 h1:ytcWPaNPhNoG github.com/cockroachdb/pebble v0.0.0-20230209160836-829675f94811/go.mod h1:Nb5lgvnQ2+oGlE/EyZy4+2/CxRh9KfvCXnag1vtpxVM= github.com/cockroachdb/redact v1.1.3 h1:AKZds10rFSIj7qADf0g46UixK8NNLwWTNdCIGS5wfSQ= github.com/cockroachdb/redact v1.1.3/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= +github.com/cockroachdb/sentry-go v0.6.1-cockroachdb.2/go.mod h1:8BT+cPK6xvFOcRlk0R8eg+OTkcqI6baNH4xAkpiYVvQ= github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0/go.mod h1:4Zcjuz89kmFXt9morQgcfYZAYZ5n8WHjt81YYWIwtTM= github.com/containerd/cgroups v0.0.0-20201119153540-4cbc285b3327/go.mod h1:ZJeTFisyysqgcCdecO57Dj79RfL0LNeGiFUqLYQRYLE= github.com/containerd/cgroups v1.1.0 h1:v8rEWFl6EoqHB+swVNjVoCJE8o3jX7e8nqBGPLaDFBM= @@ -91,6 +115,9 @@ github.com/coreos/go-systemd v0.0.0-20181012123002-c6f51f82210d/go.mod h1:F5haX7 github.com/coreos/go-systemd/v22 v22.1.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+1atmu1JpKERPPk= github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= +github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= +github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= +github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= @@ -104,8 +131,12 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c h1:pFUpOrbxDR6AkioZ1ySsx5yxlDQZ8stG2b88gTPxgJU= github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c/go.mod h1:6UhI8N9EjYm1c2odKpFpAYeR8dsBeM7PtzQhRgxRr9U= +github.com/deckarep/golang-set v1.8.0 h1:sk9/l/KqpunDwP7pSjUg0keiOOLEnOBHzykLrsPppp4= +github.com/deckarep/golang-set v1.8.0/go.mod h1:5nI87KwE7wgsBU1F4GKAw2Qod7p5kyS383rP6+o6qqo= github.com/deckarep/golang-set/v2 v2.1.0 h1:g47V4Or+DUdzbs8FxCCmgb6VYd+ptPAngjM6dtGktsI= github.com/deckarep/golang-set/v2 v2.1.0/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4= +github.com/decred/base58 v1.0.3 h1:KGZuh8d1WEMIrK0leQRM47W85KqCAdl2N+uagbctdDI= +github.com/decred/base58 v1.0.3/go.mod h1:pXP9cXCfM2sFLb2viz2FNIdeMWmZDBKG3ZBYbiSM78E= github.com/decred/dcrd/crypto/blake256 v1.0.0 h1:/8DMNYp9SGi5f0w7uCm6d6M4OU2rGFK09Y2A4Xv7EE0= github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs= @@ -145,6 +176,7 @@ github.com/ethereum-optimism/go-ethereum-hdwallet v0.1.3/go.mod h1:QziizLAiF0Kqy github.com/ethereum-optimism/op-geth v1.101106.0-rc.2 h1:F3SGS0XIvRQ0MjL3Rzbx3A688hNsqv/DtdlBnZimFTw= github.com/ethereum-optimism/op-geth v1.101106.0-rc.2/go.mod h1:X9t7oeerFMU9/zMIjZKT/jbIca+O05QqtBTLjL+XVeA= github.com/fasthttp-contrib/websocket v0.0.0-20160511215533-1f3b11f56072/go.mod h1:duJ4Jxv5lDcvg4QuQr0oowTf7dz4/CR8NtyCooz9HL8= +github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/felixge/fgprof v0.9.3 h1:VvyZxILNuCiUCSXtPtYmmtGvb65nqXh2QFWc0Wpf2/g= github.com/felixge/fgprof v0.9.3/go.mod h1:RdbpDgzqYVh/T9fPELJyV7EYJuHB55UTEULNun8eiPw= @@ -180,6 +212,7 @@ github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclK github.com/go-chi/chi/v5 v5.0.0/go.mod h1:BBug9lr0cqtdAhsu6R4AAdvufI0/XBzAQSsUqJpoZOs= github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q= github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= +github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-martini/martini v0.0.0-20170121215854-22fa46961aab/go.mod h1:/P9AEU963A2AYjv4d1V5eVL1CQbEJq6aCNHDDjibzu8= github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= @@ -194,6 +227,7 @@ github.com/go-playground/universal-translator v0.18.0 h1:82dyy6p4OuJq4/CByFNOn/j github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI= github.com/go-playground/validator/v10 v10.11.1 h1:prmOlTVv+YjZjmRmNSF3VmspqJIxJWXmqUsHwfTRRkQ= github.com/go-sourcemap/sourcemap v2.1.3+incompatible h1:W1iEw64niKVGogNgBN3ePyLFfuisuzeidWPMPWmECqU= +github.com/go-sourcemap/sourcemap v2.1.3+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg= github.com/go-stack/stack v1.8.1 h1:ntEHSVwIt7PNXNpgPmVfMrNhLtgjlmnZha2kOpuRiDw= github.com/go-stack/stack v1.8.1/go.mod h1:dcoOX6HbPZSZptuspn9bctJ+N/CnF5gGygcUP3XYfe4= github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 h1:p104kn46Q8WdvHunIJ9dAyjPVtrBPhSr3KT2yUst43I= @@ -289,6 +323,11 @@ github.com/graph-gophers/graphql-go v1.3.0 h1:Eb9x/q6MFpCLz7jBCiP/WTxjSDrYLR1QY4 github.com/graph-gophers/graphql-go v1.3.0/go.mod h1:9CQHMSxwO4MprSdzoIEobiHpoLtHm77vfxsvsIN5Vuc= github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= github.com/grpc-ecosystem/grpc-gateway v1.5.0/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw= +github.com/gtank/merlin v0.1.1-0.20191105220539-8318aed1a79f/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= +github.com/gtank/merlin v0.1.1 h1:eQ90iG7K9pOhtereWsmyRJ6RAwcP4tHTDBHXNg+u5is= +github.com/gtank/merlin v0.1.1/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= +github.com/gtank/ristretto255 v0.1.2 h1:JEqUCPA1NvLq5DwYtuzigd7ss8fwbYay9fi4/5uMzcc= +github.com/gtank/ristretto255 v0.1.2/go.mod h1:Ph5OpO6c7xKUGROZfWVLiJf9icMDwUeIvY4OmlYW69o= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= @@ -348,17 +387,22 @@ github.com/jbenet/go-temp-err-catcher v0.1.0 h1:zpb3ZH6wIE8Shj2sKS+khgRvf7T7RABo github.com/jbenet/go-temp-err-catcher v0.1.0/go.mod h1:0kJRvmDZXNMIiJirNPEYfhpPwbGVtZVWC34vc5WLsDk= github.com/jbenet/goprocess v0.1.4 h1:DRGOFReOMqqDNXwW70QkacFW0YN9QnwLV0Vqk+3oU0o= github.com/jbenet/goprocess v0.1.4/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZlqdZVfqY4= +github.com/jedisct1/go-minisign v0.0.0-20190909160543-45766022959e/go.mod h1:G1CVv03EnqU1wYL2dFwXxW2An0az9JTl/ZsqXQeBlkU= github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU= github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= +github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.3.0 h1:U0609e9tgbseu3rBINet9P48AI/D3oJs4dN7jwJOQ1U= +github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k= +github.com/karalabe/usb v0.0.2/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= github.com/kataras/golog v0.0.10/go.mod h1:yJ8YKCmyL+nWjERB90Qwn+bdyBZsaQwU3bTVFgkFIp8= github.com/kataras/iris/v12 v12.1.8/go.mod h1:LMYy4VlP67TQ3Zgriz8RE2h2kMZV2SgMYbq3UhfoFmE= github.com/kataras/neffos v0.0.14/go.mod h1:8lqADm8PnbeFfL7CLXh1WHw53dG27MC3pgi2R1rmoTE= @@ -393,6 +437,7 @@ github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/labstack/echo/v4 v4.2.1/go.mod h1:AA49e0DZ8kk5jTOOCKNuPR6oTnBS0dYiM4FW1e6jwpg= github.com/labstack/echo/v4 v4.5.0/go.mod h1:czIriw4a0C1dFun+ObrXp7ok03xON0N1awStJ6ArI7Y= github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k= @@ -468,6 +513,9 @@ github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b h1:z78hV3sbSMAUoyUM github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b/go.mod h1:lxPUiZwKoFL8DUUmalo2yJJUCxbPKtm8OKfqr2/FTNU= github.com/mikioh/tcpopt v0.0.0-20190314235656-172688c1accc h1:PTfri+PuQmWDqERdnNMiD9ZejrlswWrCpBEZgWOiTrc= github.com/mikioh/tcpopt v0.0.0-20190314235656-172688c1accc/go.mod h1:cGKTAVKx4SxOuR/czcZ/E2RSJ3sfHs8FpHhQ5CWMf9s= +github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM= +github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0 h1:QRUSJEgZn2Snx0EmT/QLXibWjSUDjKWvXIT19NBVp94= +github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM= github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= github.com/minio/sha256-simd v0.1.1-0.20190913151208-6de447530771/go.mod h1:B5e1o+1/KgNmWrSQK08Y6Z1Vb5pwIktudl0J58iy0KM= github.com/minio/sha256-simd v1.0.0 h1:v1ta+49hkWZyvaKwrQB8elexRqm6Y0aMLjCNsrYxo6g= @@ -485,6 +533,7 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/moul/http2curl v1.0.0/go.mod h1:8UbvGypXm98wA/IqH45anm5Y2Z6ep6O31QGOAZ3H0fQ= github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o= @@ -513,6 +562,9 @@ github.com/multiformats/go-multistream v0.4.1/go.mod h1:Mz5eykRVAjJWckE2U78c6xqd github.com/multiformats/go-varint v0.0.1/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= github.com/multiformats/go-varint v0.0.7 h1:sWSGR+f/eu5ABZA2ZpYKBILXTTs9JWpdEM/nEGOHFS8= github.com/multiformats/go-varint v0.0.7/go.mod h1:r8PUYw/fD/SjBCiKOoDlGF6QawOELpZAu9eioSos/OU= +github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/naoina/go-stringutil v0.1.0/go.mod h1:XJ2SJL9jCtBh+P9q5btrd/Ylo8XwT/h1USek5+NqSA0= +github.com/naoina/toml v0.1.2-0.20170918210437-9fafd6967416/go.mod h1:NBIhNtsFMo3G2szEBne+bO4gS192HuIYRqfvOWb4i1E= github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg= github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzEE/Zbp4w= github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= @@ -555,6 +607,8 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9 github.com/pelletier/go-toml/v2 v2.0.5 h1:ipoSadvV8oGUjnUbMub59IDPPwfxF694nG/jwbMiyQg= github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7 h1:oYW+YCJ1pachXTQmzR3rNLYGGz4g/UgFcjb28p/viDM= github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0= +github.com/pierrec/xxHash v0.1.5 h1:n/jBpwTHiER4xYvK3/CdPVnLDPchj8eTJFFLUb4QHBo= +github.com/pierrec/xxHash v0.1.5/go.mod h1:w2waW5Zoa/Wc4Yqe0wgrIYAGKqRMf7czn2HNKXmuL+I= github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4= github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= @@ -657,6 +711,7 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= @@ -689,6 +744,8 @@ github.com/valyala/fasthttp v1.6.0/go.mod h1:FstJa9V+Pj9vQ7OJie2qMHdwemEDaDiSdBn github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV9WzVtRmSR+PDvWpU/qWl4Wa5LApYYX4ZtKbio= +github.com/vedhavyas/go-subkey v1.0.3 h1:iKR33BB/akKmcR2PMlXPBeeODjWLM90EL98OrOGs8CA= +github.com/vedhavyas/go-subkey v1.0.3/go.mod h1:CloUaFQSSTdWnINfBRFjVMkWXZANW+nd8+TI5jYcl6Y= github.com/viant/assertly v0.4.8/go.mod h1:aGifi++jvCrUaklKEKT0BU95igDNaqkvz+49uaYMPRU= github.com/viant/toolbox v0.24.0/go.mod h1:OxMCG57V0PXuIP2HNQrtJf2CjqdmbrOx5EkMILuUhzM= github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= @@ -736,9 +793,11 @@ golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20191227163750-53104e6ec876/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200602180216-279210d13fed/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= @@ -952,6 +1011,7 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/nx.json b/nx.json index 8cafe0ab0e769..886d4006b7ac1 100644 --- a/nx.json +++ b/nx.json @@ -1,7 +1,7 @@ { - "defaultBase": "develop", + "defaultBase": "avail-develop", "affected": { - "defaultBase": "develop" + "defaultBase": "avail-develop" }, "implicitDependencies": { "nx.json": "*" @@ -30,7 +30,10 @@ "{projectRoot}/tsconfig.json", "{projectRoot}/package.json" ], - "default": ["{projectRoot}/**/*", "configsWorkspace"], + "default": [ + "{projectRoot}/**/*", + "configsWorkspace" + ], "srcGenerated": [ "{projectRoot}/src/contract-artifacts.ts", "{projectRoot}/src/contract-deployed-artifacts.ts" @@ -39,17 +42,34 @@ "{projectRoot}/src/**/*", "!{projectRoot}/src/**/*.spec.ts" ], - "productionContracts": ["{projectRoot}/contracts/**/*"], - "production": ["productionSrc", "productionContracts"], - "testing": ["configsWorkspace", "default"] + "productionContracts": [ + "{projectRoot}/contracts/**/*" + ], + "production": [ + "productionSrc", + "productionContracts" + ], + "testing": [ + "configsWorkspace", + "default" + ] }, "targetDefaults": { "lint": { - "inputs": ["{workspaceRoot}/.markdownlint.json", "default"] + "inputs": [ + "{workspaceRoot}/.markdownlint.json", + "default" + ] }, "test": { - "inputs": ["default", "testing", "^production"], - "dependsOn": ["^build"] + "inputs": [ + "default", + "testing", + "^production" + ], + "dependsOn": [ + "^build" + ] }, "build:contracts": { "inputs": [ @@ -57,8 +77,13 @@ "productionContracts", "^productionContracts" ], - "dependsOn": ["^build"], - "outputs": ["{projectRoot}/artifacts", "{projectRoot}/forge-artifacts"] + "dependsOn": [ + "^build" + ], + "outputs": [ + "{projectRoot}/artifacts", + "{projectRoot}/forge-artifacts" + ] }, "build": { "inputs": [ @@ -67,8 +92,13 @@ "production", "^production" ], - "dependsOn": ["^build", "build:contracts"], - "outputs": ["{projectRoot}/dist"] + "dependsOn": [ + "^build", + "build:contracts" + ], + "outputs": [ + "{projectRoot}/dist" + ] } } -} +} \ No newline at end of file diff --git a/op-avail/.gitignore b/op-avail/.gitignore new file mode 100644 index 0000000000000..d344ba6b06cb4 --- /dev/null +++ b/op-avail/.gitignore @@ -0,0 +1 @@ +config.json diff --git a/op-avail/avail/getTxDataByDARef.go b/op-avail/avail/getTxDataByDARef.go new file mode 100644 index 0000000000000..7edd74576f676 --- /dev/null +++ b/op-avail/avail/getTxDataByDARef.go @@ -0,0 +1,26 @@ +package avail + +import ( + "fmt" + + service "github.com/ethereum-optimism/optimism/op-avail/internal/services" + types "github.com/ethereum-optimism/optimism/op-avail/internal/types" + "github.com/ethereum/go-ethereum/log" +) + +func GetTxDataByDARef(RefData []byte, l log.Logger) ([]byte, error) { + //Getting Avail block reference from callData + avail_blk_ref := types.AvailBlockRef{} + err := avail_blk_ref.UnmarshalFromBinary(RefData) + if err != nil { + return []byte{}, fmt.Errorf("Failed to unmarshal the ethereum trxn data to avail block refrence, error:%v", err) + } + l.Info("Avail Block Reference:", "Ref", avail_blk_ref) + + txData, err := service.GetBlockExtrinsicData(avail_blk_ref, l) + if err != nil { + return []byte{}, fmt.Errorf("Failed to get block extrinsic data, error:%v", err) + } + + return txData, nil +} diff --git a/op-avail/avail/submitTxDataAndGetRef.go b/op-avail/avail/submitTxDataAndGetRef.go new file mode 100644 index 0000000000000..915d47fbfc003 --- /dev/null +++ b/op-avail/avail/submitTxDataAndGetRef.go @@ -0,0 +1,32 @@ +package avail + +import ( + "fmt" + + service "github.com/ethereum-optimism/optimism/op-avail/internal/services" + "github.com/ethereum/go-ethereum/log" +) + +func SubmitTxDataAndGetRef(TxData []byte, l log.Logger) ([]byte, error) { + l.Info("Working on batch submission for avail") + + //Checking for the size of TxData + if len(TxData) >= 512000 { + return []byte{}, fmt.Errorf("size of TxData is more than 512KB, it is higher than a single data submit transaction supports on avail") + } + + // Submitting data to Avail + avail_Blk_Ref, err := service.SubmitDataAndWatch(TxData, l) + if err != nil { + return []byte{}, fmt.Errorf("cannot submit data:%v", err) + } + + l.Info("Avail Block Reference:", "Ref", avail_Blk_Ref) + + ref_bytes_Data, err := avail_Blk_Ref.MarshalToBinary() + if err != nil { + return []byte{}, fmt.Errorf("cannot get the binary form of avail block reference:%v", err) + } + + return ref_bytes_Data, nil +} diff --git a/op-avail/internal/config/config.go b/op-avail/internal/config/config.go new file mode 100644 index 0000000000000..7f6f080440886 --- /dev/null +++ b/op-avail/internal/config/config.go @@ -0,0 +1,34 @@ +package config + +import ( + "encoding/json" + "io" + "os" +) + +type Config struct { + Seed string `json:"seed"` + ApiURL string `json:"api_url"` + AppID int `json:"app_id"` +} + +func (c *Config) GetConfig(configFileName string) error { + + jsonFile, err := os.Open(configFileName) + if err != nil { + return err + } + defer jsonFile.Close() + + byteValue, err := io.ReadAll(jsonFile) + if err != nil { + return err + } + + err = json.Unmarshal(byteValue, c) + if err != nil { + return err + } + + return nil +} diff --git a/op-avail/internal/services/getBlockExtrinsicData.go b/op-avail/internal/services/getBlockExtrinsicData.go new file mode 100644 index 0000000000000..3b8b69b324bd8 --- /dev/null +++ b/op-avail/internal/services/getBlockExtrinsicData.go @@ -0,0 +1,70 @@ +package service + +import ( + "errors" + "fmt" + + gsrpc "github.com/centrifuge/go-substrate-rpc-client/v4" + gsrpc_types "github.com/centrifuge/go-substrate-rpc-client/v4/types" + "github.com/centrifuge/go-substrate-rpc-client/v4/types/codec" + "github.com/ethereum-optimism/optimism/op-avail/internal/config" + "github.com/ethereum-optimism/optimism/op-avail/internal/types" + "github.com/ethereum/go-ethereum/log" + "github.com/vedhavyas/go-subkey" +) + +// GetBlock: To fetch the extrinsic Data from block's extrinsic by hash +func GetBlockExtrinsicData(avail_blk_ref types.AvailBlockRef, l log.Logger) ([]byte, error) { + + // Load config + var config config.Config + err := config.GetConfig("../op-avail/config.json") + if err != nil { + l.Error("Unable to create config variable for op-avail") + panic(fmt.Sprintf("cannot get config:%v", err)) + } + + //Intitializing variables + ApiURL := config.ApiURL + Hash := avail_blk_ref.BlockHash + Address := avail_blk_ref.Sender + Nonce := avail_blk_ref.Nonce + + //Creating new substrate api + api, err := gsrpc.NewSubstrateAPI(ApiURL) + if err != nil { + return []byte{}, fmt.Errorf("cannot create api:%w", err) + } + + // Converting this string type into gsrpc_types.hash type + blk_hash, err := gsrpc_types.NewHashFromHexString(Hash) + if err != nil { + return []byte{}, fmt.Errorf("unable to convert string hash into types.hash, error:%v", err) + } + + // Fetching block based on block hash + avail_blk, err := api.RPC.Chain.GetBlock(blk_hash) + if err != nil { + return []byte{}, fmt.Errorf("cannot get block for hash:%v and getting error:%v", Hash, err) + } + + //Extracting the required extrinsic according to the reference + for _, ext := range avail_blk.Block.Extrinsics { + //Extracting sender address for extrinsic + ext_Addr, err := subkey.SS58Address(ext.Signature.Signer.AsID.ToBytes(), 42) + if err != nil { + l.Error("unable to get sender address from extrinsic", "err", err) + } + if ext_Addr == Address && ext.Signature.Nonce.Int64() == Nonce { + args := ext.Method.Args + var data []byte + err = codec.Decode(args, &data) + if err != nil { + return []byte{}, fmt.Errorf("Unable to decode the extrinsic data by address: %v with nonce: %v", Address, Nonce) + } + return data, nil + } + } + + return []byte{}, errors.New(fmt.Sprintf("Didn't found any extrinsic data for address:%v in block having hash:%v", Address, Hash)) +} diff --git a/op-avail/internal/services/submitDataAndWatch.go b/op-avail/internal/services/submitDataAndWatch.go new file mode 100644 index 0000000000000..5ad068ecffdec --- /dev/null +++ b/op-avail/internal/services/submitDataAndWatch.go @@ -0,0 +1,133 @@ +package service + +import ( + "errors" + "fmt" + "time" + + gsrpc "github.com/centrifuge/go-substrate-rpc-client/v4" + "github.com/centrifuge/go-substrate-rpc-client/v4/signature" + gsrpc_types "github.com/centrifuge/go-substrate-rpc-client/v4/types" + "github.com/ethereum-optimism/optimism/op-avail/internal/config" + "github.com/ethereum-optimism/optimism/op-avail/internal/types" + "github.com/ethereum-optimism/optimism/op-avail/internal/utils" + "github.com/ethereum/go-ethereum/log" +) + +// submitData creates a transaction and makes a Avail data submission +func SubmitDataAndWatch(data []byte, l log.Logger) (types.AvailBlockRef, error) { + + //Load variables + var config config.Config + err := config.GetConfig("../op-avail/config.json") + if err != nil { + l.Error("Unable to create config variable for op-avail") + panic(fmt.Sprintf("cannot get config:%v", err)) + } + + //Intitializing variables + ApiURL := config.ApiURL + Seed := config.Seed + AppID := config.AppID + + //Creating new substrate api + api, err := gsrpc.NewSubstrateAPI(ApiURL) + if err != nil { + fmt.Printf("cannot create api: error:%v", err) + return types.AvailBlockRef{}, err + } + + meta, err := api.RPC.State.GetMetadataLatest() + if err != nil { + fmt.Printf("cannot get metadata: error:%v", err) + return types.AvailBlockRef{}, err + } + + appID := 0 + // if app id is greater than 0 then it must be created before submitting data + if AppID != 0 { + appID = AppID + } + + c, err := gsrpc_types.NewCall(meta, "DataAvailability.submit_data", gsrpc_types.NewBytes([]byte(data))) + if err != nil { + fmt.Printf("cannot create new call: error:%v", err) + return types.AvailBlockRef{}, err + } + + // Create the extrinsic + ext := gsrpc_types.NewExtrinsic(c) + + genesisHash, err := api.RPC.Chain.GetBlockHash(0) + if err != nil { + fmt.Printf("cannot get block hash: error:%v", err) + return types.AvailBlockRef{}, err + } + + rv, err := api.RPC.State.GetRuntimeVersionLatest() + if err != nil { + fmt.Printf("cannot get runtime version: error:%v", err) + return types.AvailBlockRef{}, err + } + + keyringPair, err := signature.KeyringPairFromSecret(Seed, 42) + if err != nil { + fmt.Printf("cannot create LeyPair: error:%v", err) + return types.AvailBlockRef{}, err + } + + key, err := gsrpc_types.CreateStorageKey(meta, "System", "Account", keyringPair.PublicKey) + if err != nil { + fmt.Printf("cannot create storage key: error:%v", err) + return types.AvailBlockRef{}, err + } + + var accountInfo gsrpc_types.AccountInfo + ok, err := api.RPC.State.GetStorageLatest(key, &accountInfo) + if err != nil || !ok { + fmt.Printf("cannot get latest storage: error:%v", err) + return types.AvailBlockRef{}, err + } + + nonce := utils.GetAccountNonce(uint32(accountInfo.Nonce)) + //fmt.Println("Nonce from localDatabase:", nonce, " :::::::: from acountInfo:", accountInfo.Nonce) + o := gsrpc_types.SignatureOptions{ + BlockHash: genesisHash, + Era: gsrpc_types.ExtrinsicEra{IsMortalEra: false}, + GenesisHash: genesisHash, + Nonce: gsrpc_types.NewUCompactFromUInt(uint64(nonce)), + SpecVersion: rv.SpecVersion, + Tip: gsrpc_types.NewUCompactFromUInt(0), + AppID: gsrpc_types.NewUCompactFromUInt(uint64(appID)), + TransactionVersion: rv.TransactionVersion, + } + + // Sign the transaction using Alice's default account + err = ext.Sign(keyringPair, o) + if err != nil { + fmt.Printf("cannot sign: error:%v", err) + return types.AvailBlockRef{}, err + } + + // Send the extrinsic + sub, err := api.RPC.Author.SubmitAndWatchExtrinsic(ext) + if err != nil { + fmt.Printf("cannot submit extrinsic: error:%v", err) + return types.AvailBlockRef{}, err + } + + l.Info("Tx batch is submitted to Avail", "length", len(data), "address", keyringPair.Address, "appID", appID) + + defer sub.Unsubscribe() + timeout := time.After(100 * time.Second) + for { + select { + case status := <-sub.Chan(): + if status.IsFinalized { + return types.AvailBlockRef{BlockHash: string(status.AsFinalized.Hex()), Sender: keyringPair.Address, Nonce: o.Nonce.Int64()}, nil + } + case <-timeout: + return types.AvailBlockRef{}, errors.New("Timitout before getting finalized status") + } + } +} diff --git a/op-avail/internal/types/availBlockRef.go b/op-avail/internal/types/availBlockRef.go new file mode 100644 index 0000000000000..20a30e7ca94e6 --- /dev/null +++ b/op-avail/internal/types/availBlockRef.go @@ -0,0 +1,28 @@ +package types + +import ( + "encoding/json" + "fmt" +) + +type AvailBlockRef struct { + BlockHash string // Hash for block on avail chain + Sender string // sender address to filter extrinsic out sepecifically for this address + Nonce int64 // nonce to filter specific extrinsic +} + +func (a *AvailBlockRef) MarshalToBinary() ([]byte, error) { + ref_bytes, err := json.Marshal(a) + if err != nil { + return []byte{}, fmt.Errorf("unable to covert the avail block referece into array of bytes and getting error:%v", err) + } + return ref_bytes, nil +} + +func (a *AvailBlockRef) UnmarshalFromBinary(avail_Blk_Ref []byte) error { + err := json.Unmarshal(avail_Blk_Ref, a) + if err != nil { + return fmt.Errorf("unable to convert avail_Blk_Ref bytes to AvailBlockRef Struct and getting error:%v", err) + } + return nil +} diff --git a/op-avail/internal/utils/utils.go b/op-avail/internal/utils/utils.go new file mode 100644 index 0000000000000..034e49f8b17a3 --- /dev/null +++ b/op-avail/internal/utils/utils.go @@ -0,0 +1,12 @@ +package utils + +var localNonce uint32 = 0 + +func GetAccountNonce(accountNonce uint32) uint32 { + if accountNonce > localNonce { + localNonce = accountNonce + return accountNonce + } + localNonce++ + return localNonce +} diff --git a/op-avail/specs/Steps to run your own avail-optimism chain using avail-op-stack-adapter.md b/op-avail/specs/Steps to run your own avail-optimism chain using avail-op-stack-adapter.md new file mode 100644 index 0000000000000..f9c7d25984756 --- /dev/null +++ b/op-avail/specs/Steps to run your own avail-optimism chain using avail-op-stack-adapter.md @@ -0,0 +1,517 @@ +# Steps to run your own avail-optimism chain using avail-op-stack-adapter + +# Overview + +Hello! This guide is meant to help you kick off your Avail-OP Stack journey by taking you through the process of spinning up your very own avail-optimism chain on the Ethereum Goerli testnet as settlement layer and Avail kate testnet as Data Avalibility layer. + +# Know before you go + +Before we kick off, note that this is a relatively long tutorial! You should prepare to set aside an hour or two to get everything running. Here’s an itemized list of what we’re about to do: + +1. Install dependencies +2. Build the source code +3. Generate and fund accounts and private keys +4. Configure your network +5. Deploy the L1 contracts +6. Initialize op-geth +7. Run op-geth +8. Run op-node +9. Get some Goerli ETH on your L2 +10. Send some test transactions +11. Celebrate! + +# Prerequisites + +You’ll need the following software installed to follow this tutorial: + +- **[Git](https://git-scm.com/)** +- **[Go](https://go.dev/)** +- **[Node](https://nodejs.org/en/)** +- **[Pnpm](https://classic.yarnpkg.com/lang/en/docs/install/)** +- **[Foundry](https://github.com/foundry-rs/foundry#installation)** +- **[Make](https://linux.die.net/man/1/make)** +- **[jq](https://github.com/jqlang/jq)** +- **[direnv](https://direnv.net/)** + +This tutorial was checked on: + +| Software | Version | Installation command(s) | +| --- | --- | --- | +| Ubuntu | 20.04 LTS | | +| git, curl, jq, and make | OS default | sudo apt install -y git curl make jq | +| Go | 1.20 | sudo apt updatewget xvzf go1.20.linux-amd64.tar.gzsudo cp go/bin/go /usr/bin/gosudo mv go /usr/libecho export GOROOT=/usr/lib/go >> ~/.bashrc | +| Node | 16.19.0 | curl -fsSL | sudo -E bash -sudo apt-get install -y nodejs npm | +| pnpm | 8.5.6 | sudo npm install -g pnpm | +| Foundry | 0.2.0 | yarn install:foundry | + +# Build the Source Code + +We’re going to be spinning up an EVM Rollup from the Avail-OP-Stack-Adapter source code. The Avail-Optimism is split between two repositories, the **[Avail-OP-Stack Adapter](https://github.com/availproject/avail-op-stack-adapter) monorepo** and the **[op-geth](https://github.com/ethereum-optimism/op-geth)** repository. + +# Build the Optimism Monorepo + +1. Clone the [Avail-OP-Stack Adapter](https://github.com/availproject/avail-optimism). + + ```bash + cd ~ + git clone https://github.com/availproject/avail-op-stack-adapter.git + ``` + +2. Enter the Avail-OP-Stack Monorepo. + + ```bash + cd avail-op-stack-adapter + ``` + +3. Install required modules. This is a slow process, while it is running you can already start building `op-geth`, as shown below. + + ```bash + pnpm install + ``` + +4. Build the various packages inside of the Optimism Monorepo. + + ```bash + make op-node op-batcher op-proposer + pnpm build + ``` + +# Build op-geth + +1. Clone **[op-geth](https://github.com/ethereum-optimism/op-geth)** : + + ```bash + cd ~ + git clone https://github.com/ethereum-optimism/op-geth.git + ``` + +2. Enter `op-geth`: + + ```bash + cd op-geth + ``` + +3. Build `op-geth`: + + ```bash + make geth + ``` + +# Get access to a Goerli node + +Since we’re deploying our Avail-Optimism chain to Goerli, you’ll need to have access to a Goerli L1 node. You can either use a node provider like **[Alchemy](https://www.alchemy.com/)** (easier) or **[run your own Goerli node](https://notes.ethereum.org/@launchpad/goerli)** (harder). + +# Generate some keys + +You’ll need four accounts and their private keys when setting up the chain: + +- The `Admin` account which has the ability to upgrade contracts. +- The `Batcher` account which publishes Sequencer transaction data to L1. +- The `Proposer` account which publishes L2 transaction results to L1. +- The `Sequencer` account which signs blocks on the p2p network. + +You can generate all of these keys with the `rekey` tool in the `contracts-bedrock` package. + +1. Enter the Avail-Optimism Monorepo: + + ```bash + cd avail-op-stack-adapter + ``` + +2. Move into the `contracts-bedrock` package: + + ```bash + cd packages/contracts-bedrock + ``` + +3. Use `cast wallet` to generate new accounts + + ```bash + echo "Admin:" + cast wallet new + echo "Proposer:" + cast wallet new + echo "Batcher:" + cast wallet new + echo "Sequencer:" + cast wallet new + ``` + +You should get an output like the following: + +``` +Admin: +Successfully created new keypair. +Address: 0x9f92bdF0db69264462FC305913960Edfcc7a7c7F +Private key: 0x30e66956e1a12b81f0f2cfb982286b2f566eb73649833831d9f80b12f8fa183c +Proposer: +Successfully created new keypair. +Address: 0x31dE9B6473fc47af36ec23878bA34824B9F4AB30 +Private key: 0x8bd1c8dfffef880f8f9ab8162f97ccd119c1aac28fe00dacf919459f88e0f37d +Batcher: +Successfully created new keypair. +Address: 0x6A3DC843843139f17Fcf04C057bb536A421DC9c6 +Private key: 0x3ce44144b7fde797a28f4e47b210a4d42c3a3b642e538b54458cba2740db5ac2 +Sequencer: +Successfully created new keypair. +Address: 0x98C6cadB1fe77aBB7bD968fC3E9b206111e72848 +Private key: 0x3f4241229bb6f155140d98e0f5dd2aad7ae983f5af5d61555d05eb8e5d9514db +``` + +Save these accounts and their respective private keys somewhere, you’ll need them later. Fund the `Admin` address with a small amount of Goerli ETH as we’ll use that account to deploy our smart contracts. You’ll also need to fund the `Proposer` and `Batcher` address — note that the `Batcher` burns through the most ETH because it publishes transaction data to L1. + +Recommended funding amounts are as follows: + +- `Admin` — 2 ETH +- `Proposer` — 5 ETH +- `Batcher` — 10 ETH + +**Not for production deployments** + +The `cast wallet new` tool is *not* designed for production deployments. If you are deploying an Avail-Optimism Stack based chain into production, you should likely be using a combination of hardware security modules and hardware wallets. + +# Configure your network + +Once you’ve built both repositories, you’ll need head back to the Avail-Op-Stack-Adapter Monorepo to set up the configuration for your chain. Currently, chain configuration lives inside of the **[contracts-bedrock](https://github.com/availproject/avail-optimism/tree/129032f15b76b0d2a940443a39433de931a97a44/packages/contracts-bedrock)** package. + +1. Enter the Avail-OP-Stack Monorepo: + + ```bash + cd ~/avail-op-stack-adapter + ``` + +2. Move into the `contracts-bedrock` package: + + ```bash + cd packages/contracts-bedrock + ``` + +3. Inside of `contracts-bedrock`, copy the environment file + + ``` + cp .envrc.example .envrc + ``` + +4. Fill out the environment variables inside of that file: + - `ETH_RPC_URL` — URL for your L1 node. + - `PRIVATE_KEY` — Private key of the `Admin` account. + - `DEPLOYMENT_CONTEXT` - Name of the network, should be "avail-optimism" +5. Pull the environment variables into context using `direnv` + + ```bash + direnv allow . + ``` + + If you need to install `direnv`, **[make sure you also modify the shell configuration](https://direnv.net/docs/hook.html)**. + +6. Before we can create our configuration file, we’ll need to pick an L1 block to serve as the starting point for our Rollup. It’s best to use a finalized L1 block as our starting block. You can use the `cast` command provided by Foundry to grab all of the necessary information: + + ```bash + cast block finalized --rpc-url $ETH_RPC_URL | grep -E "(timestamp|hash|number)" + ``` + + You’ll get back something that looks like the following: + + ``` + hash 0x784d8e7f0e90969e375c7d12dac7a3df6879450d41b4cb04d4f8f209ff0c4cd9 + number 8482289 + timestamp 1676253324 + ``` + +7. Create a copy of file `deploy-config/getting-started.json` at `deploy-config` named `avail-optimism.json` +8. Fill out the remainder of the pre-populated config file **`deploy-config/avail-optimism.json`**. Use the default values in the config file and make following modifications: + - Replace `"ADMIN"` with the address of the Admin account you generated earlier. + - Replace `"PROPOSER"` with the address of the Proposer account you generated earlier. + - Replace `"BATCHER"` with the address of the Batcher account you generated earlier. + - Replace `"SEQUENCER"` with the address of the Sequencer account you generated earlier. + - Replace `"BLOCKHASH"` with the blockhash you got from the `cast` command. + - Replace `TIMESTAMP` with the timestamp you got from the `cast` command. Note that although all the other fields are strings, this field is a number! Don’t include the quotation marks. +9. Check the value of `enableDA` config variable should be `true` to use Avail chain as DA or you can set it to `false` for using ethereum as DA +10. Move into `op-avail` module + + ```bash + cd ~/avail-op-stack-adapter/op-avail + ``` + +11. Add a `config.json` file to this directory with these variables and change the `seed` and `app_id` according to your avail account + + ``` + { + "seed": "test test test test test test test test test test test avail", + "api_url": "wss://kate.avail.tools:443/ws", + "app_id": 1 + } + ``` + +# Deploy the L1 contracts + +Once you’ve configured your network, it’s time to deploy the L1 smart contracts necessary for the functionality of the chain. + +1. Create a `avail-optimism` deployment directory. + + ```bash + mkdir deployments/avail-optimism + ``` + +2. Once you’re ready, deploy the L1 smart contracts. + + ```bash + forge script scripts/Deploy.s.sol:Deploy --private-key $PRIVATE_KEY --broadcast --rpc-url $ETH_RPC_URL + forge script scripts/Deploy.s.sol:Deploy --sig 'sync()' --private-key $PRIVATE_KEY --broadcast --rpc-url $ETH_RPC_URL + + ``` + +Contract deployment can take up to 15 minutes. Please wait for all smart contracts to be fully deployed before continuing to the next step. + +# Generate the L2 config files + +We’ve set up the L1 side of things, but now we need to set up the L2 side of things. We do this by generating three important files, a `genesis.json` file, a `rollup.json` configuration file, and a `jwt.txt` **[JSON Web Token](https://jwt.io/introduction)** that allows the `op-node` and `op-geth` to communicate securely. + +1. Head over to the `op-node` package. + + ```bash + cd ~/avail-op-stack-adapter/op-node + ``` + +2. Run the following command, and make sure to replace `` with your L1 RPC URL: + + ```bash + go run cmd/main.go genesis l2 \ + --deploy-config ../packages/contracts-bedrock/deploy-config/avail-optimism.json \ + --deployment-dir ../packages/contracts-bedrock/deployments/avail-optimism/ \ + --outfile.l2 genesis.json \ + --outfile.rollup rollup.json \ + --l1-rpc=$L1_RPC + ``` + + You should then see the `genesis.json` and `rollup.json` files inside the `op-node` package. + +3. Next, generate the `jwt.txt` file with the following command: + + ```bash + openssl rand -hex 32 > jwt.txt + ``` + +4. Finally, we’ll need to copy the `genesis.json` file and `jwt.txt` file into `op-geth` so we can use it to initialize and run `op-geth` in just a minute: + + ```bash + cp genesis.json ~/op-geth + cp jwt.txt ~/op-geth + ``` + +# Initialize op-geth + +We’re almost ready to run our chain! Now we just need to run a few commands to initialize `op-geth`. We’re going to be running a Sequencer node, so we’ll need to import the `Sequencer` private key that we generated earlier. This private key is what our Sequencer will use to sign new blocks. + +1. Head over to the `op-geth` repository: + + ```bash + cd ~/op-geth + ``` + +2. Create a data directory folder: + + ```bash + mkdir datadir + ``` + +3. Next we need to initialize `op-geth` with the genesis file we generated and copied earlier: + + ```bash + build/bin/geth init --datadir=datadir genesis.json + ``` + +Everything is now initialized and ready to go! + +# Run the node software + +There are four components that need to run for a rollup. The first two, `op-geth` and `op-node`, have to run on every node. The other two, `op-batcher` and `op-proposer`, run only in one place, the sequencer that accepts transactions. + +Set these environment variables for the configuration + +| Variable | Value | +| --- | --- | +| SEQ_KEY | Private key of the Sequencer account | +| BATCHER_KEY | Private key of the Batcher accounts, which should have at least 1 ETH | +| PROPOSER_KEY | Private key of the Proposer account | +| L1_RPC | URL for the L1 (such as Goerli) you're using | +| RPC_KIND | The type of L1 server to which you connect, which can optimize requests. Available options are alchemy, quicknode, parity, nethermind, debug_geth, erigon, basic, and any | +| L2OO_ADDR | The address of the L2OutputOracleProxy, available at ~/optimism/packages/contracts-bedrock/deployments/getting-started/L2OutputOracleProxy.json | + +# `op-geth` + +Run `op-geth` with the following commands. + +```bash +cd ~/op-geth + +./build/bin/geth \ + --datadir ./datadir \ + --http \ + --http.corsdomain="*" \ + --http.vhosts="*" \ + --http.addr=0.0.0.0 \ + --http.port=9545 \ + --http.api=web3,debug,eth,txpool,net,engine \ + --ws \ + --ws.addr=0.0.0.0 \ + --ws.port=9546 \ + --ws.origins="*" \ + --ws.api=debug,eth,txpool,net,engine \ + --syncmode=full \ + --gcmode=archive \ + --nodiscover \ + --maxpeers=0 \ + --networkid=42069 \ + --authrpc.vhosts="*" \ + --authrpc.addr=0.0.0.0 \ + --authrpc.port=9551 \ + --authrpc.jwtsecret=./jwt.txt \ + --rollup.disabletxpoolgossip=true +``` + +And `op-geth` should be running! You should see some output, but you won’t see any blocks being created yet because `op-geth` is driven by the `op-node`. We’ll need to get that running next. + +**Why archive mode?** + +Archive mode takes more disk storage than full mode. However, using it is important for two reasons: + +- The `op-proposer` requires access to the full state. If at some point `op-proposer` needs to look beyond 256 blocks in the past (8.5 minutes in the default configuration), for example because it was down for that long, we need archive mode. +- The **explorer** requires archive mode. + +### Reinitializing op-geth + +There are several situations are indicate database corruption and require you to reset the `op-geth` component: + +- When `op-node` errors out when first started and exits. +- When `op-node` emits this error: + + ``` + stage 0 failed resetting: temp: failed to find the L2 Heads to start from: failed to fetch L2 block by hash 0x0000000000000000000000000000000000000000000000000000000000000000 + ``` + +This is the reinitialization procedure: + +1. Stop the `op-geth` process. +2. Delete the geth data. + + ```bash + cd ~/op-geth + rm -rf datadir/geth + ``` + +3. Rerun init. + + ```bash + build/bin/geth init --datadir=datadir genesis.json + ``` + +4. Start `op-geth` +5. Start `op-node` + +# `op-node` + +Once we’ve got `op-geth` running we’ll need to run `op-node`. Like Ethereum, the OP Stack has a consensus client (the `op-node`) and an execution client (`op-geth`). The consensus client drives the execution client over the Engine API. + +```bash +cd ~/optimism/op-node + +./bin/op-node \ + --l2=http://localhost:9551 \ + --l2.jwt-secret=./jwt.txt \ + --sequencer.enabled \ + --sequencer.l1-confs=3 \ + --verifier.l1-confs=3 \ + --rollup.config=./rollup.json \ + --rpc.addr=0.0.0.0 \ + --rpc.port=9547 \ + --p2p.disable \ + --rpc.enable-admin \ + --p2p.sequencer.key=$SEQ_KEY \ + --l1=$L1_RPC \ + --l1.rpckind=$RPC_KIND +``` + +Once you run this command, you should start seeing the `op-node` begin to process all of the L1 information after the starting block number that you picked earlier. Once the `op-node` has enough information, it’ll begin sending Engine API payloads to `op-geth`. At that point, you’ll start to see blocks being created inside of `op-geth`. We’re live! + +**Peer to peer synchronization** + +If you use a chain ID that is also used by others, for example the default (42069), your `op-node` will try to use peer to peer to speed up synchronization. These attempts will fail, because they will be signed with the wrong key, but they will waste time and network resources. + +To avoid this , we start with peer to peer synchronization disabled (`--p2p.disable`). Once you have multiple nodes, it makes sense to use these command line parameters to synchronize between them without getting confused by other blockchains. + +``` + --p2p.static= \ + --p2p.listen.ip=0.0.0.0 \ + --p2p.listen.tcp=9003 \ + --p2p.listen.udp=9003 \ +``` + +# `op-batcher` + +The `op-batcher` takes transactions from the Sequencer and publishes those transactions to L1. Once transactions are on L1, they’re officially part of the Rollup. Without the `op-batcher`, transactions sent to the Sequencer would never make it to L1 and wouldn’t become part of the canonical chain. The `op-batcher` is critical! + +It is best to give the `Batcher` at least 1 Goerli ETH to ensure that it can continue operating without running out of ETH for gas. + +```bash +cd ~/optimism/op-batcher + +./bin/op-batcher \ + --l2-eth-rpc=http://localhost:9545 \ + --rollup-rpc=http://localhost:9547 \ + --poll-interval=10s \ + --sub-safety-margin=6 \ + --num-confirmations=1 \ + --safe-abort-nonce-too-low-count=3 \ + --resubmission-timeout=30s \ + --rpc.addr=0.0.0.0 \ + --rpc.port=9548 \ + --rpc.enable-admin \ + --max-channel-duration=1 \ + --l1-eth-rpc=$L1_RPC \ + --private-key=$BATCHER_KEY +``` + +**Controlling batcher costs** + +The `--max-channel-duration=n` setting tells the batcher to write all the data to L1 every `n` L1 blocks. When it is low, transactions are written to L1 frequently, withdrawals are quick, and other nodes can synchronize from L1 fast. When it is high, transactions are written to L1 less frequently, and the batcher spends less ETH. + +# `op-proposer` + +Now start `op-proposer`, which proposes new state roots. + +```bash +cd ~/optimism/op-proposer + +./bin/op-proposer \ + --poll-interval=12s \ + --rpc.port=9560 \ + --rollup-rpc=http://localhost:9547 \ + --l2oo-address=$L2OO_ADDR \ + --private-key=$PROPOSER_KEY \ + --l1-eth-rpc=$L1_RPC +``` + +# Get some ETH on your Rollup + +Once you’ve connected your wallet, you’ll probably notice that you don’t have any ETH on your Rollup. You’ll need some ETH to pay for gas on your Rollup. The easiest way to deposit Goerli ETH into your chain is to send funds directly to the `L1StandardBridge` contract. You can find the address of the `L1StandardBridge` contract for your chain by looking inside the `deployments` folder in the `contracts-bedrock` package. + +1. First, head over to the `contracts-bedrock` package: + + ```bash + cd ~/optimism/packages/contracts-bedrock + ``` + +2. Grab the address of the proxy to the L1 standard bridge contract: + + ```bash + cat deployments/avail-optimism/L1StandardBridgeProxy.json | jq -r .address + ``` + +3. Grab the L1 bridge proxy contract address and, using the wallet that you want to have ETH on your Rollup, send that address a small amount of ETH on Goerli (0.1 or less is fine). It may take up to 5 minutes for that ETH to appear in your wallet on L2. + +# Hurray + +**Congratulations, you made it! You now have a complete Avail-OP-Stack-Adapter based EVM Rollup.** + +You can use this rollup the same way you’d use any other test blockchain. diff --git a/op-avail/specs/assets/avail-optimism-logo.gif b/op-avail/specs/assets/avail-optimism-logo.gif new file mode 100644 index 0000000000000..76e1c0517be9f Binary files /dev/null and b/op-avail/specs/assets/avail-optimism-logo.gif differ diff --git a/op-avail/specs/assets/avail-optimism-model.png b/op-avail/specs/assets/avail-optimism-model.png new file mode 100644 index 0000000000000..1afde37b23c82 Binary files /dev/null and b/op-avail/specs/assets/avail-optimism-model.png differ diff --git a/op-batcher/batcher/driver.go b/op-batcher/batcher/driver.go index 312c761163dfa..3539d5d83aee3 100644 --- a/op-batcher/batcher/driver.go +++ b/op-batcher/batcher/driver.go @@ -10,6 +10,8 @@ import ( "sync" "time" + avail "github.com/ethereum-optimism/optimism/op-avail/avail" + "github.com/ethereum-optimism/optimism/op-batcher/metrics" "github.com/ethereum-optimism/optimism/op-node/eth" "github.com/ethereum-optimism/optimism/op-node/rollup/derive" @@ -393,6 +395,18 @@ func (l *BatchSubmitter) sendTransaction(txdata txData, queue *txmgr.Queue[txDat TxData: data, GasLimit: intrinsicGas, } + + if l.Rollup.DAEnabled { + // Submit transaction data on Data and get reference to submit on ethereum layer + refData, err := avail.SubmitTxDataAndGetRef(data, l.log) + if err != nil { + l.log.Error("failed to submit txData on avail", "err", err) + return + } + //To add reference on ethereum layer + candidate.TxData = refData + } + queue.Send(txdata, candidate, receiptsCh) } diff --git a/op-bindings/hardhat/types.go b/op-bindings/hardhat/types.go index 8e8e86fca1665..9dd3a36298283 100644 --- a/op-bindings/hardhat/types.go +++ b/op-bindings/hardhat/types.go @@ -2,6 +2,7 @@ package hardhat import ( "encoding/json" + "strings" "github.com/ethereum-optimism/optimism/op-bindings/solc" "github.com/ethereum/go-ethereum/accounts/abi" @@ -14,7 +15,7 @@ type Deployment struct { Name string Abi abi.ABI `json:"abi"` Address common.Address `json:"address"` - Args []any `json:"args"` + Args []interface{} `json:"-"` Bytecode hexutil.Bytes `json:"bytecode"` DeployedBytecode hexutil.Bytes `json:"deployedBytecode"` Devdoc json.RawMessage `json:"devdoc"` @@ -26,6 +27,61 @@ type Deployment struct { Userdoc json.RawMessage `json:"userdoc"` } +// UnmarshalJSON is a custom unmarshaler for Deployment, handling the Args field. This changed recently +// when `foundry` migrated to `alloy` types, and now the Args field within the contract artifact has +// a different serialization format. +// +// This custom unmarshaller should be removed when this is fixed upstream. +// +// Old Example: +// ``` +// "args": [ +// +// "0xCE9FeE676767A25feb9722986148Fcd87085a14e", +// "OVM_L1CrossDomainMessenger" +// +// ], +// ``` +// +// New Example: +// ``` +// "args": "[\"0x45ce2021212883d655348778aC99707d63D49aBc\",\"\\OVM_L1CrossDomainMessenger\\\"]" +// ``` +func (d *Deployment) UnmarshalJSON(data []byte) error { + // Create a type alias to prevent recursion + type DeploymentAlias Deployment + + // Unmarshal all fields except for `Args` + var alias DeploymentAlias + if err := json.Unmarshal(data, &alias); err != nil { + return err + } + + // Unmarshal `Args` manually. + tmp := struct { + Args json.RawMessage `json:"args"` + }{} + if err := json.Unmarshal(data, &tmp); err != nil { + return err + } + + // Strip the `args` string of escapes and quotes. + stripped := strings.ReplaceAll(strings.Trim(string(tmp.Args), "\""), "\\", "") + + // Unmarshal the stripped version of the `args` field. + var args []interface{} + if err := json.Unmarshal([]byte(stripped), &args); err != nil { + return err + } + + // Set the `Args` field in the `Deployment` to the correctly unmarshaled value + alias.Args = args + + // Assign the unmarshaled alias back to the original struct + *d = Deployment(alias) + return nil +} + // Receipt represents the receipt held in a hardhat-deploy // artifact file type Receipt struct { diff --git a/op-chain-ops/genesis/config.go b/op-chain-ops/genesis/config.go index 6b4952ee9ecb3..2d6823ee1848c 100644 --- a/op-chain-ops/genesis/config.go +++ b/op-chain-ops/genesis/config.go @@ -128,6 +128,9 @@ type DeployConfig struct { EIP1559Denominator uint64 `json:"eip1559Denominator"` FundDevAccounts bool `json:"fundDevAccounts"` + + //Flag for check DA enabled + EnableDA bool `json:"enableDA"` } // Check will ensure that the config is sane and return an error when it is not @@ -373,6 +376,7 @@ func (d *DeployConfig) RollupConfig(l1StartBlock *types.Block, l2GenesisBlockHas DepositContractAddress: d.OptimismPortalProxy, L1SystemConfigAddress: d.SystemConfigProxy, RegolithTime: d.RegolithTime(l1StartBlock.Time()), + DAEnabled: d.EnableDA, //flag to check DA enabled }, nil } diff --git a/op-node/.gitignore b/op-node/.gitignore index ba077a4031add..7c4f7a2306e36 100644 --- a/op-node/.gitignore +++ b/op-node/.gitignore @@ -1 +1,6 @@ +# Ingnore for avail-optimism +genesis.json +rollup.json +jwt.txt + bin diff --git a/op-node/rollup/derive/calldata_source.go b/op-node/rollup/derive/calldata_source.go index 52314420a8dee..c297ac4eba159 100644 --- a/op-node/rollup/derive/calldata_source.go +++ b/op-node/rollup/derive/calldata_source.go @@ -11,6 +11,8 @@ import ( "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/log" + avail "github.com/ethereum-optimism/optimism/op-avail/avail" + "github.com/ethereum-optimism/optimism/op-node/eth" "github.com/ethereum-optimism/optimism/op-node/rollup" ) @@ -119,7 +121,18 @@ func DataFromEVMTransactions(config *rollup.Config, batcherAddr common.Address, log.Warn("tx in inbox with unauthorized submitter", "index", j, "err", err) continue // not an authorized batch submitter, ignore } - out = append(out, tx.Data()) + + if config.DAEnabled { + // Get Transaction data from da reference + txData, err := avail.GetTxDataByDARef(tx.Data(), log) + if err != nil { + log.Error("unable to retrieve the data back from Avail", "index", j, "err", err) + panic("Failed to get TxData from Avail block ref") + } + out = append(out, txData) + } else { + out = append(out, tx.Data()) + } } } return out diff --git a/op-node/rollup/types.go b/op-node/rollup/types.go index 2f82a17296d9e..289402882d274 100644 --- a/op-node/rollup/types.go +++ b/op-node/rollup/types.go @@ -84,6 +84,9 @@ type Config struct { DepositContractAddress common.Address `json:"deposit_contract_address"` // L1 System Config Address L1SystemConfigAddress common.Address `json:"l1_system_config_address"` + + //Flag to define the DA property enabled + DAEnabled bool `json:"da_enabled"` } // ValidateL1Config checks L1 config variables for errors. diff --git a/op-service/txmgr/txmgr.go b/op-service/txmgr/txmgr.go index cb5e058cd5d28..ae6d53191775e 100644 --- a/op-service/txmgr/txmgr.go +++ b/op-service/txmgr/txmgr.go @@ -155,6 +155,7 @@ func (m *SimpleTxManager) send(ctx context.Context, candidate TxCandidate) (*typ ctx, cancel = context.WithTimeout(ctx, m.cfg.TxSendTimeout) defer cancel() } + tx, err := m.craftTx(ctx, candidate) if err != nil { return nil, fmt.Errorf("failed to create the tx: %w", err) diff --git a/packages/contracts-bedrock/.gitignore b/packages/contracts-bedrock/.gitignore index 4611ced23b667..69de02f396a22 100644 --- a/packages/contracts-bedrock/.gitignore +++ b/packages/contracts-bedrock/.gitignore @@ -1,3 +1,7 @@ +# Ingnore for avail-optimism +deployments/avail-optimism +deploy-config/avail-optimism.json + artifacts forge-artifacts cache diff --git a/packages/contracts-bedrock/deploy-config/getting-started.json b/packages/contracts-bedrock/deploy-config/getting-started.json index 967b35f7cf9ad..39188a12501a8 100644 --- a/packages/contracts-bedrock/deploy-config/getting-started.json +++ b/packages/contracts-bedrock/deploy-config/getting-started.json @@ -1,57 +1,44 @@ { "numDeployConfirmations": 1, - "finalSystemOwner": "ADMIN", "portalGuardian": "ADMIN", "controller": "ADMIN", - "l1StartingBlockTag": "BLOCKHASH", - "l1ChainID": 5, "l2ChainID": 42069, "l2BlockTime": 2, - "maxSequencerDrift": 600, "sequencerWindowSize": 3600, "channelTimeout": 300, - "p2pSequencerAddress": "SEQUENCER", "batchInboxAddress": "0xff00000000000000000000000000000000042069", "batchSenderAddress": "BATCHER", - "l2OutputOracleSubmissionInterval": 120, "l2OutputOracleStartingBlockNumber": 0, "l2OutputOracleStartingTimestamp": TIMESTAMP, - "l2OutputOracleProposer": "PROPOSER", "l2OutputOracleChallenger": "ADMIN", - "finalizationPeriodSeconds": 12, - "proxyAdminOwner": "ADMIN", "baseFeeVaultRecipient": "ADMIN", "l1FeeVaultRecipient": "ADMIN", "sequencerFeeVaultRecipient": "ADMIN", - "baseFeeVaultMinimumWithdrawalAmount": "0x8ac7230489e80000", "l1FeeVaultMinimumWithdrawalAmount": "0x8ac7230489e80000", "sequencerFeeVaultMinimumWithdrawalAmount": "0x8ac7230489e80000", "baseFeeVaultWithdrawalNetwork": 0, "l1FeeVaultWithdrawalNetwork": 0, "sequencerFeeVaultWithdrawalNetwork": 0, - "gasPriceOracleOverhead": 2100, "gasPriceOracleScalar": 1000000, - "enableGovernance": true, "governanceTokenSymbol": "OP", "governanceTokenName": "Optimism", "governanceTokenOwner": "ADMIN", - "l2GenesisBlockGasLimit": "0x1c9c380", "l2GenesisBlockBaseFeePerGas": "0x3b9aca00", "l2GenesisRegolithTimeOffset": "0x0", - "eip1559Denominator": 50, - "eip1559Elasticity": 10 -} + "eip1559Elasticity": 10, + "enableDA": true +} \ No newline at end of file