Skip to content

Conversation

@awrichar
Copy link
Contributor

@awrichar awrichar commented Nov 10, 2021

Part of #218
Resolves #315
Resolves #318

A pool must be activated before using it. The activation step will trigger the pool
creation event to be re-sent (so that it can be used to confirm the pool), and will
also trigger the plugin to begin sending transfers from that specific pool.

This solves a number of holes with token pool creation - including validating the
pool announcement against the local plugin and ensuring transfers are not received
before the pool is fully created.

Requires hyperledger/firefly-tokens-erc1155#43 (E2E tests will fail until this is integrated).
There are breaking changes in the internal API between core and the tokens connector,
but they should be invisible to an end user. Migrations are in place to transition any
pre-existing token pools.

The standalone "trackingId" parameter is being removed.

Also differentiate between the stored TokenPool type in FireFly core and the
simpler TokenPool data that is returned from the tokens plugin.

Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
…tion

A pool must be activated before using it. The activation step will trigger the pool
creation event to be re-sent (so that it can be used to confirm the pool), and will
also trigger the plugin to begin sending transfers from that specific pool.

This solves a number of holes with token pool creation - including validating the
pool announcement against the local plugin and ensuring transfers are not received
before the pool is fully created.

Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
Pools in "unknown" state will be activated and moved to "confirmed".

Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
@codecov-commenter
Copy link

codecov-commenter commented Nov 11, 2021

Codecov Report

Merging #317 (893d403) into main (fe55880) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #317   +/-   ##
=======================================
  Coverage   99.98%   99.98%           
=======================================
  Files         232      232           
  Lines       12578    12664   +86     
=======================================
+ Hits        12576    12662   +86     
  Misses          1        1           
  Partials        1        1           
Impacted Files Coverage Δ
internal/apiserver/route_post_token_pool.go 100.00% <ø> (ø)
...nternal/apiserver/route_post_token_pool_by_type.go 100.00% <ø> (ø)
internal/assets/manager.go 100.00% <ø> (ø)
internal/assets/token_pool.go 100.00% <100.00%> (ø)
internal/assets/token_transfer.go 100.00% <100.00%> (ø)
internal/broadcast/tokenpool.go 100.00% <100.00%> (ø)
internal/database/sqlcommon/tokenpool_sql.go 100.00% <100.00%> (ø)
internal/database/sqlcommon/tokentransfer_sql.go 100.00% <100.00%> (ø)
internal/events/aggregator.go 100.00% <100.00%> (ø)
internal/events/event_manager.go 100.00% <100.00%> (ø)
... and 9 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fe55880...893d403. Read the comment docs.

Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
A transaction ID is still required to trigger announcement, so the initial event
back to the submitter needs to reflect the data passed into the connector.
However, the later events triggered to all nodes technically do not need the
transaction ID - so do not enforce this as a hard requirement.

Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
Signed-off-by: Peter Broadhurst <peter.broadhurst@kaleido.io>
Copy link
Contributor

@peterbroadhurst peterbroadhurst left a comment

Choose a reason for hiding this comment

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

Spent a bunch of time staring at TokenPoolCreated() and didn't spot any concerns.
The only comment I had was on a method name.

I note the e2e tests are still failing after I updated the manifest and merged with main, so might be one more thing to look at before this clicks in.

"github.com/hyperledger/firefly/pkg/tokens"
)

func updatePool(storedPool *fftypes.TokenPool, chainPool *tokens.TokenPool) *fftypes.TokenPool {
Copy link
Contributor

Choose a reason for hiding this comment

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

I kept tripping over the update here reading the code.
Maybe tokenPoolToFFPool or newPoolFrom?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Pushed a commit to use addPoolDetailsFromPlugin... it's a bit more verbose, but at least it's accurate.

Also removed the return value (switched it to only modify the input param) - so hopefully that makes it clearer as well.

@peterbroadhurst
Copy link
Contributor

I don't think the e2e failure is related - raising separate issue #328

@peterbroadhurst
Copy link
Contributor

kaleido-io#39 raised as a PR into this branch, to address the (unrelated) E2E failure

@peterbroadhurst
Copy link
Contributor

peterbroadhurst commented Nov 19, 2021

(... the coverage red box will be addressed when #325 merges)

peterbroadhurst and others added 2 commits November 19, 2021 10:21
Signed-off-by: Peter Broadhurst <peter.broadhurst@kaleido.io>
Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
@awrichar awrichar merged commit 446f40b into hyperledger:main Nov 19, 2021
@awrichar awrichar deleted the activate branch November 19, 2021 16:05
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.

Fix inconsistencies between token pools and token transfers Support for all token pool creation scenarios

3 participants