mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 02:42:27 +00:00
Format
This commit is contained in:
parent
1e9d4882ce
commit
55df11555c
4 changed files with 14 additions and 17 deletions
6
Makefile
6
Makefile
|
|
@ -2,16 +2,16 @@
|
||||||
# with Go source code. If you know what GOPATH is then you probably
|
# with Go source code. If you know what GOPATH is then you probably
|
||||||
# don't need to bother with make.
|
# 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
|
GOBIN = ./build/bin
|
||||||
GO ?= latest
|
GO ?= latest
|
||||||
GORUN = env GO111MODULE=on go run
|
GORUN = env GO111MODULE=on go run
|
||||||
|
|
||||||
mina_lib:
|
mina:
|
||||||
cd mina && cargo build --release
|
cd mina && cargo build --release
|
||||||
|
|
||||||
geth: mina_lib
|
geth: mina
|
||||||
$(GORUN) build/ci.go install ./cmd/geth
|
$(GORUN) build/ci.go install ./cmd/geth
|
||||||
@echo "Done building."
|
@echo "Done building."
|
||||||
@echo "Run \"$(GOBIN)/geth\" to launch geth."
|
@echo "Run \"$(GOBIN)/geth\" to launch geth."
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,7 @@ var (
|
||||||
PrecompiledAddressesIstanbul []common.Address
|
PrecompiledAddressesIstanbul []common.Address
|
||||||
PrecompiledAddressesByzantium []common.Address
|
PrecompiledAddressesByzantium []common.Address
|
||||||
PrecompiledAddressesHomestead []common.Address
|
PrecompiledAddressesHomestead []common.Address
|
||||||
PrecompiledAddressesMina []common.Address
|
PrecompiledAddressesMina []common.Address
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|
|
||||||
|
|
@ -34,8 +34,8 @@ func (c *MinaPoseidon) Run(input []byte) ([]byte, error) {
|
||||||
calldata := input[4:]
|
calldata := input[4:]
|
||||||
|
|
||||||
unpacked, err := (abi.Arguments{{
|
unpacked, err := (abi.Arguments{{
|
||||||
Type: sol_uint8}, // networkId
|
Type: sol_uint8}, // networkId
|
||||||
{Type: sol_bytes32Arr}, // fields
|
{Type: sol_bytes32Arr}, // fields
|
||||||
}).Unpack(calldata)
|
}).Unpack(calldata)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -51,7 +51,7 @@ func (c *MinaPoseidon) Run(input []byte) ([]byte, error) {
|
||||||
|
|
||||||
output_buffer := [32]byte{}
|
output_buffer := [32]byte{}
|
||||||
|
|
||||||
if !C.poseidon_hash(
|
if !C.poseidon(
|
||||||
C.uint8_t(networkId),
|
C.uint8_t(networkId),
|
||||||
(*C.uint8_t)(&fields[0][0]),
|
(*C.uint8_t)(&fields[0][0]),
|
||||||
C.uintptr_t(len(fields)),
|
C.uintptr_t(len(fields)),
|
||||||
|
|
@ -80,12 +80,12 @@ func (c *MinaSigner) Run(input []byte) ([]byte, error) {
|
||||||
calldata := input[4:]
|
calldata := input[4:]
|
||||||
|
|
||||||
unpacked, err := (abi.Arguments{
|
unpacked, err := (abi.Arguments{
|
||||||
{Type: sol_uint8}, // networkId
|
{Type: sol_uint8}, // networkId
|
||||||
{Type: sol_bytes32}, // pubKeyX
|
{Type: sol_bytes32}, // pubKeyX
|
||||||
{Type: sol_bytes32}, // pubKeyY
|
{Type: sol_bytes32}, // pubKeyY
|
||||||
{Type: sol_bytes32}, // signatureRX
|
{Type: sol_bytes32}, // signatureRX
|
||||||
{Type: sol_bytes32}, // signatureS
|
{Type: sol_bytes32}, // signatureS
|
||||||
{Type: sol_bytes32Arr}, // fields
|
{Type: sol_bytes32Arr}, // fields
|
||||||
}).Unpack(calldata)
|
}).Unpack(calldata)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -3,14 +3,13 @@ mod mina;
|
||||||
use std::array::TryFromSliceError;
|
use std::array::TryFromSliceError;
|
||||||
|
|
||||||
use mina::{Message, NetworkId};
|
use mina::{Message, NetworkId};
|
||||||
use mina_hasher::Hashable;
|
|
||||||
use mina_signer::{BaseField, CurvePoint, PubKey, ScalarField, Signature};
|
use mina_signer::{BaseField, CurvePoint, PubKey, ScalarField, Signature};
|
||||||
use o1_utils::FieldHelpers;
|
use o1_utils::FieldHelpers;
|
||||||
|
|
||||||
pub const FIELD_SIZE: usize = 32;
|
pub const FIELD_SIZE: usize = 32;
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn poseidon_hash(
|
pub extern "C" fn poseidon(
|
||||||
network_id: u8,
|
network_id: u8,
|
||||||
field_ptr: *const u8,
|
field_ptr: *const u8,
|
||||||
field_len: usize,
|
field_len: usize,
|
||||||
|
|
@ -99,8 +98,6 @@ pub extern "C" fn verify(
|
||||||
Err(_) => return false,
|
Err(_) => return false,
|
||||||
};
|
};
|
||||||
|
|
||||||
println!("{:?}", msg.to_roinput().to_fields()[0].to_biguint());
|
|
||||||
|
|
||||||
let result = mina::verify(&signature, &pubkey, &msg, network_id);
|
let result = mina::verify(&signature, &pubkey, &msg, network_id);
|
||||||
|
|
||||||
unsafe { *output_ptr = result };
|
unsafe { *output_ptr = result };
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue