Skip to content

Commit

Permalink
go: Drop {hash,address}Lenght constants
Browse files Browse the repository at this point in the history
  • Loading branch information
chfast committed May 13, 2020
1 parent 37f71e9 commit 1232ddb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
11 changes: 7 additions & 4 deletions bindings/go/evmc/evmc.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,13 @@ import (

// Static asserts.
const (
_ = uint(hashLength - C.sizeof_evmc_bytes32) // The size of evmc_bytes32 equals the size of Hash.
_ = uint(C.sizeof_evmc_bytes32 - hashLength)
_ = uint(addressLength - C.sizeof_evmc_address) // The size of evmc_address equals the size of Address.
_ = uint(C.sizeof_evmc_address - addressLength)
// The size of evmc_bytes32 equals the size of Hash.
_ = uint(len(Hash{}) - C.sizeof_evmc_bytes32)
_ = uint(C.sizeof_evmc_bytes32 - len(Hash{}))

// The size of evmc_address equals the size of Address.
_ = uint(len(Address{}) - C.sizeof_evmc_address)
_ = uint(C.sizeof_evmc_address - len(Address{}))
)

type Error int32
Expand Down
12 changes: 2 additions & 10 deletions bindings/go/evmc/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,8 @@

package evmc

// Lengths of hashes and addresses in bytes.
const (
// hashLength is the expected length of the hash (in bytes)
hashLength = 32
// addressLength is the expected length of the address (in bytes)
addressLength = 20
)

// Hash represents the 32 bytes of arbitrary data (e.g. the result of Keccak256 hash).
type Hash [hashLength]byte
type Hash [32]byte

// Address represents the 20 byte address of an Ethereum account.
type Address [addressLength]byte
type Address [20]byte

0 comments on commit 1232ddb

Please sign in to comment.