This commit is contained in:
Martin Ondejka 2023-04-05 23:28:30 +02:00
parent 1e9d4882ce
commit 55df11555c
4 changed files with 14 additions and 17 deletions

View file

@ -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."

View file

@ -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)),

View file

@ -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 };