feat(sui): support host port mapping #2044
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Allow a different port other than 9000 for sui to be mapped on the host since 9000 can be consumed by other apps.
Also updated the docker image used by ton smoke as the existing one no longer working
JIRA: https://smartcontract-it.atlassian.net/browse/CLD-500
Below is a summarization created by an LLM (gpt-4-0125-preview). Be mindful of hallucinations and verify accuracy.
Why
The changes ensure that Sui blockchain components correctly manage default and user-specified ports, improving usability and flexibility. The update in the example project aims to align with development standards by using a development image version.
What
framework/components/blockchain/sui.go"github.com/docker/go-connections/nat"to handle NAT port mappings more effectively.defaultSuifunction to setin.PorttoDefaultSuiNodePortif it's empty, ensuring a default port is always used if not specified by the user.newSuifunction to definecontainerPortas the Sui container's internal default port (DefaultSuiNodePort) and use it for container port mappings. This change allows mapping the user-specified host port to the container's internal port.HostConfigModifierintestcontainers.ContainerRequestto usenat.PortMapfor port bindings, ensuring the correct external to internal port mappings.ExternalHTTPUrlandInternalHTTPUrlto useDefaultSuiNodePortfor the internal URL, providing consistency with how the container is accessed internally.framework/examples/myproject/smoke_ton.tomlimageconfiguration forblockchain_afromghcr.io/neodix42/mylocalton-docker:latesttoghcr.io/neodix42/mylocalton-docker:dev, aligning with development practices by using a development image.