-
Notifications
You must be signed in to change notification settings - Fork 66
feat(l2): batch reversion #3136
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
base: main
Are you sure you want to change the base?
Conversation
Lines of code reportTotal lines added: Detailed view
|
fcb4138
to
622f6d6
Compare
cmd/ethrex/l2/command.rs
Outdated
async fn call_contract( | ||
client: &EthClient, | ||
private_key: &SecretKey, | ||
to: Address, | ||
signature: &str, | ||
parameters: Vec<Value>, | ||
) -> eyre::Result<()> { | ||
let calldata = encode_calldata(signature, ¶meters)?.into(); | ||
let from = get_address_from_secret_key(private_key)?; | ||
let tx = client | ||
.build_eip1559_transaction(to, from, calldata, Default::default()) | ||
.await?; | ||
|
||
let tx_hash = client.send_eip1559_transaction(&tx, private_key).await?; | ||
|
||
info!("TxID: {tx_hash:#x}",); | ||
|
||
wait_for_transaction_receipt(tx_hash, client, 100).await?; | ||
Ok(()) | ||
} |
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.
Maybe this should go in the SDK
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.
+1. We may have something like this already, I don't remember.
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.
I'd add some integration tests or file an issue for doing so in the future. |
Motivation
As outlined in #3124, sometimes a committed batch can't be verified or the operator wants to prevent it from going though.
Description
This PR implements a
revertBatch
function that allows reverting back to any batch, as long as no verified batches are being discarded.There's also a l2 CLI subcommand, revert-batch that lets you revert a batch and remove it from the local database.
Usage on local network:
Closes #3124