diff options
author | aaronbuchwald <[email protected]> | 2020-11-09 12:00:29 -0500 |
---|---|---|
committer | GitHub <[email protected]> | 2020-11-09 12:00:29 -0500 |
commit | 8938754d0d0bc5e1fd7f7a8892b0ff23458c8f10 (patch) | |
tree | cd81b89181ac3ecfee082dca202db7db73de3b75 | |
parent | ff462c343e87ba3ab38d7aad95e3a85408f38bb0 (diff) | |
parent | 72df173b512eb02306ebcb160b6924cad23cf7af (diff) |
Merge pull request #50 from ava-labs/v0.3.12-with-id-update
V0.3.12 with id update
-rw-r--r-- | examples/mctx_gen/main.go | 2 | ||||
-rw-r--r-- | go.mod | 2 | ||||
-rw-r--r-- | go.sum | 42 | ||||
-rw-r--r-- | internal/ethapi/api.go | 2 | ||||
-rw-r--r-- | plugin/evm/block.go | 4 | ||||
-rw-r--r-- | plugin/evm/database.go | 4 | ||||
-rw-r--r-- | plugin/evm/export_tx.go | 24 | ||||
-rw-r--r-- | plugin/evm/export_tx_test.go | 2 | ||||
-rw-r--r-- | plugin/evm/factory.go | 6 | ||||
-rw-r--r-- | plugin/evm/import_tx.go | 26 | ||||
-rw-r--r-- | plugin/evm/import_tx_test.go | 22 | ||||
-rw-r--r-- | plugin/evm/service.go | 2 | ||||
-rw-r--r-- | plugin/evm/tx.go | 8 | ||||
-rw-r--r-- | plugin/evm/user.go | 7 | ||||
-rw-r--r-- | plugin/evm/vm.go | 61 | ||||
-rw-r--r-- | plugin/evm/vm_test.go | 24 |
16 files changed, 83 insertions, 155 deletions
diff --git a/examples/mctx_gen/main.go b/examples/mctx_gen/main.go index b0baac9..9deaf4b 100644 --- a/examples/mctx_gen/main.go +++ b/examples/mctx_gen/main.go @@ -57,7 +57,7 @@ func main() { assetID, err := ids.FromString(fAssetID) checkError(err) mcAbi, err := abi.JSON(strings.NewReader(mcAbiJSON)) - data, err := mcAbi.Pack("transfer", to, big.NewInt(0), common.Hash(assetID.Key()).Big(), big.NewInt(fAmount)) + data, err := mcAbi.Pack("transfer", to, big.NewInt(0), common.Hash(assetID).Big(), big.NewInt(fAmount)) checkError(err) tx := types.NewTransaction(nonce, vm.BuiltinAddr, big.NewInt(0), uint64(gasLimit), gasPrice, data) signedTx, err := types.SignTx(tx, types.NewEIP155Signer(chainID), pkey.PrivateKey) @@ -4,7 +4,7 @@ go 1.14 require ( github.com/VictoriaMetrics/fastcache v1.5.7 - github.com/ava-labs/avalanchego v1.0.4 + github.com/ava-labs/avalanchego v1.0.4-update-id-2 github.com/davecgh/go-spew v1.1.1 github.com/deckarep/golang-set v1.7.1 github.com/edsrzf/mmap-go v1.0.0 @@ -30,7 +30,6 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= -github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 h1:fLjPD/aNc3UIOA6tDi6QXUemppXK3P9BI7mr2hd6gx8= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/VictoriaMetrics/fastcache v1.5.7 h1:4y6y0G8PRzszQUYIQHHssv/jgPHAb5qQuuDNdCbyAgw= github.com/VictoriaMetrics/fastcache v1.5.7/go.mod h1:ptDBkNMQI4RtmVo8VS/XwRY6RoTu1dAWCbrk+6WsEM8= @@ -39,17 +38,14 @@ github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuy github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156 h1:eMwmnE/GDgah4HI848JfFxHt+iPb26b4zyfspmqY0/8= github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= github.com/aristanetworks/goarista v0.0.0-20170210015632-ea17b1a17847 h1:rtI0fD4oG/8eVokGVPYJEW1F88p1ZNgXiEIs9thEE4A= github.com/aristanetworks/goarista v0.0.0-20170210015632-ea17b1a17847/go.mod h1:D/tb0zPVXnP7fmsLZjtdUhSsumbK/ij54UXjjVgMGxQ= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= -github.com/ava-labs/avalanchego v1.0.3 h1:0YJYmPkb1Qxc4OWIMjwpr+IDdUe8XetOkCi99jNDBcc= -github.com/ava-labs/avalanchego v1.0.3/go.mod h1:ktaMgskNtDrXkjc6W4C9iOFmOipf09nHMmHa+Lhagu0= -github.com/ava-labs/avalanchego v1.0.4 h1:GHAe1vxWMg9GtO3p61HBhRazxhEYf0dQ6A/ON4q+01g= -github.com/ava-labs/avalanchego v1.0.4/go.mod h1:4GfedhY9S6k/SOUeMzDh6cuLoPAtnkFsL4R89xg5wf0= +github.com/ava-labs/avalanchego v1.0.4-update-id-2 h1:C4Ss43XgWw1NdCm74mHiQbgsP02+I6QvTCfvIEgmkM0= +github.com/ava-labs/avalanchego v1.0.4-update-id-2/go.mod h1:4GfedhY9S6k/SOUeMzDh6cuLoPAtnkFsL4R89xg5wf0= github.com/aws/aws-sdk-go v1.25.48/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= @@ -58,7 +54,6 @@ github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6r github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= github.com/btcsuite/btcd v0.0.0-20171128150713-2e60448ffcc6/go.mod h1:Dmm/EzmjnCiweXmzRIAiUWCInVmPgjkzgv5k4tVyXiQ= -github.com/btcsuite/btcd v0.20.1-beta h1:Ik4hyJqN8Jfyv3S4AGBOmyouMsYE3EdYODkMbQjwPGw= github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= @@ -70,7 +65,6 @@ github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/cp v0.1.0 h1:SE+dxFebS7Iik5LK0tsi1k9ZCxEaFX4AjQmoyA+1dJk= github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s= github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= @@ -92,9 +86,7 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/deckarep/golang-set v0.0.0-20180603214616-504e848d77ea/go.mod h1:93vsz/8Wt4joVM7c2AVqh+YRMiUSc14yDtF28KmMOgQ= github.com/deckarep/golang-set v1.7.1 h1:SCQV0S6gTtp6itiFrTqI+pfmJ4LN85S1YzhDf9rTHJQ= github.com/deckarep/golang-set v1.7.1/go.mod h1:93vsz/8Wt4joVM7c2AVqh+YRMiUSc14yDtF28KmMOgQ= -github.com/decred/dcrd/chaincfg/chainhash v1.0.2 h1:rt5Vlq/jM3ZawwiacWjPa+smINyLRN07EO0cNBV6DGU= github.com/decred/dcrd/chaincfg/chainhash v1.0.2/go.mod h1:BpbrGgrPTr3YJYRN3Bm+D9NuaFd+zGyNeIKgrhCXK60= -github.com/decred/dcrd/crypto/blake256 v1.0.0 h1:/8DMNYp9SGi5f0w7uCm6d6M4OU2rGFK09Y2A4Xv7EE0= github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc= github.com/decred/dcrd/dcrec/secp256k1/v3 v3.0.0-20200627015759-01fd2de07837 h1:g2cyFTu5FKWhCo7L4hVJ797Q506B4EywA7L9I6OebgA= github.com/decred/dcrd/dcrec/secp256k1/v3 v3.0.0-20200627015759-01fd2de07837/go.mod h1:J70FGZSbzsjecRTiTzER+3f1KZLNaXkuv+yeFTKoxM8= @@ -102,7 +94,6 @@ github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumC github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/dlclark/regexp2 v1.2.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= -github.com/docker/docker v1.4.2-0.20180625184442-8e610b2b55bf h1:sh8rkQZavChcmakYiSlqu2425CHyFXLZZnvm7PDpU8M= github.com/docker/docker v1.4.2-0.20180625184442-8e610b2b55bf/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/dop251/goja v0.0.0-20200721192441-a695b0cdd498/go.mod h1:Mw6PkjjMXWbTj+nnj4s3QPXq1jaT0s5pC0iFD4+BOAA= github.com/edsrzf/mmap-go v0.0.0-20160512033002-935e0e8a636c/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= @@ -120,10 +111,8 @@ github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5Kwzbycv github.com/fjl/memsize v0.0.0-20180418122429-ca190fb6ffbc/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 h1:FtmdgXiUlNeRsoNMFlKLDt+S+6hbjVMEW6RGQ7aUf7c= github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= -github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08 h1:f6D9Hr8xV8uYKlyuj8XIruxlh9WjVjdh1gIicAS7ays= @@ -131,12 +120,9 @@ github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08/go.mod h1:x github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/kit v0.9.0 h1:wDJmvq38kDhkVxi50ni9ykkdUr1PKgqKOoi01fa0Mdk= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= -github.com/go-logfmt/logfmt v0.4.0 h1:MP4Eh7ZCb31lleYCFuwm0oe4/YGak+5l1vA2NOE80nA= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-ole/go-ole v1.2.1 h1:2lOsA72HgjxAuMlKpFiCbHTvu44PIVkZ5hqm3RSdI/E= github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= github.com/go-sourcemap/sourcemap v2.1.2+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg= github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= @@ -145,7 +131,6 @@ github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7a github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6 h1:ZgQEtGgCBiWRM39fZuwSd1LwSqqSW0hOdXCYYDX0R3I= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= @@ -162,7 +147,6 @@ github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:W github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.2-0.20200707131729-196ae77b8a26 h1:lMm2hD9Fy0ynom5+85/pbdkiYcBqM1JWmhpAXLmy0fw= github.com/golang/snappy v0.0.2-0.20200707131729-196ae77b8a26/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= @@ -171,7 +155,6 @@ github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= @@ -200,7 +183,6 @@ github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBt github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= -github.com/hashicorp/go-hclog v0.0.0-20180709165350-ff2cf002a8dd h1:rNuUHR+CvK1IS89MMtcF0EpcVMZtjKfPRp4MEmt/aTs= github.com/hashicorp/go-hclog v0.0.0-20180709165350-ff2cf002a8dd/go.mod h1:9bjs9uLqI8l75knNv3lV1kA55veR+WUPSiKIWcQHudI= github.com/hashicorp/go-hclog v0.14.1 h1:nQcJDQwIAGnmoUWp8ubocEX40cCml/17YkF6csQLReU= github.com/hashicorp/go-hclog v0.14.1/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= @@ -238,7 +220,6 @@ github.com/jackpal/go-nat-pmp v1.0.2-0.20160603034137-1fa385a6f458/go.mod h1:QPH github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus= github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jhump/protoreflect v1.6.0 h1:h5jfMVslIg6l29nsMs0D8Wj17RDVdNYti0vDN/PZZoE= github.com/jhump/protoreflect v1.6.0/go.mod h1:eaTn3RZAmMBcV0fifFvlm6VHNz3wSkYyXYWUh7ymB74= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= @@ -248,7 +229,6 @@ github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/ github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.1.1-0.20170430222011-975b5c4c7c21/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/julienschmidt/httprouter v1.2.0 h1:TDTW5Yz1mjftljbcKqRcrYhd4XeOoI98t+9HbQbYf7g= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/karalabe/usb v0.0.0-20190919080040-51dc0efba356 h1:I/yrLt2WilKxlQKCM52clh5rGzTKpVctGT1lH4Dc8Jw= github.com/karalabe/usb v0.0.0-20190919080040-51dc0efba356/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= @@ -256,13 +236,10 @@ github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvW github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515 h1:T+h1c/A9Gawja4Y9mFVWj2vyii2bbUNDw3kt9VxK2EY= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs= github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= @@ -290,7 +267,6 @@ github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceT github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/go-testing-interface v0.0.0-20171004221916-a61a99592b77 h1:7GoSOOW2jpsfkntVKaS2rAr1TJqfcxotyaUcuxoZSzg= github.com/mitchellh/go-testing-interface v0.0.0-20171004221916-a61a99592b77/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= github.com/mitchellh/go-testing-interface v1.0.0 h1:fzU/JVNcaqHQEcVFAKeR41fkiLdIPrefOvVG1VZ96U0= github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= @@ -309,7 +285,6 @@ github.com/naoina/go-stringutil v0.1.0/go.mod h1:XJ2SJL9jCtBh+P9q5btrd/Ylo8XwT/h github.com/naoina/toml v0.1.2-0.20170918210437-9fafd6967416/go.mod h1:NBIhNtsFMo3G2szEBne+bO4gS192HuIYRqfvOWb4i1E= github.com/nbutton23/zxcvbn-go v0.0.0-20180912185939-ae427f1e4c1d h1:AREM5mwr4u1ORQBMvzfzBgpsctsbQikCVpvC+tX285E= github.com/nbutton23/zxcvbn-go v0.0.0-20180912185939-ae427f1e4c1d/go.mod h1:o96djdrsSGy3AWPyBgZMAGfxZNfgntdJG+11KU4QvbU= -github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/oklog/run v1.0.0 h1:Ru7dDtJNOyC66gQ5dQmaCa0qIsAUFY3sFpK1Xk8igrw= github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= @@ -321,11 +296,9 @@ github.com/olekukonko/tablewriter v0.0.4/go.mod h1:zq6QwlOf5SlnkVbMSr5EoBv3636FW github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= -github.com/onsi/ginkgo v1.14.0 h1:2mOpI4JVVPBN+WQRa0WKH2eXR+Ey+uK4n7Zj0aYpIQA= github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= -github.com/onsi/gomega v1.10.1 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= @@ -336,11 +309,9 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9 github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7 h1:oYW+YCJ1pachXTQmzR3rNLYGGz4g/UgFcjb28p/viDM= github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= @@ -404,11 +375,9 @@ github.com/steakknife/hamming v0.0.0-20180906055917-c99c65617cd3 h1:njlZPzLwU639 github.com/steakknife/hamming v0.0.0-20180906055917-c99c65617cd3/go.mod h1:hpGUWaI9xL8pRQCTXQgocU38Qw1g0Us7n5PxxTwTCYU= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca h1:Ld/zXl5t4+D69SiV4JoN7kkfvJdOWlPpfxrzxpLMoUk= @@ -513,7 +482,6 @@ golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1 h1:ogLJMz+qpzav7lGMh10LMvAkM/fAoGlaiiHYiFYdm80= golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200824131525-c12d262b63d8 h1:AvbQYmiaaaza3cW3QXRyPo5kYgpFIzOAfeAAN7m3qQ4= @@ -546,7 +514,6 @@ golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= @@ -589,17 +556,14 @@ google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2 gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce h1:+JknDZhAj8YMt7GC73Ei8pv4MzjDUNPHgQWJdtMAaDU= gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce/go.mod h1:5AcXVHNjg+BDxry382+8OKon8SEWiKktQR07RKPsv1c= gopkg.in/olebedev/go-duktape.v3 v3.0.0-20200619000410-60c24ae608a6 h1:a6cXbcDDUkSBlpnkWV1bJ+vv3mOgQEltEJ2rPxroVu0= gopkg.in/olebedev/go-duktape.v3 v3.0.0-20200619000410-60c24ae608a6/go.mod h1:uAJfkITjFhyEEuUfm7bsmCZRbW5WRq8s9EY8HZ6hCns= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/urfave/cli.v1 v1.20.0 h1:NdAVW6RYxDif9DhDHaAortIu956m2c0v+09AZBPTbE0= gopkg.in/urfave/cli.v1 v1.20.0/go.mod h1:vuBzUtMdQeixQj8LVd+/98pzhxNGQoyuPBlsXHOQNO0= @@ -608,9 +572,7 @@ gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index 728fb07..d894ea0 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -565,7 +565,7 @@ func (s *PublicBlockChainAPI) GetAssetBalance(ctx context.Context, address commo if state == nil || err != nil { return nil, err } - return (*hexutil.Big)(state.GetBalanceMultiCoin(address, assetID.Key())), state.Error() + return (*hexutil.Big)(state.GetBalanceMultiCoin(address, common.Hash(assetID))), state.Error() } // Result structs for GetProof diff --git a/plugin/evm/block.go b/plugin/evm/block.go index 77a85b3..7c23c17 100644 --- a/plugin/evm/block.go +++ b/plugin/evm/block.go @@ -34,7 +34,7 @@ func (b *Block) Accept() error { log.Trace(fmt.Sprintf("Block %s is accepted", b.ID())) vm.updateStatus(b.id, choices.Accepted) - if err := vm.acceptedDB.Put(b.ethBlock.Number().Bytes(), b.id.Bytes()); err != nil { + if err := vm.acceptedDB.Put(b.ethBlock.Number().Bytes(), b.id[:]); err != nil { return err } @@ -68,7 +68,7 @@ func (b *Block) Status() choices.Status { // Parent implements the snowman.Block interface func (b *Block) Parent() snowman.Block { - parentID := ids.NewID(b.ethBlock.ParentHash()) + parentID := ids.ID(b.ethBlock.ParentHash()) if block := b.vm.getBlock(parentID); block != nil { return block } diff --git a/plugin/evm/database.go b/plugin/evm/database.go index 18890fa..59a78a9 100644 --- a/plugin/evm/database.go +++ b/plugin/evm/database.go @@ -48,12 +48,12 @@ func (db Database) NewBatch() ethdb.Batch { return Batch{db.Database.NewBatch()} // NewIterator implements ethdb.Database func (db Database) NewIterator(prefix []byte, start []byte) ethdb.Iterator { - return db.NewIteratorWithStartAndPrefix(start, prefix) + return db.Database.NewIteratorWithStartAndPrefix(start, prefix) } // NewIteratorWithStart implements ethdb.Database func (db Database) NewIteratorWithStart(start []byte) ethdb.Iterator { - return db.NewIteratorWithStart(start) + return db.Database.NewIteratorWithStart(start) } // Batch implements ethdb.Batch diff --git a/plugin/evm/export_tx.go b/plugin/evm/export_tx.go index d099eb2..0778d0a 100644 --- a/plugin/evm/export_tx.go +++ b/plugin/evm/export_tx.go @@ -17,6 +17,7 @@ import ( safemath "github.com/ava-labs/avalanchego/utils/math" "github.com/ava-labs/avalanchego/vms/components/avax" "github.com/ava-labs/avalanchego/vms/secp256k1fx" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/log" ) @@ -52,15 +53,15 @@ func (tx *UnsignedExportTx) Verify( return errNilTx case tx.syntacticallyVerified: // already passed syntactic verification return nil - case tx.DestinationChain.IsZero(): + case tx.DestinationChain == ids.Empty: return errWrongChainID - case !tx.DestinationChain.Equals(avmID): + case tx.DestinationChain != avmID: return errWrongChainID case len(tx.ExportedOutputs) == 0: return errNoExportOutputs case tx.NetworkID != ctx.NetworkID: return errWrongNetworkID - case !ctx.ChainID.Equals(tx.BlockchainID): + case ctx.ChainID != tx.BlockchainID: return errWrongBlockchainID } @@ -154,9 +155,9 @@ func (tx *UnsignedExportTx) Accept(ctx *snow.Context, _ database.Batch) error { if err != nil { return err } - + utxoID := utxo.InputID() elem := &atomic.Element{ - Key: utxo.InputID().Bytes(), + Key: utxoID[:], Value: utxoBytes, } if out, ok := utxo.Out.(avax.Addressable); ok { @@ -177,13 +178,13 @@ func (vm *VM) newExportTx( to ids.ShortID, // Address of chain recipient keys []*crypto.PrivateKeySECP256K1R, // Pay the fee and provide the tokens ) (*Tx, error) { - if !vm.ctx.XChainID.Equals(chainID) { + if vm.ctx.XChainID != chainID { return nil, errWrongChainID } var toBurn uint64 var err error - if assetID.Equals(vm.ctx.AVAXAssetID) { + if assetID == vm.ctx.AVAXAssetID { toBurn, err = safemath.Add64(amount, vm.txFee) if err != nil { return nil, errOverflowExport @@ -198,7 +199,7 @@ func (vm *VM) newExportTx( } // burn non-AVAX - if !assetID.Equals(vm.ctx.AVAXAssetID) { + if assetID != vm.ctx.AVAXAssetID { ins2, signers2, err := vm.GetSpendableFunds(keys, assetID, amount) if err != nil { return nil, fmt.Errorf("couldn't generate tx inputs/outputs: %w", err) @@ -242,7 +243,7 @@ func (tx *UnsignedExportTx) EVMStateTransfer(vm *VM, state *state.StateDB) error addrs := map[[20]byte]uint64{} for _, from := range tx.Ins { log.Info("crosschain C->X", "addr", from.Address, "amount", from.Amount) - if from.AssetID.Equals(vm.ctx.AVAXAssetID) { + if from.AssetID == vm.ctx.AVAXAssetID { amount := new(big.Int).Mul( new(big.Int).SetUint64(from.Amount), x2cRate) if state.GetBalance(from.Address).Cmp(amount) < 0 { @@ -251,11 +252,10 @@ func (tx *UnsignedExportTx) EVMStateTransfer(vm *VM, state *state.StateDB) error state.SubBalance(from.Address, amount) } else { amount := new(big.Int).SetUint64(from.Amount) - assetID := from.AssetID.Key() - if state.GetBalanceMultiCoin(from.Address, assetID).Cmp(amount) < 0 { + if state.GetBalanceMultiCoin(from.Address, common.Hash(from.AssetID)).Cmp(amount) < 0 { return errInsufficientFunds } - state.SubBalanceMultiCoin(from.Address, assetID, amount) + state.SubBalanceMultiCoin(from.Address, common.Hash(from.AssetID), amount) } if state.GetNonce(from.Address) != from.Nonce { return errInvalidNonce diff --git a/plugin/evm/export_tx_test.go b/plugin/evm/export_tx_test.go index 319c6dd..6fdf3a2 100644 --- a/plugin/evm/export_tx_test.go +++ b/plugin/evm/export_tx_test.go @@ -76,7 +76,7 @@ func TestExportTxVerify(t *testing.T) { // Test Valid Export Tx if err := exportTx.Verify(testXChainID, ctx, testTxFee, testAvaxAssetID); err != nil { - t.Fatalf("Failed to verify valid ExportTx: %w", err) + t.Fatalf("Failed to verify valid ExportTx: %s", err) } exportTx.syntacticallyVerified = false diff --git a/plugin/evm/factory.go b/plugin/evm/factory.go index 593d85b..b977117 100644 --- a/plugin/evm/factory.go +++ b/plugin/evm/factory.go @@ -3,13 +3,11 @@ package evm -import ( - "github.com/ava-labs/avalanchego/ids" -) +import "github.com/ava-labs/avalanchego/ids" // ID this VM should be referenced by var ( - ID = ids.NewID([32]byte{'e', 'v', 'm'}) + ID = ids.ID([32]byte{'e', 'v', 'm'}) ) // Factory ... diff --git a/plugin/evm/import_tx.go b/plugin/evm/import_tx.go index ae6b540..2ce8f6f 100644 --- a/plugin/evm/import_tx.go +++ b/plugin/evm/import_tx.go @@ -58,15 +58,15 @@ func (tx *UnsignedImportTx) Verify( return errNilTx case tx.syntacticallyVerified: // already passed syntactic verification return nil - case tx.SourceChain.IsZero(): + case tx.SourceChain == ids.Empty: return errWrongChainID - case !tx.SourceChain.Equals(avmID): + case tx.SourceChain != avmID: return errWrongChainID case len(tx.ImportedInputs) == 0: return errNoImportInputs case tx.NetworkID != ctx.NetworkID: return errWrongNetworkID - case !ctx.ChainID.Equals(tx.BlockchainID): + case ctx.ChainID != tx.BlockchainID: return errWrongBlockchainID } @@ -124,7 +124,8 @@ func (tx *UnsignedImportTx) SemanticVerify( utxoIDs := make([][]byte, len(tx.ImportedInputs)) for i, in := range tx.ImportedInputs { - utxoIDs[i] = in.UTXOID.InputID().Bytes() + inputID := in.UTXOID.InputID() + utxoIDs[i] = inputID[:] } // allUTXOBytes is guaranteed to be the same length as utxoIDs allUTXOBytes, err := vm.ctx.SharedMemory.Get(tx.SourceChain, utxoIDs) @@ -144,7 +145,7 @@ func (tx *UnsignedImportTx) SemanticVerify( utxoAssetID := utxo.AssetID() inAssetID := in.AssetID() - if !utxoAssetID.Equals(inAssetID) { + if utxoAssetID != inAssetID { return permError{errAssetIDMismatch} } @@ -164,7 +165,8 @@ func (tx *UnsignedImportTx) Accept(ctx *snow.Context, _ database.Batch) error { // TODO: Is any batch passed in here? utxoIDs := make([][]byte, len(tx.ImportedInputs)) for i, in := range tx.ImportedInputs { - utxoIDs[i] = in.InputID().Bytes() + inputID := in.InputID() + utxoIDs[i] = inputID[:] } return ctx.SharedMemory.Remove(tx.SourceChain, utxoIDs) } @@ -175,7 +177,7 @@ func (vm *VM) newImportTx( to common.Address, // Address of recipient keys []*crypto.PrivateKeySECP256K1R, // Keys to import the funds ) (*Tx, error) { - if !vm.ctx.XChainID.Equals(chainID) { + if vm.ctx.XChainID != chainID { return nil, errWrongChainID } @@ -204,8 +206,7 @@ func (vm *VM) newImportTx( continue } aid := utxo.AssetID() - aidKey := aid.Key() - importedAmount[aidKey], err = math.Add64(importedAmount[aidKey], input.Amount()) + importedAmount[aid], err = math.Add64(importedAmount[aid], input.Amount()) if err != nil { return nil, err } @@ -238,8 +239,7 @@ func (vm *VM) newImportTx( // This will create unique outputs (in the context of sorting) // since each output will have a unique assetID - for assetKey, amount := range importedAmount { - assetID := ids.NewID(assetKey) + for assetID, amount := range importedAmount { //if assetID.Equals(vm.ctx.AVAXAssetID) || amount == 0 { if amount == 0 { continue @@ -273,13 +273,13 @@ func (vm *VM) newImportTx( func (tx *UnsignedImportTx) EVMStateTransfer(vm *VM, state *state.StateDB) error { for _, to := range tx.Outs { log.Info("crosschain X->C", "addr", to.Address, "amount", to.Amount) - if to.AssetID.Equals(vm.ctx.AVAXAssetID) { + if to.AssetID == vm.ctx.AVAXAssetID { amount := new(big.Int).Mul( new(big.Int).SetUint64(to.Amount), x2cRate) state.AddBalance(to.Address, amount) } else { amount := new(big.Int).SetUint64(to.Amount) - state.AddBalanceMultiCoin(to.Address, to.AssetID.Key(), amount) + state.AddBalanceMultiCoin(to.Address, common.Hash(to.AssetID), amount) } } return nil diff --git a/plugin/evm/import_tx_test.go b/plugin/evm/import_tx_test.go index fcd18ac..b0f2875 100644 --- a/plugin/evm/import_tx_test.go +++ b/plugin/evm/import_tx_test.go @@ -22,7 +22,7 @@ func TestImportTxVerifyNil(t *testing.T) { func TestImportTxVerify(t *testing.T) { var importAmount uint64 = 10000000 - txID := ids.NewID([32]byte{0xff}) + txID := [32]byte{0xff} importTx := &UnsignedImportTx{ NetworkID: testNetworkID, BlockchainID: testCChainID, @@ -77,7 +77,7 @@ func TestImportTxVerify(t *testing.T) { // Test Valid ImportTx if err := importTx.Verify(testXChainID, ctx, testTxFee, testAvaxAssetID); err != nil { - t.Fatalf("Failed to verify ImportTx: %w", err) + t.Fatalf("Failed to verify ImportTx: %s", err) } importTx.syntacticallyVerified = false @@ -134,12 +134,12 @@ func TestImportTxSemanticVerify(t *testing.T) { importAmount := uint64(1000000) utxoID := avax.UTXOID{ - TxID: ids.NewID([32]byte{ + TxID: [32]byte{ 0x0f, 0x2f, 0x4f, 0x6f, 0x8e, 0xae, 0xce, 0xee, 0x0d, 0x2d, 0x4d, 0x6d, 0x8c, 0xac, 0xcc, 0xec, 0x0b, 0x2b, 0x4b, 0x6b, 0x8a, 0xaa, 0xca, 0xea, 0x09, 0x29, 0x49, 0x69, 0x88, 0xa8, 0xc8, 0xe8, - }), + }, } utxo := &avax.UTXO{ @@ -203,9 +203,9 @@ func TestImportTxSemanticVerify(t *testing.T) { if err := unsignedImportTx.SemanticVerify(vm, tx); err != nil { t.Fatal("Should have failed to import non-existent UTXO") } - + inputID := utxo.InputID() if err := xChainSharedMemory.Put(vm.ctx.ChainID, []*atomic.Element{{ - Key: utxo.InputID().Bytes(), + Key: inputID[:], Value: utxoBytes, Traits: [][]byte{ testKeys[0].PublicKey().Address().Bytes(), @@ -268,7 +268,7 @@ func TestImportTxSemanticVerify(t *testing.T) { } if err := unsignedImportTx.Accept(vm.ctx, nil); err != nil { - t.Fatalf("Accept failed due to: %w", err) + t.Fatalf("Accept failed due to: %s", err) } if err := unsignedImportTx.EVMStateTransfer(vm, state); err != nil { @@ -293,12 +293,12 @@ func TestNewImportTx(t *testing.T) { importAmount := uint64(1000000) utxoID := avax.UTXOID{ - TxID: ids.NewID([32]byte{ + TxID: [32]byte{ 0x0f, 0x2f, 0x4f, 0x6f, 0x8e, 0xae, 0xce, 0xee, 0x0d, 0x2d, 0x4d, 0x6d, 0x8c, 0xac, 0xcc, 0xec, 0x0b, 0x2b, 0x4b, 0x6b, 0x8a, 0xaa, 0xca, 0xea, 0x09, 0x29, 0x49, 0x69, 0x88, 0xa8, 0xc8, 0xe8, - }), + }, } utxo := &avax.UTXO{ @@ -318,9 +318,9 @@ func TestNewImportTx(t *testing.T) { } xChainSharedMemory := sharedMemory.NewSharedMemory(vm.ctx.XChainID) - + inputID := utxo.InputID() if err := xChainSharedMemory.Put(vm.ctx.ChainID, []*atomic.Element{{ - Key: utxo.InputID().Bytes(), + Key: inputID[:], Value: utxoBytes, Traits: [][]byte{ testKeys[0].PublicKey().Address().Bytes(), diff --git a/plugin/evm/service.go b/plugin/evm/service.go index f9b32b7..c0106ab 100644 --- a/plugin/evm/service.go +++ b/plugin/evm/service.go @@ -262,7 +262,7 @@ type ExportArgs struct { // It must be imported on the X-Chain to complete the transfer func (service *AvaxAPI) Export(_ *http.Request, args *ExportArgs, response *api.JSONTxID) error { log.Info("EVM: Export called") - if args.AssetID.IsZero() { + if args.AssetID == ids.Empty { return fmt.Errorf("assetID is required") } diff --git a/plugin/evm/tx.go b/plugin/evm/tx.go index 2d722a5..82d4c10 100644 --- a/plugin/evm/tx.go +++ b/plugin/evm/tx.go @@ -23,10 +23,6 @@ import ( "github.com/ethereum/go-ethereum/common" ) -// Max size of memo field -// Don't change without also changing avm.maxMemoSize -const maxMemoSize = 256 - var ( errWrongBlockchainID = errors.New("wrong blockchain ID provided") errWrongNetworkID = errors.New("tx was issued with a different network ID") @@ -134,7 +130,7 @@ func (ins *innerSortInputsAndSigners) Less(i, j int) bool { if addrComp != 0 { return addrComp < 0 } - return bytes.Compare(ins.inputs[i].AssetID.Bytes(), ins.inputs[j].AssetID.Bytes()) < 0 + return bytes.Compare(ins.inputs[i].AssetID[:], ins.inputs[j].AssetID[:]) < 0 } func (ins *innerSortInputsAndSigners) Len() int { return len(ins.inputs) } @@ -165,7 +161,7 @@ func (outs *innerSortEVMOutputs) Less(i, j int) bool { if addrComp != 0 { return addrComp < 0 } - return bytes.Compare(outs.outputs[i].AssetID.Bytes(), outs.outputs[j].AssetID.Bytes()) < 0 + return bytes.Compare(outs.outputs[i].AssetID[:], outs.outputs[j].AssetID[:]) < 0 } func (outs *innerSortEVMOutputs) Len() int { return len(outs.outputs) } diff --git a/plugin/evm/user.go b/plugin/evm/user.go index b751634..0ab1863 100644 --- a/plugin/evm/user.go +++ b/plugin/evm/user.go @@ -15,12 +15,11 @@ import ( // Key in the database whose corresponding value is the list of // addresses this user controls -var addressesKey = ids.Empty.Bytes() +var addressesKey = ids.Empty[:] var ( - errDBNil = errors.New("db uninitialized") - errKeyNil = errors.New("key uninitialized") - errEmptyAddress = errors.New("address is empty") + errDBNil = errors.New("db uninitialized") + errKeyNil = errors.New("key uninitialized") ) type user struct { diff --git a/plugin/evm/vm.go b/plugin/evm/vm.go index fd177a0..c7c7ca0 100644 --- a/plugin/evm/vm.go +++ b/plugin/evm/vm.go @@ -57,10 +57,6 @@ import ( ) var ( - zeroAddr = common.Address{ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - } x2cRate = big.NewInt(1000000000) ) @@ -83,10 +79,6 @@ const ( bdTimerStateLong ) -const ( - addressSep = "-" -) - var ( txFee = units.MilliAvax @@ -99,21 +91,14 @@ var ( errInvalidAddr = errors.New("invalid hex address") errTooManyAtomicTx = errors.New("too many pending atomic txs") errAssetIDMismatch = errors.New("asset IDs in the input don't match the utxo") - errWrongNumberOfCredentials = errors.New("should have the same number of credentials as inputs") - errNoInputs = errors.New("tx has no inputs") errNoImportInputs = errors.New("tx has no imported inputs") errInputsNotSortedUnique = errors.New("inputs not sorted and unique") errPublicKeySignatureMismatch = errors.New("signature doesn't match public key") errSignatureInputsMismatch = errors.New("number of inputs does not match number of signatures") - errUnknownAsset = errors.New("unknown asset ID") - errNoFunds = errors.New("no spendable funds were found") errWrongChainID = errors.New("tx has wrong chain ID") errInsufficientFunds = errors.New("insufficient funds") errNoExportOutputs = errors.New("tx has no export outputs") errOutputsNotSorted = errors.New("tx outputs not sorted") - errNoImportOutputs = errors.New("tx has no outputs to import") - errNoExportInputs = errors.New("tx has no inputs to export") - errInputsNotSortedAndUnique = errors.New("inputs not sorted and unique") errOverflowExport = errors.New("overflow when computing export amount + txFee") errInvalidNonce = errors.New("invalid nonce") ) @@ -315,7 +300,7 @@ func (vm *VM) Initialize( log.Trace("EVM sealed a block") blk := &Block{ - id: ids.NewID(block.Hash()), + id: ids.ID(block.Hash()), ethBlock: block, vm: vm, } @@ -324,7 +309,7 @@ func (vm *VM) Initialize( return errInvalidBlock } vm.newBlockChan <- blk - vm.updateStatus(ids.NewID(block.Hash()), choices.Processing) + vm.updateStatus(ids.ID(block.Hash()), choices.Processing) vm.txPoolStabilizedLock.Lock() vm.txPoolStabilizedHead = block.Hash() vm.txPoolStabilizedLock.Unlock() @@ -391,7 +376,7 @@ func (vm *VM) Initialize( lastAccepted = chain.GetGenesisBlock() } vm.lastAccepted = &Block{ - id: ids.NewID(lastAccepted.Hash()), + id: ids.ID(lastAccepted.Hash()), ethBlock: lastAccepted, vm: vm, } @@ -443,7 +428,7 @@ func (vm *VM) BuildBlock() (snowman.Block, error) { vm.blockDelayTimer.SetTimeoutIn(minBlockTime) vm.bdlock.Unlock() - log.Debug(fmt.Sprintf("built block 0x%x", block.ID().Bytes())) + log.Debug(fmt.Sprintf("built block %s", block.ID())) // make sure Tx Pool is updated <-vm.txPoolStabilizedOk return block, nil @@ -463,12 +448,12 @@ func (vm *VM) ParseBlock(b []byte) (snowman.Block, error) { } blockHash := ethBlock.Hash() // Coinbase must be zero on C-Chain - if bytes.Compare(blockHash.Bytes(), vm.genesisHash.Bytes()) != 0 && - bytes.Compare(ethBlock.Coinbase().Bytes(), coreth.BlackholeAddr.Bytes()) != 0 { + if !bytes.Equal(blockHash.Bytes(), vm.genesisHash.Bytes()) && + !bytes.Equal(ethBlock.Coinbase().Bytes(), coreth.BlackholeAddr.Bytes()) { return nil, errInvalidBlock } block := &Block{ - id: ids.NewID(blockHash), + id: ids.ID(blockHash), ethBlock: ethBlock, vm: vm, } @@ -490,7 +475,7 @@ func (vm *VM) GetBlock(id ids.ID) (snowman.Block, error) { // SetPreference sets what the current tail of the chain is func (vm *VM) SetPreference(blkID ids.ID) { - err := vm.chain.SetTail(blkID.Key()) + err := vm.chain.SetTail(common.Hash(blkID)) vm.ctx.Log.AssertNoError(err) } @@ -644,7 +629,7 @@ func (vm *VM) getCachedStatus(blockID ids.ID) choices.Status { if acceptedID, err := ids.ToID(acceptedIDBytes); err != nil { log.Error(fmt.Sprintf("snowman-eth: acceptedID bytes didn't match expected value: %s", err)) } else { - if acceptedID.Equals(blockID) { + if acceptedID == blockID { vm.blockStatusCache.Put(blockID, choices.Accepted) return choices.Accepted } @@ -655,14 +640,14 @@ func (vm *VM) getCachedStatus(blockID ids.ID) choices.Status { status := vm.getUncachedStatus(blk) if status == choices.Accepted { - err := vm.acceptedDB.Put(heightKey, blockID.Bytes()) + err := vm.acceptedDB.Put(heightKey, blockID[:]) if err != nil { log.Error(fmt.Sprintf("snowman-eth: failed to write back acceptedID bytes: %s", err)) } tempBlock := wrappedBlk for tempBlock.ethBlock != nil { - parentID := ids.NewID(tempBlock.ethBlock.ParentHash()) + parentID := ids.ID(tempBlock.ethBlock.ParentHash()) tempBlock = vm.getBlock(parentID) if tempBlock == nil || tempBlock.ethBlock == nil { break @@ -674,7 +659,7 @@ func (vm *VM) getCachedStatus(blockID ids.ID) choices.Status { break } - if err := vm.acceptedDB.Put(heightKey, parentID.Bytes()); err != nil { + if err := vm.acceptedDB.Put(heightKey, parentID[:]); err != nil { log.Error(fmt.Sprintf("snowman-eth: failed to write back acceptedID bytes: %s", err)) } } @@ -695,7 +680,7 @@ func (vm *VM) getUncachedStatus(blk *types.Block) choices.Status { highBlock, lowBlock = lowBlock, highBlock } for highBlock.Number().Cmp(lowBlock.Number()) > 0 { - parentBlock := vm.getBlock(ids.NewID(highBlock.ParentHash())) + parentBlock := vm.getBlock(ids.ID(highBlock.ParentHash())) if parentBlock == nil { return choices.Processing } @@ -716,12 +701,12 @@ func (vm *VM) getBlock(id ids.ID) *Block { if blockIntf, ok := vm.blockCache.Get(id); ok { return blockIntf.(*Block) } - ethBlock := vm.chain.GetBlockByHash(id.Key()) + ethBlock := vm.chain.GetBlockByHash(common.Hash(id)) if ethBlock == nil { return nil } block := &Block{ - id: ids.NewID(ethBlock.Hash()), + id: ids.ID(ethBlock.Hash()), ethBlock: ethBlock, vm: vm, } @@ -729,16 +714,6 @@ func (vm *VM) getBlock(id ids.ID) *Block { return block } -func (vm *VM) issueRemoteTxs(txs []*types.Transaction) error { - errs := vm.chain.AddRemoteTxs(txs) - for _, err := range errs { - if err != nil { - return err - } - } - return vm.tryBlockGen() -} - func (vm *VM) writeBackMetadata() { vm.metalock.Lock() defer vm.metalock.Unlock() @@ -865,7 +840,7 @@ func (vm *VM) GetAtomicUTXOs( chainID, addrsList, startAddr.Bytes(), - startUTXOID.Bytes(), + startUTXOID[:], limit, ) if err != nil { @@ -912,10 +887,10 @@ func (vm *VM) GetSpendableFunds(keys []*crypto.PrivateKeySECP256K1R, assetID ids } addr := GetEthAddress(key) var balance uint64 - if assetID.Equals(vm.ctx.AVAXAssetID) { + if assetID == vm.ctx.AVAXAssetID { balance = new(big.Int).Div(state.GetBalance(addr), x2cRate).Uint64() } else { - balance = state.GetBalanceMultiCoin(addr, assetID.Key()).Uint64() + balance = state.GetBalanceMultiCoin(addr, common.Hash(assetID)).Uint64() } if balance == 0 { continue diff --git a/plugin/evm/vm_test.go b/plugin/evm/vm_test.go index 8ce7825..d58fdda 100644 --- a/plugin/evm/vm_test.go +++ b/plugin/evm/vm_test.go @@ -23,18 +23,16 @@ import ( var ( testNetworkID uint32 = 10 - testCChainID = ids.NewID([32]byte{'c', 'c', 'h', 'a', 'i', 'n', 't', 'e', 's', 't'}) - testXChainID = ids.NewID([32]byte{'t', 'e', 's', 't', 'x'}) - nonExistentID = ids.NewID([32]byte{'F'}) + testCChainID = ids.ID([32]byte{'c', 'c', 'h', 'a', 'i', 'n', 't', 'e', 's', 't'}) + testXChainID = ids.ID([32]byte{'t', 'e', 's', 't', 'x'}) + nonExistentID = ids.ID([32]byte{'F'}) testTxFee = uint64(1000) - startBalance = uint64(50000) testKeys []*crypto.PrivateKeySECP256K1R testEthAddrs []common.Address // testEthAddrs[i] corresponds to testKeys[i] testShortIDAddrs []ids.ShortID - testAvaxAssetID = ids.NewID([32]byte{1, 2, 3}) - username = "Johns" - password = "CjasdjhiPeirbSenfeI13" // #nosec G101 - ethChainID uint32 = 43112 + testAvaxAssetID = [32]byte{1, 2, 3} + username = "Johns" + password = "CjasdjhiPeirbSenfeI13" // #nosec G101 ) func init() { @@ -63,7 +61,7 @@ func BuildGenesisTest(t *testing.T) []byte { genesis := &core.Genesis{} if err := json.Unmarshal([]byte(genesisJSON), genesis); err != nil { - t.Fatalf("Problem unmarshaling genesis JSON: %w", err) + t.Fatalf("Problem unmarshaling genesis JSON: %s", err) } genesisReply, err := ss.BuildGenesis(nil, genesis) if err != nil { @@ -79,10 +77,10 @@ func NewContext() *snow.Context { ctx.AVAXAssetID = testAvaxAssetID ctx.XChainID = ids.Empty.Prefix(0) aliaser := ctx.BCLookup.(*ids.Aliaser) - aliaser.Alias(testCChainID, "C") - aliaser.Alias(testCChainID, testCChainID.String()) - aliaser.Alias(testXChainID, "X") - aliaser.Alias(testXChainID, testXChainID.String()) + _ = aliaser.Alias(testCChainID, "C") + _ = aliaser.Alias(testCChainID, testCChainID.String()) + _ = aliaser.Alias(testXChainID, "X") + _ = aliaser.Alias(testXChainID, testXChainID.String()) // SNLookup might be required here??? return ctx |