Skip to content
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

Backport shim fix to eth-bridge-integration #689

Merged
merged 3 commits into from
Oct 27, 2022

Conversation

james-chf
Copy link
Contributor

@james-chf james-chf commented Oct 26, 2022

Fixes #641 for eth-bridge-integration

This is a backport of #656 which is in namada v0.8.1 (backporting now so that merging v0.8.1 into eth-bridge-integration is easier -
Relates to #673)

We had removed Shell::process_txs in eth-bridge-integration, which is now being used by the shim, so had to add something like it back - Shell::process_proposed_txs.

Comment on lines 140 to 141
let (processing_results, _) =
self.service.process_proposed_txs(&self.delivered_txs);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only sort of irrelevant line that should differ between eth-bridge-integration and v0.8.1 now - in eth-bridge-integration we need to return a DigestCounters as part of process_txs/process_proposed_txs

/// present. `ProcessProposal` should be able to make a decision on whether
/// a proposed block is acceptable or not based solely on what this function
/// returns.
pub fn process_proposed_txs(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest we take the opportunity to rename this fn (and process_single_tx), since we are changing the signatures of these two fns anyway

@james-chf james-chf marked this pull request as ready for review October 26, 2022 12:22
@james-chf
Copy link
Contributor Author

pls update wasm

)
})
.collect();
let (tx_results, counters) = self.process_proposed_txs(&req.txs);

// We should not have more than one `ethereum_events::VextDigest` in
// a proposal from some round's leader.
Copy link
Contributor

@sug0 sug0 Oct 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might as well move the logic from lines 55-110 to a new function. something like:

fn vote_on_proposal(tx_results: &[TxResult], counters: &DigestCounters) -> ProposalStatus

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree though it ends being a bit more of a refactor so would rather not do it in this PR. Specifically we currently log the reason for rejecting a proposed block, with context from the req struct, which we wouldn't be able to do in a fn vote_on_proposal without also passing in req or returning the reason (e.g. via an enum), I think we should go with something like the latter

/// present. `ProcessProposal` should be able to make a decision on whether
/// a proposed block is acceptable or not based solely on what this function
/// returns.
pub fn process_proposed_txs(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rename this to something like check_tx_status(), or anything that conveys the fact all we are doing is checking if a given tx is valid.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, technically we could "process" txs during ProcessProposal but in our ABCI application we don't do this which keeps things simpler. ProcessProposal to us is really more like CheckProposal

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renamed to check_proposal and check_proposal_tx

Comment on lines 118 to 122
/// Calculates what the [`TxResult`]s would be for the transactions in a
/// proposed block, as well as counting the number of digest transactions
/// present. `ProcessProposal` should be able to make a decision on whether
/// a proposed block is acceptable or not based solely on what this function
/// returns.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// Calculates what the [`TxResult`]s would be for the transactions in a
/// proposed block, as well as counting the number of digest transactions
/// present. `ProcessProposal` should be able to make a decision on whether
/// a proposed block is acceptable or not based solely on what this function
/// returns.
/// Calculates what the [`TxResult`]s would be for the transactions in a
/// proposed block, and counts the number of digest transactions
/// present.

leave the last part to vote_on_proposal, with a bit of clean up:

    /// Decides whether `ProcessProposal` should accept or reject
    /// a block proposed by some Tendermint round's leader.
    ///
    /// We first call `check_tx_status()`, to check for non-recoverable
    /// transaction errors.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unsure about this suggestion, if we don't create a vote_on_proposal fn in this PR

@james-chf james-chf marked this pull request as draft October 26, 2022 15:57
@james-chf james-chf marked this pull request as ready for review October 27, 2022 08:30
@james-chf james-chf requested a review from sug0 October 27, 2022 08:30
@james-chf james-chf merged commit 04cf854 into eth-bridge-integration Oct 27, 2022
@james-chf james-chf deleted the james/ethbridge/shim-fix-backport branch October 27, 2022 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants