Skip to content

Invalid Rust bindings are generated #461

@Wodann

Description

@Wodann

I tried generating Rust bindings for this openrpc.json: https://raw.githubusercontent.com/ethereum/execution-apis/v1.0.0-beta.1/refs-openrpc.json; but it resulted in invalid Rust code.

The problems I'm seeing:

  • duplicate Rust types (Duplicate typings in typescript #42 mentions this having been resolved for Rust)
  • cyclic type definitions
     {
     	"name": "rewardPercentiles",
     	"description": "A monotonically increasing list of percentile values. For each block in the requested range, the transactions will be sorted in ascending order by effective tip per gas and the coresponding effective tip for the percentile will be determined, accounting for gas consumed.",
     	"required": true,
     	"schema": {
     		"title": "rewardPercentiles",
     		"type": "array",
     		"items": {
     			"title": "rewardPercentile",
     			"description": "Floating point value between 0 and 100.",
     			"type": "number"
     		}
     	}
     }
    
    results in this Rust code:
    pub type RewardPercentiles = Vec<RewardPercentile>;
    
    where I would have expected something like:
    pub type RewardPercentiles = Vec<u32>;
    
  • functions are generated without a body. E.g.
    pub fn EthGetBlockByHash(&mut self, Block hash: 2ByteHexValue, Hydrated transactions: Hydrated) -> RpcRequest<BlockObject>;
    

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions