Update Move support to accomadate Libra's changes to compiler behavior (#6993)
This commit is contained in:
73
programs/librapay_api/Cargo.lock
generated
73
programs/librapay_api/Cargo.lock
generated
@@ -21,11 +21,6 @@ dependencies = [
|
||||
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "approx"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "ar"
|
||||
version = "0.6.2"
|
||||
@@ -289,16 +284,6 @@ name = "cfg-if"
|
||||
version = "0.1.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "cgmath"
|
||||
version = "0.16.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"approx 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "chashmap"
|
||||
version = "2.2.2"
|
||||
@@ -316,7 +301,6 @@ dependencies = [
|
||||
"libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
@@ -370,11 +354,12 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "colored"
|
||||
version = "1.8.0"
|
||||
version = "1.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winconsole 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -630,7 +615,7 @@ dependencies = [
|
||||
"bloom 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"colored 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"colored 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"enum-primitive-derive 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -901,7 +886,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "hash32"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -1999,11 +1984,6 @@ dependencies = [
|
||||
"winreg 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rgb"
|
||||
version = "0.8.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "ring"
|
||||
version = "0.16.9"
|
||||
@@ -2316,6 +2296,7 @@ dependencies = [
|
||||
"bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cc 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"curve25519-dalek 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ed25519-dalek 1.0.0-pre.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -2324,26 +2305,12 @@ dependencies = [
|
||||
"regex-syntax 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"reqwest 0.9.22 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"solana-ed25519-dalek 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "solana-ed25519-dalek"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"clear_on_drop 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"curve25519-dalek 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "solana-librapay-api"
|
||||
version = "0.21.0"
|
||||
@@ -2467,7 +2434,7 @@ dependencies = [
|
||||
"bincode 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bs58 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"chrono 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ed25519-dalek 1.0.0-pre.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"generic-array 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hex 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"itertools 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -2477,16 +2444,13 @@ dependencies = [
|
||||
"num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rayon 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_bytes 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_derive 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"solana-crate-features 0.21.0",
|
||||
"solana-ed25519-dalek 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"solana-logger 0.21.0",
|
||||
"untrusted 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2521,7 +2485,6 @@ dependencies = [
|
||||
name = "solana-storage-api"
|
||||
version = "0.21.0"
|
||||
dependencies = [
|
||||
"assert_matches 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bincode 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-derive 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -2959,7 +2922,7 @@ dependencies = [
|
||||
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"combine 2.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"elfkit 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hash32 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hash32 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -3736,17 +3699,6 @@ dependencies = [
|
||||
"winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winconsole"
|
||||
version = "0.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cgmath 0.16.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rgb 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winreg"
|
||||
version = "0.6.2"
|
||||
@@ -3778,7 +3730,6 @@ dependencies = [
|
||||
"checksum adler32 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "5d2e7343e7fc9de883d1b0341e0b13970f764c14101234857d2ddafa1cb1cac2"
|
||||
"checksum aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "58fb5e95d83b38284460a5fda7d6470aa0b8844d283a0b614b8535e880800d2d"
|
||||
"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
|
||||
"checksum approx 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "08abcc3b4e9339e33a3d0a5ed15d84a687350c05689d825e0f6655eef9e76a94"
|
||||
"checksum ar 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "579681b3fecd1e9d6b5ce6969e05f9feb913f296eddaf595be1166a5ca597bc4"
|
||||
"checksum arc-swap 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f1a1eca3195b729bbd64e292ef2f5fff6b1c28504fed762ce2b1013dde4d8e92"
|
||||
"checksum arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0d382e583f07208808f6b1249e60848879ba3543f57c32277bf52d69c2f0f0ee"
|
||||
@@ -3816,7 +3767,6 @@ dependencies = [
|
||||
"checksum c_linked_list 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4964518bd3b4a8190e832886cdc0da9794f12e8e6c1613a9e90ff331c4c8724b"
|
||||
"checksum cc 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)" = "0213d356d3c4ea2c18c40b037c3be23cd639825c18f25ee670ac7813beeef99c"
|
||||
"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
|
||||
"checksum cgmath 0.16.1 (registry+https://github.com/rust-lang/crates.io-index)" = "64a4b57c8f4e3a2e9ac07e0f6abc9c24b6fc9e1b54c3478cfb598f3d0023e51c"
|
||||
"checksum chashmap 2.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ff41a3c2c1e39921b9003de14bf0439c7b63a9039637c291e1a64925d8ddfa45"
|
||||
"checksum chrono 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e8493056968583b0193c1bb04d6f7684586f3726992d6c573261941a895dbd68"
|
||||
"checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9"
|
||||
@@ -3824,7 +3774,7 @@ dependencies = [
|
||||
"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f"
|
||||
"checksum codespan 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "004def512a9848b23a68ed110927d102b0e6d9f3dc732e28570879afde051f8c"
|
||||
"checksum codespan-reporting 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ab081a14ab8f9598ce826890fe896d0addee68c7a58ab49008369ccbb51510a8"
|
||||
"checksum colored 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6cdb90b60f2927f8d76139c72dbde7e10c3a2bc47c8594c9c7a66529f2687c03"
|
||||
"checksum colored 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "433e7ac7d511768127ed85b0c4947f47a254131e37864b2dc13f52aa32cd37e5"
|
||||
"checksum combine 2.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1645a65a99c7c8d345761f4b75a6ffe5be3b3b27a93ee731fccc5050ba6be97c"
|
||||
"checksum constant_time_eq 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "995a44c877f9212528ccc74b21a232f66ad69001e40ede5bcee2ac9ef2657120"
|
||||
"checksum cookie 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "888604f00b3db336d2af898ec3c1d5d0ddf5e6d462220f2ededc33a87ac4bbd5"
|
||||
@@ -3884,7 +3834,7 @@ dependencies = [
|
||||
"checksum getrandom 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "e7db7ca94ed4cd01190ceee0d8a8052f08a247aa1b469a7f68c6a3b71afcf407"
|
||||
"checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb"
|
||||
"checksum h2 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)" = "a5b34c246847f938a410a03c5458c7fee2274436675e76d8b903c08efc29c462"
|
||||
"checksum hash32 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "12d790435639c06a7b798af9e1e331ae245b7ef915b92f70a39b4cf8c00686af"
|
||||
"checksum hash32 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d4041af86e63ac4298ce40e5cca669066e75b6f1aa3390fe2561ffa5e1d9f4cc"
|
||||
"checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205"
|
||||
"checksum hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77"
|
||||
"checksum hex 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "023b39be39e3a2da62a94feb433e91e8bcd37676fbc8bea371daf52b7a769a3e"
|
||||
@@ -4003,7 +3953,6 @@ dependencies = [
|
||||
"checksum rental 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "8545debe98b2b139fb04cad8618b530e9b07c152d99a5de83c860b877d67847f"
|
||||
"checksum rental-impl 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "475e68978dc5b743f2f40d8e0a8fdc83f1c5e78cbf4b8fa5e74e73beebc340de"
|
||||
"checksum reqwest 0.9.22 (registry+https://github.com/rust-lang/crates.io-index)" = "2c2064233e442ce85c77231ebd67d9eca395207dec2127fe0bbedde4bd29a650"
|
||||
"checksum rgb 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)" = "2089e4031214d129e201f8c3c8c2fe97cd7322478a0d1cdf78e7029b0042efdb"
|
||||
"checksum ring 0.16.9 (registry+https://github.com/rust-lang/crates.io-index)" = "6747f8da1f2b1fabbee1aaa4eb8a11abf9adef0bf58a41cee45db5d59cecdfac"
|
||||
"checksum rust-argon2 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4ca4eaef519b494d1f2848fc602d18816fed808a981aedf4f1f00ceb7c9d32cf"
|
||||
"checksum rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783"
|
||||
@@ -4034,7 +3983,6 @@ dependencies = [
|
||||
"checksum slog-stdlog 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "be4d87903baf655da2d82bc3ac3f7ef43868c58bf712b3a661fda72009304c23"
|
||||
"checksum slog-term 2.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "54b50e85b73c2bd42ceb97b6ded235576d405bd1e974242ccfe634fa269f6da7"
|
||||
"checksum smallvec 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)" = "cefaa50e76a6f10b86f36e640eb1739eafbd4084865067778463913e43a77ff3"
|
||||
"checksum solana-ed25519-dalek 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1c21f9d5aa62959872194dfd086feb4e8efec1c2589d27e6a0339904759e99fc"
|
||||
"checksum solana_libra_bytecode_verifier 0.0.1-sol4 (registry+https://github.com/rust-lang/crates.io-index)" = "79c3b7e9555da6f04a3f542a40e92bbbd46d0f05bd270ae3ff8c0283c329a179"
|
||||
"checksum solana_libra_canonical_serialization 0.0.1-sol4 (registry+https://github.com/rust-lang/crates.io-index)" = "c674689dd2d17b0bab49501f0d63ec71b3e1f8fab2eae86174e37768435a54aa"
|
||||
"checksum solana_libra_compiler 0.0.1-sol4 (registry+https://github.com/rust-lang/crates.io-index)" = "908b00b637e6eaf835d67bea2329bbee82e75f8e162744fd707ca9c9e4c1400b"
|
||||
@@ -4149,7 +4097,6 @@ dependencies = [
|
||||
"checksum winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7168bab6e1daee33b4557efd0e95d5ca70a03706d39fa5f3fe7a236f584b03c9"
|
||||
"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||
"checksum wincolor 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "96f5016b18804d24db43cebf3c77269e7569b8954a8464501c216cc5e070eaa9"
|
||||
"checksum winconsole 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ef84b96d10db72dd980056666d7f1e7663ce93d82fa33b63e71c966f4cf5032"
|
||||
"checksum winreg 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b2986deb581c4fe11b621998a5e53361efe6b48a151178d0cd9eeffa4dc6acc9"
|
||||
"checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e"
|
||||
"checksum x25519-dalek 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7ee1585dc1484373cbc1cee7aafda26634665cf449436fd6e24bfd1fad230538"
|
||||
|
@@ -12,11 +12,11 @@ edition = "2018"
|
||||
bincode = "1.2.0"
|
||||
log = "0.4.8"
|
||||
solana-logger = { path = "../../logger", version = "0.21.0" }
|
||||
solana-sdk = { path = "../../sdk", version = "0.21.0" }
|
||||
solana-runtime = { path = "../../runtime", version = "0.21.0" }
|
||||
types = { version = "0.0.1-sol4", package = "solana_libra_types" }
|
||||
language_e2e_tests = { version = "0.0.1-sol4", package = "solana_libra_language_e2e_tests" }
|
||||
solana-move-loader-api = { path = "../move_loader_api", version = "0.21.0" }
|
||||
solana-runtime = { path = "../../runtime", version = "0.21.0" }
|
||||
solana-sdk = { path = "../../sdk", version = "0.21.0" }
|
||||
language_e2e_tests = { version = "0.0.1-sol4", package = "solana_libra_language_e2e_tests" }
|
||||
types = { version = "0.0.1-sol4", package = "solana_libra_types" }
|
||||
|
||||
[lib]
|
||||
crate-type = ["lib"]
|
||||
|
@@ -25,12 +25,12 @@ use solana_sdk::system_instruction;
|
||||
|
||||
use types::account_config;
|
||||
|
||||
pub fn create_genesis<T: Client>(from_key: &Keypair, client: &T, amount: u64) -> Keypair {
|
||||
let libra_genesis_key = Keypair::new();
|
||||
pub fn create_genesis<T: Client>(from: &Keypair, client: &T, amount: u64) -> Keypair {
|
||||
let genesis = Keypair::new();
|
||||
|
||||
let instruction = system_instruction::create_account(
|
||||
&from_key.pubkey(),
|
||||
&libra_genesis_key.pubkey(),
|
||||
&from.pubkey(),
|
||||
&genesis.pubkey(),
|
||||
1,
|
||||
bincode::serialized_size(&LibraAccountState::create_genesis(amount).unwrap()).unwrap()
|
||||
as u64,
|
||||
@@ -38,35 +38,33 @@ pub fn create_genesis<T: Client>(from_key: &Keypair, client: &T, amount: u64) ->
|
||||
);
|
||||
|
||||
client
|
||||
.send_message(
|
||||
&[&from_key, &libra_genesis_key],
|
||||
Message::new(vec![instruction]),
|
||||
)
|
||||
.send_message(&[&from, &genesis], Message::new(vec![instruction]))
|
||||
.unwrap();
|
||||
|
||||
let instruction = librapay_instruction::genesis(&libra_genesis_key.pubkey(), amount);
|
||||
let message = Message::new_with_payer(vec![instruction], Some(&from_key.pubkey()));
|
||||
client
|
||||
.send_message(&[from_key, &libra_genesis_key], message)
|
||||
.unwrap();
|
||||
let instruction = librapay_instruction::genesis(&genesis.pubkey(), amount);
|
||||
let message = Message::new_with_payer(vec![instruction], Some(&from.pubkey()));
|
||||
client.send_message(&[from, &genesis], message).unwrap();
|
||||
|
||||
libra_genesis_key
|
||||
genesis
|
||||
}
|
||||
|
||||
pub fn upload_move_program<T: Client>(from: &Keypair, client: &T, code: &str) -> Pubkey {
|
||||
pub fn publish_module<T: Client>(from: &Keypair, client: &T, code: &str) -> Pubkey {
|
||||
let address = account_config::association_address();
|
||||
let account_state = LibraAccountState::create_program(&address, code, vec![]);
|
||||
let program_bytes = bincode::serialize(&account_state).unwrap();
|
||||
let account_state = LibraAccountState::create_module(&address, code, vec![]);
|
||||
let bytes = bincode::serialize(&account_state).unwrap();
|
||||
|
||||
load_program(
|
||||
client,
|
||||
&from,
|
||||
&solana_sdk::move_loader::id(),
|
||||
program_bytes,
|
||||
)
|
||||
load_program(client, &from, &solana_sdk::move_loader::id(), bytes)
|
||||
}
|
||||
|
||||
pub fn upload_mint_program<T: Client>(from: &Keypair, client: &T) -> Pubkey {
|
||||
pub fn upload_script<T: Client>(from: &Keypair, client: &T, code: &str) -> Pubkey {
|
||||
let address = account_config::association_address();
|
||||
let account_state = LibraAccountState::create_script(&address, code, vec![]);
|
||||
let bytes = bincode::serialize(&account_state).unwrap();
|
||||
|
||||
load_program(client, &from, &solana_sdk::move_loader::id(), bytes)
|
||||
}
|
||||
|
||||
pub fn upload_mint_script<T: Client>(from: &Keypair, client: &T) -> Pubkey {
|
||||
let code = "
|
||||
import 0x0.LibraAccount;
|
||||
import 0x0.LibraCoin;
|
||||
@@ -74,10 +72,9 @@ pub fn upload_mint_program<T: Client>(from: &Keypair, client: &T) -> Pubkey {
|
||||
LibraAccount.mint_to_address(move(payee), move(amount));
|
||||
return;
|
||||
}";
|
||||
upload_move_program(from, client, code)
|
||||
upload_script(from, client, code)
|
||||
}
|
||||
|
||||
pub fn upload_payment_program<T: Client>(from: &Keypair, client: &T) -> Pubkey {
|
||||
pub fn upload_payment_script<T: Client>(from: &Keypair, client: &T) -> Pubkey {
|
||||
let code = "
|
||||
import 0x0.LibraAccount;
|
||||
import 0x0.LibraCoin;
|
||||
@@ -87,7 +84,7 @@ pub fn upload_payment_program<T: Client>(from: &Keypair, client: &T) -> Pubkey {
|
||||
}
|
||||
";
|
||||
|
||||
upload_move_program(from, client, code)
|
||||
upload_script(from, client, code)
|
||||
}
|
||||
|
||||
pub fn process_instruction(
|
||||
|
@@ -10,15 +10,13 @@ use types::transaction::TransactionArgument;
|
||||
pub fn genesis(genesis_pubkey: &Pubkey, microlibras: u64) -> Instruction {
|
||||
let data = bincode::serialize(&InvokeCommand::CreateGenesis(microlibras)).unwrap();
|
||||
let ix_data = LoaderInstruction::InvokeMain { data };
|
||||
|
||||
let accounts = vec![AccountMeta::new(*genesis_pubkey, true)];
|
||||
|
||||
Instruction::new(solana_sdk::move_loader::id(), &ix_data, accounts)
|
||||
}
|
||||
|
||||
pub fn mint(
|
||||
program_pubkey: &Pubkey,
|
||||
from_pubkey: &Pubkey,
|
||||
script_pubkey: &Pubkey,
|
||||
genesis_pubkey: &Pubkey,
|
||||
to_pubkey: &Pubkey,
|
||||
microlibras: u64,
|
||||
) -> Instruction {
|
||||
@@ -27,7 +25,7 @@ pub fn mint(
|
||||
TransactionArgument::U64(microlibras),
|
||||
];
|
||||
|
||||
let data = bincode::serialize(&InvokeCommand::RunProgram {
|
||||
let data = bincode::serialize(&InvokeCommand::RunScript {
|
||||
sender_address: account_config::association_address(),
|
||||
function_name: "main".to_string(),
|
||||
args,
|
||||
@@ -36,8 +34,8 @@ pub fn mint(
|
||||
let ix_data = LoaderInstruction::InvokeMain { data };
|
||||
|
||||
let accounts = vec![
|
||||
AccountMeta::new_readonly(*program_pubkey, false),
|
||||
AccountMeta::new(*from_pubkey, true),
|
||||
AccountMeta::new_readonly(*script_pubkey, false),
|
||||
AccountMeta::new(*genesis_pubkey, true),
|
||||
AccountMeta::new(*to_pubkey, false),
|
||||
];
|
||||
|
||||
@@ -45,8 +43,8 @@ pub fn mint(
|
||||
}
|
||||
|
||||
pub fn transfer(
|
||||
program_pubkey: &Pubkey,
|
||||
mint_pubkey: &Pubkey,
|
||||
script_pubkey: &Pubkey,
|
||||
genesis_pubkey: &Pubkey,
|
||||
from_pubkey: &Pubkey,
|
||||
to_pubkey: &Pubkey,
|
||||
microlibras: u64,
|
||||
@@ -56,7 +54,7 @@ pub fn transfer(
|
||||
TransactionArgument::U64(microlibras),
|
||||
];
|
||||
|
||||
let data = bincode::serialize(&InvokeCommand::RunProgram {
|
||||
let data = bincode::serialize(&InvokeCommand::RunScript {
|
||||
sender_address: pubkey_to_address(from_pubkey),
|
||||
function_name: "main".to_string(),
|
||||
args,
|
||||
@@ -65,8 +63,8 @@ pub fn transfer(
|
||||
let ix_data = LoaderInstruction::InvokeMain { data };
|
||||
|
||||
let accounts = vec![
|
||||
AccountMeta::new_readonly(*program_pubkey, false),
|
||||
AccountMeta::new_readonly(*mint_pubkey, false),
|
||||
AccountMeta::new_readonly(*script_pubkey, false),
|
||||
AccountMeta::new_readonly(*genesis_pubkey, false),
|
||||
AccountMeta::new(*from_pubkey, true),
|
||||
AccountMeta::new(*to_pubkey, false),
|
||||
];
|
||||
@@ -80,19 +78,19 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_pay() {
|
||||
let from = Pubkey::new_rand();
|
||||
let to = Pubkey::new_rand();
|
||||
let from_pubkey = Pubkey::new_rand();
|
||||
let to_pubkey = Pubkey::new_rand();
|
||||
let program_id = Pubkey::new_rand();
|
||||
let mint_id = Pubkey::new_rand();
|
||||
transfer(&program_id, &mint_id, &from, &to, 1);
|
||||
transfer(&program_id, &mint_id, &from_pubkey, &to_pubkey, 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_mint() {
|
||||
let program_id = Pubkey::new_rand();
|
||||
let from = Pubkey::new_rand();
|
||||
let to = Pubkey::new_rand();
|
||||
let from_pubkey = Pubkey::new_rand();
|
||||
let to_pubkey = Pubkey::new_rand();
|
||||
|
||||
mint(&program_id, &from, &to, 1);
|
||||
mint(&program_id, &from_pubkey, &to_pubkey, 1);
|
||||
}
|
||||
}
|
||||
|
@@ -3,6 +3,7 @@ use log::*;
|
||||
use solana_move_loader_api::account_state::{pubkey_to_address, LibraAccountState};
|
||||
use solana_move_loader_api::data_store::DataStore;
|
||||
use solana_sdk::client::Client;
|
||||
use solana_sdk::commitment_config::CommitmentConfig;
|
||||
use solana_sdk::hash::Hash;
|
||||
use solana_sdk::pubkey::Pubkey;
|
||||
use solana_sdk::signature::{Keypair, KeypairUtil};
|
||||
@@ -12,67 +13,74 @@ use std::boxed::Box;
|
||||
use std::error;
|
||||
use std::fmt;
|
||||
|
||||
pub fn create_genesis(
|
||||
genesis_keypair: &Keypair,
|
||||
microlibras: u64,
|
||||
recent_blockhash: Hash,
|
||||
) -> Transaction {
|
||||
let ix = librapay_instruction::genesis(&genesis_keypair.pubkey(), microlibras);
|
||||
pub fn create_genesis(keypair: &Keypair, microlibras: u64, recent_blockhash: Hash) -> Transaction {
|
||||
let ix = librapay_instruction::genesis(&keypair.pubkey(), microlibras);
|
||||
Transaction::new_signed_with_payer(
|
||||
vec![ix],
|
||||
Some(&genesis_keypair.pubkey()),
|
||||
&[genesis_keypair],
|
||||
Some(&keypair.pubkey()),
|
||||
&[keypair],
|
||||
recent_blockhash,
|
||||
)
|
||||
}
|
||||
|
||||
pub fn mint_tokens(
|
||||
program_id: &Pubkey,
|
||||
payer: &Keypair,
|
||||
mint: &Keypair,
|
||||
to: &Pubkey,
|
||||
script_pubkey: &Pubkey,
|
||||
payer_keypair: &Keypair,
|
||||
genesis_keypair: &Keypair,
|
||||
to_pubkey: &Pubkey,
|
||||
microlibras: u64,
|
||||
recent_blockhash: Hash,
|
||||
) -> Transaction {
|
||||
let ix = librapay_instruction::mint(program_id, &mint.pubkey(), to, microlibras);
|
||||
let ix = librapay_instruction::mint(
|
||||
script_pubkey,
|
||||
&genesis_keypair.pubkey(),
|
||||
to_pubkey,
|
||||
microlibras,
|
||||
);
|
||||
Transaction::new_signed_with_payer(
|
||||
vec![ix],
|
||||
Some(&payer.pubkey()),
|
||||
&[payer, mint],
|
||||
Some(&payer_keypair.pubkey()),
|
||||
&[payer_keypair, genesis_keypair],
|
||||
recent_blockhash,
|
||||
)
|
||||
}
|
||||
|
||||
pub fn transfer(
|
||||
program_id: &Pubkey,
|
||||
mint: &Pubkey,
|
||||
payer: &Keypair,
|
||||
from: &Keypair,
|
||||
to: &Pubkey,
|
||||
script_pubkey: &Pubkey,
|
||||
genesis_pubkey: &Pubkey,
|
||||
payer_keypair: &Keypair,
|
||||
from_keypair: &Keypair,
|
||||
to_pubkey: &Pubkey,
|
||||
microlibras: u64,
|
||||
recent_blockhash: Hash,
|
||||
) -> Transaction {
|
||||
let ix = librapay_instruction::transfer(program_id, mint, &from.pubkey(), to, microlibras);
|
||||
let ix = librapay_instruction::transfer(
|
||||
script_pubkey,
|
||||
genesis_pubkey,
|
||||
&from_keypair.pubkey(),
|
||||
to_pubkey,
|
||||
microlibras,
|
||||
);
|
||||
Transaction::new_signed_with_payer(
|
||||
vec![ix],
|
||||
Some(&payer.pubkey()),
|
||||
&[payer, from],
|
||||
Some(&payer_keypair.pubkey()),
|
||||
&[payer_keypair, from_keypair],
|
||||
recent_blockhash,
|
||||
)
|
||||
}
|
||||
|
||||
pub fn create_accounts(
|
||||
from: &Keypair,
|
||||
to: &[&Keypair],
|
||||
from_keypair: &Keypair,
|
||||
to_keypair: &[&Keypair],
|
||||
lamports: u64,
|
||||
recent_blockhash: Hash,
|
||||
) -> Transaction {
|
||||
let instructions = to
|
||||
let instructions = to_keypair
|
||||
.iter()
|
||||
.map(|to| {
|
||||
.map(|keypair| {
|
||||
system_instruction::create_account(
|
||||
&from.pubkey(),
|
||||
&to.pubkey(),
|
||||
&from_keypair.pubkey(),
|
||||
&keypair.pubkey(),
|
||||
lamports,
|
||||
400,
|
||||
&solana_sdk::move_loader::id(),
|
||||
@@ -80,18 +88,18 @@ pub fn create_accounts(
|
||||
})
|
||||
.collect();
|
||||
|
||||
let mut from_signers = vec![from];
|
||||
from_signers.extend_from_slice(to);
|
||||
let mut from_signers = vec![from_keypair];
|
||||
from_signers.extend_from_slice(to_keypair);
|
||||
Transaction::new_signed_instructions(&from_signers, instructions, recent_blockhash)
|
||||
}
|
||||
|
||||
pub fn create_account(
|
||||
from: &Keypair,
|
||||
to: &Keypair,
|
||||
from_keypair: &Keypair,
|
||||
to_keypair: &Keypair,
|
||||
lamports: u64,
|
||||
recent_blockhash: Hash,
|
||||
) -> Transaction {
|
||||
create_accounts(from, &[to], lamports, recent_blockhash)
|
||||
create_accounts(from_keypair, &[to_keypair], lamports, recent_blockhash)
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
@@ -109,12 +117,13 @@ impl error::Error for LibrapayError {}
|
||||
|
||||
pub fn get_libra_balance<T: Client>(
|
||||
client: &T,
|
||||
account_address: &Pubkey,
|
||||
pubkey: &Pubkey,
|
||||
) -> Result<u64, Box<dyn error::Error>> {
|
||||
let account = client.get_account_data(&account_address)?;
|
||||
if let Some(account) = account {
|
||||
if let Some(account) =
|
||||
client.get_account_with_commitment(&pubkey, CommitmentConfig::recent())?
|
||||
{
|
||||
let mut data_store = DataStore::default();
|
||||
match bincode::deserialize(&account)? {
|
||||
match bincode::deserialize(&account.data)? {
|
||||
LibraAccountState::User(_, write_set) => {
|
||||
data_store.apply_write_set(&write_set);
|
||||
}
|
||||
@@ -127,9 +136,8 @@ pub fn get_libra_balance<T: Client>(
|
||||
}
|
||||
}
|
||||
let resource = data_store
|
||||
.read_account_resource(&pubkey_to_address(account_address))
|
||||
.read_account_resource(&pubkey_to_address(pubkey))
|
||||
.unwrap();
|
||||
|
||||
let res = resource.balance();
|
||||
Ok(res)
|
||||
} else {
|
||||
@@ -140,7 +148,7 @@ pub fn get_libra_balance<T: Client>(
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::{create_genesis, upload_mint_program, upload_payment_program};
|
||||
use crate::{create_genesis, upload_mint_script, upload_payment_script};
|
||||
use solana_runtime::bank::Bank;
|
||||
use solana_runtime::bank_client::BankClient;
|
||||
use solana_sdk::genesis_config::create_genesis_config;
|
||||
@@ -148,7 +156,7 @@ mod tests {
|
||||
use std::sync::Arc;
|
||||
|
||||
fn create_bank(lamports: u64) -> (Arc<Bank>, Keypair, Keypair, Pubkey, Pubkey) {
|
||||
let (genesis_config, mint_keypair) = create_genesis_config(lamports);
|
||||
let (genesis_config, mint) = create_genesis_config(lamports);
|
||||
let mut bank = Bank::new(&genesis_config);
|
||||
bank.add_instruction_processor(
|
||||
solana_sdk::move_loader::id(),
|
||||
@@ -156,59 +164,73 @@ mod tests {
|
||||
);
|
||||
let shared_bank = Arc::new(bank);
|
||||
let bank_client = BankClient::new_shared(&shared_bank);
|
||||
let genesis_keypair = create_genesis(&mint_keypair, &bank_client, 1_000_000);
|
||||
let mint_program_pubkey = upload_mint_program(&mint_keypair, &bank_client);
|
||||
let program_pubkey = upload_payment_program(&mint_keypair, &bank_client);
|
||||
let genesis_pubkey = create_genesis(&mint, &bank_client, 1_000_000);
|
||||
let mint_script_pubkey = upload_mint_script(&mint, &bank_client);
|
||||
let script_pubkey = upload_payment_script(&mint, &bank_client);
|
||||
(
|
||||
shared_bank,
|
||||
mint_keypair,
|
||||
genesis_keypair,
|
||||
mint_program_pubkey,
|
||||
program_pubkey,
|
||||
mint,
|
||||
genesis_pubkey,
|
||||
mint_script_pubkey,
|
||||
script_pubkey,
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_transfer() {
|
||||
let (bank, mint_keypair, libra_genesis_keypair, mint_program_id, program_id) =
|
||||
create_bank(10_000);
|
||||
let from = Keypair::new();
|
||||
let to = Keypair::new();
|
||||
solana_logger::setup();
|
||||
|
||||
let tx = create_accounts(&mint_keypair, &[&from, &to], 1, bank.last_blockhash());
|
||||
let (bank, mint, genesis_keypair, mint_script_pubkey, payment_script_pubkey) =
|
||||
create_bank(10_000);
|
||||
let from_keypair = Keypair::new();
|
||||
let to_keypair = Keypair::new();
|
||||
|
||||
let tx = create_accounts(
|
||||
&mint,
|
||||
&[&from_keypair, &to_keypair],
|
||||
1,
|
||||
bank.last_blockhash(),
|
||||
);
|
||||
bank.process_transaction(&tx).unwrap();
|
||||
|
||||
info!(
|
||||
"created accounts: mint: {} libra_mint: {}",
|
||||
mint_keypair.pubkey(),
|
||||
libra_genesis_keypair.pubkey()
|
||||
"created accounts: mint: {} genesis_pubkey: {}",
|
||||
mint.pubkey(),
|
||||
genesis_keypair.pubkey()
|
||||
);
|
||||
info!(
|
||||
" from: {} to: {}",
|
||||
from_keypair.pubkey(),
|
||||
to_keypair.pubkey()
|
||||
);
|
||||
info!(" from: {} to: {}", from.pubkey(), to.pubkey());
|
||||
|
||||
let tx = mint_tokens(
|
||||
&mint_program_id,
|
||||
&mint_keypair,
|
||||
&libra_genesis_keypair,
|
||||
&from.pubkey(),
|
||||
&mint_script_pubkey,
|
||||
&mint,
|
||||
&genesis_keypair,
|
||||
&from_keypair.pubkey(),
|
||||
1,
|
||||
bank.last_blockhash(),
|
||||
);
|
||||
bank.process_transaction(&tx).unwrap();
|
||||
let client = BankClient::new_shared(&bank);
|
||||
assert_eq!(1, get_libra_balance(&client, &from.pubkey()).unwrap());
|
||||
assert_eq!(
|
||||
1,
|
||||
get_libra_balance(&client, &from_keypair.pubkey()).unwrap()
|
||||
);
|
||||
|
||||
info!("passed mint... doing another transfer..");
|
||||
|
||||
let tx = transfer(
|
||||
&program_id,
|
||||
&libra_genesis_keypair.pubkey(),
|
||||
&mint_keypair,
|
||||
&from,
|
||||
&to.pubkey(),
|
||||
&payment_script_pubkey,
|
||||
&genesis_keypair.pubkey(),
|
||||
&mint,
|
||||
&from_keypair,
|
||||
&to_keypair.pubkey(),
|
||||
1,
|
||||
bank.last_blockhash(),
|
||||
);
|
||||
bank.process_transaction(&tx).unwrap();
|
||||
assert_eq!(1, get_libra_balance(&client, &to.pubkey()).unwrap());
|
||||
assert_eq!(1, get_libra_balance(&client, &to_keypair.pubkey()).unwrap());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user