mirror of
https://github.com/luxfi/node.git
synced 2026-10-30 15:24:05 +00:00
chains/oraclevm is 213 lines and is not the chain. It re-exports github.com/luxfi/oracle/vm, which is 1628; chains/relayvm is 161 lines over luxfi/relay/vm's 2077. Of the eight chains the node runs that the differential did not cover, the two that looked smallest by an order of magnitude were the two that were not there. The O-chain's wire is not a codec frame. ParseBlock is json.Unmarshal and Bytes is json.Marshal, so the wire is whatever encoding/json writes for the chain's structs, and computeID hashes the block marshalled AGAIN rather than the bytes it was handed. So a block does not round-trip its own id, and a member the reader accepts and omitempty then drops does not change it. Both are vectors now. Its genesis block is built with time.Unix, which is local time, and MarshalJSON writes the offset: one genesis file gives block id 6cf00752 with TZ unset on a -08:00 box and f4970a27 under Asia/Kolkata. Two validators in two timezones are on different chains from block zero. No vector can carry that id, so O_GENESIS pins the genesis through a re-marshal instead and conformance/README.md says why rather than letting the workaround hide the bug. 153 O vectors: the JSON wire and the id over it, the request id that gives a request its name, the Merkle root a request's records commit to, and the three refusals the observation plane has. The Rust and C++ ports answer every one of them and decline nothing, and all three implementations agree on all six compared fields. The C++ port compiles chains/cpp/fhevm's id.cpp and json.cpp rather than carrying a second opinion about what encoding/json accepts. Those two files are chain-neutral and their name is a debt: the right home is a shared one, and moving them is a rename across fifteen F-chain files. Co-authored-by: Hanzo Dev <[email protected]>
33 lines
1.3 KiB
TOML
33 lines
1.3 KiB
TOML
[package]
|
|
name = "lux-oraclevm"
|
|
version = "0.1.0"
|
|
edition = "2021"
|
|
description = "The Lux O-Chain in Rust: oracle feeds, deterministic requests, and the commitment over what executors reported."
|
|
license = "BSD-3-Clause-Eco"
|
|
repository = "https://github.com/luxfi/node"
|
|
publish = false
|
|
|
|
[dependencies]
|
|
# Every name this chain derives is a SHA-256: the block id, the request id and
|
|
# the Merkle root over a request's records. Writing one by hand would be a
|
|
# second implementation to keep in step with Go and C++.
|
|
sha2 = "0.10"
|
|
|
|
# The O-chain's wire is JSON, so what a reader ACCEPTS is a consensus question
|
|
# and not a convenience. serde_json is the grammar; the rules Go layers on top
|
|
# of it — a member name matched by case-folding, the LAST of two members naming
|
|
# one field, a number that must be an integer to reach an integer — are in
|
|
# `gojson`, which is the only place they are written down.
|
|
#
|
|
# `preserve_order` is not cosmetic: one of those rules is about ORDER.
|
|
serde_json = { version = "1", features = ["preserve_order"] }
|
|
|
|
# An id on this wire is CB58 — base 58 with a four-byte SHA-256 checksum — and
|
|
# a byte slice is base64. Both are what `encoding/json` writes for the Go
|
|
# types, so both are the wire and neither is a rendering choice.
|
|
bs58 = "0.5"
|
|
base64 = "0.22"
|
|
|
|
# The corpus is hex, because that is how the Go generator prints it.
|
|
hex = "0.4"
|