Skip to content

Comments

#15 Migrate Balance Dojang Attestations to Merkle Root–Based Scheme#16

Merged
troy-dunamu merged 4 commits intomainfrom
issues/15
Nov 25, 2025
Merged

#15 Migrate Balance Dojang Attestations to Merkle Root–Based Scheme#16
troy-dunamu merged 4 commits intomainfrom
issues/15

Conversation

@troy-dunamu
Copy link
Contributor

@troy-dunamu troy-dunamu commented Nov 24, 2025

Replace legacy per-account balance proofing with a Merkle Root–based design.

Generate a Balance Merkle Root from the snapshot; clients attest and verify per-account balances via Merkle proofs against that root.

closes #15

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR migrates the balance attestation system from a per-account proofing approach to a Merkle root-based scheme. The key change replaces direct balance attestations with a two-tier system: balance root attestations containing Merkle roots of snapshot data, and individual balance attestations that verify against these roots using Merkle proofs.

  • Introduces new BalanceRootDojangResolver and related validation/indexing resolvers for Merkle root attestations
  • Updates BalanceDojangResolver to verify individual balances against Merkle proofs
  • Removes legacy IDojangAttester interface in favor of the new attestation structure

Reviewed changes

Copilot reviewed 27 out of 28 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/BalanceRootDojangResolver.sol New resolver for validating and indexing balance root attestations containing Merkle roots
src/abstract/BalanceRootValidationResolverUpgradeable.sol Base validation logic for balance root attestations with comprehensive field checks
src/abstract/BalanceRootIndexingResolverUpgradeable.sol Indexing functionality for balance root attestations by coin type and snapshot time
src/abstract/BalanceValidationResolverUpgradeable.sol Updated to verify individual balance attestations against Merkle proofs from referenced roots
src/abstract/BalanceIndexingResolverUpgradeable.sol Modified to extract indexing data from referenced root attestations
src/DojangScroll.sol Added balance root retrieval methods and updated balance verification to check root references
test/BalanceRootDojangResolver.t.sol Comprehensive test coverage for balance root resolver functionality
test/abstract/BalanceValidationResolverUpgradeable.t.sol Updated tests for Merkle proof validation
script/deploy/02-DeployBalanceRootDojang.s.sol Deployment script for the new balance root infrastructure
src/interfaces/IDojangAttester.sol Removed legacy interface no longer needed with new attestation structure
Comments suppressed due to low confidence (1)

test/DojangScroll.t.sol:1

  • The hex value ends with '4c4f53' which appears to be an encoding issue. The comment history shows this was changed from '501' (decimal). Verify this is the correct custom coin type encoding for Solana.
// SPDX-License-Identifier: MIT

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

/**
* @notice Returns the balance root attestation for the given coin type and timestamp.
* @dev This function does not verify the existence or validity of the attestation.
* @param coinType The BIP-44 coin type of the asset
Copy link

Copilot AI Nov 24, 2025

Choose a reason for hiding this comment

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

Documentation is inconsistent with the interface. The parameter is described as 'BIP-44 coin type' but the interface at line 23 and 66 describes it as 'custom coin type (ticker encoded as uint256)'.

Copilot uses AI. Check for mistakes.
Copy link
Collaborator

@ihooni ihooni left a comment

Choose a reason for hiding this comment

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

Please update the README to reflect the changes.

@troy-dunamu
Copy link
Contributor Author

troy-dunamu commented Nov 24, 2025

Please update the README to reflect the changes.

@ihooni
b4c9bac Updated! Thanks :)

@troy-dunamu troy-dunamu requested a review from ihooni November 24, 2025 16:29
Copy link
Collaborator

@ihooni ihooni left a comment

Choose a reason for hiding this comment

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

@troy-dunamu
Thanks for updating it! Could you also update the contract list in the README as well? (version and new contract)

@troy-dunamu troy-dunamu merged commit 58751c6 into main Nov 25, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate Balance Dojang Attestations to Merkle Root–Based Scheme

2 participants