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

Feature/remove raw #3692

Merged
merged 67 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
70ba129
Improves UnmarshalJSON for base types
tjayrush May 19, 2024
7c5720b
Accepts null as a value for base.Address
tjayrush May 19, 2024
81d6681
Removes // EXISTING_CODE blocks from Raw types to get started
tjayrush May 19, 2024
3cfa029
Removes --raw from the chifra logs command - tests not run yet
tjayrush May 19, 2024
12d7f51
Updates tests after removing --raw from chifra logs
tjayrush May 19, 2024
52a84e9
Prepares auto-code-gen for removing Raw via attribute simponly
tjayrush May 19, 2024
d528408
Removes, by hand, RawLog but enables auto-code-gen for non-raw types.
tjayrush May 19, 2024
c1fedea
Updates tests after removing --raw from chifra logs
tjayrush May 19, 2024
b7edbaa
Cleanup for removal of RawLog
tjayrush May 19, 2024
eebb710
Removes Raw for many other types
tjayrush May 19, 2024
3abbbe1
Removes RawWithdrawal
tjayrush May 19, 2024
c3bed81
removes Raw for function, parameter, result
tjayrush May 20, 2024
b3423a5
Removes RawReceipt and updates tests
tjayrush May 20, 2024
3a2bb62
Change attribute for raw to hasraw rather than not simponly
tjayrush May 20, 2024
23ba0d0
Removes RawTraceResult and updates tests
tjayrush May 20, 2024
b8ac379
Removes RawTraceAction and updates tests
tjayrush May 20, 2024
e2ce815
Removes RawTrace and updates tests
tjayrush May 20, 2024
6811c67
Removes --raw from chifra traces
tjayrush May 20, 2024
0b675cc
Removes RawAppearance and updates tests
tjayrush May 20, 2024
6bb04e5
Broken
tjayrush May 20, 2024
3c6b0ba
Removes RawSlurp-ish...
tjayrush May 20, 2024
cada2e5
Faster
tjayrush May 20, 2024
5ebcbc0
Trying to separate Block[string] from Block[Transaction] with LightBlock
tjayrush May 21, 2024
331a2fd
Starts to replace Block[string] with LightBlock
tjayrush May 21, 2024
129237e
Replaces Block[string] with LightBlock in a few places
tjayrush May 21, 2024
9db6403
Remove more Block[string] uses
tjayrush May 21, 2024
14f5c41
Cleaning
tjayrush May 21, 2024
cb28277
Cleaning
tjayrush May 21, 2024
6da6786
Makes Blocks concrete. LightBlocks is what used to be Blocks[string]
tjayrush May 21, 2024
ef17cc9
Removes --raw from chifra slurp
tjayrush May 21, 2024
2e9ea90
Removes --raw from chifra transactions
tjayrush May 21, 2024
71997a5
Removes --raw from chifra blocks
tjayrush May 21, 2024
6d71f98
Cleans up a few docs related to removing --raw
tjayrush May 21, 2024
cae7a4e
Removes "raw" from python SDK
tjayrush May 21, 2024
06ee7a6
Remove Raw and SetRaw from template, but does not regenerate
tjayrush May 21, 2024
b536212
Tries to remove raw in many, many places
tjayrush May 21, 2024
737b916
Removes --raw throughout
tjayrush May 21, 2024
9b44c8e
Trying to remove Raw
tjayrush May 21, 2024
4f131ca
Renames extraOptions to extraOpts
tjayrush May 22, 2024
8d277a4
Renames extra to extraOpts to match
tjayrush May 22, 2024
7ccd89d
Replace RawModeler with Streamable and be explicit about what types a…
tjayrush May 22, 2024
a8feed9
Replace the less clear and more old-fashioned `interface{}` with `any…
tjayrush May 22, 2024
a15702b
Removes AppearanceCount type. It should have been (and is now) a Monitor
tjayrush May 22, 2024
1b01d46
LogFilter is not a Streamable type. Moved to rpc package
tjayrush May 22, 2024
44f37d2
Removes SlurpCount - should have been Monitor
tjayrush May 22, 2024
020603b
Cleaning
tjayrush May 22, 2024
f10c3ea
Removes RawLightBlock
tjayrush May 22, 2024
a920ecd
Cleaning
tjayrush May 22, 2024
8024cf9
Partially removes RawBlock
tjayrush May 22, 2024
9c1ae5e
Removes one more use of RawBlock
tjayrush May 22, 2024
cef7952
Starting to remove RawTransaction
tjayrush May 22, 2024
6045654
Partially removes RawTransaction
tjayrush May 22, 2024
7b454cc
Removes RawBlocks -- and ALL other raw shit
tjayrush May 22, 2024
dfc854e
Removes some vestiges of raw
tjayrush May 22, 2024
2167d27
All that's left is cleaning up the raw code that did all the copying
tjayrush May 22, 2024
5ca5afa
Starts final cleanup of removal of Raw
tjayrush May 22, 2024
120c98e
Starts to clean up old vestiges of raw copy and the many copies problem
tjayrush May 22, 2024
2f3411b
Small cleaning
tjayrush May 22, 2024
fdb1a02
Almost done fixing blocks for raw
tjayrush May 22, 2024
913b0de
Best version yet of blocks
tjayrush May 22, 2024
c1fb85a
Best version yet
tjayrush May 22, 2024
00613c9
Fixes a bug in chifra blocks --uncles
tjayrush May 22, 2024
f3b0a96
Cleans up traces in RPC code
tjayrush May 22, 2024
40d69f9
Object instead of null for trace.Result
tjayrush May 22, 2024
e9b3f0e
Fixing tests
tjayrush May 22, 2024
cfb748b
Cleaning
tjayrush May 22, 2024
0bcd9b4
I am done.
tjayrush May 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,7 @@ The following data models were either modified, added, removed, or renamed by ha
- #3232 chifra daemon scrape values invalid
- #3229 Indexing an unsupported EVM chain
- #3227 chifra state cores
- #3226 chifra abis should have a --raw option
- #3226 chifra abis should have a --r aw option
- #3225 Utilize BlockRange on eth_getLogs querys
- #3223 ABI docs are vague and unclear
- #3221 chifra blocks reports error incorrectly
Expand Down Expand Up @@ -1342,7 +1342,7 @@ There were no changes to the [Specification for the Unchained Index](https://tru
- Many additional tests for all subcommands
- Removed a fair amount of the C++ library testing code as being not needed and in preparation for porting to C++
- Re-wrote logger package to more closely mimic the new GoLang structured log package which we will be switching to soon - if you depend on our logging messages for anything, please note that they will change.
- Made sure RPC and Raw data agrees
- Made sure RPC is valid

## Changes to Data Models

Expand Down
175 changes: 62 additions & 113 deletions docs/content/api/openapi.yaml

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions docs/content/chifra/accounts.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ Notes:
Data models produced by this tool:

- [appearance](/data-model/accounts/#appearance)
- [appearancecount](/data-model/accounts/#appearancecount)
- [bounds](/data-model/accounts/#bounds)
- [monitor](/data-model/accounts/#monitor)

Expand Down Expand Up @@ -161,7 +160,6 @@ Notes:
Data models produced by this tool:

- [appearance](/data-model/accounts/#appearance)
- [appearancecount](/data-model/accounts/#appearancecount)
- [function](/data-model/other/#function)
- [log](/data-model/chaindata/#log)
- [message](/data-model/other/#message)
Expand Down
13 changes: 3 additions & 10 deletions docs/content/chifra/chaindata.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ weight: 21000
toc: true
---

The Chain Data group of tools extract raw blockchain data directly from the node. You may extract
The Chain Data group of tools extract blockchain data directly from the node. You may extract
block data, transactional data, receipts, logs, traces, and other information. Each tool has it own
set of options, allowing you to get exactly the data you need.

Expand Down Expand Up @@ -59,7 +59,6 @@ Flags:
-a, --articulate for the --logs option only, articulate the retrieved data if ABIs can be found
-U, --count display only the count of appearances for --addrs or --uniq
-H, --ether specify value in ether
-w, --raw report JSON data from the source with minimal processing
-o, --cache force the results of the query into the cache
-D, --decache removes related items from the cache
-x, --fmt string export format, one of [none|json*|txt|csv]
Expand All @@ -82,8 +81,8 @@ Data models produced by this tool:
- [appearance](/data-model/accounts/#appearance)
- [block](/data-model/chaindata/#block)
- [blockcount](/data-model/chaindata/#blockcount)
- [lightblock](/data-model/chaindata/#lightblock)
- [log](/data-model/chaindata/#log)
- [logfilter](/data-model/chaindata/#logfilter)
- [message](/data-model/other/#message)
- [trace](/data-model/chaindata/#trace)
- [traceaction](/data-model/chaindata/#traceaction)
Expand All @@ -97,8 +96,7 @@ Links:

## chifra transactions

The `chifra transactions` tool retrieves transactions directly from the Ethereum node (using the `--raw`
option) or from the TrueBlocks cache (if present). You may specify multiple transaction identifiers
The `chifra transactions` tool retrieves transactions directly from the Ethereum node or from the TrueBlocks cache (if present). You may specify multiple transaction identifiers
per invocation. Unlike the Ethereum RPC, the reported transactions include the transaction's receipt
and generated logs.

Expand Down Expand Up @@ -129,7 +127,6 @@ Flags:
-m, --emitter strings for the --logs option only, filter logs to show only those logs emitted by the given address(es)
-B, --topic strings for the --logs option only, filter logs to show only those with this topic(s)
-H, --ether specify value in ether
-w, --raw report JSON data from the source with minimal processing
-o, --cache force the results of the query into the cache
-D, --decache removes related items from the cache
-x, --fmt string export format, one of [none|json*|txt|csv]
Expand Down Expand Up @@ -181,7 +178,6 @@ Arguments:

Flags:
-a, --articulate articulate the retrieved data if ABIs can be found
-w, --raw report JSON data from the source with minimal processing
-o, --cache force the results of the query into the cache
-D, --decache removes related items from the cache
-x, --fmt string export format, one of [none|json*|txt|csv]
Expand Down Expand Up @@ -227,7 +223,6 @@ Flags:
-m, --emitter strings filter logs to show only those logs emitted by the given address(es)
-B, --topic strings filter logs to show only those with this topic(s)
-a, --articulate articulate the retrieved data if ABIs can be found
-w, --raw report JSON data from the source with minimal processing
-o, --cache force the results of the query into the cache
-D, --decache removes related items from the cache
-x, --fmt string export format, one of [none|json*|txt|csv]
Expand All @@ -245,7 +240,6 @@ Data models produced by this tool:

- [function](/data-model/other/#function)
- [log](/data-model/chaindata/#log)
- [logfilter](/data-model/chaindata/#logfilter)
- [message](/data-model/other/#message)
- [parameter](/data-model/other/#parameter)

Expand Down Expand Up @@ -280,7 +274,6 @@ Flags:
-f, --filter string call the node's trace_filter routine with bang-separated filter
-U, --count display only the number of traces for the transaction (fast)
-H, --ether specify value in ether
-w, --raw report JSON data from the source with minimal processing
-o, --cache force the results of the query into the cache
-D, --decache removes related items from the cache
-x, --fmt string export format, one of [none|json*|txt|csv]
Expand Down
26 changes: 12 additions & 14 deletions docs/content/chifra/globals.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,20 +78,18 @@ Where:

### Group 4

The tools in this group have all of the above options, but have an additional option, `--raw`, which shows the underlying data queried directly from the node (or API provider in the case of `slurp`).

| Group | Cmd | Enabled | Disabled |
| ---------- | ------------ | -------------------------- | -------- |
| chain_data | blocks | Cache, Decache, Ether, Raw | |
| chain_data | transactions | Cache, Decache, Ether, Raw | |
| chain_data | receipts | Cache, Decache, Ether, Raw | |
| chain_data | logs | Cache, Decache, Ether, Raw | |
| chain_data | traces | Cache, Decache, Ether, Raw | |
| other | slurp | Cache, Decache, Ether, Raw | |

Where:

--raw passes the data queried from the node directly to the display
**As of version 2.6.0, the `--r aw` option has been removed in its entirity.
Prior to that version, the following tools had this option which would pass
the data received directly from the node without modification.**

```[bash]
chifra blocks
chifra transactions
chifra receipts
chifra logs
chifra traces
chifra slurp
```

### Group 5

Expand Down
2 changes: 0 additions & 2 deletions docs/content/chifra/other.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ Flags:
-U, --count for --appearances mode only, display only the count of records
-s, --sleep float seconds to sleep between requests (default 0.25)
-H, --ether specify value in ether
-w, --raw report JSON data from the source with minimal processing
-o, --cache force the results of the query into the cache
-D, --decache removes related items from the cache
-x, --fmt string export format, one of [none|json*|txt|csv]
Expand All @@ -118,7 +117,6 @@ Data models produced by this tool:
- [monitor](/data-model/accounts/#monitor)
- [parameter](/data-model/other/#parameter)
- [slurp](/data-model/other/#slurp)
- [slurpcount](/data-model/other/#slurpcount)

Links:

Expand Down
18 changes: 0 additions & 18 deletions docs/content/data-model/accounts.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,24 +128,6 @@ Names consist of the following fields:
| isErc20 | `true` if the address is an ERC20, `false` otherwise | bool |
| isErc721 | `true` if the address is an ERC720, `false` otherwise | bool |

## AppearanceCount

The `appearanceCount` data model is used mostly by the frontend explorer application. It carries
various information about the monitor data for an address.

The following commands produce and manage AppearanceCounts:

- [chifra list](/chifra/accounts/#chifra-list)
- [chifra export](/chifra/accounts/#chifra-export)

AppearanceCounts consist of the following fields:

| Field | Description | Type |
| -------- | --------------------------------------------------------- | ------- |
| address | the address for this count | address |
| nRecords | the number of appearances for the given address | uint64 |
| fileSize | the size of the monitor file containing those appearances | uint64 |

## Bounds

The Bounds data model displays information about a given address including how many times it's appeared on the chain and when the first and most recent blocks, timestamps, and dates are.
Expand Down
49 changes: 27 additions & 22 deletions docs/content/data-model/chaindata.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Blocks consist of the following fields:
| difficulty | the computational difficulty at this block | value |
| timestamp | the Unix timestamp of the object | timestamp |
| date | the timestamp as a date (calculated) | datetime |
| transactions | a possibly empty array of transactions or transaction hashes | [Transaction[]](/data-model/chaindata/#transaction) |
| transactions | a possibly empty array of transactions | [Transaction[]](/data-model/chaindata/#transaction) |
| baseFeePerGas | the base fee for this block | gas |
| uncles | a possibly empty array of uncle hashes | hash[] |
| withdrawals | a possibly empty array of withdrawals (post Shanghai) | [Withdrawal[]](/data-model/chaindata/#withdrawal) |
Expand Down Expand Up @@ -165,25 +165,6 @@ Logs consist of the following fields:
| articulatedLog | a human-readable version of the topic and data fields | [Function](/data-model/other/#function) |
| compressedLog | a truncated, more readable version of the articulation (calculated) | string |

## LogFilter

Log filters are used to speed up querying of the node when searching for logs.

The following commands produce and manage LogFilters:

- [chifra blocks](/chifra/chaindata/#chifra-blocks)
- [chifra logs](/chifra/chaindata/#chifra-logs)

LogFilters consist of the following fields:

| Field | Description | Type |
| --------- | ---------------------------------------------------------------------- | --------- |
| fromBlock | the first block in the block range to query with eth_getLogs | blknum |
| toBlock | the last block in the range to query with eth_getLogs | blknum |
| blockHash | an alternative to blocks specification, the hash of the block to query | hash |
| emitters | one or more emitting addresses from which logs were emitted | address[] |
| topics | one or more topics which logs represent | topic[] |

## Trace

The deepest layer of the Ethereum data is the trace. Every transaction has at least one trace which
Expand Down Expand Up @@ -221,8 +202,6 @@ Traces consist of the following fields:

### Notes

When produced using the `--raw` option to `chifra traces`, this data model actually produces `transactionPosition` instead of `transactionIndex`. When produced without the `--raw` option, the model uses `transactionIndex` to be consistent with other data models such as the `transaction`.

Traces and TraceActions, when produced during a self-destruct, export different fields when rendered in JSON. In CSV and TXT output, these fields change thier meaning while retaining the header of the original fields. The following table describes these differences:

Fields that change during self-destruct transaction:
Expand Down Expand Up @@ -398,6 +377,32 @@ TimestampCounts consist of the following fields:
| ----- | --------------------------------------------------- | ------ |
| count | the number of timestamps in the timestamps database | uint64 |

## LightBlock

`chifra blocks --hashes` returns top level data specified block with only
the hashes of the block's transactions.

The following commands produce and manage LightBlocks:

- [chifra blocks](/chifra/chaindata/#chifra-blocks)

LightBlocks consist of the following fields:

| Field | Description | Type |
| ------------- | ------------------------------------------------------------- | ------------------------------------------------- |
| gasLimit | the system-wide maximum amount of gas permitted in this block | gas |
| hash | the hash of the current block | hash |
| blockNumber | the number of the block | blknum |
| parentHash | hash of previous block | hash |
| miner | address of block's winning miner | address |
| difficulty | the computational difficulty at this block | value |
| timestamp | the Unix timestamp of the object | timestamp |
| date | the timestamp as a date (calculated) | datetime |
| transactions | a possibly empty array of transaction hashes | string[] |
| baseFeePerGas | the base fee for this block | gas |
| uncles | a possibly empty array of uncle hashes | hash[] |
| withdrawals | a possibly empty array of withdrawals (post Shanghai) | [Withdrawal[]](/data-model/chaindata/#withdrawal) |

## Base types

This documentation mentions the following basic data types.
Expand Down
16 changes: 0 additions & 16 deletions docs/content/data-model/other.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,21 +145,6 @@ Slurps consist of the following fields:
| compressedTx | truncated, more readable version of the articulation (calculated) | string |
| isError | `true` if the transaction ended in error, `false` otherwise | bool |

## SlurpCount

The `slurpCount` carries information about the counts returned by remote APIs.

The following commands produce and manage SlurpCounts:

- [chifra slurp](/chifra/other/#chifra-slurp)

SlurpCounts consist of the following fields:

| Field | Description | Type |
| ------- | ------------------------------------------------------- | ------- |
| address | the address used to query the API | address |
| count | the number of records known by the API for this address | uint64 |

## Message

The Message type is used in various places to return information about a command. For example, when using the `chifra names --autoname` feature in the SDK, a Message type is returned.
Expand Down Expand Up @@ -202,7 +187,6 @@ This documentation mentions the following basic data types.
| string | a normal character string | |
| timestamp | a 64-bit unsigned integer | Unix timestamp |
| txnum | an alias for a uint64 | |
| uint64 | a 64-bit unsigned integer | |
| value | an alias for a 64-bit unsigned integer | |
| wei | an unsigned big number | as a string |

Expand Down
2 changes: 1 addition & 1 deletion scripts/test-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ CHIFRA="${REPO_ROOT}/src/apps/chifra"
(cd "$CHIFRA" && go test --tags integration ./...)

#------------------------------------------------
echo "Reporting on the status of the stests submodule. No update..."
echo "Reporting on the status of the tests submodule. No update..."
git -C "$REPO_ROOT" submodule status tests

#------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion sdk/abis_internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func (opts *abisOptionsInternal) AbisBytes(w io.Writer) error {
}

// abisParseFunc handles special cases such as structs and enums (if any).
func abisParseFunc(target interface{}, key, value string) (bool, error) {
func abisParseFunc(target any, key, value string) (bool, error) {
var found bool
_, ok := target.(*abisOptionsInternal)
if !ok {
Expand Down
12 changes: 6 additions & 6 deletions sdk/blocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,23 @@ func (opts BlocksOptions) String() string {
}

// Blocks implements the chifra blocks command.
func (opts *BlocksOptions) Blocks() ([]types.Block[types.Transaction], *types.MetaData, error) {
func (opts *BlocksOptions) Blocks() ([]types.Block, *types.MetaData, error) {
in := opts.toInternal()
return queryBlocks[types.Block[types.Transaction]](in)
return queryBlocks[types.Block](in)
}

// BlocksHashes implements the chifra blocks --hashes command.
func (opts *BlocksOptions) BlocksHashes() ([]types.Block[string], *types.MetaData, error) {
func (opts *BlocksOptions) BlocksHashes() ([]types.LightBlock, *types.MetaData, error) {
in := opts.toInternal()
in.Hashes = true
return queryBlocks[types.Block[string]](in)
return queryBlocks[types.LightBlock](in)
}

// BlocksUncles implements the chifra blocks --uncles command.
func (opts *BlocksOptions) BlocksUncles() ([]types.Block[string], *types.MetaData, error) {
func (opts *BlocksOptions) BlocksUncles() ([]types.LightBlock, *types.MetaData, error) {
in := opts.toInternal()
in.Uncles = true
return queryBlocks[types.Block[string]](in)
return queryBlocks[types.LightBlock](in)
}

// BlocksTraces implements the chifra blocks --traces command.
Expand Down
6 changes: 3 additions & 3 deletions sdk/blocks_internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func (opts *blocksOptionsInternal) BlocksBytes(w io.Writer) error {
}

// blocksParseFunc handles special cases such as structs and enums (if any).
func blocksParseFunc(target interface{}, key, value string) (bool, error) {
func blocksParseFunc(target any, key, value string) (bool, error) {
var found bool
opts, ok := target.(*blocksOptionsInternal)
if !ok {
Expand Down Expand Up @@ -90,8 +90,8 @@ func GetBlocksOptions(args []string) (*blocksOptionsInternal, error) {
}

type blocksGeneric interface {
types.Block[types.Transaction] |
types.Block[string] |
types.Block |
types.LightBlock |
types.Trace |
types.Appearance |
types.Log |
Expand Down
2 changes: 1 addition & 1 deletion sdk/chunks_internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func (opts *chunksOptionsInternal) ChunksBytes(w io.Writer) error {
}

// chunksParseFunc handles special cases such as structs and enums (if any).
func chunksParseFunc(target interface{}, key, value string) (bool, error) {
func chunksParseFunc(target any, key, value string) (bool, error) {
var found bool
opts, ok := target.(*chunksOptionsInternal)
if !ok {
Expand Down
2 changes: 1 addition & 1 deletion sdk/config_internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func (opts *configOptionsInternal) ConfigBytes(w io.Writer) error {
}

// configParseFunc handles special cases such as structs and enums (if any).
func configParseFunc(target interface{}, key, value string) (bool, error) {
func configParseFunc(target any, key, value string) (bool, error) {
var found bool
opts, ok := target.(*configOptionsInternal)
if !ok {
Expand Down
Loading
Loading