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

ADR 001: coin cross-chain transfer source tracing #6662

Merged
merged 68 commits into from
Aug 3, 2020

Conversation

fedekunze
Copy link
Collaborator

@fedekunze fedekunze commented Jul 9, 2020

Description

closes: #6649


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Targeted PR against correct branch (see CONTRIBUTING.md)
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code follows the module structure standards.
  • Wrote unit and integration tests
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/)
  • Added relevant godoc comments.
  • Added a relevant changelog entry to the Unreleased section in CHANGELOG.md
  • Re-reviewed Files changed in the Github PR explorer
  • Review Codecov Report in the comment section below once CI passes

@fedekunze fedekunze added x/ibc C:Types T: ADR An issue or PR relating to an architectural decision record labels Jul 9, 2020
string amount = 2 [(gogoproto.customtype) = "Int", (gogoproto.nullable) = false];
// trace the origin of the token. Every time a Coin is transferred to a chain that's not the souce
// of the token, a new item is inserted to the first position.
repeated Trace trace = 3;
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the elaborate and well throughout ADR @fedekunze, but I can see that I'll already have concerns with this because we're conflating concerns and use-cases w/ IBC. Specifically, I do not believe trace should be a first-class citizen field of Coin. Please consider instead using some notion of metadata.

Copy link
Member

Choose a reason for hiding this comment

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

I agree that we should use metadata and not add this to Coin itself. @fedekunze I have some ideas on how to address this more generally and will write something up.

Copy link
Member

@aaronc aaronc Jul 10, 2020

Choose a reason for hiding this comment

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

So I realize what I have in mind will be a larger ADR that also covers supply. I'm hoping to get to that relatively soon as these are things I've thought about for some of Regen's use case which allows for some modules to arbitrarily create approved denom's.

Anyway the gist of it is that from the perspective of the bank module, IBC transfer is just minting or burning coins for some denom which it has the right to manage.

I propose we use prefixes for these denoms such as ibc: or ibc/ and then IBC assigns an auto-generated ID that looks something like ibc:2g8sd6h. Or maybe ibc:atom:2g8sd6h to be more descriptive if the source denom is atom.

Then the Trace information is something that gets managed as metadata by the ibc transfer module. So the ibc transfer keeper would then have a method like DescribeIBCDenom(denom string) IBCDenomMetadata to retrieve the Trace data.

One problem that I pointed out in the call is that balances are indexed by denom. So adding Trace would break that in addition polluting any balances with all of that metadata. Instead we can just treat denoms as dumb identifiers which are fully described by their metadata.

To take it a step further, I would restrict which modules can mint/burn which denoms. So x/mint would get rights to atom, x/ibc-transfer would mange the whole ibc:* prefix, etc. But that gets into supply which I'd love to address too, but later after stargate.

Copy link
Contributor

Choose a reason for hiding this comment

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

This makes sense, although for now (IBC 1.0) I think we should do the simplest thing which solves our main problem, and hash the denominations in the 20-transfer module to allow for arbitrary port/channel paths, and keep a lookup table so that we can lookup the port(s) & channel(s) from the denomination.

@fedekunze fedekunze changed the title adr: coin cross-chain transfer source tracing ADR 001: coin cross-chain transfer source tracing Jul 22, 2020
@fedekunze fedekunze marked this pull request as ready for review July 22, 2020 17:18
@fedekunze fedekunze requested a review from alessio as a code owner July 22, 2020 17:18
Copy link
Collaborator

@anilcse anilcse left a comment

Choose a reason for hiding this comment

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

Great work, added some minor comments

docs/architecture/adr-001-coin-source-tracing.md Outdated Show resolved Hide resolved
docs/architecture/adr-001-coin-source-tracing.md Outdated Show resolved Hide resolved
docs/architecture/adr-001-coin-source-tracing.md Outdated Show resolved Hide resolved
docs/architecture/adr-001-coin-source-tracing.md Outdated Show resolved Hide resolved
docs/architecture/adr-001-coin-source-tracing.md Outdated Show resolved Hide resolved
docs/architecture/adr-001-coin-source-tracing.md Outdated Show resolved Hide resolved
docs/architecture/adr-001-coin-source-tracing.md Outdated Show resolved Hide resolved
Copy link
Member

@AdityaSripal AdityaSripal left a comment

Choose a reason for hiding this comment

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

Looks good, Mostly minor changes requested

docs/architecture/adr-001-coin-source-tracing.md Outdated Show resolved Hide resolved
docs/architecture/adr-001-coin-source-tracing.md Outdated Show resolved Hide resolved
docs/architecture/adr-001-coin-source-tracing.md Outdated Show resolved Hide resolved
Copy link
Contributor

@colin-axner colin-axner left a comment

Choose a reason for hiding this comment

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

Overall looks amazing to me!! 🎉 🙌 Thanks for doing all this work @fedekunze !! I think we should copy over some of this into transfer docs.

Left some small nits on wording, but the general flow aligns with my mental model

docs/architecture/adr-001-coin-source-tracing.md Outdated Show resolved Hide resolved
docs/architecture/adr-001-coin-source-tracing.md Outdated Show resolved Hide resolved
docs/architecture/adr-001-coin-source-tracing.md Outdated Show resolved Hide resolved
docs/architecture/adr-001-coin-source-tracing.md Outdated Show resolved Hide resolved
docs/architecture/adr-001-coin-source-tracing.md Outdated Show resolved Hide resolved
Copy link
Collaborator

@anilcse anilcse left a comment

Choose a reason for hiding this comment

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

lgtm

docs/architecture/adr-001-coin-source-tracing.md Outdated Show resolved Hide resolved
Copy link
Contributor

@cwgoes cwgoes left a comment

Choose a reason for hiding this comment

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

Agree with @colin-axner's comments. Otherwise this looks fine to me.

docs/architecture/adr-001-coin-source-tracing.md Outdated Show resolved Hide resolved
@fedekunze fedekunze dismissed stale reviews from AdityaSripal and alexanderbez August 3, 2020 11:39

addressed

@mergify mergify bot merged commit 6f3ca5c into master Aug 3, 2020
@mergify mergify bot deleted the adr-coin-source-tracing branch August 3, 2020 11:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A:automerge Automatically merge PR once all prerequisites pass. C:Types T: ADR An issue or PR relating to an architectural decision record
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ADR for IBC coin denomination prefix
9 participants