Repository navigation
[objects] generalize ObjectState to capture native and Move ob… - #28
Conversation
| .try_into() | ||
| .expect("An address is always long enough to extract 20 bytes") | ||
| .expect("An address is always long enough to extract 16 bytes") |
There was a problem hiding this comment.
Use ObjectID::LENGTH instead of 16?
There was a problem hiding this comment.
This is a 'hack' function and we have an issue open to eliminate. So we can live with a more value expect like, "address too short".
|
|
||
| use crate::base_types::{FastPayAddress, ObjectID, ObjectRef, PublicKeyBytes, SequenceNumber}; | ||
|
|
||
| // Copyright (c) Mysten Labs |
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| #[derive(Eq, PartialEq, Debug, Clone)] | ||
| pub enum Type { |
There was a problem hiding this comment.
What's the use case for Type? Do we want to store the type somewhere? It seems that the way Rust supports enum put type and data together.
There was a problem hiding this comment.
Fair point--I don't think this is well-motivated. Will eliminate for now.
| #[derive(Eq, PartialEq, Debug, Clone)] | ||
| pub enum Data { | ||
| /// An object whose governing logic lives in the FastX authority code | ||
| Gas(GasToken), |
There was a problem hiding this comment.
Gas may not best represent the use. Should it just be called Token?
gdanezis
left a comment
There was a problem hiding this comment.
Love the abstraction so far. Lets document in a spec the semantics of transfer, gas etc (and simplify as much as we can). But these are separate concerns.
| .try_into() | ||
| .expect("An address is always long enough to extract 20 bytes") | ||
| .expect("An address is always long enough to extract 16 bytes") |
There was a problem hiding this comment.
This is a 'hack' function and we have an issue open to eliminate. So we can live with a more value expect like, "address too short".
| pub sender: FastPayAddress, | ||
| pub gas_payment: ObjectRef, | ||
| // TODO: would like to use CompiledModule here, but this type doesn't implement Hash | ||
| pub module_byes: Vec<u8>, |
There was a problem hiding this comment.
typo: bytes. Lets keep the actual module bytes, here and optimize later.
| // TODO: would like to use CompiledModule here, but this type doesn't implement Hash | ||
| pub module_byes: Vec<u8>, | ||
| } | ||
|
|
||
| #[derive(Debug, PartialEq, Eq, Hash, Clone, Serialize, Deserialize)] | ||
| pub enum OrderKind { | ||
| /// Initiate an object transfer between addresses | ||
| Transfer(Transfer), |
There was a problem hiding this comment.
So we allow all objects to be transferred? Lets make a note (somewhere) about the semantics. Maybe we can extent the spec doc (overleaf) with a new section on runtime & semantics explaining gas, publish, types, restrictions etc
There was a problem hiding this comment.
Good call + will do on the overleaf!
I don't think we should allow all objects to be transferred--this is just me keeping around the old order types + their processing logic. Reflecting the discussion below to start with Move-managed types/ops only, I'll add a TODO for removing this in a subsequent PR.
I definitely think we'll want to bring this back in the near future, but there are some tricky issues here--e.g., ensuring you can't use this to subvert a custom transfer policy for a Move object.
| match &self.kind { | ||
| OrderKind::Transfer(t) => self.signature.check(&self.kind, t.sender), | ||
| } | ||
| self.signature.check(&self.kind, *self.sender()) | ||
| } | ||
|
|
||
| // TODO: support orders with multiple objects, each with their own sequence number (https://github.com/MystenLabs/fastnft/issues/8) | ||
| pub fn sequence_number(&self) -> SequenceNumber { |
There was a problem hiding this comment.
I think here we should support an input_object()->[ObjectRef] function, instead of sequence number. Next PR.
| #[derive(Eq, PartialEq, Debug, Clone)] | ||
| pub enum Type { | ||
| /// Fungible token used to pay for gas. Mutable. | ||
| GasToken, |
There was a problem hiding this comment.
Tell us more about this GasToken type? Do we need rust to know about i? Or can we implement this in move?
There was a problem hiding this comment.
In principle, this can be fully implemented in Move--e.g.,it could be Coin<GAS>: https://github.com/MystenLabs/fastnft/blob/main/fastx_programmability/framework/sources/Coin.move#L10.
The thinking behind having a separate native value/type is only to make common operations more efficient. But perhaps for simplicity, I should start off with Move-managed types only, and we can worry about extracting native types (and figuring out the story for how they get used in Move) later.
7d7af69 to
39c2e0f
Compare
ObjectState to capture native and Move ob…ObjectState to capture native and Move ob…
… objects - Move `ObjectState` to its own file and rename it to `Object` - An `Object` can be one of three things (for now): a gas token, a Move value, or a Move module - An object knows its ID, owner, type, and mutability status - Introduce WIP new message types (Publish and Call) that will create/consumed Move values and modules. For now, these messages are unhandled
…ent/operators/full-node/sui-full-node.mdx
## Summary Automated documentation fixes based on the weekly docs audit report. ### Fixed issues - 🔴 **#1** [HIGH]: CLI: `send-funds` command missing from docs snippet - 🔴 **#2** [HIGH]: Move CLI: `sui move new` generated `Move.toml` is completely outdated - 🔴 **#3** [HIGH]: Move CLI: Directory listing shows `Sources` (capital S) instead of `sources` - 🟡 **#20** [MEDIUM]: Move build output mentions `UPDATING GIT DEPENDENCY` - 🟡 **#21** [MEDIUM]: Move coverage: Claims debug build is required - 🔴 **#4** [HIGH]: Exchange Integration: `sui_getEvents` API used with wrong signature - 🔴 **#5** [HIGH]: Exchange Integration: Variable name bug in curl example - 🔴 **#6** [HIGH]: Exchange Integration: Uses devnet URLs for production guidance - 🔴 **#9** [HIGH]: Duplicate exchange integration docs - 🔴 **#10** [HIGH]: Exchange Integration: Rust SDK examples use deprecated `SuiClientBuilder` with JSON-RPC - 🟡 **#22** [MEDIUM]: Exchange Integration: `read_api().get_balance()` pattern - 🔴 **#7** [HIGH]: Validator CLI: Missing commands in docs - 🔴 **#8** [HIGH]: Research Papers: Outdated consensus description - 🟡 **#11** [MEDIUM]: GraphQL: Hardcoded version number `1.56.1` - 🟡 **#12** [MEDIUM]: External Signers: Hardcoded minimum version - 🟡 **#13** [MEDIUM]: Package Management: Hardcoded `toolchain-version = "1.64.0"` - 🟡 **#14** [MEDIUM]: Full Node Config: `enable-event-processing` in template but not in NodeConfig - 🟡 **#15** [MEDIUM]: Full Node Config: `rpc.enable-indexing` not prominently documented - 🟢 **#28** [LOW]: Full node setup: Genesis blob URLs use `curl -fLJO` - 🟡 **#16** [MEDIUM]: Consensus: Performance numbers may be stale - 🟡 **#17** [MEDIUM]: `client.mdx`: Dynamic field example shows `SuiSystemStateInnerV2` - 🟡 **#18** [MEDIUM]: Release Notes: Broken external URL - 🟡 **#19** [MEDIUM]: DeepBook Margin SDK: Hardcoded fullnode URLs - 🟢 **#25** [LOW]: Observability doc is marked as draft - 🟢 **#26** [LOW]: Tokenized Asset docs reference `UPDATING GIT DEPENDENCY` - 🟢 **#27** [LOW]: Install from source: `--features tracing` documentation ### Files changed - `docs/content/snippets/console-output/sui-client-help.mdx` - `docs/content/references/cli/move.mdx` - `docs/content/operators/exchange-integration.mdx` - `docs/content/references/exchange-integration-guide.mdx` - `docs/content/references/cli/validator.mdx` - `docs/content/references/research-papers.mdx` - `docs/content/develop/accessing-data/using-events.mdx` - `docs/content/develop/accessing-data/graphql/query-with-graphql.mdx` - `docs/content/references/cli/external-signers.mdx` - `docs/content/develop/manage-packages/move-package-management.mdx` - `docs/content/operators/full-node/sui-full-node.mdx` - `docs/content/develop/sui-architecture/consensus.mdx` - `docs/content/references/cli/client.mdx` - `docs/content/references/release-notes.mdx` - `docs/content/onchain-finance/deepbook-margin-sdk/deepbook-margin-sdk.mdx` - `docs/content/operators/observability.mdx` - `docs/content/onchain-finance/tokenized-assets/deploy-tokenized-asset.mdx` - `docs/content/getting-started/onboarding/install-source.mdx` ### Skipped (manual action needed) - 🟢 **#23** [LOW]: `completion` subcommand not independently documented - 🟢 **#24** [LOW]: `fire-drill` subcommand not documented --- *This PR was automatically generated by the Docs Audit Fixer. Please review the changes carefully before merging.*
## Summary The `mysten/stress` image is currently **~1244 MB compressed** vs `mysten/sui-node`'s **~114 MB** at the same SHA. This bloat directly causes the recent buildkit/gRPC wedge failures in `Continuous` CI. After this PR, the image is **75.6 MiB compressed** (1234.7 → 75.6 MiB, **94% smaller**, 21 → 10 layers). ## Symptom On 2026-05-18, four consecutive Continuous runs failed at the stress build with the same signature: > `rpc error: code = Unavailable ... error reading from server: EOF while exporting to the client directory` Each took **~2–3h** before failing (sidecar timeout + buildkit graceful-terminate). Affected mp3 builds: **34721, 34765, 34787, 34858**. Most-recent broken run: https://github.com/MystenLabs/sui-operations/actions/runs/26068501485. ## Root cause The current runtime stage uses `rust:1.92-bullseye` as its base (~1.5 GB) and does a `git clone https://github.com/MystenLabs/sui.git` at build time, dragging the entire repo into the runtime image. Plus apt-installs `wget iputils-ping netcat procps bind9-host bind9-dnsutils curl iproute2 git ca-certificates awscli` — most unused. BuildKit's `#28 exporting to client directory` step writes the full image content to the buildkitd PVC. At ~3-4 GB uncompressed, the export takes minutes and is much more likely to hit a transient gRPC stream failure than sui-node's ~300 MB. The PVC cargo cache (helpful for the compile step) doesn't help the export step. ## Fix Mirror the `docker/sui-node` and `docker/sui-tools` pattern: - Runtime base: `debian:bullseye-slim` - `COPY docker/stress/entrypoint.sh ...` from build context (no runtime `git clone`) - Install only `ca-certificates curl awscli` (everything else is unused — see consumer audit below) - Drop `/var/run/sui_commit` write (no consumer reads it; `LABEL git-revision` is the standard place) Ship the minimal Move package tree the workloads load at runtime: - `crates/sui-benchmark/src/workloads/data` (~320 KB) — `composite`/`adversarial`/`party`/`slow`/`max_package` packages - `crates/sui-framework/packages/sui-framework` (~1.3 MB) — referenced by each workload's `Move.toml` via `local = "../../../../../sui-framework/packages/sui-framework"` - `crates/sui-framework/packages/move-stdlib` (~352 KB) — Sui's transitive dep - `examples/move/basics` (~32 KB) — read by `TestTransactionBuilder::publish_examples("basics")` via the `publish_basics_package` helper (called by `shared_counter`, `randomness`, `randomized_transaction`, `shared_object_deletion`) - `ENV BENCHMARK_MOVE_BASE_DIR=/sui/crates/sui-benchmark` and `ENV MOVE_EXAMPLES_DIR=/sui/examples/move` so callers don't fall back to the build-time `CARGO_MANIFEST_DIR` path Negate `docker/stress/entrypoint.sh` in `.dockerignore`. The repo-wide `docker/` exclusion was previously sidestepped by the runtime `git clone`; removing the clone forces an explicit COPY, which the existing ignore line blocks. ### Defects caught during validation Two real defects surfaced under real-world testing that wouldn't have shown up in CI checks alone: 1. **`.dockerignore` excludes `docker/`** → first mp3 build (34958) failed at `COPY docker/stress/entrypoint.sh` after 132s with a `checksum calculation` error. Fixed by adding `!docker/stress/entrypoint.sh` exception (commit `9ace43189c`). 2. **Missing `examples/move/basics`** → second mp3 build (34960) succeeded and image deployed to staging, but the stress pod crashlooped with `Invalid directory at /sui/examples/move/basics` inside `SharedCounterWorkload::init`. `sui-test-transaction-builder::publish_examples("basics")` resolves its path via `env!("CARGO_MANIFEST_DIR")` — a build-time path that doesn't exist in the slim runtime. Fixed by COPY'ing `examples/move/basics` (32 KB) and setting `MOVE_EXAMPLES_DIR` (commit `4649ba4253`). ## Consumer audit | Consumer | Path | What it uses from the image | |---|---|---| | **sui-network-aux** (K8s, devnet/staging/ci) | mounts `entry.sh` from a ConfigMap | `/usr/local/bin/stress`, `bash`, `aws s3 cp` (genesis + keystore), `curl` fallback. Doesn't use the in-image entrypoint. With `stress_shared_counter > 0`, **does** publish `examples/move/basics` at runtime via `publish_basics_package` — which is why the second commit's `examples/move/basics` COPY is required. | | **sui-antithesis** (docker-compose) | uses in-image `/docker/stress/entrypoint.sh` | `/usr/local/bin/stress`, `bash`, `curl`, `grep`, `wc`, `sleep`. Mounts genesis/keystore from host. Sets `STRESS_COMPOSITE=5` — publishes the `composite` Move package, covered by the `workloads/data/composite` COPY. | | **PTN bare-metal** (ansible) | pulls binary from `s3://sui-releases/{sha}/stress` | **Not affected by image changes.** Cargo build is unchanged → binary is byte-identical to main. | Verified `sui-benchmark` has no `diesel`/`postgres`/`pq-sys` deps — `libpq5` is not needed at runtime. ## Validation End-to-end on staging via `sui-network-aux`, pinned to PR head `4649ba4253` ([MystenLabs/sui-operations#7978](MystenLabs/sui-operations#7978)): - mp3 build (34965): succeeded, image published to GAR + DockerHub - Compressed size: 1234.7 MiB → 75.6 MiB (94% reduction) - Pod startup: genesis/keystore download → fullnode connection → reconfiguration to epoch 43 → bank initialization (563 coins) → `Publishing basics package` succeeded → bench driver running with 24 workers - Steady-state behavior: ~50–55 TPS sustained (target 50), latency p50 ~240ms / p99 ~290–380ms, 0 error tx, 0 panics, 0 restarts over ~10 min Workload coverage across consumers of this image: | Env | shared_counter | transfer_object | other | enabled? | |---|---|---|---|---| | **staging** | 2 | 2 | 0 | validated directly | | **devnet** | 2 | 2 | 0 | identical config to staging | | **ci** | 2 | 2 | 0 | identical config to staging | | **testnet** | – | – | – | `stress_enabled: false` | All five referenced workload data dirs (`adversarial/composite/max_package/party/slow`) are present at this PR head and COPY'd. `examples/move/basics` is COPY'd. `sui-framework` + `move-stdlib` paths resolve correctly via the Move.toml relative-path chain. ## Pre-existing latent bug (noted, not fixed here) `crates/sui-benchmark/src/workloads/adversarial.rs:581` pushes `src/workloads/data/really_big_package`, but the on-disk directory is named `max_package`. The codepath is only reached when `--adversarial` is non-zero; production runs (`sui-network-aux`, antithesis) both set it to `0`, so this latent mismatch doesn't trigger. Worth a separate small PR to rename. ## Test plan - [x] mp3 build of PR head produces a much smaller `mysten/stress:<sha>` and completes in normal time. **Result: 75.6 MiB compressed, build 34965 finished in ~4 min.** - [x] On a single sui-network-aux deploy, confirm the stress pod starts, `aws s3 cp` succeeds, and `/usr/local/bin/stress bench ...` runs. **Result: validated on staging, ~50 TPS, 0 errors, 0 restarts over 10 min.** - [ ] Run an antithesis test cycle (sets `STRESS_COMPOSITE=5`) and verify the in-image entrypoint completes `rpc.discover` polling, publishes the composite Move package, and starts benchmarking. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
…jects
ObjectStateto its own file and rename it toObjectObjectcan be one of three things (for now): a gas token, a Move value, or a Move module