feat: Add timestamp argument for deterministic CID generation - #43
Merged
Merged
Conversation
somasekimoto
marked this pull request as ready for review
December 14, 2025 07:25
Yu-da-1
reviewed
Dec 20, 2025
| "Merge operations must be committed via auto-merge".to_string(), | ||
| )); | ||
| } | ||
| self.stage_merge(payload, &op, timestamp, &mut pending_nodes)? |
Member
There was a problem hiding this comment.
これかなり重要な問題でしたね.....!ありがとうございます!!
思ったのが現状だと一応誰でもmerge操作をすることができちゃうと思っていて、これってどう制御するのが良さそうですかね。monasで考えるとネットワーク内のnodeからのみ受け入れるなど?
そもそもその制御はライブラリ側で行うことではなかったりしますかね??
Contributor
Author
There was a problem hiding this comment.
@Yu-da-1
マージできるユーザー権限の管理みたいなところですかね?それはここではやらないで外でやればいいと思います!今回だとstate-node側の実装ですね。
Yu-da-1
approved these changes
Dec 24, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
timestampparameter to DAG node creation methods for deterministic CID generationnode_timestampfield toOperationfor replication support with consistent CIDsChanges
src/graph/dag.rs
timestampparameter toadd_node,add_genesis_node,add_child_node,prepare_genesis_node,prepare_child_nodemethodscurrent_timestamp()helper (timestamp is now provided by caller)src/convergence/resolver.rs
timestampparameter tocreate_merge_nodemethodcurrent_timestamp()helpersrc/crdt/operation.rs
node_timestamp: Option<Timestamp>field for import operationssrc/repo.rs
next_monotonic_timestamp()for local operationsop.node_timestampfor import operations (replication)stage_mergemethod for importing Merge operations from replicasresolve_metadata_for_committoresolve_metadatawithlenientflaglenient=true: returns default metadata when nodes not found (for imports)lenient=false: returns error when nodes not found (for local operations)commit_operationandresolve_metadataTest plan
test_import_operation_preserves_cid- verifies Create operation importtest_import_operation_update_preserves_cid- verifies Update operation import🤖 Generated with Claude Code