test(kt-devnet): add batcher failover kurtosis test#33
Conversation
c548b50 to
2a78e16
Compare
360b1f6 to
c52d9f2
Compare
| } | ||
|
|
||
| // Fetches all the batch-inbox posted commitments from blockNum (inclusive) to current block. | ||
| func fetchBatcherTxsSinceBlock(gethL1Endpoint string, batchInbox string, blockNum uint64) ([]BatcherTx, error) { |
There was a problem hiding this comment.
are there no constructions that are already exist in state derivation pipeline that can be leveraged for reading batcher txs instead?
There was a problem hiding this comment.
Added note in 6111c52
Basically this feels easier for now. If we ever need to manage more complex state (like failing over to 4844 txs), then prob would be good to consider using L1Retriever instead.
| // We assume that this enclave is already running. | ||
| const enclaveName = "eigenda-memstore-devnet" | ||
|
|
||
| // TestFailover tests the failover behavior of the batcher, in response to the proxy returning 503 errors. |
There was a problem hiding this comment.
should we add a comment describing the parallelism limitations?
| // The test then toggles the failover back off and checks that the batcher starts submitting EigenDA batches again. | ||
| // The batches inbox transactions are queried via geth's GraphQL API. | ||
| // TODO: We will also need to test the failover behavior of the node, which currently doesn't finalize after failover (fixed in https://github.com/Layr-Labs/optimism/pull/23) | ||
| func TestFailover(t *testing.T) { |
There was a problem hiding this comment.
will we eventually wanna add tests ensuring failover to?
- keccak commitment mode
- 4844
There was a problem hiding this comment.
keccak yes probably, I'll add a comment. 4844 I don't know... it's hard to implement and not a priority for me.
| // 1. Check that the original commitments are EigenDA | ||
| harness.requireBatcherTxsToBeFromLayer(t, sinceBlock, DALayerEigenDA) | ||
|
|
||
| // 2. Failover and check that the commitments are now EthDA |
| }) | ||
|
|
||
| // assume kurtosis is running and is at least at block 10 (just deploying the contracts takes more than 10 blocks) | ||
| require.GreaterOrEqual(t, harness.testStartL1BlockNum, uint64(10), "Test started too early in the chain") |
There was a problem hiding this comment.
magic number 10 is used in a lot of places - consider using a variable
There was a problem hiding this comment.
Good callout. Hardcoded it and updated the graphql query functions to use both a FROM and a TO block. This then makes the semantics of the test much easier to understand, so I was able to document them more easily: 0dba0f2
| // Test Harness, which contains all the state needed to run the tests. | ||
| // harness also defines some higher-level "require" methods that are used in the tests. | ||
| type harness struct { | ||
| enclaveCtx *enclaves.EnclaveContext |
There was a problem hiding this comment.
not currently used. is it planned for future use, or just there as a template for future tests that might need it?
There was a problem hiding this comment.
Good call, added just in case, but agree its cleaner to remove. Done: 2277e3a
| if batcherTx.daLayer != expectedLayer { | ||
| wrongCommitmentsToDiscard++ | ||
| } | ||
| // as soon as we see 3 ethDA commitments, or an EigenDA commitment, we stop |
There was a problem hiding this comment.
doc seems to describe a previous version of the code which wasn't generalized to expectedLayer
| // Get the kurtosis tag | ||
| tag := field.Tag.Get("kurtosis") | ||
| if tag == "" { | ||
| continue // Skip fields without tags |
There was a problem hiding this comment.
What would be the reason for fields to exist without the tag? Is the idea that you'd add kurtosis fields to production structs?
There was a problem hiding this comment.
None, good catch. This was claude generated. I updated to return error instead: 80fcebf
| // NewServiceEndpoint string `kurtosis:"new-service-name,port-name"` | ||
| } | ||
|
|
||
| func getEndpointsFromKurtosis(enclaveCtx *enclaves.EnclaveContext) (*EnclaveServiceEndpoints, error) { |
There was a problem hiding this comment.
A doc here would be helpful. It looks like this method replaces the service name in the EnclaveServiceEndpoints struct with a valid localhost endpoint?
There was a problem hiding this comment.
Super good callout thanks, I even had to figure out for myself why I was using the localhost endpoints instead of the private ip:port endpoints which are more efficient. Documented in 3065622
| // Update the proxy's memstore config to start returning 503 errors | ||
| // Note: we have to GetConfig, update it and then UpdateConfig because the client doesn't implement a "patch" method, | ||
| // | ||
| // even though the API does support it. |
There was a problem hiding this comment.
nit: weird formatting here, with newline and tab mid-sentence
Was not being used and I had put it there only "in case"
Define l1BlocksQueriedForBatcherTxs and better describe how tests use it Also refactored graphql query to use both FROM and TO blocks, not only FROM. This makes the semantics of the tests easier to understand.
…ServiceEndpoints field doesn't have kurtosis tag
…ndpointsFromKurtosis Also better document the function to explain what its doing
This is done to reflect the fact that batcher currently doesn't support failing over to calldata.
7126821
into
feat--op-batcher-altda-failover-to-ethda
* test(altda): add test for altda->ethda failover * feat(batcher): altda->ethda failover when altda is down * chore: fix typos * fix(fakeDAServer): handlePut was still handling put when in failover mode * Update op-batcher/batcher/driver.go Co-authored-by: Gaston Ponti <pontigaston@gmail.com> * chore: better logs in batcher * test(kt-devnet): add batcher failover kurtosis test (#33) * test(kt-devnet): add batcher failover test * chore(kt-devnet): use new proxy image v1.6.5 which has memstore rest routes * test(kt-devnet): fix TestFailover + add comments/logs * ci(kt-devnet): run new kurtosis failover test in ci * test(kt-devnet): remove enclaveCtx from test harness Was not being used and I had put it there only "in case" * test(kt-devnet): refactor failover test to not use hardcoded 10 constant Define l1BlocksQueriedForBatcherTxs and better describe how tests use it Also refactored graphql query to use both FROM and TO blocks, not only FROM. This makes the semantics of the tests easier to understand. * test(kt-devnet): better comments for requireBatcherTxsToBeFromLayer function * teest(kt-devnet): return err from getEndpointsFromKurtosis if EnclaveServiceEndpoints field doesn't have kurtosis tag * docs(kt-failover-test): rename getEndpointsFromKurtosis -> getPublicEndpointsFromKurtosis Also better document the function to explain what its doing * style(kt-devnet): reformat a weirdly tabbed comment * docs(kt-failover-test): describe why we use graphql api insead of l1retriever api * docs(kt-failover-test): add note mentioning that kt tests need to be run sequentially * docs(kt-failover-test): update test name to TestFailoverToEthDACalldata This is done to reflect the fact that batcher currently doesn't support failing over to calldata. * style: fix lint * docs(e2eutils): document returned values for WaitForBlockWithTxFromSender * docs(e2eutils): add doc comment for TransactionsBySender * docs(op-e2e): remove wrong comment in failover_test * docs(op-e2e): better test comment in failover_test * style(op-e2e): merged 2 if statements into one * style: fix comment typo --------- Co-authored-by: Gaston Ponti <pontigaston@gmail.com>
* test(altda): add test for altda->ethda failover * feat(batcher): altda->ethda failover when altda is down * chore: fix typos * fix(fakeDAServer): handlePut was still handling put when in failover mode * Update op-batcher/batcher/driver.go Co-authored-by: Gaston Ponti <pontigaston@gmail.com> * chore: better logs in batcher * test(kt-devnet): add batcher failover kurtosis test (#33) * test(kt-devnet): add batcher failover test * chore(kt-devnet): use new proxy image v1.6.5 which has memstore rest routes * test(kt-devnet): fix TestFailover + add comments/logs * ci(kt-devnet): run new kurtosis failover test in ci * test(kt-devnet): remove enclaveCtx from test harness Was not being used and I had put it there only "in case" * test(kt-devnet): refactor failover test to not use hardcoded 10 constant Define l1BlocksQueriedForBatcherTxs and better describe how tests use it Also refactored graphql query to use both FROM and TO blocks, not only FROM. This makes the semantics of the tests easier to understand. * test(kt-devnet): better comments for requireBatcherTxsToBeFromLayer function * teest(kt-devnet): return err from getEndpointsFromKurtosis if EnclaveServiceEndpoints field doesn't have kurtosis tag * docs(kt-failover-test): rename getEndpointsFromKurtosis -> getPublicEndpointsFromKurtosis Also better document the function to explain what its doing * style(kt-devnet): reformat a weirdly tabbed comment * docs(kt-failover-test): describe why we use graphql api insead of l1retriever api * docs(kt-failover-test): add note mentioning that kt tests need to be run sequentially * docs(kt-failover-test): update test name to TestFailoverToEthDACalldata This is done to reflect the fact that batcher currently doesn't support failing over to calldata. * style: fix lint * docs(e2eutils): document returned values for WaitForBlockWithTxFromSender * docs(e2eutils): add doc comment for TransactionsBySender * docs(op-e2e): remove wrong comment in failover_test * docs(op-e2e): better test comment in failover_test * style(op-e2e): merged 2 if statements into one * style: fix comment typo --------- Co-authored-by: Gaston Ponti <pontigaston@gmail.com>
* test(altda): add test for altda->ethda failover * feat(batcher): altda->ethda failover when altda is down * chore: fix typos * fix(fakeDAServer): handlePut was still handling put when in failover mode * Update op-batcher/batcher/driver.go Co-authored-by: Gaston Ponti <pontigaston@gmail.com> * chore: better logs in batcher * test(kt-devnet): add batcher failover kurtosis test (#33) * test(kt-devnet): add batcher failover test * chore(kt-devnet): use new proxy image v1.6.5 which has memstore rest routes * test(kt-devnet): fix TestFailover + add comments/logs * ci(kt-devnet): run new kurtosis failover test in ci * test(kt-devnet): remove enclaveCtx from test harness Was not being used and I had put it there only "in case" * test(kt-devnet): refactor failover test to not use hardcoded 10 constant Define l1BlocksQueriedForBatcherTxs and better describe how tests use it Also refactored graphql query to use both FROM and TO blocks, not only FROM. This makes the semantics of the tests easier to understand. * test(kt-devnet): better comments for requireBatcherTxsToBeFromLayer function * teest(kt-devnet): return err from getEndpointsFromKurtosis if EnclaveServiceEndpoints field doesn't have kurtosis tag * docs(kt-failover-test): rename getEndpointsFromKurtosis -> getPublicEndpointsFromKurtosis Also better document the function to explain what its doing * style(kt-devnet): reformat a weirdly tabbed comment * docs(kt-failover-test): describe why we use graphql api insead of l1retriever api * docs(kt-failover-test): add note mentioning that kt tests need to be run sequentially * docs(kt-failover-test): update test name to TestFailoverToEthDACalldata This is done to reflect the fact that batcher currently doesn't support failing over to calldata. * style: fix lint * docs(e2eutils): document returned values for WaitForBlockWithTxFromSender * docs(e2eutils): add doc comment for TransactionsBySender * docs(op-e2e): remove wrong comment in failover_test * docs(op-e2e): better test comment in failover_test * style(op-e2e): merged 2 if statements into one * style: fix comment typo --------- Co-authored-by: Gaston Ponti <pontigaston@gmail.com>
* test(altda): add test for altda->ethda failover * feat(batcher): altda->ethda failover when altda is down * chore: fix typos * fix(fakeDAServer): handlePut was still handling put when in failover mode * Update op-batcher/batcher/driver.go Co-authored-by: Gaston Ponti <pontigaston@gmail.com> * chore: better logs in batcher * test(kt-devnet): add batcher failover kurtosis test (#33) * test(kt-devnet): add batcher failover test * chore(kt-devnet): use new proxy image v1.6.5 which has memstore rest routes * test(kt-devnet): fix TestFailover + add comments/logs * ci(kt-devnet): run new kurtosis failover test in ci * test(kt-devnet): remove enclaveCtx from test harness Was not being used and I had put it there only "in case" * test(kt-devnet): refactor failover test to not use hardcoded 10 constant Define l1BlocksQueriedForBatcherTxs and better describe how tests use it Also refactored graphql query to use both FROM and TO blocks, not only FROM. This makes the semantics of the tests easier to understand. * test(kt-devnet): better comments for requireBatcherTxsToBeFromLayer function * teest(kt-devnet): return err from getEndpointsFromKurtosis if EnclaveServiceEndpoints field doesn't have kurtosis tag * docs(kt-failover-test): rename getEndpointsFromKurtosis -> getPublicEndpointsFromKurtosis Also better document the function to explain what its doing * style(kt-devnet): reformat a weirdly tabbed comment * docs(kt-failover-test): describe why we use graphql api insead of l1retriever api * docs(kt-failover-test): add note mentioning that kt tests need to be run sequentially * docs(kt-failover-test): update test name to TestFailoverToEthDACalldata This is done to reflect the fact that batcher currently doesn't support failing over to calldata. * style: fix lint * docs(e2eutils): document returned values for WaitForBlockWithTxFromSender * docs(e2eutils): add doc comment for TransactionsBySender * docs(op-e2e): remove wrong comment in failover_test * docs(op-e2e): better test comment in failover_test * style(op-e2e): merged 2 if statements into one * style: fix comment typo --------- Co-authored-by: Gaston Ponti <pontigaston@gmail.com>
* test(altda): add test for altda->ethda failover * feat(batcher): altda->ethda failover when altda is down * chore: fix typos * fix(fakeDAServer): handlePut was still handling put when in failover mode * Update op-batcher/batcher/driver.go Co-authored-by: Gaston Ponti <pontigaston@gmail.com> * chore: better logs in batcher * test(kt-devnet): add batcher failover kurtosis test (#33) * test(kt-devnet): add batcher failover test * chore(kt-devnet): use new proxy image v1.6.5 which has memstore rest routes * test(kt-devnet): fix TestFailover + add comments/logs * ci(kt-devnet): run new kurtosis failover test in ci * test(kt-devnet): remove enclaveCtx from test harness Was not being used and I had put it there only "in case" * test(kt-devnet): refactor failover test to not use hardcoded 10 constant Define l1BlocksQueriedForBatcherTxs and better describe how tests use it Also refactored graphql query to use both FROM and TO blocks, not only FROM. This makes the semantics of the tests easier to understand. * test(kt-devnet): better comments for requireBatcherTxsToBeFromLayer function * teest(kt-devnet): return err from getEndpointsFromKurtosis if EnclaveServiceEndpoints field doesn't have kurtosis tag * docs(kt-failover-test): rename getEndpointsFromKurtosis -> getPublicEndpointsFromKurtosis Also better document the function to explain what its doing * style(kt-devnet): reformat a weirdly tabbed comment * docs(kt-failover-test): describe why we use graphql api insead of l1retriever api * docs(kt-failover-test): add note mentioning that kt tests need to be run sequentially * docs(kt-failover-test): update test name to TestFailoverToEthDACalldata This is done to reflect the fact that batcher currently doesn't support failing over to calldata. * style: fix lint * docs(e2eutils): document returned values for WaitForBlockWithTxFromSender * docs(e2eutils): add doc comment for TransactionsBySender * docs(op-e2e): remove wrong comment in failover_test * docs(op-e2e): better test comment in failover_test * style(op-e2e): merged 2 if statements into one * style: fix comment typo --------- Co-authored-by: Gaston Ponti <pontigaston@gmail.com>
* test(altda): add test for altda->ethda failover * feat(batcher): altda->ethda failover when altda is down * chore: fix typos * fix(fakeDAServer): handlePut was still handling put when in failover mode * Update op-batcher/batcher/driver.go Co-authored-by: Gaston Ponti <pontigaston@gmail.com> * chore: better logs in batcher * test(kt-devnet): add batcher failover kurtosis test (#33) * test(kt-devnet): add batcher failover test * chore(kt-devnet): use new proxy image v1.6.5 which has memstore rest routes * test(kt-devnet): fix TestFailover + add comments/logs * ci(kt-devnet): run new kurtosis failover test in ci * test(kt-devnet): remove enclaveCtx from test harness Was not being used and I had put it there only "in case" * test(kt-devnet): refactor failover test to not use hardcoded 10 constant Define l1BlocksQueriedForBatcherTxs and better describe how tests use it Also refactored graphql query to use both FROM and TO blocks, not only FROM. This makes the semantics of the tests easier to understand. * test(kt-devnet): better comments for requireBatcherTxsToBeFromLayer function * teest(kt-devnet): return err from getEndpointsFromKurtosis if EnclaveServiceEndpoints field doesn't have kurtosis tag * docs(kt-failover-test): rename getEndpointsFromKurtosis -> getPublicEndpointsFromKurtosis Also better document the function to explain what its doing * style(kt-devnet): reformat a weirdly tabbed comment * docs(kt-failover-test): describe why we use graphql api insead of l1retriever api * docs(kt-failover-test): add note mentioning that kt tests need to be run sequentially * docs(kt-failover-test): update test name to TestFailoverToEthDACalldata This is done to reflect the fact that batcher currently doesn't support failing over to calldata. * style: fix lint * docs(e2eutils): document returned values for WaitForBlockWithTxFromSender * docs(e2eutils): add doc comment for TransactionsBySender * docs(op-e2e): remove wrong comment in failover_test * docs(op-e2e): better test comment in failover_test * style(op-e2e): merged 2 if statements into one * style: fix comment typo --------- Co-authored-by: Gaston Ponti <pontigaston@gmail.com>
* test(altda): add test for altda->ethda failover * feat(batcher): altda->ethda failover when altda is down * chore: fix typos * fix(fakeDAServer): handlePut was still handling put when in failover mode * Update op-batcher/batcher/driver.go Co-authored-by: Gaston Ponti <pontigaston@gmail.com> * chore: better logs in batcher * test(kt-devnet): add batcher failover kurtosis test (#33) * test(kt-devnet): add batcher failover test * chore(kt-devnet): use new proxy image v1.6.5 which has memstore rest routes * test(kt-devnet): fix TestFailover + add comments/logs * ci(kt-devnet): run new kurtosis failover test in ci * test(kt-devnet): remove enclaveCtx from test harness Was not being used and I had put it there only "in case" * test(kt-devnet): refactor failover test to not use hardcoded 10 constant Define l1BlocksQueriedForBatcherTxs and better describe how tests use it Also refactored graphql query to use both FROM and TO blocks, not only FROM. This makes the semantics of the tests easier to understand. * test(kt-devnet): better comments for requireBatcherTxsToBeFromLayer function * teest(kt-devnet): return err from getEndpointsFromKurtosis if EnclaveServiceEndpoints field doesn't have kurtosis tag * docs(kt-failover-test): rename getEndpointsFromKurtosis -> getPublicEndpointsFromKurtosis Also better document the function to explain what its doing * style(kt-devnet): reformat a weirdly tabbed comment * docs(kt-failover-test): describe why we use graphql api insead of l1retriever api * docs(kt-failover-test): add note mentioning that kt tests need to be run sequentially * docs(kt-failover-test): update test name to TestFailoverToEthDACalldata This is done to reflect the fact that batcher currently doesn't support failing over to calldata. * style: fix lint * docs(e2eutils): document returned values for WaitForBlockWithTxFromSender * docs(e2eutils): add doc comment for TransactionsBySender * docs(op-e2e): remove wrong comment in failover_test * docs(op-e2e): better test comment in failover_test * style(op-e2e): merged 2 if statements into one * style: fix comment typo --------- Co-authored-by: Gaston Ponti <pontigaston@gmail.com>
Closes DAINT-303
This PR adds a golang failover test which uses the kurtosis devnet as backend.
This test is used to test the new batcher failover behavior from #34.
We will merge this test into that PR, and then that PR into eigenda-develop (our master branch).
Note to reviewers
Please be very harsh on the golang test, as this same framework will be reused to add new tests for future features.
The "proper" way to implement this would probably have been to reuse op's op-e2e framework, but create a way to populate this system (equivalent to our harness in this PR) from a kurtosis backend. This would have taken me a lot more time to figure out however, and I feel like its something that the OP team might create at some point, so prefer to let them put in the work there and figure out how to do it properly, and we can potentially move to using that at a future point.