Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 22 additions & 21 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ env:
CHIFRA_PATH: src/apps/chifra
KHEDRA_PATH: khedra
# Go Version
GO_VERSION: 1.23.1
GO_VERSION: 1.25.1
jobs:
Lint:
runs-on: ubuntu-latest
Expand All @@ -21,19 +21,17 @@ jobs:
run: |
./scripts/go-work-sync.sh
- name: Lint chifra
uses: golangci/golangci-lint-action@v4
uses: golangci/golangci-lint-action@v8
with:
version: v1.61.0
version: v2.4.0
working-directory: ${{ env.CHIFRA_PATH }}
args: --timeout=5m --verbose --out-format=colored-line-number
skip-pkg-cache: true
args: --timeout=5m --verbose --output.text.colors=true --output.text.print-linter-name=true
- name: Lint khedra
uses: golangci/golangci-lint-action@v4
uses: golangci/golangci-lint-action@v8
with:
version: v1.61.0
version: v2.4.0
working-directory: ${{ env.KHEDRA_PATH }}
args: --timeout=5m --verbose --out-format=colored-line-number
skip-pkg-cache: true
args: --timeout=5m --verbose --output.text.colors=true --output.text.print-linter-name=true
Build:
needs: Lint
runs-on: ubuntu-latest
Expand All @@ -50,11 +48,12 @@ jobs:
- name: Install prerequistes
run: |
sudo apt-mark hold grub-efi-amd64-signed
sudo apt-get update --fix-missing
sudo apt-get upgrade
sudo apt-get install build-essential git cmake
sudo apt-get install python3 tree jq
sudo apt-get install libcurl3-dev
sudo apt-mark hold firefox
sudo apt-get update --fix-missing || true
sudo apt-get upgrade -y --fix-missing || true
sudo apt-get install -y build-essential git cmake
sudo apt-get install -y python3 tree jq
sudo apt-get install -y libcurl3-dev
- name: Run chifra unit tests
run: |
mkdir -p build
Expand All @@ -68,19 +67,20 @@ jobs:
export TB_NO_PROVIDER_CHECK=true
go test ./...
cd ../../../
cd ${{ env.KHEDRA_PATH }}
export TB_NO_PROVIDER_CHECK=true
go test ./...
# cd ${{ env.KHEDRA_PATH }}
# export TB_NO_PROVIDER_CHECK=true
# go test ./...
RemoteTests:
needs: Build
runs-on: ubuntu-latest
steps:
- name: Run tests remotely
uses: appleboy/ssh-action@master
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ secrets.TESTING_HOST }}
username: ${{ secrets.TESTING_USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
# These secrets are configured in the repository settings
host: ${{ secrets.TESTING_HOST }} # Remote testing server hostname
username: ${{ secrets.TESTING_USERNAME }} # SSH username for remote testing
key: ${{ secrets.SSH_PRIVATE_KEY }} # SSH private key for authentication
command_timeout: 40m
script: |
set -e # Exit on any error
Expand All @@ -93,6 +93,7 @@ jobs:
git checkout ${{ github.head_ref }}
git submodule update --init --recursive
cd scripts
bash check_go_version.sh ${{ env.GO_VERSION }}
if CONFIG_FILE=$HOME/trueBlocks.toml bash test-with-docker.sh ${{ github.repository }} ${{ github.sha }} ${{ github.head_ref }}; then
echo "✅ Tests passed successfully"
echo "Results placed in /home/testuser/testing/${{ github.sha }}"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
uses: actions/setup-go@v1
with:
# Go Version
go-version: '1.23.1'
go-version: '1.25.1'
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
Expand Down
68 changes: 65 additions & 3 deletions docs/content/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,14 @@ paths:
explode: true
schema:
type: boolean
- name: approvals
description: export all token approval transactions for the given address
required: false
style: form
in: query
explode: true
schema:
type: boolean
- name: traces
description: export traces instead of transactional data
required: false
Expand Down Expand Up @@ -2304,7 +2312,7 @@ paths:
operationId: chainstate-tokens
parameters:
- name: addrs
description: two or more addresses (0x...), the first is an ERC20 token, balances for the rest are reported
description: two or more addresses (one for --approvals), the first is an ERC20 token, balances for the rest are reported
required: true
style: form
in: query
Expand All @@ -2325,6 +2333,14 @@ paths:
items:
type: string
format: blknum
- name: approvals
description: returns all open approvals for the given address(es)
required: false
style: form
in: query
explode: true
schema:
type: boolean
- name: parts
description: which parts of the token information to retrieve
required: false
Expand Down Expand Up @@ -2415,10 +2431,12 @@ paths:
schema:
properties:
data:
description: Produces <a href="/data-model/chainstate/#token">Token</a> data. Corresponds to the <a href="/chifra/chainstate/#chifra-tokens">chifra tokens</a> command line.
description: Produces <a href="/data-model/accounts/#approval">Approval</a> or <a href="/data-model/chainstate/#token">Token</a> data. Corresponds to the <a href="/chifra/chainstate/#chifra-tokens">chifra tokens</a> command line.
type: array
items:
$ref: "#/components/schemas/token"
oneOf:
- $ref: "#/components/schemas/approval"
- $ref: "#/components/schemas/token"
examples:
[
{
Expand Down Expand Up @@ -3564,6 +3582,50 @@ components:
items:
$ref: "#/components/schemas/log"
description: "if a token transfer, the log that triggered the transfer (calculated)"
approval:
description: "an ERC-20 token approval granting spending permission from owner to spender"
type: object
properties:
blockNumber:
type: number
format: blknum
description: "the block number at which this call was made"
timestamp:
type: number
format: timestamp
description: "the timestamp of the block for this call"
date:
type: string
format: datetime
description: "the timestamp as a date (calculated)"
address:
type: string
format: address
description: "the address of the owner of the token (the approver)"
addressName:
type: string
format: string
description: "the name of the holder, if available"
spender:
type: string
format: address
description: "the address being granted approval to spend tokens"
spenderName:
type: string
format: string
description: "the name of the spender, if available"
amount:
type: string
format: wei
description: "the amount of tokens approved for spending"
token:
type: string
format: address
description: "the address of the ERC-20 token being approved"
tokenName:
type: string
format: string
description: "the name of the token, if available"
appearanceTable:
description: "an appearance table for an address"
type: object
Expand Down
1 change: 1 addition & 0 deletions docs/content/chifra/accounts.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ Flags:
-p, --appearances export a list of appearances
-r, --receipts export receipts instead of transactional data
-l, --logs export logs instead of transactional data
-O, --approvals export all token approval transactions for the given address
-t, --traces export traces instead of transactional data
-n, --neighbors export the neighbors of the given address
-A, --statements export only statements
Expand Down
2 changes: 1 addition & 1 deletion docs/content/chifra/chaindata.md
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ Links:

The `--traces` option requires your node to enable the `trace_block` (and related) RPC endpoints. Many remote RPC providers do not enable these endpoints due to the additional load they can place on the node. If you are running your own node, you can enable these endpoints by adding `trace` to your node's startup.

The test for tracing assumes your node provides tracing starting at block 1. If your is partially synced, you may export the following enviroment variable before running the command to instruct `chifra` where to test.
The test for tracing assumes your node provides tracing starting at block 1. If your is partially synced, you may export the following environment variable before running the command to instruct `chifra` where to test.

```[bash]
export TB_<chain>_FIRSTTRACE=<bn>
Expand Down
5 changes: 4 additions & 1 deletion docs/content/chifra/chainstate.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,11 @@ Usage:
chifra tokens [flags] <address> <address> [address...] [block...]

Arguments:
addrs - two or more addresses (0x...), the first is an ERC20 token, balances for the rest are reported (required)
addrs - two or more addresses (one for --approvals), the first is an ERC20 token, balances for the rest are reported (required)
blocks - an optional list of one or more blocks at which to report balances, defaults to 'latest'

Flags:
-O, --approvals returns all open approvals for the given address(es)
-p, --parts strings which parts of the token information to retrieve
One or more of [ name | symbol | decimals | totalSupply | version | some | all ]
-b, --by_acct consider each address an ERC20 token except the last, whose balance is reported for each token
Expand All @@ -140,10 +141,12 @@ Notes:
- If the queried node does not store historical state, the results are undefined.
- Special blocks are detailed under chifra when --list.
- If the --parts option is not empty, all addresses are considered tokens and each token's attributes are presented.
- For the --approvals option, all open approvals are reported for each provided address.
```

Data models produced by this tool:

- [approval](/data-model/accounts/#approval)
- [token](/data-model/chainstate/#token)

Links:
Expand Down
2 changes: 1 addition & 1 deletion docs/content/chifra/configs.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ the table below for the name of each tool's config file.

## Multichain

If you're running against mutliple chains, you may place any of these files in the root of the
If you're running against multiple chains, you may place any of these files in the root of the
chain's configuration folder, and the values found there will replace any values found at the
top level. In this way, you may configure all chains for certain values, but customize your
configuration per chain.
Expand Down
2 changes: 1 addition & 1 deletion docs/content/chifra/globals.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ Where:

### Group 4

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

Expand Down
26 changes: 26 additions & 0 deletions docs/content/data-model/accounts.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,31 @@ Transfers consist of the following fields:
| transaction | the transaction that triggered the transfer (calculated) | [Transaction](/data-model/chaindata/#transaction) |
| log | if a token transfer, the log that triggered the transfer (calculated) | [Log](/data-model/chaindata/#log) |

## Approval

An Approval represents an ERC-20 token spending permission granted by a token owner to a spender address. This data structure captures the essential elements of the `approve()` function call, including the token contract address, the owner granting permission, the spender receiving permission, and the approved amount.

Approvals are fundamental to ERC-20 token interactions, enabling decentralized exchanges, automated market makers, and other DeFi protocols to spend tokens on behalf of users. By tracking these permissions, users can monitor and analyze token spending authorizations across their addresses.

The following commands produce and manage Approvals:

- [chifra tokens](/chifra/chainstate/#chifra-tokens)

Approvals consist of the following fields:

| Field | Description | Type |
| ----------- | ---------------------------------------------------- | --------- |
| blockNumber | the block number at which this call was made | blknum |
| timestamp | the timestamp of the block for this call | timestamp |
| date | the timestamp as a date (calculated) | datetime |
| address | the address of the owner of the token (the approver) | address |
| addressName | the name of the holder, if available | string |
| spender | the address being granted approval to spend tokens | address |
| spenderName | the name of the spender, if available | string |
| amount | the amount of tokens approved for spending | wei |
| token | the address of the ERC-20 token being approved | address |
| tokenName | the name of the token, if available | string |

## AppearanceTable

The `appearanceTable` data model carries an address and all appearances for that address found in any given chunk.
Expand Down Expand Up @@ -289,5 +314,6 @@ This documentation mentions the following basic data types.
| uint32 | a 32-bit unsigned integer | |
| uint64 | a 64-bit unsigned integer | |
| value | an alias for a 64-bit unsigned integer | |
| wei | an unsigned big number | as a string |

*Copyright (c) 2024, TrueBlocks, LLC. All rights reserved. Generated with goMaker.*
2 changes: 1 addition & 1 deletion docs/content/docs/install/install-core.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ If you need help with a particular step, see the [installation's troubleshooting

- Open a terminal window.

- Type `go version`. If Go is not installed or less than Go Version 1.23, [install the latest version of Go](https://go.dev/doc/install)
- Type `go version`. If Go is not installed or less than Go Version 1.25.1, [install the latest version of Go](https://go.dev/doc/install)

- Install or upgrade the build dependencies: _git_, _cmake_, _ninja_, _curl_, _python_, _clang-format_, _jq_

Expand Down
4 changes: 2 additions & 2 deletions docs/content/docs/install/install-troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ This section lists solutions to problems some users have run into with the insta

### Installing go

#### How do I check my Go version?
#### How do I check my Go Version?

Run this command

```shell
go version
```

TrueBlocks needs version 1.16.x or later. If you to install or update Go, [see here](https://golang.org/doc/install).
TrueBlocks needs version 1.25.1 or later. If you to install or update Go, [see here](https://golang.org/doc/install).

### Installing build tools

Expand Down
2 changes: 1 addition & 1 deletion khedra
Loading
Loading