Closed ShookLyngs closed 8 months ago
@ShookLyngs do we have some basic tests that we can run as github actions?
@ShookLyngs do we have some basic tests that we can run as github actions?
We have 2 kinds of tests right now:
@Dawn-githup and I plan to address the capacity issue and create a github action to test the sdk automatically. Just opened an issue for it, feel free to follow #47 for later updates.
Was using a uint type that was too large for the ClusterProxyArgs.minPayment
codec, changed Uint64 -> Uint16:
Changes
Checklist
beta
Details
What is ClusterProxy/ClusterAgent
A question to start: If there is a private Cluster belonging to A, how can B create clustered Spores using this Cluster without relying on A's signatures/approvals to reference the Cluster in the Spore creation transactions?
With just the cluster, B cannot do this. Therefore, we're having two new type scripts, ClusterProxy and ClusterAgent, to address the permission distribution problem of Cluster.
Here's a summary of the two type scripts:
ClusterProxy
: It's a type of distributor cell where the owner can reference it to create ClusterAgents. Alternatively, if the ClusterProxy has aminPayment
defined, anyone can pay the owner and reference the ClusterProxy to create ClusterAgents.ClusterAgent
: Each ClusterAgent represents a Cluster, but they can have different owners than the represented Cluster. The owner can reference it and create clustered Spores without needing the signatures/approvals from the owner of the represented Cluster.Example flow
Here's a simple flow to illutrate the usage:
Cluster#1
ClusterProxy#1
withCluster#1
ClusterProxy#1
lock = AClusterProxy#1
minPayment = 10Cluster#1
in the transactionClusterAgent#1
withClusterProxy#1
ClusterAgent#1
lock = BClusterProxy#1
in the transactionSpore#1
withClusterAgent#1
Spore#1
referenced cluster =Cluster#1
ClusterAgent#1
in the transactionClusterAgent#2
with paymentClusterAgent#2
lock = B10^10
shannons in the transaction, asClusterProxy#1
requiredSpore#2
withClusterAgent#12
Spore#2
referenced cluster =Cluster#1
ClusterAgent#2
in the transactionFrom the above flow, we can observe that in step 4, B creates
Spore#1
that it's a clustered Spore and referencesCluster#1
, butCluster#1
is not actually included in the transction, and A's signature is not needed. The transaction only referencesClusterAgent#1
as the proof to create the clustered Spore, andClusterAgent#1
belongs to B, so only B's signature is required in the transaction.In steps 5-6, C takes a different approach by paying a fee to A and creating
ClsuterAgent#2
. The fee amount is determined by theminPayment
property ofClusterProxy#1
. And the rest of the process is the same as B's flow.ClusterProxy
New Composed APIs
Create ClusterProxy
ClusterAgent
New Composed APIs
Create ClusterAgent
Create by referencing ClusterProxy:
Create by paying to the owner of the ClusterProxy:
Spore
Create Spore with ClusterAgent
Previously, one can only create a clustered Spore by referencing the target Cluster or its LockProxy in the Spore creation transation, now
props.clusterAgentOutPoint
.