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

A fix to allow leading zero on sig values #71

Merged
merged 11 commits into from
Sep 27, 2024
Merged

Conversation

poplexity
Copy link
Member

No description provided.

// If we fail to decode with the strict RLP from reth,
// and we don't have a raw.sender which suggests a native signed trx
// then try the telos legacy decode without passing a signature
if signed_legacy_result.is_err() && raw.sender.is_none() {
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be the same without having 2 if checks for signed_legacy_result error

Suggested change
if signed_legacy_result.is_err() && raw.sender.is_none() {
if signed_legacy_result.is_err() {
if raw.sender.is_none() {
signed_legacy_result =
TxLegacy::decode_telos_signed_fields(&mut raw.tx.clone().as_slice(), None);
}
let address = Address::from(
raw.sender
.expect("Failed to get address from sender in unsigned transaction, signed_legacy_result is Err")
.data,
);
let sig = make_unique_vrs(block_hash, address, trx_index);
let unsigned_legacy = TxLegacy::decode_telos_signed_fields(
&mut raw.tx.clone().as_slice(),
Some(sig),
)?;
let envelope = TxEnvelope::Legacy(unsigned_legacy);
return Ok(TelosEVMTransaction { envelope, receipt });
}

Copy link
Member Author

Choose a reason for hiding this comment

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

This does change the behavior, if we decode_telos_signed_fields with a None signature successfully then we don't want to enter the second if block.

Copy link
Contributor

@lesa-telos lesa-telos left a comment

Choose a reason for hiding this comment

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

2 minor comments, lgtm

Copy link
Contributor

@coa-telos coa-telos left a comment

Choose a reason for hiding this comment

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

Looks fine, just minor comments.

translator/src/rlp/telos_rlp_decode.rs Outdated Show resolved Hide resolved
translator/src/rlp/telos_rlp_decode.rs Outdated Show resolved Hide resolved
@poplexity poplexity merged commit f99f2c0 into master Sep 27, 2024
4 checks passed
@poplexity poplexity deleted the leading_zero_sig branch September 27, 2024 22:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants