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

feat: minor improvements to Ethereum delegated siggys #10084

Merged
merged 1 commit into from
Jan 23, 2023

Conversation

arajasek
Copy link
Contributor

Related Issues

Minor improvements noticed while writing this logic into FIP-0055.

Proposed Changes

  • Uniformly use cborgen's ReadByteArray / WriteByteArray
  • Check parameter length against expectations based on MethodNum at the end

Additional Info

Checklist

Before you mark the PR ready for review, please make sure that:

  • Commits have a clear commit message.
  • PR title is in the form of of <PR type>: <area>: <change being made>
    • example: fix: mempool: Introduce a cache for valid signatures
    • PR type: fix, feat, build, chore, ci, docs, perf, refactor, revert, style, test
    • area, e.g. api, chain, state, market, mempool, multisig, networking, paych, proving, sealing, wallet, deps
  • New features have usage guidelines and / or documentation updates in
  • Tests exist for new functionality or change in behavior
  • CI is green

@arajasek arajasek requested a review from a team as a code owner January 20, 2023 15:22
}
}

if paramsReader.Len() != 0 {
return EthTxArgs{}, xerrors.Errorf("extra data found in params")
}

if len(params) == 0 && msg.Method != builtintypes.MethodSend {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Stebalien I think we need this to cover a case where the EthTx calls the EAM's CreateExternal method with the CBOR-encoding of the empty byte array, which would fail to roundtrip.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Feels cleaner regardless.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, but isn't that case already covered? I.e., we should fail to read a bytes array from the params in that case. But either way works.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Stebalien So that's what I was unsure about it, but I think this case wasn't covered? You could have successfully read (the serialization of) the empty byte array -- [MajByteString, 0], I think, which would still lead to params having a length of 0. And that wouldn't roundtrip because we assert non-empty bytes for CreateExternal calls when going Eth -> Fil.

}
}

if paramsReader.Len() != 0 {
return EthTxArgs{}, xerrors.Errorf("extra data found in params")
}

if len(params) == 0 && msg.Method != builtintypes.MethodSend {
Copy link
Member

Choose a reason for hiding this comment

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

Yes, but isn't that case already covered? I.e., we should fail to read a bytes array from the params in that case. But either way works.

@arajasek arajasek merged commit a21bba8 into release/v1.20.0 Jan 23, 2023
@arajasek arajasek deleted the asr/delegated-siggy branch January 23, 2023 17:11
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.

2 participants