diff --git a/Makefile b/Makefile index adbbb15069..6154a0cfd7 100644 --- a/Makefile +++ b/Makefile @@ -2,16 +2,16 @@ # with Go source code. If you know what GOPATH is then you probably # don't need to bother with make. -.PHONY: geth android ios evm all test clean +.PHONY: geth android ios evm all test clean mina GOBIN = ./build/bin GO ?= latest GORUN = env GO111MODULE=on go run -mina_lib: +mina: cd mina && cargo build --release -geth: mina_lib +geth: mina $(GORUN) build/ci.go install ./cmd/geth @echo "Done building." @echo "Run \"$(GOBIN)/geth\" to launch geth." diff --git a/core/vm/contracts.go b/core/vm/contracts.go index 46dd813d03..9c17e64379 100644 --- a/core/vm/contracts.go +++ b/core/vm/contracts.go @@ -114,7 +114,7 @@ var ( PrecompiledAddressesIstanbul []common.Address PrecompiledAddressesByzantium []common.Address PrecompiledAddressesHomestead []common.Address - PrecompiledAddressesMina []common.Address + PrecompiledAddressesMina []common.Address ) func init() { diff --git a/core/vm/mina_contracts.go b/core/vm/mina_contracts.go index 80225be77e..1e5123afaf 100644 --- a/core/vm/mina_contracts.go +++ b/core/vm/mina_contracts.go @@ -34,8 +34,8 @@ func (c *MinaPoseidon) Run(input []byte) ([]byte, error) { calldata := input[4:] unpacked, err := (abi.Arguments{{ - Type: sol_uint8}, // networkId - {Type: sol_bytes32Arr}, // fields + Type: sol_uint8}, // networkId + {Type: sol_bytes32Arr}, // fields }).Unpack(calldata) if err != nil { @@ -51,7 +51,7 @@ func (c *MinaPoseidon) Run(input []byte) ([]byte, error) { output_buffer := [32]byte{} - if !C.poseidon_hash( + if !C.poseidon( C.uint8_t(networkId), (*C.uint8_t)(&fields[0][0]), C.uintptr_t(len(fields)), @@ -80,12 +80,12 @@ func (c *MinaSigner) Run(input []byte) ([]byte, error) { calldata := input[4:] unpacked, err := (abi.Arguments{ - {Type: sol_uint8}, // networkId - {Type: sol_bytes32}, // pubKeyX - {Type: sol_bytes32}, // pubKeyY - {Type: sol_bytes32}, // signatureRX - {Type: sol_bytes32}, // signatureS - {Type: sol_bytes32Arr}, // fields + {Type: sol_uint8}, // networkId + {Type: sol_bytes32}, // pubKeyX + {Type: sol_bytes32}, // pubKeyY + {Type: sol_bytes32}, // signatureRX + {Type: sol_bytes32}, // signatureS + {Type: sol_bytes32Arr}, // fields }).Unpack(calldata) if err != nil { diff --git a/mina/src/lib.rs b/mina/src/lib.rs index 41e38d1f29..ac60efa1d7 100644 --- a/mina/src/lib.rs +++ b/mina/src/lib.rs @@ -3,14 +3,13 @@ mod mina; use std::array::TryFromSliceError; use mina::{Message, NetworkId}; -use mina_hasher::Hashable; use mina_signer::{BaseField, CurvePoint, PubKey, ScalarField, Signature}; use o1_utils::FieldHelpers; pub const FIELD_SIZE: usize = 32; #[no_mangle] -pub extern "C" fn poseidon_hash( +pub extern "C" fn poseidon( network_id: u8, field_ptr: *const u8, field_len: usize, @@ -99,8 +98,6 @@ pub extern "C" fn verify( Err(_) => return false, }; - println!("{:?}", msg.to_roinput().to_fields()[0].to_biguint()); - let result = mina::verify(&signature, &pubkey, &msg, network_id); unsafe { *output_ptr = result };