Skip to content

Conversation

@friedemannf
Copy link
Member

@friedemannf friedemannf commented Dec 18, 2025


Below is a summarization created by an LLM (gpt-4-0125-preview). Be mindful of hallucinations and verify accuracy.

Why

The changes introduce support for the Canton blockchain network within a blockchain simulation framework. This includes defining new constants for the Canton type and family, extending validation for the Canton network type, and implementing the necessary container setup for running a Canton network. These updates allow users to simulate and interact with Canton networks, enhancing the framework's versatility and support for different blockchain technologies.

What

  • framework/components/blockchain/blockchain.go

    • Added TypeCanton constant to define Canton type.
    • Added FamilyCanton constant to define Canton family.
    • Updated Type field validation in Input struct to include canton.
    • Added NumberOfValidators field to Input struct for Canton specific configuration.
    • Implemented case for TypeCanton in NewWithContext function to handle Canton network setup.
    • Added TypeCanton handling in TypeToFamily function to map Canton type to its family.
  • framework/components/blockchain/canton.go

    • New file added to define functions specific to setting up a Canton network.
  • framework/components/blockchain/canton/canton.go

    • New file added to define the container request configurations for Canton nodes including health checks and Canton configuration.
  • framework/components/blockchain/canton/nginx.go

    • New file added to define the Nginx container request for the Canton setup, used for reverse proxy configuration.
  • framework/components/blockchain/canton/postgres.go

    • New file added to define the Postgres container request for the Canton setup, configuring the database needed for Canton nodes.
  • framework/components/blockchain/canton/splice.go

    • New file added to define the Splice container request for the Canton setup, configuring the Splice application necessary for validator operations in a Canton network.

Comment on lines +51 to +55
script += fmt.Sprintf(`
# Participant %02[1]d
echo "Checking ${CANTON_PARTICIPANT_GRPC_HEALTHCHECK_PORT_PREFIX}%02[1]d"
grpcurl -plaintext "localhost:${CANTON_PARTICIPANT_GRPC_HEALTHCHECK_PORT_PREFIX}%02[1]d" grpc.health.v1.Health/Check
`, i)

Choose a reason for hiding this comment

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

Does this Sprintf work as expected? I see 3 format verbs (%02[1]d) but just one arg in the varargs section of the args (i rather than i,i,i)

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, arguments can be explicitly indexed: https://pkg.go.dev/fmt#hdr-Explicit_argument_indexes
This seems cleaner than repeating the same argument i all over again

Choose a reason for hiding this comment

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

Oh nice! TIL. 😄

if err != nil {
return nil, err
}
_ = c

Choose a reason for hiding this comment

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

You could do _, err := ... on line 30 to avoid doing this

Choose a reason for hiding this comment

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

Similarly for other lines

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.

2 participants