Skip to content
This repository was archived by the owner on Nov 9, 2022. It is now read-only.

Commit 767545d

Browse files
committed
chore: fix subgraph bugs
1 parent ba77111 commit 767545d

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
## (2021-01-23)
1+
## (2021-01-25)
22

33
- chore: build subgraph schema ([9810923](https://github.com/kleros/governor-web/commit/9810923))
44
- chore: generate first changelog ([2e41de7](https://github.com/kleros/governor-web/commit/2e41de7))
55
- chore: map appeal funding in subgraph ([990a87d](https://github.com/kleros/governor-web/commit/990a87d))
66
- chore: map governance functions in subgraph ([360d007](https://github.com/kleros/governor-web/commit/360d007))
77
- chore: map list submissions in subgraph ([8cbbe41](https://github.com/kleros/governor-web/commit/8cbbe41))
88
- chore: map the withdrawal and execution of submissions in subgraph ([f74acb7](https://github.com/kleros/governor-web/commit/f74acb7))
9+
- chore: map transaction executions in subgraph ([ba77111](https://github.com/kleros/governor-web/commit/ba77111))
910
- chore: map withdrawals and rulings in subgraph ([fddd9b7](https://github.com/kleros/governor-web/commit/fddd9b7))
1011
- chore: set up project and architecture ([d28fb74](https://github.com/kleros/governor-web/commit/d28fb74))

subgraph/schema.graphql

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
"""
2+
Non functional change for redeployments: 0
3+
"""
14
enum Status {
25
"""
36
Session has no dispute.

subgraph/src/mapping.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ function initializeContract(
5656
contract = new Contract("0");
5757
contract.arbitrator = governor.arbitrator();
5858
contract.arbitratorExtraData = governor.arbitratorExtraData();
59-
contract.deployer = contract.deployer || deployer;
59+
contract.deployer = deployer;
6060
contract.reservedETH = governor.reservedETH();
6161
contract.submissionBaseDeposit = governor.submissionBaseDeposit();
6262
contract.submissionTimeout = governor.submissionTimeout();
@@ -88,7 +88,7 @@ function newSession(contract: Contract, creationTime: BigInt): Session {
8888
session.roundsLength = BigInt.fromI32(0);
8989
session.save();
9090

91-
contract.sessionsLength.plus(BigInt.fromI32(1));
91+
contract.sessionsLength = contract.sessionsLength.plus(BigInt.fromI32(1));
9292
contract.save();
9393

9494
// Something is broken with The Graph's null type guards so we need these explicit casts in some places.
@@ -100,7 +100,7 @@ function newRound(session: Session, creationTime: BigInt): Round {
100100
crypto
101101
.keccak256(
102102
concatByteArrays(
103-
ByteArray.fromHexString(session.id),
103+
ByteArray.fromUTF8(session.id),
104104
ByteArray.fromUTF8(session.roundsLength.toString())
105105
)
106106
)
@@ -137,7 +137,7 @@ function updateContribution(
137137

138138
let roundID = crypto.keccak256(
139139
concatByteArrays(
140-
ByteArray.fromUTF8(sessionID.toString()),
140+
ByteArray.fromUTF8(sessionID.toHexString()),
141141
ByteArray.fromUTF8(roundIndex.toString())
142142
)
143143
);
@@ -263,7 +263,7 @@ export function submitList(call: SubmitListCall): void {
263263
for (let i = 0; i < call.inputs._target.length; i++) {
264264
let transaction = new Transaction(
265265
concatByteArrays(
266-
crypto.keccak256(ByteArray.fromHexString(submission.id)),
266+
crypto.keccak256(ByteArray.fromUTF8(submission.id)),
267267
ByteArray.fromUTF8(i.toString())
268268
).toHexString()
269269
);
@@ -405,7 +405,7 @@ export function withdrawFeesAndRewards(call: WithdrawFeesAndRewardsCall): void {
405405
}
406406

407407
export function ruling(event: Ruling): void {
408-
let governor = Governor.bind(event.transaction.to as Address);
408+
let governor = Governor.bind(event.address);
409409
let contract = initializeContract(
410410
event.transaction.to as Address,
411411
event.transaction.from,
@@ -446,7 +446,7 @@ export function executeTransactionList(call: ExecuteTransactionListCall): void {
446446
for (let i = 0; i < submission.transactionsLength.toI32(); i++) {
447447
let transaction = Transaction.load(
448448
concatByteArrays(
449-
crypto.keccak256(ByteArray.fromHexString(submission.id)),
449+
crypto.keccak256(ByteArray.fromUTF8(submission.id)),
450450
ByteArray.fromUTF8(i.toString())
451451
).toHexString()
452452
);

0 commit comments

Comments
 (0)