Skip to content

Conversation

@adecaro
Copy link
Contributor

@adecaro adecaro commented Mar 23, 2025

We start by adding the check that at least one issuer identity is specified in the Validate function of the public parameters. From there, we make sure the rest still works.
Many of the integration tests were assuming that anyone could issue, therefore we had to change the test to update the public parameters with the identities of who needed to issue.

@adecaro adecaro self-assigned this Mar 23, 2025
@adecaro adecaro linked an issue Mar 23, 2025 that may be closed by this pull request
@adecaro adecaro changed the title dlog v1 finalzation: enforce at list one issuer dlog v1 finalzation: enforce at least one issuer Mar 24, 2025
@adecaro adecaro changed the title dlog v1 finalzation: enforce at least one issuer dlog v1 finalization: enforce at least one issuer Mar 24, 2025
adecaro added 23 commits March 25, 2025 11:21
Signed-off-by: Angelo De Caro <angelo.decaro@gmail.com>
Signed-off-by: Angelo De Caro <angelo.decaro@gmail.com>
Signed-off-by: Angelo De Caro <angelo.decaro@gmail.com>
update public params during test when needed
LocalMembership should not discard identities not in the target list, just assign a low priority

Signed-off-by: Angelo De Caro <angelo.decaro@gmail.com>
Signed-off-by: Angelo De Caro <angelo.decaro@gmail.com>
Signed-off-by: Angelo De Caro <angelo.decaro@gmail.com>
Signed-off-by: Angelo De Caro <angelo.decaro@gmail.com>
Signed-off-by: Angelo De Caro <angelo.decaro@gmail.com>
Signed-off-by: Angelo De Caro <angelo.decaro@gmail.com>
support for fabtoken pp

Signed-off-by: Angelo De Caro <angelo.decaro@gmail.com>
Signed-off-by: Angelo De Caro <angelo.decaro@gmail.com>
Signed-off-by: Angelo De Caro <angelo.decaro@gmail.com>
Signed-off-by: Angelo De Caro <angelo.decaro@gmail.com>
Signed-off-by: Angelo De Caro <angelo.decaro@gmail.com>
Signed-off-by: Angelo De Caro <angelo.decaro@gmail.com>
Signed-off-by: Angelo De Caro <angelo.decaro@gmail.com>
Signed-off-by: Angelo De Caro <angelo.decaro@gmail.com>
Signed-off-by: Angelo De Caro <angelo.decaro@gmail.com>
Signed-off-by: Angelo De Caro <angelo.decaro@gmail.com>
Signed-off-by: Angelo De Caro <angelo.decaro@gmail.com>
Signed-off-by: Angelo De Caro <angelo.decaro@gmail.com>
Signed-off-by: Angelo De Caro <angelo.decaro@gmail.com>
Signed-off-by: Angelo De Caro <angelo.decaro@gmail.com>
Signed-off-by: Angelo De Caro <angelo.decaro@gmail.com>
func PrepareUpdatedPublicParams(network *integration.Infrastructure, auditor string, networkName string) []byte {
tms := GetTMSByNetworkName(network, networkName)
auditorId := GetAuditorIdentity(tms, auditor)
issuerId := GetIssuerIdentity(tms, "newIssuer")
Copy link
Contributor

Choose a reason for hiding this comment

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

Gives a bit more clarity if we pass the issuer id as a parameter too.

// log information about the public params
pp := publicParamsManager.PublicParams()
logger.Infof("new token driver for tms id [%s] with label and version [%s:%s]", tmsID, pp.Identifier(), pp.Version())
for _, issuer := range pp.Issuers() {
Copy link
Contributor

Choose a reason for hiding this comment

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

You can do

logger.Debug("issuers are [%s]", pp.Issuers())

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 wanted to have them on separated lines, for clarify.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed, I'll just print the public params.

"--issuers", "Error: failed to generate public parameters: failed to get issuer identity [aOrg1MSP]: invalid input [aOrg1MSP]",
},
ErrMsg: "Error: failed to generate public parameters: failed to get issuer identity [Error: failed to generate public parameters: failed to get issuer identity [aOrg1MSP]: invalid input [aOrg1MSP]]:",
ErrMsg: "Error: failed to generate public parameters: failed to setup issuer and auditors: failed to get issuer identity [Error: failed to generate public parameters: failed to get issuer identity [aOrg1MSP]: invalid input [aOrg1MSP]]: failed to load certificates from Error: failed to generate public parameters: failed to get issuer identity [aOrg1MSP]: invalid input [aOrg1MSP]/signcerts: stat Error: failed to generate public parameters: failed to get issuer identity [aOrg1MSP]: invalid input [aOrg1MSP]/signcerts: no such file or directory",
Copy link
Contributor

Choose a reason for hiding this comment

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

typo: "failed to load certificates from Error"

type OnRestartFunc = func(*integration.Infrastructure, string)

func TestAll(network *integration.Infrastructure, auditorId string, onRestart OnRestartFunc, aries bool, sel *token3.ReplicaSelector) {
func TestAll(network *integration.Infrastructure, auditorId string, onRestart OnRestartFunc, aries bool, orion bool, sel *token3.ReplicaSelector) {
Copy link
Contributor

Choose a reason for hiding this comment

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

consider, instead of "aries", "orion", and more possible future system-specific parameter names, maybe use a single generic parameter like network_name.


SetKVSEntry(network, issuer, "auditor", auditor.Id())
CheckPublicParams(network, issuer, auditor, alice, bob, charlie, manager)
if orion {
Copy link
Contributor

Choose a reason for hiding this comment

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

consider, instead of mentioning a specific network_name in the code, maybe refer to its relevant trait. Then, either pass the trait as a parameter or maintain a structure with generic traits for every network type.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good point, I think we need to rework these tests. I'll open a github issue for it.

// log information about the public params
pp := publicParamsManager.PublicParams()
logger.Infof("new token driver for tms id [%s] with label and version [%s:%s]", tmsID, pp.Identifier(), pp.Version())
for _, issuer := range pp.Issuers() {
Copy link
Contributor

Choose a reason for hiding this comment

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

I see that this kind of debug-printing occurs often in the code.
Consider having a general debug-printing method for printing slices of strings - e.g. something like logger.logSliceOf("issuer", pp.Issuers())

Copy link
Contributor Author

Choose a reason for hiding this comment

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

cleaned

l.logger.Debugf("identity [%s:%s] not in target identities", name, config.URL)
} else {
// give it high priority
priority = -1
Copy link
Contributor

Choose a reason for hiding this comment

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

We could have it as a constant or even better a type to explain whether a low or high number has higher priority

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Contributor

@alexandrosfilios alexandrosfilios left a comment

Choose a reason for hiding this comment

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

LGTM modulo comments

Signed-off-by: Angelo De Caro <angelo.decaro@gmail.com>
@adecaro adecaro merged commit d5d3a66 into main Mar 27, 2025
54 checks passed
@adecaro adecaro deleted the f-1009 branch March 27, 2025 09:51
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.

dlog v1 finalzation: enforce at list one issuer

4 participants