Skip to content

Conversation

@SuperFluffy
Copy link
Contributor

@SuperFluffy SuperFluffy commented Dec 11, 2023

Summary

Define protobuf spec for ABCI error codes, remove sequencer-types crate.

Background

All public APIs should be defined in astria-api and the protobuf spec. This patch allows non-rust code to understand the abci codes emitted by sequencer.

The abci return code convention of having 0 be success and non-zero be an error does not cleanly map to the protobuf convention. Protobuf enums should have a default value UNSPECIFIED = 0. We therefore go with the protobuf convention and define the enum type as AbciErrorCode.

Changes

  • Define ABCI errors codes in protobuf spec
  • Move Rust code from api-sequencer-types to astria-api
  • Delete sequencer-types crate

Testing

Tests making use of abci codes still work.

Related Issues

closes #369

@github-actions github-actions bot added conductor pertaining to the astria-conductor crate sequencer pertaining to the astria-sequencer crate composer pertaining to composer labels Dec 11, 2023
@SuperFluffy SuperFluffy force-pushed the superfluffy/restructure-sequencer-api-code branch 3 times, most recently from 57f9c5b to 12ba88f Compare December 12, 2023 11:36
@SuperFluffy SuperFluffy force-pushed the superfluffy/abci-codes-in-proto branch from 0db7eac to d9273c1 Compare December 12, 2023 11:39
@SuperFluffy SuperFluffy marked this pull request as ready for review December 12, 2023 11:47
@SuperFluffy SuperFluffy changed the title refactor: move abci codes to api, delete sequencer-types crate refactor: define abci error codes in protobuf Dec 12, 2023
ABCI_ERROR_CODE_INVALID_PARAMETER = 2;
ABCI_ERROR_CODE_INTERNAL_ERROR = 3;
ABCI_ERROR_CODE_INVALID_NONCE = 4;
ABCI_ERROR_CODE_TRANSACTION_TOO_LARGE = 5;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@noot I renamed this from INVALID_SIZE to make it slightly more specific/descriptive.

/// This hashes each item before pushing it into the Merkle Tree, which
/// effectively causes a double hashing. The leaf hash of an item `d_i`
/// is then `MTH(d_i) = SHA256(0x00 || SHA256(d_i))`.
fn merkle_tree_from_transactions<I, B>(iter: I) -> merkle::Tree
Copy link
Contributor Author

Choose a reason for hiding this comment

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

no code changes here. Just moved this out of the sequencer-types crate as this was only used in conductor.

@SuperFluffy SuperFluffy changed the title refactor: define abci error codes in protobuf refactor(api): define abci error codes in protobuf Dec 12, 2023
@SuperFluffy SuperFluffy force-pushed the superfluffy/restructure-sequencer-api-code branch 2 times, most recently from 5f78d67 to 419028f Compare December 18, 2023 18:41
@SuperFluffy SuperFluffy force-pushed the superfluffy/abci-codes-in-proto branch from e909954 to 585fe66 Compare December 18, 2023 18:46
@SuperFluffy SuperFluffy force-pushed the superfluffy/restructure-sequencer-api-code branch from 419028f to f454bd4 Compare December 18, 2023 18:49
@SuperFluffy SuperFluffy force-pushed the superfluffy/abci-codes-in-proto branch from 585fe66 to ee36c7c Compare December 18, 2023 18:49
@SuperFluffy SuperFluffy force-pushed the superfluffy/abci-codes-in-proto branch from ee36c7c to 0a86d37 Compare December 18, 2023 19:14
@SuperFluffy SuperFluffy force-pushed the superfluffy/restructure-sequencer-api-code branch 2 times, most recently from 97dd791 to f141fda Compare December 19, 2023 11:14
Base automatically changed from superfluffy/restructure-sequencer-api-code to main December 19, 2023 11:18
@github-actions github-actions bot added proto pertaining to the Astria Protobuf spec sequencer-relayer pertaining to the astria-sequencer-relayer crate labels Dec 19, 2023
@SuperFluffy SuperFluffy force-pushed the superfluffy/abci-codes-in-proto branch from 0a86d37 to c6538c1 Compare December 19, 2023 12:55
@github-actions github-actions bot removed proto pertaining to the Astria Protobuf spec sequencer-relayer pertaining to the astria-sequencer-relayer crate labels Dec 19, 2023
Copy link
Contributor

@noot noot left a comment

Choose a reason for hiding this comment

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

looks good!

@SuperFluffy SuperFluffy merged commit 7bff1dc into main Jan 2, 2024
@SuperFluffy SuperFluffy deleted the superfluffy/abci-codes-in-proto branch January 2, 2024 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sequencer: define ABCI code responses as protos

4 participants