Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zeto domain to support zeto tokens with anonymity and encryption #114

Merged
merged 91 commits into from
Sep 14, 2024

Conversation

jimthematrix
Copy link
Contributor

@jimthematrix jimthematrix commented Aug 30, 2024

The Zeto domain implementation has been updated to handle two variations: anonymity and encryption. Variations using nullifiers will come in a separate PR as that'll need significant work.

A local configuration has been introduced that will work with the "onchain" domain config which gets published by the deploy transaction. Using the token name from the onchain domain config, the domain can look up the supporting materials from the local configuration (contract ABIs, circuit runtimes and proving keys etc.) to process transaction requests for the token implementation.

The e2e test is split out into a separate package integration-test so that it's clear what are the things being done inside the domain vs. outside.

Add Zeto domain contract deployment for the e2e tests, based on a convenient yaml based configuration. Proper contract deployment and upgrade management is outside of the scope of the Paladin runtime. The domain contract deployment discovers the declared contracts to deploy, and builds the order to deploy based on dependencies.

The domain instance address detection in the core event indexer is enhanced to allow events emitted by the factory with the instance address, to avoid requiring all implementation contracts to be wrapped for Paladin's consumption.

TODO: add unit tests in the domains/zeto package now that the existing tests have been pulled out into integration-tests

@jimthematrix jimthematrix marked this pull request as draft September 3, 2024 02:43
@jimthematrix jimthematrix marked this pull request as ready for review September 5, 2024 18:01
@jimthematrix jimthematrix marked this pull request as draft September 6, 2024 12:17
@jimthematrix
Copy link
Contributor Author

besides reconciling some of the moved types that were missed, I'm also sorting the domain config with the contract config. so moving this back to draft

type DomainFactoryConfig struct {
FactoryAddress string `json:"factoryAddress"`
Libraries map[string]string `json:"libraries"`
DomainContracts DomainConfigContracts `json:"domainContracts"`
Copy link
Contributor

Choose a reason for hiding this comment

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

So this factory config is something that ultimately all users would need to add into their Paladin config yaml.

I understand factory address and library addresses. But why do they need to do so much configuration of the domain contracts? It seems like only the deployer would need to know those details, and everyone else could receive them from the deploy event.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I haven't got to the behavior of a participating Paladin node yet, which I think should just need some subset of the configurations, the implementation contracts that they want to support. keeping the ABIs as a local configuration means it doesn't need to be sent with every transaction. the DomainConfig can just be the minimal information, which is just the token name (and the version). everything else needed for dealing with the transactions such as ABIs, circuit IDs, can all be obtained from the domain factory configuration, which needs to be constructed from a local configuration (to be added later).

Copy link
Contributor

Choose a reason for hiding this comment

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

OK - I think we need to explicitly split what is actual "domain config" (which will ultimately be part of Paladin config) and what is "test config" (things like lists of contracts to load into the testbed). Anything that is "test config" should not be in pkg but somewhere in the test.

bytes32 transactionId,
string memory tokenName,
address initialOwner,
bytes memory data
Copy link
Contributor

Choose a reason for hiding this comment

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

I note that in #137 Peter moved toward calling this parameter "config" (instead of "data")... I think that might be a good idea.

@@ -247,6 +247,7 @@ func (z *Zeto) FindCoins(ctx context.Context, query string) ([]*types.ZetoCoin,
if err != nil {
return nil, err
}
fmt.Printf("states: %+v\n", states)
Copy link
Contributor

Choose a reason for hiding this comment

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

remove?

Copy link
Contributor

@awrichar awrichar left a comment

Choose a reason for hiding this comment

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

I left a few comments that haven't yet been addressed - at least these:
https://github.com/kaleido-io/paladin/pull/114/files#r1757345044
https://github.com/kaleido-io/paladin/pull/114/files#r1757350587
https://github.com/kaleido-io/paladin/pull/114/files#r1757348822

But overall this looks very good. None of the above are blocking, if it's more convenient to merge and address in follow-ups.

@peterbroadhurst peterbroadhurst merged commit 61c7188 into main Sep 14, 2024
2 checks passed
@peterbroadhurst peterbroadhurst deleted the domains-zeto branch September 14, 2024 14:56
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.

3 participants