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(otterscan): add ots slim block and serialze OperationType to int #1043

Merged
merged 7 commits into from
Jul 12, 2024

Conversation

jsvisa
Copy link
Contributor

@jsvisa jsvisa commented Jul 12, 2024

Motivation

I'm running reth along with otterscan, and find some more rpc mismatches:

  1. ots_getInternalOperations returns type as int, but the default serde json serialize will return as String instead, use serde_repr to serialize it;
  2. the response of ots_getBlockDetails without transactions, https://github.com/otterscan/otterscan/blob/3adcc62c4eedc56f812fab5ca4b85e3c5fd4b595/docs/custom-jsonrpc.md#L76 https://github.com/ledgerwatch/erigon/blob/6097c05cc914801132e7897427956f196efbbba1/turbo/jsonrpc/otterscan_api.go#L259-L261
  3. add a new function to set issuance and total_fees for BlockDetails

After this prototypes changed, I think reth can almost run along with otterscan(without the transaction before/after listing and ots2 API)

Solution

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

Copy link
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

awesome, tysm for all of these
one nit

crates/rpc-types-trace/src/otterscan.rs Outdated Show resolved Hide resolved
Signed-off-by: jsvisa <delweng@gmail.com>
Signed-off-by: jsvisa <delweng@gmail.com>
… int"

This reverts commit 96df6f4.

Signed-off-by: jsvisa <delweng@gmail.com>
Signed-off-by: jsvisa <delweng@gmail.com>
Signed-off-by: jsvisa <delweng@gmail.com>
Signed-off-by: jsvisa <delweng@gmail.com>
where
S: Serializer,
{
serializer.serialize_u8(*self as u8)
Copy link
Member

Choose a reason for hiding this comment

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

so this is actually a number and not a string?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I think it is:

image

@mattsse mattsse merged commit 8abc607 into alloy-rs:main Jul 12, 2024
22 checks passed
@jsvisa jsvisa deleted the ots-block-without-txs branch July 12, 2024 12:32
ben186 pushed a commit to ben186/alloy that referenced this pull request Jul 27, 2024
…alloy-rs#1043)

* fix(otterscan): add OtsSlimBlock for BlockDetails

Signed-off-by: jsvisa <delweng@gmail.com>

* feat(otterscan): use serde_repr to serialize OperationType to int

Signed-off-by: jsvisa <delweng@gmail.com>

* feat(otterscan): add a new function for BlockDetails

Signed-off-by: jsvisa <delweng@gmail.com>

* Revert "feat(otterscan): use serde_repr to serialize OperationType to int"

This reverts commit 96df6f4.

Signed-off-by: jsvisa <delweng@gmail.com>

* feat(otterscan): custom implement Serialize for OperationType

Signed-off-by: jsvisa <delweng@gmail.com>

* (de)serialize to u8

Signed-off-by: jsvisa <delweng@gmail.com>

* clippy

Signed-off-by: jsvisa <delweng@gmail.com>

---------

Signed-off-by: jsvisa <delweng@gmail.com>
j75689 pushed a commit to bnb-chain/alloy that referenced this pull request Aug 1, 2024
…alloy-rs#1043)

* fix(otterscan): add OtsSlimBlock for BlockDetails

Signed-off-by: jsvisa <delweng@gmail.com>

* feat(otterscan): use serde_repr to serialize OperationType to int

Signed-off-by: jsvisa <delweng@gmail.com>

* feat(otterscan): add a new function for BlockDetails

Signed-off-by: jsvisa <delweng@gmail.com>

* Revert "feat(otterscan): use serde_repr to serialize OperationType to int"

This reverts commit 96df6f4.

Signed-off-by: jsvisa <delweng@gmail.com>

* feat(otterscan): custom implement Serialize for OperationType

Signed-off-by: jsvisa <delweng@gmail.com>

* (de)serialize to u8

Signed-off-by: jsvisa <delweng@gmail.com>

* clippy

Signed-off-by: jsvisa <delweng@gmail.com>

---------

Signed-off-by: jsvisa <delweng@gmail.com>
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