forked from Consensys/linea-sequencer
-
Notifications
You must be signed in to change notification settings - Fork 0
Eth send bundle merge #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
garyschulte
merged 7 commits into
garyschulte:feature/linea-send-bundle
from
fab-10:eth_sendBundle-merge
Feb 5, 2025
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
0a0ef9f
AT passing nonce to linea_estimateGas (#138)
fab-10 82e81df
Update tx selectors to use selector state
fab-10 4d40524
Merge remote-tracking branch 'gary/feature/linea-send-bundle' into et…
fab-10 d434e25
Adapt code to new TransactionEvaluationContext
fab-10 de02674
First sendBundle ATs
fab-10 51defdc
Move shared services in AbstractLineaSharedPrivateOptionsPlugin
fab-10 855f2b2
Use PendingTransaction::memorySize
fab-10 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
90 changes: 90 additions & 0 deletions
90
acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/SendBundleTest.java
This file contains hidden or 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,90 @@ | ||
| package linea.plugin.acc.test.rpc.linea; | ||
|
|
||
| import static org.assertj.core.api.Assertions.assertThat; | ||
|
|
||
| import java.io.IOException; | ||
| import java.util.Arrays; | ||
| import java.util.List; | ||
|
|
||
| import linea.plugin.acc.test.LineaPluginTestBase; | ||
| import linea.plugin.acc.test.TestCommandLineOptionsBuilder; | ||
| import lombok.RequiredArgsConstructor; | ||
| import org.hyperledger.besu.tests.acceptance.dsl.account.Account; | ||
| import org.hyperledger.besu.tests.acceptance.dsl.transaction.NodeRequests; | ||
| import org.hyperledger.besu.tests.acceptance.dsl.transaction.Transaction; | ||
| import org.hyperledger.besu.tests.acceptance.dsl.transaction.account.TransferTransaction; | ||
| import org.junit.jupiter.api.Test; | ||
| import org.web3j.protocol.core.Request; | ||
|
|
||
| public class SendBundleTest extends LineaPluginTestBase { | ||
|
|
||
| @Override | ||
| public List<String> getTestCliOptions() { | ||
| return new TestCommandLineOptionsBuilder().build(); | ||
| } | ||
|
|
||
| @Test | ||
| public void singleTxBundleIsAcceptedAndMined() { | ||
| final Account sender = accounts.getSecondaryBenefactor(); | ||
| final Account recipient = accounts.getPrimaryBenefactor(); | ||
|
|
||
| final TransferTransaction tx = accountTransactions.createTransfer(sender, recipient, 1); | ||
|
|
||
| final String rawTx = tx.signedTransactionData(); | ||
|
|
||
| final var sendBundleRequest = | ||
| new SendBundleRequest(new BundleParams(new String[] {rawTx}, Integer.toHexString(1))); | ||
| final var sendBundleResponse = sendBundleRequest.execute(minerNode.nodeRequests()); | ||
|
|
||
| assertThat(sendBundleResponse.hasError()).isFalse(); | ||
| assertThat(sendBundleResponse.getResult().bundleHash()).isNotBlank(); | ||
|
|
||
| minerNode.verify(eth.expectSuccessfulTransactionReceipt(tx.transactionHash())); | ||
| } | ||
|
|
||
| @Test | ||
| public void bundleIsAcceptedAndMined() { | ||
| final Account sender = accounts.getSecondaryBenefactor(); | ||
| final Account recipient = accounts.getPrimaryBenefactor(); | ||
|
|
||
| final TransferTransaction tx1 = accountTransactions.createTransfer(sender, recipient, 1); | ||
| final TransferTransaction tx2 = accountTransactions.createTransfer(recipient, sender, 1); | ||
|
|
||
| final String[] rawTxs = new String[] {tx1.signedTransactionData(), tx2.signedTransactionData()}; | ||
|
|
||
| final var sendBundleRequest = | ||
| new SendBundleRequest(new BundleParams(rawTxs, Integer.toHexString(1))); | ||
| final var sendBundleResponse = sendBundleRequest.execute(minerNode.nodeRequests()); | ||
|
|
||
| assertThat(sendBundleResponse.hasError()).isFalse(); | ||
| assertThat(sendBundleResponse.getResult().bundleHash()).isNotBlank(); | ||
|
|
||
| minerNode.verify(eth.expectSuccessfulTransactionReceipt(tx1.transactionHash())); | ||
| minerNode.verify(eth.expectSuccessfulTransactionReceipt(tx2.transactionHash())); | ||
| } | ||
|
|
||
| @RequiredArgsConstructor | ||
| static class SendBundleRequest implements Transaction<SendBundleRequest.SendBundleResponse> { | ||
| private final BundleParams bundleParams; | ||
|
|
||
| @Override | ||
| public SendBundleResponse execute(final NodeRequests nodeRequests) { | ||
| try { | ||
| return new Request<>( | ||
| "linea_sendBundle", | ||
| Arrays.asList(bundleParams), | ||
| nodeRequests.getWeb3jService(), | ||
| SendBundleResponse.class) | ||
| .send(); | ||
| } catch (IOException e) { | ||
| throw new RuntimeException(e); | ||
| } | ||
| } | ||
|
|
||
| static class SendBundleResponse extends org.web3j.protocol.core.Response<Response> {} | ||
|
|
||
| record Response(String bundleHash) {} | ||
| } | ||
|
|
||
| record BundleParams(String[] txs, String blockNumber) {} | ||
| } | ||
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯