Skip to content

fix: abci error code#1280

Merged
Fraser999 merged 4 commits intomainfrom
fraser/fix-abci-error-code
Aug 20, 2024
Merged

fix: abci error code#1280
Fraser999 merged 4 commits intomainfrom
fraser/fix-abci-error-code

Conversation

@Fraser999
Copy link
Contributor

@Fraser999 Fraser999 commented Jul 18, 2024

Summary

This changes AbciErrorCode to no longer be able to represent tendermint Code 0.

Background

Previously 0 was defined as UNSPECIFIED (in line with common practice for protobuf enum variant assignations). However, in terms of ABCI codes, 0 should always represent success rather than an error case.

We also had an impl From<NonZeroU32> for AbciErrorCode which allowed for constructing arbitrary AbciErrorCodes with meaningless values in the context of the Astria codebase. This impl was unused however.

Changes

  • Changed AbciErrorCode to wrap a NonZeroU32 rather than a u32 so that const tendermint Codes matching the AbciErrorCode variants can be created without using unsafe blocks. All such unsafe code is restricted to the AbciErrorCode impl and is trivially checkable to be safe.
  • Removed the UNSPECIFIED variant, making the AbciErrorCode name more meaningful, as it now only represents error cases.
  • Removed the From<NonZeroU32> impl, meaning only the set of defined const values can be used.
  • Replaced impl From<AbciErrorCode> for Code with pub const fn value(self) -> NonZeroU32 so that const Codes can be used (useful when matching on Code values).

Testing

N/A (all new code is trivial IMO).

Breaking Changelist

  • Technically removing the pub const AbciErrorCode::UNSPECIFIED breaks the astria-core crate's API, but as it's unpublished yet, and since that const was never actually used afaik, this should not be an issue.

Related Issues

Closes #1259.

@Fraser999 Fraser999 requested a review from a team as a code owner July 18, 2024 11:59
@Fraser999 Fraser999 requested a review from SuperFluffy July 18, 2024 11:59
@github-actions github-actions bot added sequencer pertaining to the astria-sequencer crate composer pertaining to composer labels Jul 18, 2024
@Fraser999 Fraser999 enabled auto-merge August 20, 2024 09:50
@Fraser999 Fraser999 added this pull request to the merge queue Aug 20, 2024
Merged via the queue into main with commit 7b36af7 Aug 20, 2024
@Fraser999 Fraser999 deleted the fraser/fix-abci-error-code branch August 20, 2024 10:04
steezeburger added a commit that referenced this pull request Aug 22, 2024
* main:
  refactor(core, proto)!: define app genesis state in proto (#1346)
  fix(sequencer): bump penumbra dep to fix ibc state access bug (#1389)
  feat(conductor)!: support disabled celestia auth (#1372)
  fix(sequencer)!: fix block fees (#1343)
  perf(sequencer): add benchmark for prepare_proposal (ENG-660) (#1337)
  fix(proto): fix import name mismatch (#1380)
  fix(ci): enable bridge withdrawer building with tag (#1374)
  feat(sequencer): rewrite memool to have per-account transaction storage and maintenance  (#1323)
  refactor(core, sequencer)!: require that bridge unlock address always be set (#1339)
  fix(sequencer)!: take funds from bridge in ics20 withdrawals (#1344)
  fix(sequencer)!: fix TOCTOU issues by merging check and execution (#1332)
  fix: abci error code (#1280)
  refactor(core): shorten `try_from_block_info_and_data()` (#1371)
  fix(relayer): change `reqwest` for `isahc` in relayer blackbox tests (ENG-699) (#1366)
  fix(conductor): update for celestia-node v0.15.0 (#1367)
  Chore: Upgrade celestia-node to v0.14.1 (#1360)
  chore(charts): fix charts production templates (#1359)
  chore(core, proto): migrate byte slices from Vec to Bytes (#1319)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

composer pertaining to composer sequencer pertaining to the astria-sequencer crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Change AbciErrorCode with value 0 to represent OK

3 participants