Skip to content

Enums in Go-binding start from 1 instead of 0 #317

@howjmay

Description

@howjmay

See the following snippet from iota-rust-sdk/bindings/go/iota_sdk_ffi/iota_sdk_ffi.go

// Defines what happened to an ObjectId during execution
//
// # BCS
//
// The BCS serialized form for this type is defined by the following ABNF:
//
// ```text
// id-operation =  id-operation-none
// =/ id-operation-created
// =/ id-operation-deleted
//
// id-operation-none       = %x00
// id-operation-created    = %x01
// id-operation-deleted    = %x02                                                        

type IdOperation uint                                                                                                                               
const (                                                                   
    IdOperationNone IdOperation = 1                                           
    IdOperationCreated IdOperation = 2                                        
    IdOperationDeleted IdOperation = 3                                                                                                      
)

And the Rust ones in iota-rust-sdk/crates/iota-sdk-types/src/effects/v1.rs

pub enum IdOperation {
    None,
    Created,
    Deleted,
}

The starting int of the enum in these 2 languages are different. I haven't seen a confirmed error caused by this, but for sure it may cause some potential errors if the developers manually assign the value

Metadata

Metadata

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions