-
Notifications
You must be signed in to change notification settings - Fork 49
Shutterized Dispute Kit #1965
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
base: dev
Are you sure you want to change the base?
Shutterized Dispute Kit #1965
Conversation
WalkthroughThe changes introduce a new Shutter-based dispute kit (DisputeKitShutter) to the arbitration system, including its deployment, proxy, and integration into deployment scripts and tests. Supporting scripts for encryption and decryption using the Shutter Network are added, and existing dispute kit logic is refactored to support extensibility. Documentation and dependency updates reflect the new functionality. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant ShutterScript
participant ShutterAPI
participant ShutterSDK
User->>ShutterScript: encrypt(message)
ShutterScript->>ShutterAPI: fetchShutterData(decryptionTimestamp)
ShutterAPI-->>ShutterScript: message data (public key, etc.)
ShutterScript->>ShutterSDK: encryptData(message, publicKey, sigma)
ShutterSDK-->>ShutterScript: encryptedCommitment
ShutterScript-->>User: { encryptedCommitment, identity }
User->>ShutterScript: decrypt(encryptedMessage, identity)
ShutterScript->>ShutterAPI: fetchDecryptionKey(identity)
ShutterAPI-->>ShutterScript: decryption key
ShutterScript->>ShutterSDK: decrypt(encryptedMessage, decryptionKey)
ShutterSDK-->>ShutterScript: decrypted message
ShutterScript-->>User: decrypted message
sequenceDiagram
participant Deployer
participant DeployScript
participant DisputeKitShutterProxy
participant DisputeKitShutter
participant KlerosCore
Deployer->>DeployScript: Run deployment
DeployScript->>DisputeKitShutterProxy: Deploy with DisputeKitShutter implementation
DisputeKitShutterProxy->>DisputeKitShutter: Initialize(governor, core)
DeployScript->>KlerosCore: addNewDisputeKit(DisputeKitShutterProxy)
DeployScript->>KlerosCore: enableDisputeKits(GeneralCourt, [DisputeKitClassic, DisputeKitShutter])
Possibly related PRs
Suggested reviewers
Poem
Note ⚡️ AI Code Reviews for VS Code, Cursor, WindsurfCodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback. Note ⚡️ Faster reviews with cachingCodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
❌ Deploy Preview for kleros-v2-university failed. Why did it fail? →
|
✅ Deploy Preview for kleros-v2-testnet ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for kleros-v2-neo ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for kleros-v2-testnet-devtools ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
🧹 Nitpick comments (5)
contracts/src/arbitration/dispute-kits/DisputeKitClassicBase.sol (1)
439-453
: Added virtual hashVote function for extensible vote hashingThis new
hashVote
function is a key architectural change that enables the Shutter integration:
- It's declared as
virtual
so derived contracts can override it- The base implementation hashes only
_choice
and_salt
(backward compatible)- It accepts but doesn't use the
_justification
parameter in the base implementation- The comment explicitly indicates that derived contracts may use the unused parameters
This design enables the specialized Shutter implementation to include the justification in the hash calculation.
This is a well-designed extension point that maintains backward compatibility while enabling new functionality in derived contracts. The virtual function pattern allows for specialized implementations like DisputeKitShutter to include the justification in the hash while keeping the base functionality unchanged.
contracts/src/arbitration/dispute-kits/DisputeKitShutter.sol (2)
30-33
: Unnecessary external self-call incurs gas & re-entrancy risk
this.castCommit(...)
performs an external call to the same contract, paying
extra gas for ABI encoding/decoding and exposing the function to re-entrancy
checks (albeit low-risk here).Since
castCommit
is declaredexternal
, you can call it internally without
this
by using the fully-qualified function name:- this.castCommit(_coreDisputeID, _voteIDs, _commit); + castCommit(_coreDisputeID, _voteIDs, _commit);This is cheaper and avoids the external-call context switch.
85-92
: Natspec parameter order does not match function signatureThe docstring lists the parameters as
(_choice, _justification, _salt)
while the signature is(_choice, _salt, _justification)
.
This can confuse automated doc generators.- * @param _justification The justification for the vote - * @param _salt A random salt for commitment + * @param _salt A random salt for commitment + * @param _justification The justification for the votecontracts/scripts/shutter.ts (2)
33-82
: Missing retry / back-off on Shutter API call
fetchShutterData
fails the whole encryption flow on the first transient HTTP
error. Consider adding a simple exponential back-off or at least one retry to
improve UX when the Shutter API momentarily flakes.Not blocking, but worth considering.
160-186
: Leaking raw Shutter keys in logs
encrypt()
logs the eon key, identity and sigma to stdout. These are
cryptographically sensitive materials and should not be printed in production
mode.Recommend gating the
console.log
statements behind an environment variable
(e.g.DEBUG
) or removing them entirely.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
yarn.lock
is excluded by!**/yarn.lock
,!**/*.lock
📒 Files selected for processing (7)
contracts/package.json
(1 hunks)contracts/scripts/shutter.ts
(1 hunks)contracts/src/arbitration/dispute-kits/DisputeKitClassic.sol
(1 hunks)contracts/src/arbitration/dispute-kits/DisputeKitClassicBase.sol
(3 hunks)contracts/src/arbitration/dispute-kits/DisputeKitGated.sol
(1 hunks)contracts/src/arbitration/dispute-kits/DisputeKitShutter.sol
(1 hunks)contracts/test/foundry/KlerosCore.t.sol
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (12)
- GitHub Check: Redirect rules - kleros-v2-testnet
- GitHub Check: Redirect rules - kleros-v2-testnet
- GitHub Check: Header rules - kleros-v2-testnet
- GitHub Check: Header rules - kleros-v2-testnet
- GitHub Check: Pages changed - kleros-v2-testnet
- GitHub Check: Pages changed - kleros-v2-testnet
- GitHub Check: Redirect rules - kleros-v2-university
- GitHub Check: Header rules - kleros-v2-university
- GitHub Check: Pages changed - kleros-v2-university
- GitHub Check: SonarCloud
- GitHub Check: Analyze (javascript)
- GitHub Check: contracts-testing
🔇 Additional comments (8)
contracts/src/arbitration/dispute-kits/DisputeKitGated.sol (1)
30-30
: Version update from 0.8.0 to 0.9.0The version constant has been updated as part of the broader Shutter integration changes across dispute kit contracts.
contracts/package.json (1)
159-160
:❓ Verification inconclusive
Added Shutter SDK and related dependencies
These new dependencies are required to support the Shutter Network integration for encrypted commitments:
@shutter-network/shutter-sdk
- Core SDK for Shutter Network functionalityisomorphic-fetch
- Cross-environment fetch implementationNote that the Shutter SDK is at version
0.0.1
, which suggests it's in early development.
🏁 Script executed:
#!/bin/bash # Check for newer versions of the Shutter SDK and potential issues echo "Checking for latest version of @shutter-network/shutter-sdk" npm view @shutter-network/shutter-sdk versions echo "Checking for any reported issues or vulnerabilities" npm audit --json | grep -i shutterLength of output: 682
🏁 Script executed:
#!/bin/bash # Generate a lockfile to enable auditing npm install --package-lock-only echo "Re-checking for any reported issues or vulnerabilities after lockfile creation" npm audit --json | grep -i shutterLength of output: 796
Verify Shutter SDK and Fetch Dependency
The PR adds:
@shutter-network/shutter-sdk
@ 0.0.1isomorphic-fetch
@ ^3.0.0Because this project uses workspace-protocols, running
npm audit
in CI failed—please manually:
• Confirm there are no known vulnerabilities in these packages (e.g. via a localnpm audit
oryarn audit
).
• Verify that 0.0.1 of the Shutter SDK is the intended stable release (bump when a newer stable version is available).contracts/src/arbitration/dispute-kits/DisputeKitClassicBase.sol (3)
241-241
: Improved parameter documentationThe
_commit
parameter documentation is updated to more clearly indicate it's a "commitment hash" rather than a general commit.
286-286
: Added vote hash calculation for verificationThe code now uses the new
hashVote
function to generate a vote hash, which enables customized hashing strategies in derived contracts.
292-293
: Updated vote hash verification logic and error messageThe verification logic now compares against the computed
voteHash
instead of directly hashing the choice and salt. The error message has been updated accordingly.contracts/src/arbitration/dispute-kits/DisputeKitClassic.sol (1)
14-14
: Version update from 0.8.0 to 0.9.0The version constant has been updated as part of the broader Shutter integration changes across dispute kit contracts.
contracts/src/arbitration/dispute-kits/DisputeKitShutter.sol (1)
56-72
: Event is emitted even whencastCommit
revertsBecause
castCommitShutter
emitsCommitCastShutter
after the external call,
a failure insidecastCommit
will revert the whole transaction and the event
will not be emitted.
If your intention was to guarantee the event only when the commit succeeds,
this is fine. If you need to record the attempt, move theemit
in a
try/catch
block.contracts/scripts/shutter.ts (1)
88-127
: Error parsing assumes specific JSON structure
fetchDecryptionKey
throws ifjsonResponse.message
is undefined, but the
Shutter API returns the payload atjsonResponse
root according to the spec
used earlier. Align the two helpers or add a type-guard to avoid false
positives.
function generateRandomBytes32(): `0x${string}` { | ||
return ("0x" + | ||
crypto | ||
.getRandomValues(new Uint8Array(32)) | ||
.reduce((acc, byte) => acc + byte.toString(16).padStart(2, "0"), "")) as Hex; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
crypto.getRandomValues
is not available in Node.js
getRandomValues
is a Web-Crypto API. In a Node environment use
crypto.randomBytes
.
- return ("0x" +
- crypto
- .getRandomValues(new Uint8Array(32))
- .reduce((acc, byte) => acc + byte.toString(16).padStart(2, "0"), "")) as Hex;
+ return ("0x" + crypto.randomBytes(32).toString("hex")) as Hex;
This prevents runtime crashes when the script is executed with ts-node
.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
function generateRandomBytes32(): `0x${string}` { | |
return ("0x" + | |
crypto | |
.getRandomValues(new Uint8Array(32)) | |
.reduce((acc, byte) => acc + byte.toString(16).padStart(2, "0"), "")) as Hex; | |
} | |
function generateRandomBytes32(): `0x${string}` { | |
return ("0x" + crypto.randomBytes(32).toString("hex")) as Hex; | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
contracts/test/arbitration/index.ts (2)
65-65
: Test function updated but consider expanding test coverageThe deployContracts function is properly updated to include DisputeKitShutter. However, while the deployment and registration of DisputeKitShutter are verified, there are no specific tests for its unique functionality related to Shutter integration.
Consider adding specific test cases for the DisputeKitShutter's encryption/decryption capabilities and its integration with the Shutter API to ensure complete coverage.
Also applies to: 71-71, 73-73
6-6
: Update test description to reflect expanded scopeThe describe block is still labeled "DisputeKitClassic" even though the tests now cover both classic and shutter dispute kits. Consider renaming this to "DisputeKits" or "Arbitration System" to more accurately reflect the expanded test scope.
-describe("DisputeKitClassic", async () => { +describe("DisputeKits", async () => {
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro (Legacy)
📒 Files selected for processing (6)
contracts/README.md
(1 hunks)contracts/deploy/00-home-chain-arbitration.ts
(1 hunks)contracts/deployments/arbitrumSepoliaDevnet/DisputeKitShutter.json
(1 hunks)contracts/deployments/arbitrumSepoliaDevnet/DisputeKitShutter_Proxy.json
(1 hunks)contracts/src/proxy/KlerosProxies.sol
(1 hunks)contracts/test/arbitration/index.ts
(2 hunks)
✅ Files skipped from review due to trivial changes (4)
- contracts/README.md
- contracts/src/proxy/KlerosProxies.sol
- contracts/deployments/arbitrumSepoliaDevnet/DisputeKitShutter_Proxy.json
- contracts/deployments/arbitrumSepoliaDevnet/DisputeKitShutter.json
⏰ Context from checks skipped due to timeout of 90000ms (15)
- GitHub Check: Redirect rules - kleros-v2-neo
- GitHub Check: Header rules - kleros-v2-neo
- GitHub Check: Pages changed - kleros-v2-neo
- GitHub Check: Redirect rules - kleros-v2-testnet
- GitHub Check: Redirect rules - kleros-v2-testnet
- GitHub Check: Redirect rules - kleros-v2-testnet-devtools
- GitHub Check: Header rules - kleros-v2-testnet-devtools
- GitHub Check: Header rules - kleros-v2-testnet
- GitHub Check: Header rules - kleros-v2-testnet
- GitHub Check: Pages changed - kleros-v2-testnet-devtools
- GitHub Check: Pages changed - kleros-v2-testnet
- GitHub Check: Pages changed - kleros-v2-testnet
- GitHub Check: SonarCloud
- GitHub Check: contracts-testing
- GitHub Check: Analyze (javascript)
🔇 Additional comments (5)
contracts/deploy/00-home-chain-arbitration.ts (1)
99-106
: Good integration of DisputeKitShutterThe implementation properly deploys the new DisputeKitShutter contract as upgradeable and registers it with the core contract. This aligns with the PR objective of introducing Shutter API integration for message encryption in the dispute kit system.
Consider adding a brief comment explaining what DisputeKitShutter is for and how it differs from DisputeKitClassic, which would improve code documentation.
contracts/test/arbitration/index.ts (4)
3-3
: LGTM!Correctly imports the new DisputeKitShutter type.
9-9
: LGTM!Properly declares the disputeKitShutter variable for use in tests.
13-13
: LGTM!Updated to destructure the disputeKitShutter from the return value of deployContracts().
18-18
: LGTM!Test correctly verifies both dispute kits are created with the expected IDs and addresses.
Also applies to: 21-22
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
♻️ Duplicate comments (1)
contracts/src/arbitration/dispute-kits/DisputeKitShutter.sol (1)
15-15
:⚠️ Potential issue
override
on aconstant
still breaks compilation
constant
variables cannot be declaredvirtual
, hence they cannot be overridden.
UnlessDisputeKitClassicBase
now declaresstring public virtual version;this line will fail to compile exactly as reported in the previous review.
- string public constant override version = "0.9.1"; + /// @inheritdoc DisputeKitClassicBase + string public constant version = "0.9.1";
🧹 Nitpick comments (1)
contracts/src/arbitration/dispute-kits/DisputeKitShutter.sol (1)
85-96
: Natspec parameter order/documentation driftThe comment lists
_justification
before_salt
, but the signature places_salt
first.
This will confuse integrators and automated doc generators.- * @param _justification The justification for the vote - * @param _salt A random salt for commitment + * @param _salt A random salt for commitment + * @param _justification The justification for the vote
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro (Legacy)
📒 Files selected for processing (3)
contracts/README.md
(3 hunks)contracts/deployments/arbitrumSepoliaDevnet/DisputeKitShutter.json
(1 hunks)contracts/src/arbitration/dispute-kits/DisputeKitShutter.sol
(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- contracts/README.md
⏰ Context from checks skipped due to timeout of 90000ms (15)
- GitHub Check: Redirect rules - kleros-v2-testnet-devtools
- GitHub Check: Redirect rules - kleros-v2-university
- GitHub Check: Header rules - kleros-v2-testnet-devtools
- GitHub Check: Redirect rules - kleros-v2-testnet
- GitHub Check: Redirect rules - kleros-v2-testnet
- GitHub Check: Header rules - kleros-v2-university
- GitHub Check: Pages changed - kleros-v2-testnet-devtools
- GitHub Check: Header rules - kleros-v2-testnet
- GitHub Check: Header rules - kleros-v2-testnet
- GitHub Check: Pages changed - kleros-v2-university
- GitHub Check: Pages changed - kleros-v2-testnet
- GitHub Check: Pages changed - kleros-v2-testnet
- GitHub Check: Analyze (javascript)
- GitHub Check: SonarCloud
- GitHub Check: contracts-testing
🔇 Additional comments (1)
contracts/deployments/arbitrumSepoliaDevnet/DisputeKitShutter.json (1)
1-1145
: Artifact looks fine – no action required
Deployment metadata/ABI are auto-generated; nothing to review manually here.
…cting an internal function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
♻️ Duplicate comments (1)
contracts/src/arbitration/dispute-kits/DisputeKitShutter.sol (1)
14-15
:⚠️ Potential issueFix the
override
modifier on constant variable.The
override
modifier on a constant variable will cause compilation errors because constant variables cannot be virtual in the base contract. UnlessDisputeKitClassicBase
definesversion
as a non-constant variable with thevirtual
modifier, this will fail to compile.- string public constant override version = "0.9.2"; + /// @inheritdoc DisputeKitClassicBase + string public constant version = "0.9.2";
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro (Legacy)
📒 Files selected for processing (9)
contracts/README.md
(3 hunks)contracts/deploy/upgrade-dispute-kit-v0.9.2.ts
(1 hunks)contracts/deployments/arbitrumSepoliaDevnet/DisputeKitClassic.json
(3 hunks)contracts/deployments/arbitrumSepoliaDevnet/DisputeKitShutter.json
(1 hunks)contracts/src/arbitration/dispute-kits/DisputeKitClassic.sol
(2 hunks)contracts/src/arbitration/dispute-kits/DisputeKitClassicBase.sol
(4 hunks)contracts/src/arbitration/dispute-kits/DisputeKitGated.sol
(1 hunks)contracts/src/arbitration/dispute-kits/DisputeKitShutter.sol
(1 hunks)contracts/src/arbitration/dispute-kits/DisputeKitSybilResistant.sol
(1 hunks)
✅ Files skipped from review due to trivial changes (2)
- contracts/src/arbitration/dispute-kits/DisputeKitGated.sol
- contracts/src/arbitration/dispute-kits/DisputeKitSybilResistant.sol
🚧 Files skipped from review as they are similar to previous changes (4)
- contracts/README.md
- contracts/src/arbitration/dispute-kits/DisputeKitClassic.sol
- contracts/src/arbitration/dispute-kits/DisputeKitClassicBase.sol
- contracts/deployments/arbitrumSepoliaDevnet/DisputeKitShutter.json
⏰ Context from checks skipped due to timeout of 90000ms (16)
- GitHub Check: Redirect rules - kleros-v2-neo
- GitHub Check: Header rules - kleros-v2-neo
- GitHub Check: Pages changed - kleros-v2-neo
- GitHub Check: Redirect rules - kleros-v2-testnet
- GitHub Check: Redirect rules - kleros-v2-testnet
- GitHub Check: Redirect rules - kleros-v2-university
- GitHub Check: Header rules - kleros-v2-testnet
- GitHub Check: Header rules - kleros-v2-testnet
- GitHub Check: Header rules - kleros-v2-university
- GitHub Check: Pages changed - kleros-v2-testnet
- GitHub Check: Pages changed - kleros-v2-testnet
- GitHub Check: Pages changed - kleros-v2-university
- GitHub Check: contracts-testing
- GitHub Check: SonarCloud
- GitHub Check: Analyze (javascript)
- GitHub Check: Mend Security Check
🔇 Additional comments (6)
contracts/src/arbitration/dispute-kits/DisputeKitShutter.sol (2)
76-78
: Ensure proper usage of internal call to maintainmsg.sender
context.Your implementation correctly uses the internal
_castCommit
method, which preserves the originalmsg.sender
context. This avoids the issue that would occur with an external self-call (this.castCommit(...)
), which would changemsg.sender
to the contract address.
92-99
:✅ Verification successful
Verify justification hashing security.
The hash function properly incorporates the justification by first hashing it separately and then including that hash in the final encoded hash. This approach is secure and correctly extends the base implementation to add Shutter-specific functionality.
🏁 Script executed:
#!/bin/bash # Verify if the base implementation of hashVote exists and how it's defined ast-grep --pattern $'function hashVote($_, $_, $_) $$$'Length of output: 56
🏁 Script executed:
#!/bin/bash # Search for all occurrences of hashVote to locate its definition or overrides rg -n "function hashVote" . # Display the imports and inheritance at the top of DisputeKitShutter.sol sed -n '1,50p' contracts/src/arbitration/dispute-kits/DisputeKitShutter.solLength of output: 65641
🏁 Script executed:
#!/bin/bash # Show contract declaration and imports for DisputeKitShutter.sol sed -n '1,50p' contracts/src/arbitration/dispute-kits/DisputeKitShutter.sol # Inspect IDisputeKit for hashVote (if declared) rg -n "interface IDisputeKit" -A10 contracts/src/arbitration/interfaces/IDisputeKit.sol # Specifically search for hashVote in all dispute-kit interfaces rg -n "hashVote" contracts/src/arbitration/interfacesLength of output: 2640
#!/bin/bash # Search for the base implementation of hashVote in the DisputeKitClassicBase contract rg -n "function hashVote" contracts/src/arbitration/dispute-kits/DisputeKitClassicBase.sol -A3
🏁 Script executed:
#!/bin/bash # Locate the base implementation of hashVote in DisputeKitClassicBase.sol rg -n "function hashVote" contracts/src/arbitration/dispute-kits/DisputeKitClassicBase.sol -A5Length of output: 334
hashVote override securely incorporates the justification
The override in DisputeKitShutter.sol (lines 92–99) properly hashes the
_justification
string and includes itsbytes32
hash in anabi.encode
call with_choice
and_salt
. This securely extends the base implementation—which only packed choice and salt—by incorporating juror justifications without introducing collision risks.• contracts/src/arbitration/dispute-kits/DisputeKitShutter.sol:92–99 –
hashVote
override as shown aboveNo further action required.
contracts/deploy/upgrade-dispute-kit-v0.9.2.ts (1)
36-36
: Update initializer function name correctly aligned with contract changes.The initializer function name change from (presumably) "initialize2" to "initialize4" correctly aligns with the changes in
DisputeKitClassic
andDisputeKitShutter
contracts where the upgrade initializer was renamed toinitialize4
with areinitializer(4)
modifier.contracts/deployments/arbitrumSepoliaDevnet/DisputeKitClassic.json (3)
820-848
: New hashVote function added to support justification hashing.The added
hashVote
function in the ABI matches the implementation inDisputeKitShutter
and supports the new requirement of providing justification at commit time rather than at voting time as mentioned in the PR objectives.
869-869
: Renamed initializer function for upgrades.Correctly updated the initializer function name from
initialize2
toinitialize4
to match the changes in the contract implementation.
874-892
: Added isAppealFunded view function.This new function provides a way to check if an appeal is funded for a dispute, which improves the contract's functionality for the dispute resolution flow.
"numDeployments": 3, | ||
"solcInputHash": "96b8e3f55478438b6784f67c1730309e", | ||
"metadata": "{\"compiler\":{\"version\":\"0.8.24+commit.e11b9ed9\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_implementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/proxy/KlerosProxies.sol\":\"DisputeKitClassicProxy\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"src/proxy/KlerosProxies.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.24;\\n\\nimport \\\"./UUPSProxy.sol\\\";\\n\\n/// Workaround to get meaningful names for the proxy contracts\\n/// Otherwise all the contracts are called `UUPSProxy` on the chain explorers\\n\\ncontract DisputeKitClassicNeoProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract DisputeKitClassicUniversityProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract DisputeKitClassicProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract DisputeKitGatedProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract DisputeKitShutterProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract DisputeKitSybilResistantProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract DisputeTemplateRegistryProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract EvidenceModuleProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract ForeignGatewayOnEthereumProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract HomeGatewayToEthereumProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract KlerosCoreNeoProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract KlerosCoreRulerProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract KlerosCoreUniversityProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract KlerosCoreProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract PolicyRegistryProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract RandomizerRNGProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract SortitionModuleNeoProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract SortitionModuleUniversityProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract SortitionModuleProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\",\"keccak256\":\"0x209228b56d42a8444ca70919e1ded5711fba434a746f26d426e230f57526fc6c\",\"license\":\"MIT\"},\"src/proxy/UUPSProxy.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.24;\\n\\n/// @title UUPS Proxy\\n/// @author Simon Malatrait <[email protected]>\\n/// @dev This contract implements a UUPS Proxy compliant with ERC-1967 & ERC-1822.\\n/// @dev This contract delegates all calls to another contract (UUPS Proxiable) through a fallback function and the use of the `delegatecall` EVM instruction.\\n/// @dev We refer to the Proxiable contract (as per ERC-1822) with `implementation`.\\n/// @dev Adapted from <https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.9.0/contracts/proxy/ERC1967/ERC1967Proxy.sol>\\ncontract UUPSProxy {\\n /// @dev Storage slot with the address of the current implementation.\\n /// This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n /// validated in the constructor.\\n /// NOTE: bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)\\n bytes32 private constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n // ************************************* //\\n // * Constructor * //\\n // ************************************* //\\n\\n /// @dev Initializes the upgradeable proxy with an initial implementation specified by `_implementation`.\\n /// If `_data` is nonempty, it's used as data in a delegate call to `_implementation`. This will typically be an encoded\\n /// function call, and allows initializing the storage of the proxy like a Solidity constructor.\\n constructor(address _implementation, bytes memory _data) {\\n assembly {\\n sstore(IMPLEMENTATION_SLOT, _implementation)\\n }\\n\\n if (_data.length != 0) {\\n (bool success, ) = _implementation.delegatecall(_data);\\n require(success, \\\"Proxy Constructor failed\\\");\\n }\\n }\\n\\n // ************************************* //\\n // * State Modifiers * //\\n // ************************************* //\\n\\n /// @dev Delegates the current call to `implementation`.\\n /// NOTE: This function does not return to its internal call site, it will return directly to the external caller.\\n function _delegate(address implementation) internal {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n // ************************************* //\\n // * Internal Views * //\\n // ************************************* //\\n\\n function _getImplementation() internal view returns (address implementation) {\\n assembly {\\n implementation := sload(IMPLEMENTATION_SLOT)\\n }\\n }\\n\\n // ************************************* //\\n // * Fallback * //\\n // ************************************* //\\n\\n /// @dev Fallback function that delegates calls to the address returned by `_implementation()`.\\n /// @dev Will run if no other function in the contract matches the call data.\\n fallback() external payable {\\n _delegate(_getImplementation());\\n }\\n\\n receive() external payable {\\n _delegate(_getImplementation());\\n }\\n}\\n\",\"keccak256\":\"0xc3e0b18f846a62cc6c274680fc10014d1267885f8eefc6767292d3e174a081c0\",\"license\":\"MIT\"}},\"version\":1}", | ||
"bytecode": "0x608060405234801561001057600080fd5b5060405161030238038061030283398101604081905261002f91610151565b8181817f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55805160001461010e576000826001600160a01b031682604051610077919061021f565b600060405180830381855af49150503d80600081146100b2576040519150601f19603f3d011682016040523d82523d6000602084013e6100b7565b606091505b505090508061010c5760405162461bcd60e51b815260206004820152601860248201527f50726f787920436f6e7374727563746f72206661696c65640000000000000000604482015260640160405180910390fd5b505b5050505061023b565b634e487b7160e01b600052604160045260246000fd5b60005b83811015610148578181015183820152602001610130565b50506000910152565b6000806040838503121561016457600080fd5b82516001600160a01b038116811461017b57600080fd5b60208401519092506001600160401b038082111561019857600080fd5b818501915085601f8301126101ac57600080fd5b8151818111156101be576101be610117565b604051601f8201601f19908116603f011681019083821181831017156101e6576101e6610117565b816040528281528860208487010111156101ff57600080fd5b61021083602083016020880161012d565b80955050505050509250929050565b6000825161023181846020870161012d565b9190910192915050565b60b9806102496000396000f3fe608060405236603757603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b6060565b005b603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e808015607e573d6000f35b3d6000fdfea264697066735822122031995e44df4f8c0f7e14fc8c92fe3e63c4fcc994a0505b92eecf1c3a7b742d8964736f6c63430008180033", | ||
"deployedBytecode": "0x608060405236603757603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b6060565b005b603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e808015607e573d6000f35b3d6000fdfea264697066735822122031995e44df4f8c0f7e14fc8c92fe3e63c4fcc994a0505b92eecf1c3a7b742d8964736f6c63430008180033", | ||
"execute": { | ||
"methodName": "initialize", | ||
"args": [ | ||
"0xf1C7c037891525E360C59f708739Ac09A7670c59", | ||
"0x0000000000000000000000000000000000000000" | ||
] | ||
"methodName": "initialize4", | ||
"args": [] | ||
}, | ||
"implementation": "0xc51Ac08b07832Cf9b51Ff9E9dd3E85a3D205ff24", | ||
"implementation": "0x0B3E35C1b5E1C33b3A8722F3B697dF8ff8c1068a", | ||
"devdoc": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Updated deployment metadata and implementation address.
The deployment metadata has been updated to reflect the new implementation address, execution method, and bytecode. The change from initialize
with arguments to initialize4
with no arguments is consistent with the upgrade approach in the contract.
🏁 Script executed:
#!/bin/bash
# Verify if there are any references to the old implementation address that might need updating
rg -A 3 "0xc51Ac08b07832Cf9b51Ff9E9dd3E85a3D205ff24" --type-not json
Length of output: 1688
Fix outdated implementation address references in deployment scripts
The new implementation address (0x0B3E35C1b5E1C33b3A8722F3B697dF8ff8c1068a
) needs to replace all occurrences of the old one (0xc51Ac08b07832Cf9b51Ff9E9dd3E85a3D205ff24
) in your TypeScript deployment files:
• contracts/deployments/arbitrumSepoliaDevnet.ts
- address: "0xc51Ac08b07832Cf9b51Ff9E9dd3E85a3D205ff24",
+ address: "0x0B3E35C1b5E1C33b3A8722F3B697dF8ff8c1068a",
• contracts/deployments/devnet.viem.ts
- * [__View Contract on Arbitrum Sepolia Arbiscan__](https://sepolia.arbiscan.io/address/0xc51Ac08b07832Cf9b51Ff9E9dd3E85a3D205ff24)
+ * [__View Contract on Arbitrum Sepolia Arbiscan__](https://sepolia.arbiscan.io/address/0x0B3E35C1b5E1C33b3A8722F3B697dF8ff8c1068a)
- export const disputeKitClassicImplementationAddress = {
- 421614: "0xc51Ac08b07832Cf9b51Ff9E9dd3E85a3D205ff24",
+ export const disputeKitClassicImplementationAddress = {
+ 421614: "0x0B3E35C1b5E1C33b3A8722F3B697dF8ff8c1068a",
Please update these references to keep your frontend and scripts in sync with the on‐chain deployment.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
"numDeployments": 3, | |
"solcInputHash": "96b8e3f55478438b6784f67c1730309e", | |
"metadata": "{\"compiler\":{\"version\":\"0.8.24+commit.e11b9ed9\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_implementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/proxy/KlerosProxies.sol\":\"DisputeKitClassicProxy\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"src/proxy/KlerosProxies.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.24;\\n\\nimport \\\"./UUPSProxy.sol\\\";\\n\\n/// Workaround to get meaningful names for the proxy contracts\\n/// Otherwise all the contracts are called `UUPSProxy` on the chain explorers\\n\\ncontract DisputeKitClassicNeoProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract DisputeKitClassicUniversityProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract DisputeKitClassicProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract DisputeKitGatedProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract DisputeKitShutterProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract DisputeKitSybilResistantProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract DisputeTemplateRegistryProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract EvidenceModuleProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract ForeignGatewayOnEthereumProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract HomeGatewayToEthereumProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract KlerosCoreNeoProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract KlerosCoreRulerProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract KlerosCoreUniversityProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract KlerosCoreProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract PolicyRegistryProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract RandomizerRNGProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract SortitionModuleNeoProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract SortitionModuleUniversityProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract SortitionModuleProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\",\"keccak256\":\"0x209228b56d42a8444ca70919e1ded5711fba434a746f26d426e230f57526fc6c\",\"license\":\"MIT\"},\"src/proxy/UUPSProxy.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.24;\\n\\n/// @title UUPS Proxy\\n/// @author Simon Malatrait <[email protected]>\\n/// @dev This contract implements a UUPS Proxy compliant with ERC-1967 & ERC-1822.\\n/// @dev This contract delegates all calls to another contract (UUPS Proxiable) through a fallback function and the use of the `delegatecall` EVM instruction.\\n/// @dev We refer to the Proxiable contract (as per ERC-1822) with `implementation`.\\n/// @dev Adapted from <https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.9.0/contracts/proxy/ERC1967/ERC1967Proxy.sol>\\ncontract UUPSProxy {\\n /// @dev Storage slot with the address of the current implementation.\\n /// This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n /// validated in the constructor.\\n /// NOTE: bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)\\n bytes32 private constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n // ************************************* //\\n // * Constructor * //\\n // ************************************* //\\n\\n /// @dev Initializes the upgradeable proxy with an initial implementation specified by `_implementation`.\\n /// If `_data` is nonempty, it's used as data in a delegate call to `_implementation`. This will typically be an encoded\\n /// function call, and allows initializing the storage of the proxy like a Solidity constructor.\\n constructor(address _implementation, bytes memory _data) {\\n assembly {\\n sstore(IMPLEMENTATION_SLOT, _implementation)\\n }\\n\\n if (_data.length != 0) {\\n (bool success, ) = _implementation.delegatecall(_data);\\n require(success, \\\"Proxy Constructor failed\\\");\\n }\\n }\\n\\n // ************************************* //\\n // * State Modifiers * //\\n // ************************************* //\\n\\n /// @dev Delegates the current call to `implementation`.\\n /// NOTE: This function does not return to its internal call site, it will return directly to the external caller.\\n function _delegate(address implementation) internal {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n // ************************************* //\\n // * Internal Views * //\\n // ************************************* //\\n\\n function _getImplementation() internal view returns (address implementation) {\\n assembly {\\n implementation := sload(IMPLEMENTATION_SLOT)\\n }\\n }\\n\\n // ************************************* //\\n // * Fallback * //\\n // ************************************* //\\n\\n /// @dev Fallback function that delegates calls to the address returned by `_implementation()`.\\n /// @dev Will run if no other function in the contract matches the call data.\\n fallback() external payable {\\n _delegate(_getImplementation());\\n }\\n\\n receive() external payable {\\n _delegate(_getImplementation());\\n }\\n}\\n\",\"keccak256\":\"0xc3e0b18f846a62cc6c274680fc10014d1267885f8eefc6767292d3e174a081c0\",\"license\":\"MIT\"}},\"version\":1}", | |
"bytecode": "0x608060405234801561001057600080fd5b5060405161030238038061030283398101604081905261002f91610151565b8181817f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55805160001461010e576000826001600160a01b031682604051610077919061021f565b600060405180830381855af49150503d80600081146100b2576040519150601f19603f3d011682016040523d82523d6000602084013e6100b7565b606091505b505090508061010c5760405162461bcd60e51b815260206004820152601860248201527f50726f787920436f6e7374727563746f72206661696c65640000000000000000604482015260640160405180910390fd5b505b5050505061023b565b634e487b7160e01b600052604160045260246000fd5b60005b83811015610148578181015183820152602001610130565b50506000910152565b6000806040838503121561016457600080fd5b82516001600160a01b038116811461017b57600080fd5b60208401519092506001600160401b038082111561019857600080fd5b818501915085601f8301126101ac57600080fd5b8151818111156101be576101be610117565b604051601f8201601f19908116603f011681019083821181831017156101e6576101e6610117565b816040528281528860208487010111156101ff57600080fd5b61021083602083016020880161012d565b80955050505050509250929050565b6000825161023181846020870161012d565b9190910192915050565b60b9806102496000396000f3fe608060405236603757603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b6060565b005b603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e808015607e573d6000f35b3d6000fdfea264697066735822122031995e44df4f8c0f7e14fc8c92fe3e63c4fcc994a0505b92eecf1c3a7b742d8964736f6c63430008180033", | |
"deployedBytecode": "0x608060405236603757603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b6060565b005b603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e808015607e573d6000f35b3d6000fdfea264697066735822122031995e44df4f8c0f7e14fc8c92fe3e63c4fcc994a0505b92eecf1c3a7b742d8964736f6c63430008180033", | |
"execute": { | |
"methodName": "initialize", | |
"args": [ | |
"0xf1C7c037891525E360C59f708739Ac09A7670c59", | |
"0x0000000000000000000000000000000000000000" | |
] | |
"methodName": "initialize4", | |
"args": [] | |
}, | |
"implementation": "0xc51Ac08b07832Cf9b51Ff9E9dd3E85a3D205ff24", | |
"implementation": "0x0B3E35C1b5E1C33b3A8722F3B697dF8ff8c1068a", | |
"devdoc": { | |
// File: contracts/deployments/arbitrumSepoliaDevnet.ts | |
export const disputeKitClassicDeployment = { | |
// … other fields … | |
address: "0x0B3E35C1b5E1C33b3A8722F3B697dF8ff8c1068a", | |
// … other fields … | |
}; |
"numDeployments": 3, | |
"solcInputHash": "96b8e3f55478438b6784f67c1730309e", | |
"metadata": "{\"compiler\":{\"version\":\"0.8.24+commit.e11b9ed9\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_implementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/proxy/KlerosProxies.sol\":\"DisputeKitClassicProxy\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"src/proxy/KlerosProxies.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.24;\\n\\nimport \\\"./UUPSProxy.sol\\\";\\n\\n/// Workaround to get meaningful names for the proxy contracts\\n/// Otherwise all the contracts are called `UUPSProxy` on the chain explorers\\n\\ncontract DisputeKitClassicNeoProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract DisputeKitClassicUniversityProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract DisputeKitClassicProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract DisputeKitGatedProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract DisputeKitShutterProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract DisputeKitSybilResistantProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract DisputeTemplateRegistryProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract EvidenceModuleProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract ForeignGatewayOnEthereumProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract HomeGatewayToEthereumProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract KlerosCoreNeoProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract KlerosCoreRulerProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract KlerosCoreUniversityProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract KlerosCoreProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract PolicyRegistryProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract RandomizerRNGProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract SortitionModuleNeoProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract SortitionModuleUniversityProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract SortitionModuleProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\",\"keccak256\":\"0x209228b56d42a8444ca70919e1ded5711fba434a746f26d426e230f57526fc6c\",\"license\":\"MIT\"},\"src/proxy/UUPSProxy.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.24;\\n\\n/// @title UUPS Proxy\\n/// @author Simon Malatrait <[email protected]>\\n/// @dev This contract implements a UUPS Proxy compliant with ERC-1967 & ERC-1822.\\n/// @dev This contract delegates all calls to another contract (UUPS Proxiable) through a fallback function and the use of the `delegatecall` EVM instruction.\\n/// @dev We refer to the Proxiable contract (as per ERC-1822) with `implementation`.\\n/// @dev Adapted from <https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.9.0/contracts/proxy/ERC1967/ERC1967Proxy.sol>\\ncontract UUPSProxy {\\n /// @dev Storage slot with the address of the current implementation.\\n /// This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n /// validated in the constructor.\\n /// NOTE: bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)\\n bytes32 private constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n // ************************************* //\\n // * Constructor * //\\n // ************************************* //\\n\\n /// @dev Initializes the upgradeable proxy with an initial implementation specified by `_implementation`.\\n /// If `_data` is nonempty, it's used as data in a delegate call to `_implementation`. This will typically be an encoded\\n /// function call, and allows initializing the storage of the proxy like a Solidity constructor.\\n constructor(address _implementation, bytes memory _data) {\\n assembly {\\n sstore(IMPLEMENTATION_SLOT, _implementation)\\n }\\n\\n if (_data.length != 0) {\\n (bool success, ) = _implementation.delegatecall(_data);\\n require(success, \\\"Proxy Constructor failed\\\");\\n }\\n }\\n\\n // ************************************* //\\n // * State Modifiers * //\\n // ************************************* //\\n\\n /// @dev Delegates the current call to `implementation`.\\n /// NOTE: This function does not return to its internal call site, it will return directly to the external caller.\\n function _delegate(address implementation) internal {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n // ************************************* //\\n // * Internal Views * //\\n // ************************************* //\\n\\n function _getImplementation() internal view returns (address implementation) {\\n assembly {\\n implementation := sload(IMPLEMENTATION_SLOT)\\n }\\n }\\n\\n // ************************************* //\\n // * Fallback * //\\n // ************************************* //\\n\\n /// @dev Fallback function that delegates calls to the address returned by `_implementation()`.\\n /// @dev Will run if no other function in the contract matches the call data.\\n fallback() external payable {\\n _delegate(_getImplementation());\\n }\\n\\n receive() external payable {\\n _delegate(_getImplementation());\\n }\\n}\\n\",\"keccak256\":\"0xc3e0b18f846a62cc6c274680fc10014d1267885f8eefc6767292d3e174a081c0\",\"license\":\"MIT\"}},\"version\":1}", | |
"bytecode": "0x608060405234801561001057600080fd5b5060405161030238038061030283398101604081905261002f91610151565b8181817f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55805160001461010e576000826001600160a01b031682604051610077919061021f565b600060405180830381855af49150503d80600081146100b2576040519150601f19603f3d011682016040523d82523d6000602084013e6100b7565b606091505b505090508061010c5760405162461bcd60e51b815260206004820152601860248201527f50726f787920436f6e7374727563746f72206661696c65640000000000000000604482015260640160405180910390fd5b505b5050505061023b565b634e487b7160e01b600052604160045260246000fd5b60005b83811015610148578181015183820152602001610130565b50506000910152565b6000806040838503121561016457600080fd5b82516001600160a01b038116811461017b57600080fd5b60208401519092506001600160401b038082111561019857600080fd5b818501915085601f8301126101ac57600080fd5b8151818111156101be576101be610117565b604051601f8201601f19908116603f011681019083821181831017156101e6576101e6610117565b816040528281528860208487010111156101ff57600080fd5b61021083602083016020880161012d565b80955050505050509250929050565b6000825161023181846020870161012d565b9190910192915050565b60b9806102496000396000f3fe608060405236603757603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b6060565b005b603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e808015607e573d6000f35b3d6000fdfea264697066735822122031995e44df4f8c0f7e14fc8c92fe3e63c4fcc994a0505b92eecf1c3a7b742d8964736f6c63430008180033", | |
"deployedBytecode": "0x608060405236603757603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b6060565b005b603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e808015607e573d6000f35b3d6000fdfea264697066735822122031995e44df4f8c0f7e14fc8c92fe3e63c4fcc994a0505b92eecf1c3a7b742d8964736f6c63430008180033", | |
"execute": { | |
"methodName": "initialize", | |
"args": [ | |
"0xf1C7c037891525E360C59f708739Ac09A7670c59", | |
"0x0000000000000000000000000000000000000000" | |
] | |
"methodName": "initialize4", | |
"args": [] | |
}, | |
"implementation": "0xc51Ac08b07832Cf9b51Ff9E9dd3E85a3D205ff24", | |
"implementation": "0x0B3E35C1b5E1C33b3A8722F3B697dF8ff8c1068a", | |
"devdoc": { | |
// File: contracts/deployments/devnet.viem.ts | |
/** | |
* __View Contract on Arbitrum Sepolia Arbiscan__ | |
* https://sepolia.arbiscan.io/address/0x0B3E35C1b5E1C33b3A8722F3B697dF8ff8c1068a | |
*/ | |
export const disputeKitClassicImplementationAddress = { | |
421614: "0x0B3E35C1b5E1C33b3A8722F3B697dF8ff8c1068a", | |
}; |
…ata sources not deployed e.g. DisputeKitShutter on testnet
…or-multiple-dispute-kit-above-id-1
…ple-dispute-kit-above-id-1 feat: subgraph support for shutter disputekit in devnet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
♻️ Duplicate comments (2)
subgraph/core-neo/subgraph.template.yaml (2)
46-49
: Same “duplicate event name” issue as in the core manifest
See previous comment insubgraph/core/subgraph.template.yaml
.
The advice applies identically here.
119-153
: Repeated Classic/Shutter mapping duplication
Same DRY concern and template suggestion as raised for the core
manifest.
🧹 Nitpick comments (8)
subgraph/core/src/entities/ClassicContribution.ts (1)
1-1
: Added necessary entity importsThe import statement now includes additional entities needed for the dynamic dispute kit ID resolution.
Note: The
DisputeKit
entity is imported but not used in the function. Consider removing this unused import.-import { ClassicContribution, Dispute, DisputeKit, Round } from "../../generated/schema"; +import { ClassicContribution, Dispute, Round } from "../../generated/schema";subgraph/scripts/update.sh (2)
13-13
: Fix potential shell script issues.There are some bash scripting practices that could be improved.
- local contractName=$(basename $(yq '.dataSources['$dataSourceIndex'].mapping.abis[] | select(.name == "'$dataSourceName'") | .file' "$subgraphConfig") .json) + local contractName + contractName=$(basename "$(yq '.dataSources['$dataSourceIndex'].mapping.abis[] | select(.name == "'$dataSourceName'") | .file' "$subgraphConfig")" .json)This change:
- Separates declaration and assignment to prevent masking return values
- Adds proper quotes to prevent word splitting
🧰 Tools
🪛 Shellcheck (0.10.0)
[warning] 13-13: Declare and assign separately to avoid masking return values.
(SC2155)
[warning] 13-13: Quote this to prevent word splitting.
(SC2046)
79-79
: Fix array assignment in bash.The current array assignment could lead to word splitting issues.
- notDeployedSourceIndices+=($i) + notDeployedSourceIndices+=("$i")This change adds quotes to prevent word splitting and ensure reliable array handling.
🧰 Tools
🪛 Shellcheck (0.10.0)
[warning] 79-79: Quote to prevent word splitting/globbing, or split robustly with mapfile or read -a.
(SC2206)
subgraph/core/subgraph.template.yaml (1)
123-160
: Large copy-paste blocks hint that a data-source template could DRY this file
DisputeKitClassic
andDisputeKitShutter
share the exact mapping
definition apart from the ABI name. Consider replacing both with a
single datasource template and spawning instances programmatically
duringhandleDisputeKitCreated
.
Benefits: one source of truth, easier maintenance when events change.subgraph/core/src/DisputeKitClassic.ts (2)
29-33
: Potential off-by-one when computingnewRoundIndex
getNumberOfRounds
returns 1 immediately after dispute creation in
Kleros Core, but if that ever changes (e.g. returns 0) subtractingONE
will yield a negative BigInt and crash the handler.Safeguard the subtraction:
let totalRounds = klerosCore.getNumberOfRounds(event.params._coreDisputeID); if (totalRounds.equals(BigInt.zero())) { totalRounds = ONE; // fallback for safety } const newRoundIndex = totalRounds.minus(ONE);
42-48
: String interpolation might leak formatting issuesBuilding IDs with template literals assumes
disputeKitID
is printable
without loss. For stricter typing (and less accidental whitespace) do:const classicDisputeID = disputeKitID.toString().concat("-").concat(coreDisputeID);Minor, but helps avoid hard-to-spot string-conversion bugs.
subgraph/core-university/subgraph.template.yaml (2)
4-5
: Double-checkfullTextSearch
feature usage
Verify thatschema.graphql
defines the fields intended for full-text indexing, and confirm your Graph Node version supports thefullTextSearch
feature.
9-13
: Use consistent placeholder formatting
Thenetwork
,address
, andstartBlock
placeholders mix unquoted (_PLACEHOLDER_
) and quoted ("_PLACEHOLDER_"
) styles. Standardizing to a templating convention (e.g.,{{ NETWORK }}
) will simplify automated replacements and reduce errors.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro (Legacy)
⛔ Files ignored due to path filters (1)
yarn.lock
is excluded by!**/yarn.lock
,!**/*.lock
📒 Files selected for processing (17)
subgraph/core-neo/subgraph.template.yaml
(1 hunks)subgraph/core-neo/subgraph.yaml
(1 hunks)subgraph/core-university/subgraph.template.yaml
(1 hunks)subgraph/core-university/subgraph.yaml
(3 hunks)subgraph/core/src/DisputeKitClassic.ts
(8 hunks)subgraph/core/src/KlerosCore.ts
(1 hunks)subgraph/core/src/entities/ClassicContribution.ts
(1 hunks)subgraph/core/src/entities/ClassicDispute.ts
(1 hunks)subgraph/core/src/entities/ClassicRound.ts
(2 hunks)subgraph/core/src/utils.ts
(1 hunks)subgraph/core/subgraph.template.yaml
(1 hunks)subgraph/core/subgraph.yaml
(2 hunks)subgraph/dispute-template-registry/subgraph.template.yaml
(1 hunks)subgraph/dispute-template-registry/subgraph.yaml
(1 hunks)subgraph/package.json
(1 hunks)subgraph/scripts/all.sh
(1 hunks)subgraph/scripts/update.sh
(3 hunks)
✅ Files skipped from review due to trivial changes (5)
- subgraph/core/src/KlerosCore.ts
- subgraph/core-neo/subgraph.yaml
- subgraph/dispute-template-registry/subgraph.yaml
- subgraph/package.json
- subgraph/dispute-template-registry/subgraph.template.yaml
🧰 Additional context used
🪛 Biome (1.9.4)
subgraph/core/src/utils.ts
[error] 1-1: Do not shadow the global "BigInt" property.
Consider renaming this variable. It's easy to confuse the origin of variables when they're named after a known global.
(lint/suspicious/noShadowRestrictedNames)
subgraph/core/src/entities/ClassicDispute.ts
[error] 1-1: Do not shadow the global "BigInt" property.
Consider renaming this variable. It's easy to confuse the origin of variables when they're named after a known global.
(lint/suspicious/noShadowRestrictedNames)
🪛 Shellcheck (0.10.0)
subgraph/scripts/update.sh
[warning] 13-13: Declare and assign separately to avoid masking return values.
(SC2155)
[warning] 13-13: Quote this to prevent word splitting.
(SC2046)
[warning] 79-79: Quote to prevent word splitting/globbing, or split robustly with mapfile or read -a.
(SC2206)
⏰ Context from checks skipped due to timeout of 90000ms (9)
- GitHub Check: Redirect rules - kleros-v2-testnet-devtools
- GitHub Check: Header rules - kleros-v2-testnet-devtools
- GitHub Check: Pages changed - kleros-v2-testnet-devtools
- GitHub Check: Redirect rules - kleros-v2-university
- GitHub Check: Header rules - kleros-v2-university
- GitHub Check: Pages changed - kleros-v2-university
- GitHub Check: Redirect rules - kleros-v2-testnet
- GitHub Check: Header rules - kleros-v2-testnet
- GitHub Check: Pages changed - kleros-v2-testnet
🔇 Additional comments (27)
subgraph/scripts/all.sh (1)
13-13
: Expanded subgraph scope to include new subgraphsThe script now processes two additional subgraphs:
core-neo
andcore-university
. This change aligns with the introduction of theDisputeKitShutter
contract and ensures that all necessary subgraphs are updated when running batch operations.subgraph/core/src/utils.ts (2)
1-1
: Added Bytes import to support new utility functionThe import statement now includes
Bytes
alongsideBigInt
, which is required for the new utility function that processes byte data.🧰 Tools
🪛 Biome (1.9.4)
[error] 1-1: Do not shadow the global "BigInt" property.
Consider renaming this variable. It's easy to confuse the origin of variables when they're named after a known global.
(lint/suspicious/noShadowRestrictedNames)
6-10
: Well-implemented utility for extracting dispute kit IDsThis new utility function correctly extracts the dispute kit ID from extraData by:
- Getting the last 32 bytes
- Reversing them to convert from big-endian to little-endian
- Converting to a BigInt and returning the string representation
This function is essential for supporting multiple dispute kits dynamically, including the new DisputeKitShutter.
Regarding the static analysis warning about shadowing
BigInt
: This is a common pattern when working with TheGraph's library and doesn't cause issues in this context.subgraph/core/src/entities/ClassicDispute.ts (3)
1-1
: Updated import to directly use BigIntThe import now directly uses
BigInt
instead of the previously importedZERO
constant, which aligns with the function's updated parameters.🧰 Tools
🪛 Biome (1.9.4)
[error] 1-1: Do not shadow the global "BigInt" property.
Consider renaming this variable. It's easy to confuse the origin of variables when they're named after a known global.
(lint/suspicious/noShadowRestrictedNames)
5-5
: Enhanced function signature with dispute kit parametersThe function now accepts two additional parameters:
disputeKitID
(string) androundIndex
(BigInt). This makes the function more flexible and supports the multi-dispute-kit architecture.
7-9
: Dynamic ID construction and round index initializationThe entity ID now uses the passed
disputeKitID
parameter for construction instead of a hardcoded value, and thecurrentLocalRoundIndex
is set from the passedroundIndex
parameter. These changes allow the function to work correctly with multiple dispute kits.subgraph/core/src/entities/ClassicContribution.ts (2)
9-18
: Added dynamic dispute kit ID resolutionThis code correctly resolves the dispute kit ID by:
- Loading the core dispute entity
- Loading the corresponding round entity
- Extracting the dispute kit ID from the round
The function properly handles null cases by returning early if either entity is not found.
19-19
: Updated round ID construction with dynamic dispute kit IDThe round ID is now constructed using the dynamically resolved dispute kit ID instead of a hardcoded value, enabling the function to work correctly with multiple dispute kits including the new DisputeKitShutter.
subgraph/core-university/subgraph.yaml (2)
68-70
: Address and start block updated for PolicyRegistry.The contract address was updated to
0x31d067405184d7FaA64b0834511cBcFAF32CdC4b
and the start block to141215158
for the PolicyRegistry data source, reflecting the new deployment referenced in the PR objectives for the Sepolia Arbitrum Devnet.
123-125
: Address and start block updated for EvidenceModule.The contract address was updated to
0x990f44d19a5F46889801B31bf58e0536fBECf27C
and the start block to141215177
for the EvidenceModule data source, ensuring the subgraph indexes events from the correct deployment on the Sepolia Arbitrum Devnet.subgraph/core/subgraph.yaml (2)
124-161
: Added DisputeKitShutter data source to the subgraph.The new data source properly configures the subgraph to index events from the DisputeKitShutter contract, reusing the same event handlers, entities, and mappings as DisputeKitClassic. This ensures that the subgraph can properly track disputes using this new Shutter-based dispute kit.
The implementation follows best practices by:
- Maintaining consistency with existing data sources
- Using the same event handlers for similar events
- Setting the correct start block to avoid missing historical events
143-144
: Check if the comment "Testing for Alchemy" should remain in production code.The comment suggests this might be temporary for testing purposes.
Is this comment intended to remain in the production version of the subgraph manifest?
subgraph/core/src/entities/ClassicRound.ts (2)
6-12
: Added support for dynamic dispute kit IDs.The function signature was improved to accept a dispute kit ID parameter, making the code more flexible to accommodate multiple dispute kit types, including the new DisputeKitShutter.
74-85
: Refactored to dynamically determine dispute kit ID.Good enhancement that replaces hardcoded dispute kit IDs with dynamic lookups from the core entities. The code now properly:
- Fetches the core dispute and round entities
- Extracts the dispute kit ID from the round entity
- Uses proper early returns when entities aren't found
This change ensures the subgraph can correctly handle multiple dispute kit types, including the new DisputeKitShutter.
subgraph/scripts/update.sh (3)
5-21
: Added function to check if a contract is deployed.The new
isContractDeployed
function provides better error handling for the update process by verifying contract deployment before updating the subgraph configuration.🧰 Tools
🪛 Shellcheck (0.10.0)
[warning] 13-13: Declare and assign separately to avoid masking return values.
(SC2155)
[warning] 13-13: Quote this to prevent word splitting.
(SC2046)
68-72
: Improved initialization using template file.The script now properly initializes from a template file, ensuring a clean starting point and preventing configuration drift between updates.
73-89
: Added handling for undeployed contracts.The script now identifies and removes data sources for contracts that aren't deployed, preventing subgraph errors and making the update process more robust.
🧰 Tools
🪛 Shellcheck (0.10.0)
[warning] 79-79: Quote to prevent word splitting/globbing, or split robustly with mapfile or read -a.
(SC2206)
subgraph/core/subgraph.template.yaml (1)
135-146
:DisputeKitShutter
data‐source still references Classic ABIYour Shutter data-source lists both
DisputeKitShutter
and
DisputeKitClassic
ABIs, the latter “required on Alchemy”.
If only the Shutter ABI is needed, drop the Classic reference; if both
are truly required document why, otherwise future maintainers may delete
it as “dead weight”.subgraph/core-university/subgraph.template.yaml (9)
1-6
: Confirm Graph manifest version and placeholder defaults
You've specifiedspecVersion: 0.0.5
with placeholders for the schema and features. Ensure this aligns with yourcore
andcore-neo
manifests, and that your deployment tooling correctly replaces these values.
14-17
: Mapping header configuration
kind: ethereum/events
,apiVersion: 0.0.7
, andlanguage: wasm/assemblyscript
look correct and consistent with your other subgraphs.
18-29
: Entities declaration in KlerosCore mapping
The entities (User
,Arbitrable
,TokenAndETHShift
,JurorTokensPerCourt
,Court
,Dispute
,Round
,Draw
,DisputeKit
,Counter
) align with the schema. No changes needed here.
63-82
: PolicyRegistry mapping review
ThePolicyRegistry
dataSource is configured correctly with its ABI andhandlePolicyUpdate
handler.
118-138
: EvidenceModule mapping review
The configuration forEvidenceModule
is sound and matches your ABI and handler setup.
139-160
: SortitionModule mapping review
TheSortitionModule
block is correctly defined with its entities and event handlers.
83-117
: 🛠️ Refactor suggestionInconsistent with PR objectives: missing DisputeKitShutter mapping
The PR introducesDisputeKitShutter
, but this manifest only definesDisputeKitClassic
. To index Shutter-specific events, add a newdataSources
block forDisputeKitShutter
(with ABI JSON, entities, and eventHandlers) mirroring theDisputeKitClassic
section.Likely an incorrect or invalid review comment.
36-62
:✅ Verification successful
Ensure all KlerosCore event handlers are implemented
This block lists handlers such ashandleAppealDecision
,handleCourtJump
, andhandleDisputeKitEnabled
. Confirm each is exported insrc/KlerosCore.ts
.
🏁 Script executed:
rg -n "export function handle" subgraph/core-university/src/KlerosCore.ts
Length of output: 903
All KlerosCore event handlers are implemented
Verified that each handler listed insubgraph/core-university/subgraph.template.yaml
has a correspondingexport function handle…
insrc/KlerosCore.ts
(e.g.,handleAppealDecision
,handleDisputeCreation
,handleDraw
, etc.). No missing handlers found.
30-35
:❓ Verification inconclusive
Verify ABI JSON file paths
Ensure these ABI files exist undercontracts/deployments/<NETWORK>/
and include the latest Shutter changes (if applicable):
SortitionModuleUniversity.json
DisputeKitClassicUniversity.json
KlerosCoreUniversity.json
🏁 Script executed:
#!/bin/bash # Verify presence of deployment ABI files for f in KlerosCoreUniversity.json DisputeKitClassicUniversity.json SortitionModuleUniversity.json PolicyRegistry.json EvidenceModule.json; do if [[ -z "$(fd -e json "$f" contracts/deployments)" ]]; then echo "::error file=subgraph/core-university/subgraph.template.yaml::$f not found" fi doneLength of output: 1691
ABI JSON file presence confirmed
All required ABI files are present undercontracts/deployments/arbitrumSepoliaDevnet/
:
- SortitionModuleUniversity.json
- DisputeKitClassicUniversity.json
- KlerosCoreUniversity.json
Please manually verify these ABIs include the latest Shutter changes and ensure they’re added under any other target network folders if needed.
- event: CourtCreated(indexed uint96,indexed uint96,bool,uint256,uint256,uint256,uint256,uint256[4],uint256[]) | ||
handler: handleCourtCreated | ||
# FIX: This is support for old signature | ||
- event: CourtCreated(indexed uint256,indexed uint96,bool,uint256,uint256,uint256,uint256,uint256[4],uint256[]) | ||
handler: handleCourtCreated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate CourtCreated
signatures may break code-generation
The same event name is declared twice with different parameter lists.
graph-cli
treats the name as the unique identifier, so the second
occurrence silently overwrites the first when the manifest is compiled,
causing one of the handlers never to be executed.
47 - event: CourtCreated(indexed uint96,indexed uint96,bool,uint256,uint256,uint256,uint256,uint256[4],uint256[])
50 - event: CourtCreated(indexed uint256,indexed uint96,bool,uint256,uint256,uint256,uint256,uint256[4],uint256[])
If you need to index both historic and new signatures, create two
separate ABIs (or one ABI with both events but different names) and
map them to distinct handlers.
- name: KlerosCore | ||
# FIX: temporarily point to the abi with event addition. | ||
file: ./abi-migrations/KlerosCore.json | ||
eventHandlers: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Temporary “abi-migrations” paths risk deployment rot
Pointing to ./abi-migrations/*
is useful during migration, but leaving
these references in the template means the generated manifest will point
to files that do not exist in the production build context, breaking
graph deploy
.
Suggestion:
- - name: KlerosCore
- # FIX: temporarily point to the abi with event addition.
- file: ./abi-migrations/KlerosCore.json
+ - name: KlerosCore
+ file: ../../contracts/deployments/_PLACEHOLDER_/KlerosCore.json
or keep the “migration” file but add a TODO to remove it after the
upgrade has fully propagated.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
- name: KlerosCore | |
# FIX: temporarily point to the abi with event addition. | |
file: ./abi-migrations/KlerosCore.json | |
eventHandlers: | |
- name: KlerosCore | |
file: ../../contracts/deployments/_PLACEHOLDER_/KlerosCore.json | |
eventHandlers: |
Code Climate has analyzed commit 5989928 and detected 13 issues on this pull request. Here's the issue category breakdown:
View more on Code Climate. |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
♻️ Duplicate comments (1)
subgraph/core/subgraph.template.yaml (1)
49-53
: DuplicateCourtCreated
event definitions may cause silent handler overwrites.The same event name
CourtCreated
is declared twice with different parameter lists, andgraph-cli
de-duplicates based on the event name. This causes one of the signatures to silently overwrite the other, so handlers for the old signature will never run.Consider renaming one of the events (e.g.,
CourtCreatedV1
) or splitting into two ABIs with distinct event names to ensure both signatures are indexed.
🧹 Nitpick comments (2)
subgraph/core/subgraph.template.yaml (1)
36-38
: Temporary ABI migration path is non-production.Pointing to
./abi-migrations/KlerosCore.json
is intended only during migration. Leaving it in the template will breakgraph deploy
once those files are removed.Refactor to reference the placeholder deployment path directly:
- file: ./abi-migrations/KlerosCore.json + file: ../../contracts/deployments/_PLACEHOLDER_/KlerosCore.jsonsubgraph/core-neo/subgraph.template.yaml (1)
138-142
: Temporary ABI migration reference may not match Neo deployment.This block points to
./abi-migrations/KlerosCore.json
. For Neo-specific migrations, consider renaming:- file: ./abi-migrations/KlerosCore.json + file: ./abi-migrations/KlerosCoreNeo.json
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro (Legacy)
📒 Files selected for processing (7)
subgraph/core-neo/subgraph.template.yaml
(1 hunks)subgraph/core-university/subgraph.template.yaml
(1 hunks)subgraph/core/subgraph.template.yaml
(1 hunks)subgraph/core/subgraph.yaml
(2 hunks)subgraph/dispute-template-registry/subgraph.template.yaml
(1 hunks)subgraph/dispute-template-registry/subgraph.yaml
(1 hunks)subgraph/package.json
(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- subgraph/package.json
🚧 Files skipped from review as they are similar to previous changes (4)
- subgraph/dispute-template-registry/subgraph.yaml
- subgraph/dispute-template-registry/subgraph.template.yaml
- subgraph/core/subgraph.yaml
- subgraph/core-university/subgraph.template.yaml
🔇 Additional comments (1)
subgraph/core-neo/subgraph.template.yaml (1)
48-50
: Verify support for historicCourtCreated
signatures.Unlike the core template, this Neo manifest only indexes the new
CourtCreated
signature. If you must capture older events, add the legacy signature as well:- event: CourtCreated(indexed uint96,indexed uint96,bool,uint256,uint256,uint256,uint256,uint256[4],uint256[]) handler: handleCourtCreated
- ClassicDispute | ||
- ClassicRound | ||
- ClassicVote | ||
- ClassicContribution | ||
abis: | ||
- name: DisputeKitShutter | ||
file: ../../contracts/deployments/_PLACEHOLDER_/DisputeKitShutter.json | ||
- name: DisputeKitClassic # Required on Alchemy | ||
file: ../../contracts/deployments/_PLACEHOLDER_/DisputeKitClassic.json | ||
- name: KlerosCore | ||
# FIX: temporarily point to abi with event addition | ||
file: ./abi-migrations/KlerosCore.json | ||
eventHandlers: | ||
- event: DisputeCreation(indexed uint256,uint256,bytes) | ||
handler: handleDisputeCreation | ||
- event: Contribution(indexed uint256,indexed uint256,uint256,indexed address,uint256) | ||
handler: handleContributionEvent | ||
- event: Withdrawal(indexed uint256,indexed uint256,uint256,indexed address,uint256) | ||
handler: handleWithdrawal | ||
- event: ChoiceFunded(indexed uint256,indexed uint256,indexed uint256) | ||
handler: handleChoiceFunded | ||
- event: VoteCast(indexed uint256,indexed address,uint256[],indexed uint256,string) | ||
handler: handleVoteCast | ||
- event: CommitCast(indexed uint256,indexed address,uint256[],bytes32) | ||
handler: handleCommitCast | ||
file: ./src/DisputeKitClassic.ts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorrect mapping file for DisputeKitShutter
data source.
The Shutter data source is still pointing at the Classic mapping implementation:
file: ./src/DisputeKitClassic.ts
This will apply the wrong handlers to Shutter events. You need a dedicated Shutter handler file.
Update the mapping path accordingly:
- file: ./src/DisputeKitClassic.ts
+ file: ./src/DisputeKitShutter.ts
🤖 Prompt for AI Agents
In subgraph/core/subgraph.template.yaml between lines 137 and 162, the
DisputeKitShutter data source incorrectly uses the Classic mapping file
(./src/DisputeKitClassic.ts), causing wrong event handlers to be applied. To fix
this, create or specify a dedicated mapping file for DisputeKitShutter (e.g.,
./src/DisputeKitShutter.ts) and update the file path under the DisputeKitShutter
data source accordingly.
name: DisputeKitShutter | ||
network: _PLACEHOLDER_ | ||
source: | ||
address: "_PLACEHOLDER_" | ||
abi: DisputeKitShutter | ||
startBlock: _PLACEHOLDER_ | ||
mapping: | ||
kind: ethereum/events | ||
apiVersion: 0.0.7 | ||
language: wasm/assemblyscript | ||
entities: | ||
- ClassicDispute | ||
- ClassicRound | ||
- ClassicVote | ||
- ClassicContribution | ||
abis: | ||
- name: DisputeKitShutter | ||
file: ../../contracts/deployments/_PLACEHOLDER_/DisputeKitShutter.json | ||
- name: KlerosCore | ||
# FIX: temporarily point to abi with event addition | ||
file: ./abi-migrations/KlerosCore.json | ||
eventHandlers: | ||
- event: DisputeCreation(indexed uint256,uint256,bytes) | ||
handler: handleDisputeCreation | ||
- event: Contribution(indexed uint256,indexed uint256,uint256,indexed address,uint256) | ||
handler: handleContributionEvent | ||
- event: Withdrawal(indexed uint256,indexed uint256,uint256,indexed address,uint256) | ||
handler: handleWithdrawal | ||
- event: ChoiceFunded(indexed uint256,indexed uint256,indexed uint256) | ||
handler: handleChoiceFunded | ||
- event: VoteCast(indexed uint256,indexed address,uint256[],indexed uint256,string) | ||
handler: handleVoteCast | ||
- event: CommitCast(indexed uint256,indexed address,uint256[],bytes32) | ||
handler: handleCommitCast |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorrect mapping file for DisputeKitShutter
in Neo template.
The Neo Shutter data source also reuses the Classic mapping:
file: ./src/DisputeKitClassic.ts
It should point to the Shutter handler:
- file: ./src/DisputeKitClassic.ts
+ file: ./src/DisputeKitShutter.ts
🤖 Prompt for AI Agents
In subgraph/core-neo/subgraph.template.yaml between lines 121 and 154, the
mapping for the DisputeKitShutter data source incorrectly uses the Classic
mapping file. Update the mapping file reference to point to the Shutter handler
by changing the file path to ./src/DisputeKitShutter.ts instead of the Classic
mapping file.
Devnet contract deployed
DisputeKitShutter
Critical changes needed:
See #1314
PR-Codex overview
This PR introduces the
DisputeKitShutter
to the Kleros v2 subgraph, enhancing dispute resolution capabilities with new features and updates across various files, including contract deployments and subgraph configurations.Detailed summary
DisputeKitShutter
contract with specific functionalities.subgraph.yaml
files forcore
,core-neo
, andcore-university
with descriptions and repository links.disputeKitID
.ClassicDispute
andClassicRound
entities to incorporatedisputeKitID
.scripts
to handle new deployments and configurations.Summary by CodeRabbit
Summary by CodeRabbit
New Features
Bug Fixes
Refactor
Chores