Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
8.1.0
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,6 @@ profile.cov
logs/

tests/spec-tests/

# Bazel scratch space
bazel-*
27 changes: 27 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
load("@gazelle//:def.bzl", "gazelle")
load("@rules_go//go:def.bzl", "go_library")

# No need for gazelle:prefix as it reads from go.mod
# libevm/tooling is a different Go/Bazel module
# gazelle:exclude libevm/tooling/**
gazelle(
name = "gazelle",
command = "fix",
)

gazelle(
name = "gazelle_diff",
command = "fix",
extra_args = ["--mode=diff"],
)

go_library(
name = "libevm",
srcs = ["interfaces.go"],
importpath = "github.com/ava-labs/libevm",
visibility = ["//visibility:public"],
deps = [
"//common",
"//core/types",
],
)
32 changes: 32 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
"ava-labs/libevm"

module(
name = "ava-labs_libevm",
version = "",
)

bazel_dep(name = "rules_go", version = "0.53.0")
bazel_dep(name = "gazelle", version = "0.42.0")

go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk")
go_sdk.download(version = "1.23.6")

go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps")
go_deps.from_file(go_mod = "//:go.mod")

# Do not update this manually; run `bazel mod tidy` to pull it from `go.mod`
use_repo(go_deps, "com_github_aws_aws_sdk_go_v2", "com_github_aws_aws_sdk_go_v2_config", "com_github_aws_aws_sdk_go_v2_credentials", "com_github_aws_aws_sdk_go_v2_service_route53", "com_github_azure_azure_sdk_for_go_sdk_storage_azblob", "com_github_btcsuite_btcd_btcec_v2", "com_github_cespare_cp", "com_github_cloudflare_cloudflare_go", "com_github_cockroachdb_pebble", "com_github_consensys_gnark_crypto", "com_github_crate_crypto_go_ipa", "com_github_crate_crypto_go_kzg_4844", "com_github_davecgh_go_spew", "com_github_deckarep_golang_set_v2", "com_github_dop251_goja", "com_github_ethereum_c_kzg_4844", "com_github_fatih_color", "com_github_ferranbt_fastssz", "com_github_fjl_gencodec", "com_github_fsnotify_fsnotify", "com_github_gballet_go_libpcsclite", "com_github_gballet_go_verkle", "com_github_gofrs_flock", "com_github_golang_jwt_jwt_v4", "com_github_golang_protobuf", "com_github_golang_snappy", "com_github_google_go_cmp", "com_github_google_gofuzz", "com_github_google_uuid", "com_github_gorilla_websocket", "com_github_graph_gophers_graphql_go", "com_github_hashicorp_go_bexpr", "com_github_holiman_billy", "com_github_holiman_bloomfilter_v2", "com_github_holiman_uint256", "com_github_huin_goupnp", "com_github_influxdata_influxdb1_client", "com_github_influxdata_influxdb_client_go_v2", "com_github_jackpal_go_nat_pmp", "com_github_jedisct1_go_minisign", "com_github_julienschmidt_httprouter", "com_github_karalabe_usb", "com_github_kr_pretty", "com_github_kylelemons_godebug", "com_github_mattn_go_colorable", "com_github_mattn_go_isatty", "com_github_microsoft_go_winio", "com_github_naoina_toml", "com_github_olekukonko_tablewriter", "com_github_peterh_liner", "com_github_protolambda_bls12_381_util", "com_github_rs_cors", "com_github_shirou_gopsutil", "com_github_status_im_keycard_go", "com_github_stretchr_testify", "com_github_supranational_blst", "com_github_syndtr_goleveldb", "com_github_tyler_smith_go_bip39", "com_github_urfave_cli_v2", "com_github_victoriametrics_fastcache", "in_gopkg_natefinch_lumberjack_v2", "in_gopkg_yaml_v3", "org_golang_x_crypto", "org_golang_x_exp", "org_golang_x_mod", "org_golang_x_sync", "org_golang_x_sys", "org_golang_x_text", "org_golang_x_time", "org_golang_x_tools", "org_uber_go_automaxprocs")

CGO_PATCHES = {
"github.com/karalabe/usb": [
"com_github_karalabe_usb.patch",
],
"github.com/supranational/blst": [
"com_github_supranational_blst.patch",
],
}

[go_deps.module_override(
patches = ["//libevm/internal/bazel:%s" % f for f in patch_files],
path = path,
) for path, patch_files in CGO_PATCHES.items()]
259 changes: 259 additions & 0 deletions MODULE.bazel.lock

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions accounts/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
load("@rules_go//go:def.bzl", "go_library", "go_test")

go_library(
name = "accounts",
srcs = [
"accounts.go",
"errors.go",
"hd.go",
"manager.go",
"sort.go",
"url.go",
],
importpath = "github.com/ava-labs/libevm/accounts",
visibility = ["//visibility:public"],
deps = [
"//:libevm",
"//common",
"//core/types",
"//event",
"@org_golang_x_crypto//sha3",
],
)

go_test(
name = "accounts_test",
srcs = [
"accounts_test.go",
"hd_test.go",
"url_test.go",
],
embed = [":accounts"],
deps = ["//common/hexutil"],
)
55 changes: 55 additions & 0 deletions accounts/abi/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
load("@rules_go//go:def.bzl", "go_library", "go_test")

go_library(
name = "abi",
srcs = [
"abi.go",
"argument.go",
"doc.go",
"error.go",
"error_handling.go",
"event.go",
"method.go",
"pack.go",
"reflect.go",
"selector_parser.go",
"topics.go",
"type.go",
"unpack.go",
"utils.go",
],
importpath = "github.com/ava-labs/libevm/accounts/abi",
visibility = ["//visibility:public"],
deps = [
"//common",
"//common/math",
"//crypto",
],
)

go_test(
name = "abi_test",
srcs = [
"abi_test.go",
"abifuzzer_test.go",
"event_test.go",
"method_test.go",
"pack_test.go",
"packing_test.go",
"reflect_test.go",
"selector_parser_test.go",
"topics_test.go",
"type_test.go",
"unpack_test.go",
],
embed = [":abi"],
deps = [
"//common",
"//common/math",
"//crypto",
"@com_github_davecgh_go_spew//spew",
"@com_github_google_gofuzz//:gofuzz",
"@com_github_stretchr_testify//assert",
"@com_github_stretchr_testify//require",
],
)
49 changes: 49 additions & 0 deletions accounts/abi/bind/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
load("@rules_go//go:def.bzl", "go_library", "go_test")

go_library(
name = "bind",
srcs = [
"auth.go",
"backend.go",
"base.go",
"bind.go",
"template.go",
"util.go",
],
importpath = "github.com/ava-labs/libevm/accounts/abi/bind",
visibility = ["//visibility:public"],
deps = [
"//:libevm",
"//accounts",
"//accounts/abi",
"//accounts/external",
"//accounts/keystore",
"//common",
"//core/types",
"//crypto",
"//event",
"//log",
],
)

go_test(
name = "bind_test",
srcs = [
"base_test.go",
"bind_test.go",
"util_test.go",
],
embed = [":bind"],
deps = [
"//:libevm",
"//accounts/abi",
"//common",
"//common/hexutil",
"//core/types",
"//crypto",
"//ethclient/simulated",
"//params",
"//rlp",
"@com_github_stretchr_testify//assert",
],
)
13 changes: 13 additions & 0 deletions accounts/abi/bind/backends/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
load("@rules_go//go:def.bzl", "go_library")

go_library(
name = "backends",
srcs = ["simulated.go"],
importpath = "github.com/ava-labs/libevm/accounts/abi/bind/backends",
visibility = ["//visibility:public"],
deps = [
"//common",
"//core/types",
"//ethclient/simulated",
],
)
19 changes: 19 additions & 0 deletions accounts/external/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
load("@rules_go//go:def.bzl", "go_library")

go_library(
name = "external",
srcs = ["backend.go"],
importpath = "github.com/ava-labs/libevm/accounts/external",
visibility = ["//visibility:public"],
deps = [
"//:libevm",
"//accounts",
"//common",
"//common/hexutil",
"//core/types",
"//event",
"//log",
"//rpc",
"//signer/core/apitypes",
],
)
139 changes: 139 additions & 0 deletions accounts/keystore/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
load("@rules_go//go:def.bzl", "go_library", "go_test")

go_library(
name = "keystore",
srcs = [
"account_cache.go",
"file_cache.go",
"key.go",
"keystore.go",
"passphrase.go",
"plain.go",
"presale.go",
"wallet.go",
"watch.go",
"watch_fallback.go",
],
importpath = "github.com/ava-labs/libevm/accounts/keystore",
visibility = ["//visibility:public"],
deps = [
"//:libevm",
"//accounts",
"//common",
"//common/math",
"//core/types",
"//crypto",
"//event",
"//log",
"@com_github_deckarep_golang_set_v2//:golang-set",
"@com_github_google_uuid//:uuid",
"@org_golang_x_crypto//pbkdf2",
"@org_golang_x_crypto//scrypt",
"@org_golang_x_exp//slices",
] + select({
"@rules_go//go/platform:android_386": [
"@com_github_fsnotify_fsnotify//:fsnotify",
],
"@rules_go//go/platform:android_amd64": [
"@com_github_fsnotify_fsnotify//:fsnotify",
],
"@rules_go//go/platform:android_arm": [
"@com_github_fsnotify_fsnotify//:fsnotify",
],
"@rules_go//go/platform:darwin_386": [
"@com_github_fsnotify_fsnotify//:fsnotify",
],
"@rules_go//go/platform:darwin_amd64": [
"@com_github_fsnotify_fsnotify//:fsnotify",
],
"@rules_go//go/platform:darwin_arm": [
"@com_github_fsnotify_fsnotify//:fsnotify",
],
"@rules_go//go/platform:darwin_arm64": [
"@com_github_fsnotify_fsnotify//:fsnotify",
],
"@rules_go//go/platform:freebsd_386": [
"@com_github_fsnotify_fsnotify//:fsnotify",
],
"@rules_go//go/platform:freebsd_amd64": [
"@com_github_fsnotify_fsnotify//:fsnotify",
],
"@rules_go//go/platform:freebsd_arm": [
"@com_github_fsnotify_fsnotify//:fsnotify",
],
"@rules_go//go/platform:freebsd_arm64": [
"@com_github_fsnotify_fsnotify//:fsnotify",
],
"@rules_go//go/platform:linux_386": [
"@com_github_fsnotify_fsnotify//:fsnotify",
],
"@rules_go//go/platform:linux_amd64": [
"@com_github_fsnotify_fsnotify//:fsnotify",
],
"@rules_go//go/platform:linux_arm": [
"@com_github_fsnotify_fsnotify//:fsnotify",
],
"@rules_go//go/platform:linux_mips": [
"@com_github_fsnotify_fsnotify//:fsnotify",
],
"@rules_go//go/platform:linux_mips64": [
"@com_github_fsnotify_fsnotify//:fsnotify",
],
"@rules_go//go/platform:linux_mips64le": [
"@com_github_fsnotify_fsnotify//:fsnotify",
],
"@rules_go//go/platform:linux_mipsle": [
"@com_github_fsnotify_fsnotify//:fsnotify",
],
"@rules_go//go/platform:linux_ppc64": [
"@com_github_fsnotify_fsnotify//:fsnotify",
],
"@rules_go//go/platform:linux_ppc64le": [
"@com_github_fsnotify_fsnotify//:fsnotify",
],
"@rules_go//go/platform:linux_riscv64": [
"@com_github_fsnotify_fsnotify//:fsnotify",
],
"@rules_go//go/platform:linux_s390x": [
"@com_github_fsnotify_fsnotify//:fsnotify",
],
"@rules_go//go/platform:netbsd_386": [
"@com_github_fsnotify_fsnotify//:fsnotify",
],
"@rules_go//go/platform:netbsd_amd64": [
"@com_github_fsnotify_fsnotify//:fsnotify",
],
"@rules_go//go/platform:netbsd_arm": [
"@com_github_fsnotify_fsnotify//:fsnotify",
],
"@rules_go//go/platform:netbsd_arm64": [
"@com_github_fsnotify_fsnotify//:fsnotify",
],
"@rules_go//go/platform:solaris_amd64": [
"@com_github_fsnotify_fsnotify//:fsnotify",
],
"//conditions:default": [],
}),
)

go_test(
name = "keystore_test",
srcs = [
"account_cache_test.go",
"keystore_fuzzing_test.go",
"keystore_test.go",
"passphrase_test.go",
"plain_test.go",
],
data = glob(["testdata/**"]),
embed = [":keystore"],
deps = [
"//accounts",
"//common",
"//crypto",
"//event",
"@com_github_cespare_cp//:cp",
"@com_github_davecgh_go_spew//spew",
"@org_golang_x_exp//slices",
],
)
Loading