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(builtins): extension v3 #951

Open
wants to merge 24 commits into
base: release/galactica
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
51f4c07
feat: e2e tests on release branches (#946)
freemanzMrojo Jan 15, 2025
583a539
feat(builtins): extension v3
darrenvechain Jan 17, 2025
6e2a7d4
feat(builtins): extension v3
darrenvechain Jan 17, 2025
f1617d3
MainDB V4 and LogDB with various improvements (#942)
darrenvechain Jan 20, 2025
109a6fb
Metrics (Compaction): Values by level (#936)
freemanzMrojo Jan 20, 2025
f49e4b0
Metrics (Compaction): Do not call the DB if metrics are disabled (#952)
freemanzMrojo Jan 20, 2025
0a0fe44
fix: runtime extension update
darrenvechain Jan 21, 2025
11e3ad8
fix: broken tests
darrenvechain Jan 21, 2025
97e6cf4
fix: devnet extension
darrenvechain Jan 21, 2025
1839534
DB metrics skeleton + Tx Pool updates (#953)
libotony Jan 21, 2025
b21dc94
Metrics (Accounts): State changes (#916)
freemanzMrojo Jan 22, 2025
8dc06f4
fix(gha): remove extra comma (#957)
darrenvechain Jan 23, 2025
df5e113
fix gosec (#958)
libotony Jan 23, 2025
4d3c7bf
Fix expired txs flaky test (#955)
vanja-vechain Jan 23, 2025
d599167
Run on older version of runner (#960)
vanja-vechain Jan 24, 2025
38e83df
chore(metrics): update the fork counter (#961)
darrenvechain Jan 24, 2025
d39031b
chore(gha): publish release branches to github on commit (#959)
darrenvechain Jan 27, 2025
ee7f5e3
fix: broken master CI (#962)
darrenvechain Jan 27, 2025
c5d4a14
feat(solo): keep thor solo genesis ID consistent for all forks (#956)
darrenvechain Jan 27, 2025
76e095b
chore(gha): only run codecove on vechain/thor (#963)
darrenvechain Jan 28, 2025
918b4ab
Enhance err handling in websockets (#966)
otherview Jan 29, 2025
1b4a1b5
fix: using from instead of to (#968)
darrenvechain Jan 30, 2025
7fd352f
Update from go-eth upstream (#971)
otherview Feb 4, 2025
d0f58f1
Merge branch 'master' into feat/extension-v3
darrenvechain Feb 5, 2025
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
4 changes: 2 additions & 2 deletions .github/workflows/gosec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,5 @@ jobs:
{
"commit-url": "${{ github.event.head_commit.url }}",
"branch": "${{ github.ref }}",
"repository": "${{ github.repository }}",
}
"repository": "${{ github.repository }}"
}
15 changes: 10 additions & 5 deletions .github/workflows/on-master-commit.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
name: Master branch CI
name: Master / Release CI

on:
push:
branches:
- 'master'
- 'release/*'
- 'releases/*'

jobs:
run-unit-tests:
Expand Down Expand Up @@ -34,13 +36,18 @@ jobs:
outputs:
tag_date: ${{ steps.tag_date.outputs.tag_date }}
short_sha: ${{ steps.short_sha.outputs.short_sha }}
clean_ref_name: ${{ steps.clean_ref_name.outputs.clean_ref_name }}
steps:
- name: Generate Tag Date
id: tag_date
run: echo "tag_date=$(date +'%Y%m%d')" >> "$GITHUB_OUTPUT"
- name: Generate Short SHA
id: short_sha
run: echo "short_sha=$(echo $GITHUB_SHA | cut -c1-7)" >> "$GITHUB_OUTPUT"
- name: Clean Ref Name
id: clean_ref_name
# replace '/' with '-' in the case of release branches
run: echo "clean_ref_name=$(echo $GITHUB_REF_NAME | sed 's/\//-/g')" >> "$GITHUB_OUTPUT"

publish-docker-image:
name: Publish Docker Image
Expand All @@ -58,12 +65,10 @@ jobs:
with:
images: |
ghcr.io/${{ github.repository }}
# eg: master-20240321-7d8e9f2
tags: |
type=raw,value=master-${{ needs.generate-tags.outputs.tag_date }}-${{ needs.generate-tags.outputs.short_sha }}
type=raw,value=master-latest
type=raw,value=${{ needs.generate-tags.outputs.clean_ref_name }}-${{ needs.generate-tags.outputs.tag_date }}-${{ needs.generate-tags.outputs.short_sha }}
type=raw,value=${{ needs.generate-tags.outputs.clean_ref_name }}-latest
trigger_internal_ci: true

notify-slack:
name: Notify Slack
needs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-docker-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ on:
jobs:
build-and-push-image:
name: Build and Push Docker Image
runs-on: ubuntu-latest
runs-on: ubuntu-22.04

permissions:
contents: read
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ jobs:
run: make test-coverage

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@v5
if: ${{ github.repository == 'vechain/thor' }}
with:
fail_ci_if_error: true
file: ./coverage.out
files: ./coverage.out
token: ${{ secrets.CODECOV_TOKEN }}
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ FROM golang:1.22-alpine3.20 AS builder

RUN apk add --no-cache make gcc musl-dev linux-headers git
WORKDIR /go/thor

COPY go.mod go.sum ./
RUN go mod download

COPY . /go/thor
RUN make all

Expand Down
4 changes: 3 additions & 1 deletion api/accounts/accounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,9 @@ func (a *Accounts) handleBatchCallData(batchCallData *BatchCallData) (txCtx *xen
gas = batchCallData.Gas
}

txCtx = &xenv.TransactionContext{}
txCtx = &xenv.TransactionContext{
ClauseCount: big.NewInt(int64(len(batchCallData.Clauses))),
}

if batchCallData.GasPrice == nil {
txCtx.GasPrice = new(big.Int)
Expand Down
5 changes: 3 additions & 2 deletions api/debug/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -376,14 +376,15 @@ func (d *Debug) parseTarget(target string) (block *block.Block, txID thor.Bytes3
if err != nil {
return nil, thor.Bytes32{}, 0, utils.BadRequest(errors.WithMessage(err, "target([0]"))
}
txMeta, err := d.repo.NewBestChain().GetTransactionMeta(txID)
bestChain := d.repo.NewBestChain()
txMeta, err := bestChain.GetTransactionMeta(txID)
if err != nil {
if d.repo.IsNotFound(err) {
return nil, thor.Bytes32{}, 0, utils.Forbidden(errors.New("transaction not found"))
}
return nil, thor.Bytes32{}, 0, err
}
block, err = d.repo.GetBlock(txMeta.BlockID)
block, err = bestChain.GetBlock(txMeta.BlockNum)
if err != nil {
return nil, thor.Bytes32{}, 0, err
}
Expand Down
7 changes: 3 additions & 4 deletions api/debug/debug_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
"github.com/vechain/thor/v2/thor"
"github.com/vechain/thor/v2/thorclient"
"github.com/vechain/thor/v2/tracers/logger"
"github.com/vechain/thor/v2/trie"
"github.com/vechain/thor/v2/tx"

// Force-load the tracer native engines to trigger registration
Expand Down Expand Up @@ -94,8 +95,7 @@ func TestDebug(t *testing.T) {
}

func TestStorageRangeFunc(t *testing.T) {
db := muxdb.NewMem()
state := state.New(db, thor.Bytes32{}, 0, 0, 0)
state := state.New(muxdb.NewMem(), trie.Root{})

// Create an account and set storage values
addr := thor.BytesToAddress([]byte("account1"))
Expand Down Expand Up @@ -124,8 +124,7 @@ func TestStorageRangeFunc(t *testing.T) {
}

func TestStorageRangeMaxResult(t *testing.T) {
db := muxdb.NewMem()
state := state.New(db, thor.Bytes32{}, 0, 0, 0)
state := state.New(muxdb.NewMem(), trie.Root{})

addr := thor.BytesToAddress([]byte("account1"))
for i := 0; i < 1001; i++ {
Expand Down
40 changes: 38 additions & 2 deletions api/doc/thor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ info:
license:
name: LGPL 3.0
url: https://www.gnu.org/licenses/lgpl-3.0.en.html
version: 2.1.6
version: 2.2.0
servers:
- url: /
description: Current Node
Expand Down Expand Up @@ -1326,6 +1326,16 @@ components:
description: The index of the clause in the transaction, from which the log was generated.
example: 0
nullable: false
txIndex:
description: The index of the transaction in the block, from which the log was generated.
type: integer
nullable: true
example: 1
logIndex:
description: The index of the log in the receipt's outputs. This is an overall index among all clauses.
type: integer
nullable: true
example: 1

Block:
title: Block
Expand Down Expand Up @@ -1856,6 +1866,11 @@ components:
The limit of records to be included in the output. Use this parameter for pagination.

Default's to all results.
includeIndexes:
type: boolean
example: true
nullable: true
description: Include both transaction and log index in the response.
description: |
Include these parameters to receive filtered results in a paged format.

Expand All @@ -1866,7 +1881,8 @@ components:
{
"options": {
"offset": 0,
"limit": 10
"limit": 10,
"includeIndexes": true
}
}
```
Expand Down Expand Up @@ -1917,6 +1933,26 @@ components:
}
```
This refers to the range from block 10 to block 1000.

EventOptionalData:
nullable: true
type: object
title: EventOptionalData
properties:
txIndex:
type: boolean
example: true
nullable: true
description: |
Specifies whether to include in the response the event transaction index.
loglIndex:
type: boolean
example: true
nullable: true
description: |
Specifies whether to include in the response the event log index.
description: |
Specifies all the optional data that can be included in the response.

EventCriteria:
type: object
Expand Down
9 changes: 5 additions & 4 deletions api/events/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func (e *Events) filter(ctx context.Context, ef *EventFilter) ([]*FilteredEvent,
}
fes := make([]*FilteredEvent, len(events))
for i, e := range events {
fes[i] = convertEvent(e)
fes[i] = convertEvent(e, ef.Options.IncludeIndexes)
}
return fes, nil
}
Expand All @@ -60,9 +60,10 @@ func (e *Events) handleFilter(w http.ResponseWriter, req *http.Request) error {
if filter.Options == nil {
// if filter.Options is nil, set to the default limit +1
// to detect whether there are more logs than the default limit
filter.Options = &logdb.Options{
Offset: 0,
Limit: e.limit + 1,
filter.Options = &Options{
Offset: 0,
Limit: e.limit + 1,
IncludeIndexes: false,
}
}

Expand Down
Loading