-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from Layr-Labs/epociask--chore-eigenda-e2e-test
feat: eigenda e2e test
- Loading branch information
Showing
5 changed files
with
133 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule contracts
updated
9 files
+20 −0 | src/bridge/EigenDABlobVerifierL1.sol | |
+14 −0 | src/bridge/EigenDABlobVerifierL2.sol | |
+13 −0 | src/bridge/IRollupManager.sol | |
+0 −84 | src/bridge/RollupManager.sol | |
+54 −60 | src/bridge/SequencerInbox.sol | |
+2 −3 | src/mocks/SequencerInboxStub.sol | |
+12 −0 | test/foundry/DummyEigenDABlobVerifier.sol | |
+43 −21 | test/foundry/Outbox.t.sol | |
+19 −15 | test/foundry/SequencerInbox.t.sol |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
echo "Pull eigenda-proxy container" | ||
docker pull ghcr.io/layr-labs/eigenda-proxy@sha256:10a4762f5c43e9037835617e6ec0b03da34012df87048a363f43b969ab93679b | ||
|
||
echo "Tagging image" | ||
docker tag ghcr.io/layr-labs/eigenda-proxy@sha256:10a4762f5c43e9037835617e6ec0b03da34012df87048a363f43b969ab93679b eigenda-proxy-nitro-test | ||
|
||
echo "Start eigenda-proxy container" | ||
|
||
docker run -d --name eigenda-proxy-nitro-test \ | ||
-p 4242:6666 \ | ||
-e EIGENDA_PROXY_ADDR=0.0.0.0 \ | ||
-e EIGENDA_PROXY_PORT=6666 \ | ||
-e MEMSTORE_ENABLED=true \ | ||
-e MEMSTORE_EXPIRATION=1m \ | ||
-e EIGENDA_PROXY_TARGET_URL=http://localhost:3000 \ | ||
eigenda-proxy-nitro-test | ||
|
||
## TODO - support teardown or embed a docker client wrapper that spins up and tears down resource | ||
# within system tests. Since this is only used by one system test, it's not a large priority atm. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
// Copyright 2021-2022, Offchain Labs, Inc. | ||
// For license information, see https://github.com/nitro/blob/master/LICENSE | ||
|
||
package arbtest | ||
|
||
import ( | ||
"context" | ||
"math/big" | ||
"testing" | ||
"time" | ||
|
||
"github.com/ethereum/go-ethereum/core/types" | ||
"github.com/ethereum/go-ethereum/ethclient" | ||
"github.com/ethereum/go-ethereum/params" | ||
|
||
"github.com/offchainlabs/nitro/arbnode" | ||
"github.com/offchainlabs/nitro/execution/gethexec" | ||
) | ||
|
||
const ( | ||
proxyURL = "http://127.0.0.1:4242" | ||
) | ||
|
||
func TestEigenDAProxyBatchPosting(t *testing.T) { | ||
|
||
initTest(t) | ||
|
||
ctx, cancel := context.WithCancel(context.Background()) | ||
defer func() { | ||
cancel() | ||
}() | ||
|
||
// Setup L1 chain and contracts | ||
chainConfig := params.ArbitrumDevTestEigenDAConfig() | ||
l1info, l1client, _, l1stack := createTestL1BlockChain(t, nil) | ||
defer requireClose(t, l1stack) | ||
feedErrChan := make(chan error, 10) | ||
addresses, initMessage := DeployOnTestL1(t, ctx, l1info, l1client, chainConfig) | ||
|
||
nodeDir := t.TempDir() | ||
l2info := NewArbTestInfo(t, chainConfig.ChainID) | ||
l1NodeConfigA := arbnode.ConfigDefaultL1Test() | ||
l1NodeConfigB := arbnode.ConfigDefaultL1NonSequencerTest() | ||
sequencerTxOpts := l1info.GetDefaultTransactOpts("Sequencer", ctx) | ||
sequencerTxOptsPtr := &sequencerTxOpts | ||
parentChainID := big.NewInt(1337) | ||
{ | ||
|
||
// Setup L2 chain | ||
_, l2stackA, l2chainDb, l2arbDb, l2blockchain := createL2BlockChainWithStackConfig(t, l2info, nodeDir, chainConfig, initMessage, nil, nil) | ||
l2info.GenerateAccount("User2") | ||
|
||
// Setup EigenDA config | ||
l1NodeConfigA.EigenDA.Enable = true | ||
l1NodeConfigA.EigenDA.Rpc = proxyURL | ||
|
||
execA, err := gethexec.CreateExecutionNode(ctx, l2stackA, l2chainDb, l2blockchain, l1client, gethexec.ConfigDefaultTest) | ||
Require(t, err) | ||
|
||
l2Cfg := l2blockchain.Config() | ||
l2Cfg.ArbitrumChainParams.DataAvailabilityCommittee = false | ||
l2Cfg.ArbitrumChainParams.EigenDA = true | ||
nodeA, err := arbnode.CreateNode(ctx, l2stackA, execA, l2arbDb, NewFetcherFromConfig(l1NodeConfigA), l2Cfg, l1client, addresses, sequencerTxOptsPtr, sequencerTxOptsPtr, nil, feedErrChan, parentChainID, nil) | ||
Require(t, err) | ||
Require(t, nodeA.Start(ctx)) | ||
l2clientA := ClientForStack(t, l2stackA) | ||
|
||
l1NodeConfigB.BlockValidator.Enable = false | ||
l1NodeConfigB.EigenDA.Enable = true | ||
l1NodeConfigB.EigenDA.Rpc = proxyURL | ||
|
||
l2clientB, nodeB := Create2ndNodeWithConfig(t, ctx, nodeA, l1stack, l1info, &l2info.ArbInitData, l1NodeConfigB, nil, nil) | ||
checkEigenDABatchPosting(t, ctx, l1client, l2clientA, l1info, l2info, big.NewInt(1e12), l2clientB) | ||
nodeA.StopAndWait() | ||
nodeB.StopAndWait() | ||
} | ||
} | ||
|
||
func checkEigenDABatchPosting(t *testing.T, ctx context.Context, l1client, l2clientA *ethclient.Client, l1info, l2info info, expectedBalance *big.Int, l2ClientsToCheck ...*ethclient.Client) { | ||
tx := l2info.PrepareTx("Owner", "User2", l2info.TransferGas, big.NewInt(1e12), nil) | ||
err := l2clientA.SendTransaction(ctx, tx) | ||
Require(t, err) | ||
|
||
_, err = EnsureTxSucceeded(ctx, l2clientA, tx) | ||
Require(t, err) | ||
|
||
// give the inbox reader a bit of time to pick up the delayed message | ||
time.Sleep(time.Millisecond * 100) | ||
|
||
// sending l1 messages creates l1 blocks.. make enough to get that delayed inbox message in | ||
for i := 0; i < 100; i++ { | ||
SendWaitTestTransactions(t, ctx, l1client, []*types.Transaction{ | ||
l1info.PrepareTx("Faucet", "User", 30000, big.NewInt(1e12), nil), | ||
}) | ||
} | ||
|
||
for _, client := range l2ClientsToCheck { | ||
_, err = WaitForTx(ctx, client, tx.Hash(), time.Second*100) | ||
Require(t, err) | ||
|
||
l2balance, err := client.BalanceAt(ctx, l2info.GetAddress("User2"), nil) | ||
Require(t, err) | ||
|
||
if l2balance.Cmp(expectedBalance) != 0 { | ||
Fatal(t, "Unexpected balance:", l2balance) | ||
} | ||
|
||
} | ||
} |