refactor: update dependencies to use external packages

This commit is contained in:
Zach Kelling
2026-07-26 10:19:06 -07:00
committed by zeekay
parent 90b6856267
commit 1dd58828d7
6 changed files with 89 additions and 78 deletions
+2 -2
View File
@@ -6,8 +6,8 @@ package keys
import (
"fmt"
"github.com/luxfi/address"
"github.com/luxfi/constants"
"github.com/luxfi/node/utils/formatting/address"
)
// Unit constants for LUX amounts
@@ -254,7 +254,7 @@ func QuickAllocations(networkID uint32, keys []*ValidatorKey, amountPerKey uint6
// TestnetAllocations creates allocations suitable for testnet (no vesting)
func TestnetAllocations(networkID uint32, keys []*ValidatorKey) (*GenesisAllocations, error) {
return NewAllocationBuilder(networkID, keys).
WithAmount(100 * MegaLux). // 100M LUX per validator
WithAmount(100*MegaLux). // 100M LUX per validator
WithFeeAccount(0, 10*MegaLux). // First validator gets extra
WithNoVesting().
Build()
+18 -13
View File
@@ -3,29 +3,34 @@ module github.com/luxfi/keys
go 1.25.5
require (
github.com/luxfi/constants v1.2.3
github.com/luxfi/crypto v1.17.25
github.com/luxfi/ids v1.2.4
github.com/luxfi/node v1.22.37
github.com/luxfi/address v1.0.1
github.com/luxfi/constants v1.4.2
github.com/luxfi/crypto v1.17.38
github.com/luxfi/go-bip32 v1.0.2
github.com/luxfi/go-bip39 v1.1.2
github.com/luxfi/ids v1.2.8
github.com/luxfi/tls v1.0.0
github.com/luxfi/vm v1.0.15
golang.org/x/crypto v0.46.0
)
require (
github.com/btcsuite/btcd/btcutil v1.1.6 // indirect
github.com/cloudflare/circl v1.6.2-0.20251204010831-23491bd573cf // indirect
github.com/cloudflare/circl v1.6.2 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0 // indirect
github.com/google/renameio/v2 v2.0.0 // indirect
github.com/gorilla/rpc v1.2.1 // indirect
github.com/klauspost/compress v1.18.0 // indirect
github.com/luxfi/cache v1.0.0 // indirect
github.com/luxfi/consensus v1.22.35 // indirect
github.com/luxfi/math v1.0.2 // indirect
github.com/luxfi/cache v1.1.0 // indirect
github.com/luxfi/consensus v1.22.51 // indirect
github.com/luxfi/const v1.4.1 // indirect
github.com/luxfi/formatting v1.0.0 // indirect
github.com/luxfi/math v1.2.2 // indirect
github.com/luxfi/math/big v0.1.0 // indirect
github.com/luxfi/mock v0.1.0 // indirect
github.com/luxfi/utils v1.0.0 // indirect
github.com/luxfi/sampler v1.0.0 // indirect
github.com/luxfi/utils v1.1.0 // indirect
github.com/mr-tron/base58 v1.2.0 // indirect
github.com/supranational/blst v0.3.16 // indirect
go.uber.org/mock v0.6.0 // indirect
golang.org/x/exp v0.0.0-20250819193227-8b4c13bb791b // indirect
golang.org/x/exp v0.0.0-20251219203646-944ab1f22d93 // indirect
golang.org/x/sys v0.39.0 // indirect
gonum.org/v1/gonum v0.16.0 // indirect
)
+36 -30
View File
@@ -22,8 +22,8 @@ github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku
github.com/btcsuite/snappy-go v1.0.0/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc=
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/cloudflare/circl v1.6.2-0.20251204010831-23491bd573cf h1:+0huF756d72ZdHxachRP5HYmvRkkOk8CLyKUmJM138c=
github.com/cloudflare/circl v1.6.2-0.20251204010831-23491bd573cf/go.mod h1:uddAzsPgqdMAYatqJ0lsjX1oECcQLIlRpzZh3pJrofs=
github.com/cloudflare/circl v1.6.2 h1:hL7VBpHHKzrV5WTfHCaBsgx/HGbBYlgrwvNXEVDYYsQ=
github.com/cloudflare/circl v1.6.2/go.mod h1:2eXP6Qfat4O/Yhh8BznvKnJ+uzEoTQ6jVKJRn81BiS4=
github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@@ -49,36 +49,46 @@ github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEW
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/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/renameio/v2 v2.0.0 h1:UifI23ZTGY8Tt29JbYFiuyIU3eX+RNFtUwefq9qAhxg=
github.com/google/renameio/v2 v2.0.0/go.mod h1:BtmJXm5YlszgC+TD4HOEEUFgkJP3nLxehU6hfe7jRt4=
github.com/gorilla/rpc v1.2.1 h1:yC+LMV5esttgpVvNORL/xX4jvTTEUE30UZhZ5JF7K9k=
github.com/gorilla/rpc v1.2.1/go.mod h1:uNpOihAlF5xRFLuTYhfR0yfCTm0WTQSQttkMSptRfGk=
github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ=
github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4=
github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo=
github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ=
github.com/luxfi/cache v1.0.0 h1:OcqGi/qs9ky+7O8fR6WMZtFsunvA40LBTg3QRQqJurs=
github.com/luxfi/cache v1.0.0/go.mod h1:BEvpffvV3SXs/KSa9nUC1TszxKwUdIHwIaoXpeiYU+Y=
github.com/luxfi/consensus v1.22.35 h1:ZJOEITtoy5pT9OkT+z+9qulbsVNFdcdsUAibCtXSoF4=
github.com/luxfi/consensus v1.22.35/go.mod h1:/sNvvKfESWfq57Jmrf22T2GquLNg6PU9m9MJ3wqfoYU=
github.com/luxfi/constants v1.2.3 h1:ewo3Ch6AJDI3G42J0rlNAdZU1Fv96YEyOmp3E2K/pzE=
github.com/luxfi/constants v1.2.3/go.mod h1:r5WL5Z03I9iHo910pHykO+RuDCwe4jy0rBSueG1l1mo=
github.com/luxfi/crypto v1.17.25 h1:emTejQ17bGj/1tu0ETB196Hbn6fJfo8wUNGIOWit6RM=
github.com/luxfi/crypto v1.17.25/go.mod h1:v6eaW5ejuzW2gecChWKQqx4CtVhoM1b+e40ro/6WVPg=
github.com/luxfi/ids v1.2.4 h1:e0OaeSI6xWjS9JnxxxfvCCs9HHDUrwDc3M9ctIhjcDI=
github.com/luxfi/ids v1.2.4/go.mod h1:HwvRJSNbuZS+u+0JqeHfPX2S13iFyLCnfGxjBCmt244=
github.com/luxfi/math v1.0.2 h1:bgBGmVC7S/QxLCgAJZJdvjFHMNXygcApcKofIn7bWpU=
github.com/luxfi/math v1.0.2/go.mod h1:2Jk1/s0f0yN2q0Sx/cBExbFJz7IDEbjxlP3VUiaujms=
github.com/luxfi/address v1.0.1 h1:Sc4keyuVzBIvHr7uVeYZf2/WY9YDGUgDi/iiWenj49g=
github.com/luxfi/address v1.0.1/go.mod h1:5j3Eh66v9zvv1GbNdZwt+23krV8JlSDaRzmWZU8ZRM0=
github.com/luxfi/cache v1.1.0 h1:6LUyGGZ+rrMAJBbAU6+UwkcamXj3zsboRUodIof2Ong=
github.com/luxfi/cache v1.1.0/go.mod h1:9GvlEEE9rFPaaWxvVpSPwW8ZMo2+8VMNNcuPa4AwzPg=
github.com/luxfi/consensus v1.22.51 h1:ul7YqQEjsdTCOPxH50Dk3C82DDVNIM4tyQNKYyeFy6M=
github.com/luxfi/consensus v1.22.51/go.mod h1:6/kQBgDLP3KiwIaaGJEfYlaG83fKL5uZ0TI9AUsDGic=
github.com/luxfi/const v1.4.1 h1:nd9A/9PaN2XBMPExHo+mgkDt60vrxRoQ/e+UKqskbDg=
github.com/luxfi/const v1.4.1/go.mod h1:qWfecjdImPY3kXsy3UAe4ZVpMcsp2/iUlHwUMPVREoI=
github.com/luxfi/constants v1.4.2 h1:hxp2cITYxNCKG3xOdjnEesOoCR4GI9Lb5RQ4120ke6E=
github.com/luxfi/constants v1.4.2/go.mod h1:xk+0eA7UY1GkHrmI7yqR+9LDe4TUe3p1VfRvs6cJbNM=
github.com/luxfi/crypto v1.17.38 h1:PZ52opsm3ECvyKsR2pLSsKONCey+FqpN0ZEwu+KMdO4=
github.com/luxfi/crypto v1.17.38/go.mod h1:G2t1GQvPsrwnzwyVEj0LQDuX2AWZVI5kEAPyVeicc5o=
github.com/luxfi/formatting v1.0.0 h1:0MSuD4Yhv8HBxsabAd/FsZnLnqI5rvbRRMpOIU+sP6o=
github.com/luxfi/formatting v1.0.0/go.mod h1:lswh6dPQ4E9Q+nZLwispV+Jdthr5R1PkYTBA/LhuSgE=
github.com/luxfi/go-bip32 v1.0.2 h1:7vFbb+Wr4Z499q2tuCLdd7wWjtn8sH+HWBlx76mhH9Y=
github.com/luxfi/go-bip32 v1.0.2/go.mod h1:bc7/LXDKAJQZ/F0Xjf5yXaTZxY9/ssLb4FC+Hxn/cDk=
github.com/luxfi/go-bip39 v1.1.2 h1:p+wLMPGs6MLQh7q0YIsmy2EhHL7LHiELEGTJko6t/Jg=
github.com/luxfi/go-bip39 v1.1.2/go.mod h1:96de9VkR2kY/ASAnhMtvt3TSh+PZkAFAngNj0GjRGDo=
github.com/luxfi/ids v1.2.8 h1:CQ6EUIDZqPDV+R754TiG5tFvD3uVM6rpNxPTSRv7IRo=
github.com/luxfi/ids v1.2.8/go.mod h1:14vKgM828w7yqnh6z0LhNrObXHVvtyRDyWBEmWBj5i8=
github.com/luxfi/math v1.2.2 h1:TtkSm8HlR8bLrqVD8UgRBxAVmytqAU46+l8j+FoWgAw=
github.com/luxfi/math v1.2.2/go.mod h1:C8STnF2H+D6rqBPt248CiWY2TGuJgdtv/+4UqrT15iM=
github.com/luxfi/math/big v0.1.0 h1:Vz4c0RsZVPdIKPsHPgAJChH/R3p15WHRUz7LkLf+NIQ=
github.com/luxfi/math/big v0.1.0/go.mod h1:BuxSu22RbO93xBLk5Eam5nldFponoJ73xDFz4uJ3Huk=
github.com/luxfi/mock v0.1.0 h1:IwElfNu+T9sXvzFX6tudPDx1vqPuACRSRdxpD5lxW+o=
github.com/luxfi/mock v0.1.0/go.mod h1:izF+9K0gGzFC9zERn6Po37v46eLdPB+EIsDjL3GLk+U=
github.com/luxfi/node v1.22.37 h1:njIPH9hmX+TphoxsjSEEWtICfrPxfu4/3ak4zg6A8kM=
github.com/luxfi/node v1.22.37/go.mod h1:d31vDerMnDBlid/YmKz1M+i/hBfBismLQn4jR8UAFeQ=
github.com/luxfi/utils v1.0.0 h1:eibxyw/xkwnB9KRSmYvKLbdLTUElyfJpxLIBeTBKqlU=
github.com/luxfi/utils v1.0.0/go.mod h1:ABqhBdGNig0CaDcnNYldv1byS0BTNi5IKPbJSPF1p98=
github.com/luxfi/sampler v1.0.0 h1:k8Sf6otW83w4pQp0jXLA+g3J/joB7w7SqXQsWmNTOV0=
github.com/luxfi/sampler v1.0.0/go.mod h1:f96/ozlj9vFfZj+akLtrHn4VpulQahwB+MQQhpeIekk=
github.com/luxfi/tls v1.0.0 h1:nEMt99LA5vuEcAx9gKTgymUthH5Kyj96GhINIdzG7s4=
github.com/luxfi/tls v1.0.0/go.mod h1:QZXWuYFZPfGA9AyRIBXgIuXPrmvWWHtQkJtplZnTlWc=
github.com/luxfi/utils v1.1.0 h1:ti7HvjNwJd4ILDMERJtOAWE9mF8l+zqDVkgWnF7Agic=
github.com/luxfi/utils v1.1.0/go.mod h1:ABqhBdGNig0CaDcnNYldv1byS0BTNi5IKPbJSPF1p98=
github.com/luxfi/vm v1.0.15 h1:VVi1wFBbua+uKAaP4J+wyQlihoxwijSSKBPtwyUfGIs=
github.com/luxfi/vm v1.0.15/go.mod h1:91sRxSbJeY+tjeZF4+xogZNFW8wqfvoOBsE1Q5KNqJQ=
github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o=
github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc=
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
@@ -93,8 +103,6 @@ github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1y
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/sanity-io/litter v1.5.5 h1:iE+sBxPBzoK6uaEP5Lt3fHNgpKcHXc/A2HGETy0uJQo=
github.com/sanity-io/litter v1.5.5/go.mod h1:9gzJgR2i4ZpjZHsKvUXIRQVk7P+yM3e+jAF7bU2UI5U=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
@@ -107,8 +115,6 @@ github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD
github.com/supranational/blst v0.3.16 h1:bTDadT+3fK497EvLdWRQEjiGnUtzJ7jjIUMF0jqwYhE=
github.com/supranational/blst v0.3.16/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw=
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc=
github.com/thepudds/fzgen v0.4.3 h1:srUP/34BulQaEwPP/uHZkdjUcUjIzL7Jkf4CBVryiP8=
github.com/thepudds/fzgen v0.4.3/go.mod h1:BhhwtRhzgvLWAjjcHDJ9pEiLD2Z9hrVIFjBCHJ//zJ4=
go.uber.org/mock v0.6.0 h1:hyF9dfmbgIX5EfOdasqLsWD6xqpNZlXblLB/Dbnwv3Y=
go.uber.org/mock v0.6.0/go.mod h1:KiVJ4BqZJaMj4svdfmHM0AUx4NJYO8ZNpPnZn1Z+BBU=
golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
@@ -116,8 +122,8 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.46.0 h1:cKRW/pmt1pKAfetfu+RCEvjvZkA9RimPbh7bhFjGVBU=
golang.org/x/crypto v0.46.0/go.mod h1:Evb/oLKmMraqjZ2iQTwDwvCtJkczlDuTmdJXoZVzqU0=
golang.org/x/exp v0.0.0-20250819193227-8b4c13bb791b h1:DXr+pvt3nC887026GRP39Ej11UATqWDmWuS99x26cD0=
golang.org/x/exp v0.0.0-20250819193227-8b4c13bb791b/go.mod h1:4QTo5u+SEIbbKW1RacMZq1YEfOBqeXa19JeshGi+zc4=
golang.org/x/exp v0.0.0-20251219203646-944ab1f22d93 h1:fQsdNF2N+/YewlRZiricy4P1iimyPKZ/xwniHj8Q2a0=
golang.org/x/exp v0.0.0-20251219203646-944ab1f22d93/go.mod h1:EPRbTFwzwjXj9NpYyyrvenVh9Y+GFeEvMNh7Xuz7xgU=
golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+16 -16
View File
@@ -19,14 +19,13 @@ import (
"path/filepath"
"strings"
"github.com/luxfi/crypto/bls"
"github.com/luxfi/crypto/bls/signer/localsigner"
luxcrypto "github.com/luxfi/crypto/secp256k1"
"github.com/luxfi/go-bip32"
"github.com/luxfi/go-bip39"
"github.com/luxfi/ids"
"github.com/luxfi/node/staking"
"github.com/luxfi/node/vms/platformvm/signer"
luxtls "github.com/luxfi/tls"
"github.com/luxfi/vm/platformvm/signer"
"golang.org/x/crypto/sha3"
)
@@ -76,7 +75,7 @@ func GenerateValidatorKey() (*ValidatorKey, error) {
vk := &ValidatorKey{}
// 1. Generate TLS staking key
certPEM, keyPEM, err := staking.NewCertAndKeyBytes()
certPEM, keyPEM, err := luxtls.NewCertAndKeyBytes()
if err != nil {
return nil, fmt.Errorf("failed to generate TLS cert: %w", err)
}
@@ -85,7 +84,7 @@ func GenerateValidatorKey() (*ValidatorKey, error) {
vk.StakerKey = keyPEM
// Parse cert to derive NodeID
tlsCert, err := staking.LoadTLSCertFromBytes(keyPEM, certPEM)
tlsCert, err := luxtls.LoadTLSCertFromBytes(keyPEM, certPEM)
if err != nil {
return nil, fmt.Errorf("failed to parse TLS cert: %w", err)
}
@@ -234,7 +233,7 @@ func LoadFromDir(nodeDir string) (*ValidatorKey, error) {
// If TLS cert/key missing, generate them and persist
if err != nil || kerr != nil || len(certPEM) == 0 || len(keyPEM) == 0 {
fmt.Printf(" Generating TLS staking cert for %s\n", filepath.Base(nodeDir))
certPEM, keyPEM, err = staking.NewCertAndKeyBytes()
certPEM, keyPEM, err = luxtls.NewCertAndKeyBytes()
if err != nil {
return nil, fmt.Errorf("failed to generate TLS cert: %w", err)
}
@@ -254,7 +253,7 @@ func LoadFromDir(nodeDir string) (*ValidatorKey, error) {
vk.StakerKey = keyPEM
// Derive NodeID from TLS cert
tlsCert, err := staking.LoadTLSCertFromBytes(keyPEM, certPEM)
tlsCert, err := luxtls.LoadTLSCertFromBytes(keyPEM, certPEM)
if err != nil {
return nil, fmt.Errorf("failed to load TLS cert: %w", err)
}
@@ -273,13 +272,15 @@ func LoadFromDir(nodeDir string) (*ValidatorKey, error) {
}
if len(signerBytes) > 0 {
vk.BLSSecretKey = signerBytes
// Derive public key and PoP
sk, err := bls.SecretKeyFromBytes(signerBytes)
// Derive public key and PoP using localsigner + signer.NewProofOfPossession
// This must match how keys are generated in GenerateValidatorKey/DeriveValidatorFromMnemonic
blsSigner, err := localsigner.FromBytes(signerBytes)
if err == nil {
pk := bls.PublicFromSecretKey(sk)
vk.BLSPublicKey = bls.PublicKeyToCompressedBytes(pk)
sig := bls.Sign(sk, vk.BLSPublicKey)
vk.BLSPoP = bls.SignatureToBytes(sig)
pop, err := signer.NewProofOfPossession(blsSigner)
if err == nil {
vk.BLSPublicKey = pop.PublicKey[:]
vk.BLSPoP = pop.ProofOfPossession[:]
}
}
}
@@ -454,7 +455,7 @@ func DeriveValidatorFromMnemonic(mnemonic string, accountIndex uint32) (*Validat
return nil, fmt.Errorf("failed to derive P-256 key: %w", err)
}
certPEM, keyPEM, err := staking.NewCertAndKeyBytesFromKey(p256Key)
certPEM, keyPEM, err := luxtls.NewCertAndKeyBytesFromKey(p256Key)
if err != nil {
return nil, fmt.Errorf("failed to generate TLS cert: %w", err)
}
@@ -462,7 +463,7 @@ func DeriveValidatorFromMnemonic(mnemonic string, accountIndex uint32) (*Validat
vk.StakerKey = keyPEM
// Derive NodeID from TLS cert
tlsCert, err := staking.LoadTLSCertFromBytes(keyPEM, certPEM)
tlsCert, err := luxtls.LoadTLSCertFromBytes(keyPEM, certPEM)
if err != nil {
return nil, fmt.Errorf("failed to parse TLS cert: %w", err)
}
@@ -620,4 +621,3 @@ func deriveMnemonicKey(mnemonic string, accountIndex uint32) ([]byte, error) {
return key.Key, nil
}
View File
+3 -3
View File
@@ -16,8 +16,8 @@ import (
"github.com/luxfi/crypto/bls/signer/localsigner"
luxcrypto "github.com/luxfi/crypto/secp256k1"
"github.com/luxfi/ids"
"github.com/luxfi/node/staking"
"github.com/luxfi/node/vms/platformvm/signer"
luxtls "github.com/luxfi/tls"
"github.com/luxfi/vm/platformvm/signer"
)
func main() {
@@ -75,7 +75,7 @@ func upgradeNode(nodeDir string) error {
return fmt.Errorf("failed to read staker.key: %w", err)
}
tlsCert, err := staking.LoadTLSCertFromBytes(keyPEM, certPEM)
tlsCert, err := luxtls.LoadTLSCertFromBytes(keyPEM, certPEM)
if err != nil {
return fmt.Errorf("failed to load TLS cert: %w", err)
}