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

Aleph Zero Fixes #43

Open
wants to merge 1 commit into
base: refresh-for-poi
Choose a base branch
from
Open
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
3 changes: 1 addition & 2 deletions aleph-zero/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,4 @@ Thumbs.db
*.mov
*.wmv

.data

.data
1 change: 1 addition & 0 deletions aleph-zero/.project-cid
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
QmRy53SPQ3JRNdjKhPRguYdmGMpWbjf1TfLvzpHwEFJUgh
6 changes: 3 additions & 3 deletions aleph-zero/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
"author": "SubQuery Network",
"license": "Apache-2.0",
"devDependencies": {
"@polkadot/api": "^9",
"@polkadot/api": "10.1.4",
"@subql/cli": "latest",
"@subql/types": "latest",
"typescript": "^4.1.3",
"@subql/cli": "latest"
"typescript": "^5.0.4"
},
"resolutions": {
"ipfs-unixfs": "6.0.6"
Expand Down
1 change: 0 additions & 1 deletion aleph-zero/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ type Event @entity {

type Extrinsic @entity {
id: ID!
txHash: String!
module: String! @index
call: String! @index
blockHeight: BigInt! @index
Expand Down
14 changes: 9 additions & 5 deletions aleph-zero/src/mappings/mappingHandlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { EventRecord } from "@polkadot/types/interfaces";
import { SubstrateExtrinsic, SubstrateBlock } from "@subql/types";
import { SpecVersion, Event, Extrinsic } from "../types";

let specVersion: SpecVersion;
let specVersion: SpecVersion | undefined;
export async function handleBlock(block: SubstrateBlock): Promise<void> {
// Initialise Spec Version
if (!specVersion) {
Expand All @@ -11,16 +11,21 @@ export async function handleBlock(block: SubstrateBlock): Promise<void> {

// Check for updates to Spec Version
if (!specVersion || specVersion.id !== block.specVersion.toString()) {
specVersion = new SpecVersion(block.specVersion.toString(), block.block.header.number.toBigInt());
specVersion = SpecVersion.create({
id: block.specVersion.toString(),
blockHeight: block.block.header.number.toBigInt(),
});
await specVersion.save();
}

// Process all events in block
const events = block.events
.filter(
(evt) =>
!(evt.event.section === "system" &&
evt.event.method === "ExtrinsicSuccess")
!(
evt.event.section === "system" &&
evt.event.method === "ExtrinsicSuccess"
)
)
.map((evt, idx) =>
handleEvent(block.block.header.number.toString(), idx, evt)
Expand Down Expand Up @@ -54,7 +59,6 @@ function handleEvent(
function handleCall(idx: string, extrinsic: SubstrateExtrinsic): Extrinsic {
return Extrinsic.create({
id: idx,
txHash: extrinsic.extrinsic.hash.toString(),
module: extrinsic.extrinsic.method.section,
call: extrinsic.extrinsic.method.method,
blockHeight: extrinsic.block.block.header.number.toBigInt(),
Expand Down
3 changes: 2 additions & 1 deletion aleph-zero/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"module": "commonjs",
"outDir": "dist",
"rootDir": "src",
"target": "es2017"
"target": "es2017",
"strict": true
},
"include": [
"src/**/*",
Expand Down
34 changes: 25 additions & 9 deletions astar/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,44 @@ type Extrinsic @entity {
type EvmTransaction @entity {
id: ID!
txHash: String!
"""A lowercase address of the sender"""
"""
A lowercase address of the sender
"""
from: String! @index
"""A lowercase address. This will be null for contract creations"""
"""
A lowercase address. This will be null for contract creations
"""
to: String @index
"""A lowercased function sighash extracted from the data field"""
"""
A lowercased function sighash extracted from the data field
"""
func: String @index
blockHeight: BigInt! @index
success: Boolean!
}

type EvmLog @entity {
id: ID!
"""The contract address that emitted the event. Lowercased"""
"""
The contract address that emitted the event. Lowercased
"""
address: String! @index
Copy link
Contributor

Choose a reason for hiding this comment

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

remove indexes here too

blockHeight: BigInt! @index
"""The lowercase event signature"""
"""
The lowercase event signature
"""
topics0: String! @index
"""The lowercase first indexed argument"""
"""
The lowercase first indexed argument
"""
topics1: String
"""The lowercase second indexed argument"""
"""
The lowercase second indexed argument
"""
topics2: String
"""The lowercase third indexed argument"""
"""
The lowercase third indexed argument
"""
topics3: String
}

Expand All @@ -59,7 +75,7 @@ type ContractsCall @entity {
type ContractEmitted @entity {
id: ID!
contract: String! @index
from: String !@index
from: String! @index
Copy link
Contributor

Choose a reason for hiding this comment

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

remove indexes, except on blockHeight

eventIndex: Int! @index
blockHeight: BigInt! @index
}