Skip to content

Add Confidential Transfers Module #1980

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

Merged
merged 92 commits into from
Apr 4, 2025
Merged

Add Confidential Transfers Module #1980

merged 92 commits into from
Apr 4, 2025

Conversation

mj850
Copy link
Contributor

@mj850 mj850 commented Dec 7, 2024

Describe your changes and provide context

This is the working branch for adding the Confidential Transfers module.

Testing performed to validate your change

Associated unit and integration tests have been added here.

dssei and others added 30 commits December 6, 2024 17:39
* scaffolding for new module

* keeper scaffolding

* scaffold with types

* go sum

* comments pt1

* comments

* drop prev580
* pending balance type

* convert apply pending balance to a message type

* close account type
* new types

* add deposit to msgs

* add import issues

* revert evm/params to old state

* withdraw with tests

* small changes

* refactor and add tests

* comment
* Genesis draft

* revert evm params

* revert evm params -2

* working simple test

* linting

* addressing linter errors

* remove creating address for now
* add genesis init/export tests

* refactor store

* confidential transfers queries

* working draft test

* more tests

* refactor tests

* all accounts query

* formatting

* add pagination to request/response

* update implementation to use paginated response instead

* formatting

* remove redundant param

* all accounts with denoms

* clean up commented code

* return GetAccount back to keeper

* formatting
* new types

* add deposit to msgs

* add import issues

* revert evm/params to old state

* withdraw with tests

* small changes

* refactor and add tests

* comment

* refactor initialize type

* types

* non module account types

* msg server methods with module accounts

* tests scaffold

* add msg server tests

* codeql

* test issues

* test improvements

* comments

* todo

* app
* basic cli and first draft command for ct module

* add second command draft

* draft of init account

* close account update

* lint errors
* update codec

* cleanup and queryies

* enable in module

* add other query

* fix bug

* fix lint

* add decryption query

* cleanup

* validate address

* comments

* rectify test failures

* speed up withdraw test

* make other tests slightly faster
* - fix ct account by address and denom REST query
- update swagger

* - regenerate with latest changes
- set module version to 1
dssei and others added 19 commits January 6, 2025 14:19
* - add sol init account

* - precompile + basic tests

* self-review tweaks

* ct init account payload cli

* caller should = the user address

* add caller check for transfers

* refactor address retrieval logic. Add more tests

* support Sei addresses in transfer precompile

* add tests for Sei addresses

* update tests

* self-review tweaks
* - add sol init account

* - precompile + basic tests

* deposit precompile

* refactor test
* - add sol init account

* - precompile + basic tests

* deposit precompile

* refactor test

* use caller instead of from address

* add amount field comment

* few tweaks

* roll back init-account changes

* remove unintended changes

* remove unintended changes - 2

* use caller in transfer

* init account precompile integration test

* deposit precompile integration test

* transfer precompile integration test

* self review
…nsfers Precompile (#2033)

* apply precompile

* add withdraw precompile as well

* update with queries

* update precompiles for sender

* close account and integration tests

* lint
* - add sol init account

* - precompile + basic tests

* Basic account precompile query code and test

* unit tests

* integration test
update error code for case when account already exists
* working draft

* get to address from events

* get conversion of EVM tx to Sei tx

* rafactor CT precompile to expose calldata parsing methods

* working draft

* self review tweaks

* fix formatting

* Add few clarifying comments
c-03 missing resource dependencies
* L-09 Proto Serialization Failures

* lint

* change to post
* update range proof for msg server

* bump upload artifacts

* workflow

* bump timeout to 15 mins

* order of transfer proof validaiton

* order

* add range proof verification cost

* bump up gas accordingly

* test changes

* remove remaining gas check

* remaining gas
* add error to rpc response

* check for response.error

* add timeout to httpclient
* - consume more gas for CT operations
- limit number of auditors to 5

* self review tweaks

* - fix precompile test
- formatting

* remove redundant nil check

* - move gas cost to params
- add more max auditor list validations

* - re-use helper method

* - add missed gas consumption

* - fix tests
- propagate validation error message
* adding allowlist to transfer

* tests for transfer with allow list

* restrict withdrawals and deposits as well

* - add acl mappings

* - add block list dep mapping
* - add missing validations
- require both supply and metadata on account init

* - add negative amount check on withdrawals

* - add bech32 check for auditor address

* - add denom validation check

* - add denom validation check - 2

* - more missed validations

* - fix tests

* - fix tests - 2

* fix gas in test
* check for denom exponent

* base

* whitelist params

* tests

* typo

* tests

* clarify
merge module with main
Comment on lines +67 to +86
for name, m := range newAbi.Methods {
switch name {
case DepositMethod:
p.DepositID = m.ID
case InitializeAccountMethod:
p.InitializeAccountID = m.ID
case ApplyPendingBalanceMethod:
p.ApplyPendingBalanceID = m.ID
case TransferMethod:
p.TransferID = m.ID
case TransferWithAuditorsMethod:
p.TransferWithAuditorsID = m.ID
case WithdrawMethod:
p.WithdrawID = m.ID
case CloseAccountMethod:
p.CloseAccountID = m.ID
case AccountMethod:
p.AccountID = m.ID
}
}

Check warning

Code scanning / CodeQL

Iteration over map Warning

Iteration over map may be a possible source of non-determinism
@mj850 mj850 requested a review from dssei April 4, 2025 02:12
@mj850 mj850 merged commit 5733762 into main Apr 4, 2025
50 checks passed
@mj850 mj850 deleted the feature/ct_module branch April 4, 2025 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants