Skip to content

Commit

Permalink
Merge pull request #735 from oasisprotocol/andrew7234/rofl-tx-support
Browse files Browse the repository at this point in the history
Andrew7234/rofl tx support
  • Loading branch information
Andrew7234 authored Aug 9, 2024
2 parents 78bbdbb + f21aaac commit d109446
Show file tree
Hide file tree
Showing 12 changed files with 144 additions and 90 deletions.
1 change: 1 addition & 0 deletions .changelog/735.feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
add rofl fee proxy support
4 changes: 2 additions & 2 deletions analyzer/queries/queries.go
Original file line number Diff line number Diff line change
Expand Up @@ -591,8 +591,8 @@ var (
SET total_received = EXCLUDED.total_received`

RuntimeTransactionInsert = `
INSERT INTO chain.runtime_transactions (runtime, round, tx_index, tx_hash, tx_eth_hash, fee, fee_symbol, gas_limit, gas_used, size, timestamp, method, body, "to", amount, amount_symbol, evm_encrypted_format, evm_encrypted_public_key, evm_encrypted_data_nonce, evm_encrypted_data_data, evm_encrypted_result_nonce, evm_encrypted_result_data, success, error_module, error_code, error_message_raw, error_message)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22, $23, $24, $25, $26, $27)`
INSERT INTO chain.runtime_transactions (runtime, round, tx_index, tx_hash, tx_eth_hash, fee, fee_symbol, fee_proxy_module, fee_proxy_id, gas_limit, gas_used, size, timestamp, method, body, "to", amount, amount_symbol, evm_encrypted_format, evm_encrypted_public_key, evm_encrypted_data_nonce, evm_encrypted_data_data, evm_encrypted_result_nonce, evm_encrypted_result_data, success, error_module, error_code, error_message_raw, error_message)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22, $23, $24, $25, $26, $27, $28, $29)`

// We use COALESCE here to avoid overwriting existing data with null values.
RuntimeTransactionEvmParsedFieldsUpdate = `
Expand Down
7 changes: 7 additions & 0 deletions analyzer/runtime/extract.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ type BlockTransactionData struct {
RelatedAccountAddresses map[apiTypes.Address]struct{}
Fee common.BigInt
FeeSymbol string
FeeProxyModule *string
FeeProxyID *[]byte
GasLimit uint64
Method string
Body interface{}
Expand Down Expand Up @@ -241,6 +243,7 @@ func ExtractRound(blockHeader nodeapi.RuntimeBlockHeader, txrs []nodeapi.Runtime
"round", blockHeader.Round,
"tx_index", txIndex,
"tx_hash", txr.Tx.Hash(),
"tx_body_cbor", hex.EncodeToString(txr.Tx.Body),
"err", err,
)
tx = nil
Expand All @@ -261,6 +264,10 @@ func ExtractRound(blockHeader nodeapi.RuntimeBlockHeader, txrs []nodeapi.Runtime
}
blockTransactionData.Fee = common.BigIntFromQuantity(tx.AuthInfo.Fee.Amount.Amount)
blockTransactionData.FeeSymbol = stringifyDenomination(sdkPT, tx.AuthInfo.Fee.Amount.Denomination)
if tx.AuthInfo.Fee.Proxy != nil {
blockTransactionData.FeeProxyModule = &tx.AuthInfo.Fee.Proxy.Module
blockTransactionData.FeeProxyID = common.Ptr(tx.AuthInfo.Fee.Proxy.ID)
}
blockTransactionData.GasLimit = tx.AuthInfo.Fee.Gas

// Parse the success/error status.
Expand Down
2 changes: 2 additions & 0 deletions analyzer/runtime/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,8 @@ func (m *processor) queueDbUpdates(batch *storage.QueryBatch, data *BlockData) {
transactionData.EthHash,
&transactionData.Fee, // pgx bug? Needs a *BigInt (not BigInt) to know how to serialize.
transactionData.FeeSymbol,
transactionData.FeeProxyModule,
transactionData.FeeProxyID,
transactionData.GasLimit,
transactionData.GasUsed,
transactionData.Size,
Expand Down
9 changes: 9 additions & 0 deletions api/spec/v1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2793,6 +2793,15 @@ components:
type: string
description: |
The denomination of the fee.
fee_proxy_module:
type: string
description: |
The module of the fee proxy.
fee_proxy_id:
type: string
format: byte
description: |
the base64-encoded id of the fee proxy.
gas_limit:
type: integer
format: uint64
Expand Down
41 changes: 22 additions & 19 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
module github.com/oasisprotocol/nexus

go 1.22

toolchain go1.22.2
go 1.22.2

replace (
github.com/cometbft/cometbft => github.com/oasisprotocol/cometbft v0.37.2-oasis1
Expand All @@ -22,8 +20,8 @@ require (
github.com/google/uuid v1.6.0
github.com/jackc/pgx/v5 v5.5.4
github.com/knadh/koanf v1.4.1
github.com/oasisprotocol/oasis-core/go v0.2300.10
github.com/oasisprotocol/oasis-sdk/client-sdk/go v0.8.3
github.com/oasisprotocol/oasis-core/go v0.2401.0
github.com/oasisprotocol/oasis-sdk/client-sdk/go v0.10.1
github.com/prometheus/client_golang v1.19.0
github.com/spf13/cobra v1.8.0
github.com/stretchr/testify v1.9.0
Expand All @@ -41,20 +39,21 @@ require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/bits-and-blooms/bitset v1.13.0 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.3 // indirect
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 // indirect
github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 // indirect
github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/cloudflare/circl v1.3.7 // indirect
github.com/cometbft/cometbft v0.0.0-00010101000000-000000000000 // indirect
github.com/cometbft/cometbft v0.37.7 // indirect
github.com/consensys/bavard v0.1.13 // indirect
github.com/consensys/gnark-crypto v0.12.1 // indirect
github.com/cosmos/gogoproto v1.4.1 // indirect
github.com/crate-crypto/go-kzg-4844 v1.0.0 // indirect
github.com/cyphar/filepath-securejoin v0.2.4 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
github.com/dustin/go-humanize v1.0.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect
github.com/dgraph-io/badger/v4 v4.2.0 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/eapache/channels v1.1.0 // indirect
github.com/eapache/queue v1.1.0 // indirect
github.com/emirpasic/gods v1.18.1 // indirect
Expand All @@ -68,10 +67,12 @@ require (
github.com/go-logfmt/logfmt v0.5.1 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/swag v0.21.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/glog v1.2.0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect
github.com/google/flatbuffers v2.0.8+incompatible // indirect
github.com/google/go-github/v39 v39.2.0 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/gtank/merlin v0.1.1 // indirect
Expand All @@ -92,12 +93,13 @@ require (
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/kevinburke/ssh_config v1.2.0 // indirect
github.com/klauspost/cpuid/v2 v2.2.5 // indirect
github.com/klauspost/compress v1.17.7 // indirect
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
github.com/labstack/echo/v4 v4.9.1 // indirect
github.com/labstack/gommon v0.4.0 // indirect
github.com/lib/pq v1.10.7 // indirect
github.com/libp2p/go-buffer-pool v0.1.0 // indirect
github.com/libp2p/go-libp2p v0.32.2 // indirect
github.com/libp2p/go-libp2p v0.33.2 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
Expand All @@ -113,7 +115,7 @@ require (
github.com/mr-tron/base58 v1.2.0 // indirect
github.com/multiformats/go-base32 v0.1.0 // indirect
github.com/multiformats/go-base36 v0.2.0 // indirect
github.com/multiformats/go-multiaddr v0.12.0 // indirect
github.com/multiformats/go-multiaddr v0.12.3 // indirect
github.com/multiformats/go-multibase v0.2.0 // indirect
github.com/multiformats/go-multicodec v0.9.0 // indirect
github.com/multiformats/go-multihash v0.2.3 // indirect
Expand All @@ -126,9 +128,9 @@ require (
github.com/pjbgf/sha1cd v0.3.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/common v0.48.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.52.2 // indirect
github.com/prometheus/procfs v0.13.0 // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/sasha-s/go-deadlock v0.3.1 // indirect
Expand All @@ -148,12 +150,13 @@ require (
github.com/valyala/fasttemplate v1.2.2 // indirect
github.com/x448/float16 v0.8.4 // indirect
github.com/xanzy/ssh-agent v0.3.3 // indirect
go.opencensus.io v0.24.0 // indirect
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.26.0 // indirect
go.uber.org/zap v1.27.0 // indirect
golang.org/x/mod v0.17.0 // indirect
golang.org/x/net v0.24.0 // indirect
golang.org/x/oauth2 v0.17.0 // indirect
golang.org/x/oauth2 v0.18.0 // indirect
golang.org/x/sys v0.20.0 // indirect
golang.org/x/text v0.15.0 // indirect
golang.org/x/tools v0.20.0 // indirect
Expand All @@ -164,7 +167,7 @@ require (
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
lukechampine.com/blake3 v1.2.1 // indirect
lukechampine.com/blake3 v1.2.2 // indirect
rsc.io/tmplfunc v0.0.3 // indirect
)

Expand All @@ -176,5 +179,5 @@ require (
github.com/oasisprotocol/metadata-registry-tools v0.0.0-20230424075921-93d132769e14
github.com/rs/cors v1.8.3
golang.org/x/crypto v0.23.0
golang.org/x/exp v0.0.0-20240213143201-ec583247a57a
golang.org/x/exp v0.0.0-20240325151524-a685a6edb6d8
)
Loading

0 comments on commit d109446

Please sign in to comment.